Re: [PATCH v2 2/7] perf/x86/core: Remove unnecessary stubs provided for KVM-only helpers

Sean Christopherson
2022-08-04T15:07:58Z

On Thu, Aug 04, 2022, Like Xu wrote:
> On 4/8/2022 3:26 am, Sean Christopherson wrote:
> > -#if defined(CONFIG_PERF_EVENTS) && defined(CONFIG_CPU_SUP_AMD)
> > - extern void amd_pmu_enable_virt(void);
> > - extern void amd_pmu_disable_virt(void);
> > -
> > -#if defined(CONFIG_PERF_EVENTS_AMD_BRS)
> > +#ifdef CONFIG_PERF_EVENTS_AMD_BRS
> > #define PERF_NEEDS_LOPWR_CB 1
> > @@ -566,12 +538,13 @@ static inline void perf_lopwr_cb(bool lopwr_in)
> > static_call_mod(perf_lopwr_cb)(lopwr_in);
> > }
> > -#endif /* PERF_NEEDS_LOPWR_CB */
>
> Oops, now the definition of PERF_NEEDS_LOPWR_CB will not be unset.
> This is not mentioned in the commit message and may cause trouble.

PERF_NEEDS_LOPWR_CB isn't being "unset" in the existing code, the comment is simply
wrong. The #endif pairs with CONFIG_PERF_EVENTS_AMD_BRS.

#if defined(CONFIG_PERF_EVENTS_AMD_BRS)

#define PERF_NEEDS_LOPWR_CB 1

/*
* architectural low power callback impacts
* drivers/acpi/processor_idle.c
* drivers/acpi/acpi_pad.c
*/
extern void perf_amd_brs_lopwr_cb(bool lopwr_in);

DECLARE_STATIC_CALL(perf_lopwr_cb, perf_amd_brs_lopwr_cb);

static inline void perf_lopwr_cb(bool lopwr_in)
{
static_call_mod(perf_lopwr_cb)(lopwr_in);
}

#endif /* PERF_NEEDS_LOPWR_CB */ <=== should be /* CONFIG_PERF_EVENTS_AMD_BRS */