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

From: Peter Zijlstra

Date: Wed Jul 01 2026 - 03:04:30 EST


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.