Re: 答复: [PATCH 1/3] perf/x86/amd/uncore: Add common PMU helper functions

From: Peter Zijlstra

Date: Wed Jul 01 2026 - 03:55:14 EST


On Wed, Jul 01, 2026 at 07:50:16AM +0000, Qi Liu wrote:
>
>
> -----邮件原件-----
> 发件人: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
> 发送时间: 2026年7月1日 15:00
> 收件人: Qi Liu <liuqi@xxxxxxxx>
> 抄送: mingo@xxxxxxxxxx; namhyung@xxxxxxxxxx; alexander.shishkin@xxxxxxxxxxxxxxx; jolsa@xxxxxxxxxx; x86@xxxxxxxxxx; linux-perf-users@xxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx; Jing Li <lijing@xxxxxxxx>; Zhenglang Hu <huzhenglang@xxxxxxxx>
> 主题: Re: [PATCH 1/3] perf/x86/amd/uncore: Add common PMU helper functions
>
> On Wed, Jul 01, 2026 at 03:44:11AM +0000, Qi Liu wrote:
> > Add common helper functions for AMD-family uncore PMU handling.
> >
> > The helpers cover event initialization, counter allocation, counter
> > read/update, event start/stop and per-CPU context management. These
> > paths are not tied to a specific uncore unit and can be reused by
> > drivers with a similar uncore PMU programming model.
> >
> > Signed-off-by: Qi Liu <liuqi@xxxxxxxx>
> > Tested-by: Zhenglang Hu <huzhenglang@xxxxxxxx>
>
> > +EXPORT_SYMBOL_GPL(uncore_common_set_update_interval);
> > +EXPORT_SYMBOL_GPL(event_to_uncore_common_pmu);
> > +EXPORT_SYMBOL_GPL(uncore_common_attr_group);
> > +EXPORT_SYMBOL_GPL(uncore_common_start_hrtimer);
> > +EXPORT_SYMBOL_GPL(uncore_common_read);
> > +EXPORT_SYMBOL_GPL(uncore_common_start);
> > +EXPORT_SYMBOL_GPL(uncore_common_stop);
> > +EXPORT_SYMBOL_GPL(uncore_common_event_init);
> > +EXPORT_SYMBOL_GPL(uncore_common_add);
> > +EXPORT_SYMBOL_GPL(uncore_common_del);
> > +EXPORT_SYMBOL_GPL(uncore_common_ctx_init);
> > +EXPORT_SYMBOL_GPL(uncore_common_ctx_free);
> > +EXPORT_SYMBOL_GPL(uncore_common_ctx_move);
>
> I like the idea, but I don't particularly like the namespace.
> 'uncore_common' is too generic, there are a ton of uncore drivers, even on x86 and these functions are specific to the AMD family. That is, they aren't really common at all.
>
> Hi Peter,
>
> Thanks for your reply!
>
> Yes, that namespace is a fair point — "common" is too broad. Here are two options:
> A) amd_uncore_* — The prefix describes the programming model origin, not the vendor running it.
> B) amd_family_uncore_* — makes it explicit that this is AMD-family uncore infrastructure.
>
> Do you have a preference? Or something else entirely?

'amd_uncore_' works for me.