Re: [PATCH 1/3] perf/x86: Add x86_pmu::print_debug

[email protected] Thu, 06 Aug 2026 10:24:07 +0000
Newsgroups org.kernel.vger.linux-perf-users
Message-ID <[email protected]>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] The function `x86_pmu_print_debug` takes `cpu` as a parameter but also declares it as a local variable. This results in a compilation error due to the redefinition of the identifier in the same scope.
--

--- Patch [1]: [PATCH 1/3] perf/x86: Add x86_pmu::print_debug ---
commit 020114d6f9bb4628136240e2b9270b949589ab7b
Author: Sandipan Das <[email protected]>

perf/x86: Add x86_pmu::print_debug

This commit splits out the register dumping portion of
perf_event_print_debug() into a new x86_pmu_print_debug() helper. It
adds an optional print_debug method to x86_pmu to allow vendor-specific
PMUs to dump their global state.

> diff --git a/arch/x86/events/core.c b/arch/x86/events/core.c
> index d1af33d96d0a3..901a294d6e6cf 100644
> --- a/arch/x86/events/core.c
> +++ b/arch/x86/events/core.c
> @@ -1557,7 +1557,7 @@ static void x86_pmu_start(struct perf_event *event, int flags)
>  	perf_event_update_userpage(event);
>  }
>  
> -void perf_event_print_debug(void)
> +void x86_pmu_print_debug(int cpu)
>  {
>  	u64 ctrl, status, overflow, pmc_ctrl, pmc_count, prev_left, fixed;
>  	unsigned long *cntr_mask, *fixed_cntr_mask;
> @@ -1566,17 +1566,11 @@ void perf_event_print_debug(void)
>  	u64 pebs, debugctl;
>  	int cpu, idx;

[Severity: Low]
Will this cause a compilation error? The x86_pmu_print_debug() function
now takes 'cpu' as a parameter, but the local variable declaration 'int cpu'
was left in place, which redefines the identifier in the same scope.

>  
> -	guard(irqsave)();
> -
> -	cpu = smp_processor_id();
>  	cpuc = &per_cpu(cpu_hw_events, cpu);

-- 
Sashiko AI review ยท https://sashiko.dev/#/patchset/[email protected]?part=1