public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] perf/x86/amd/uncore: Use Node ID to identify DF and UMC domains
@ 2026-01-22  6:45 Sandipan Das
  2026-01-22  6:48 ` Greg KH
  0 siblings, 1 reply; 2+ messages in thread
From: Sandipan Das @ 2026-01-22  6:45 UTC (permalink / raw)
  To: linux-perf-users, linux-kernel
  Cc: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Namhyung Kim, Mark Rutland, Alexander Shishkin, Jiri Olsa,
	Ian Rogers, Adrian Hunter, James Clark, Thomas Gleixner,
	Borislav Petkov, Dave Hansen, x86, H . Peter Anvin, stable,
	Ravi Bangoria, Ananth Narayan, Sandipan Das

For DF and UMC PMUs, a single context is shared across all CPUs that are
connected to the same Data Fabric (DF) instance. Currently, Socket ID is
used to identify DF instances. This approach works for configurations
having a single IO Die (IOD) but fails in the following cases.
  * Older Zen 1 processors, where each chiplet has its own DF instance
    instead of a single IOD.
  * Any configurations with multiple IODs in a single socket.

Address this by using the Node ID available in ECX[7:0] of CPUID leaf
0x8000001e which is already provided by topology_amd_node_id(). Replace
the use of topology_logical_package_id() with topology_amd_node_id() in
order to correctly identify domains for context sharing.

Fixes: 07888daa056e ("perf/x86/amd/uncore: Move discovery and registration")
Signed-off-by: Sandipan Das <sandipan.das@amd.com>
---
 arch/x86/events/amd/uncore.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/x86/events/amd/uncore.c b/arch/x86/events/amd/uncore.c
index 9293ce50574d..9a13a9f21d2f 100644
--- a/arch/x86/events/amd/uncore.c
+++ b/arch/x86/events/amd/uncore.c
@@ -700,7 +700,7 @@ void amd_uncore_df_ctx_scan(struct amd_uncore *uncore, unsigned int cpu)
 	info.split.aux_data = 0;
 	info.split.num_pmcs = NUM_COUNTERS_NB;
 	info.split.gid = 0;
-	info.split.cid = topology_logical_package_id(cpu);
+	info.split.cid = topology_amd_node_id(cpu);
 
 	if (pmu_version >= 2) {
 		ebx.full = cpuid_ebx(EXT_PERFMON_DEBUG_FEATURES);
@@ -999,8 +999,8 @@ void amd_uncore_umc_ctx_scan(struct amd_uncore *uncore, unsigned int cpu)
 	cpuid(EXT_PERFMON_DEBUG_FEATURES, &eax, &ebx.full, &ecx, &edx);
 	info.split.aux_data = ecx;	/* stash active mask */
 	info.split.num_pmcs = ebx.split.num_umc_pmc;
-	info.split.gid = topology_logical_package_id(cpu);
-	info.split.cid = topology_logical_package_id(cpu);
+	info.split.gid = topology_amd_node_id(cpu);
+	info.split.cid = topology_amd_node_id(cpu);
 	*per_cpu_ptr(uncore->info, cpu) = info;
 }
 
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] perf/x86/amd/uncore: Use Node ID to identify DF and UMC domains
  2026-01-22  6:45 [PATCH] perf/x86/amd/uncore: Use Node ID to identify DF and UMC domains Sandipan Das
@ 2026-01-22  6:48 ` Greg KH
  0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2026-01-22  6:48 UTC (permalink / raw)
  To: Sandipan Das
  Cc: linux-perf-users, linux-kernel, Peter Zijlstra, Ingo Molnar,
	Arnaldo Carvalho de Melo, Namhyung Kim, Mark Rutland,
	Alexander Shishkin, Jiri Olsa, Ian Rogers, Adrian Hunter,
	James Clark, Thomas Gleixner, Borislav Petkov, Dave Hansen, x86,
	H . Peter Anvin, stable, Ravi Bangoria, Ananth Narayan

On Thu, Jan 22, 2026 at 12:15:05PM +0530, Sandipan Das wrote:
> For DF and UMC PMUs, a single context is shared across all CPUs that are
> connected to the same Data Fabric (DF) instance. Currently, Socket ID is
> used to identify DF instances. This approach works for configurations
> having a single IO Die (IOD) but fails in the following cases.
>   * Older Zen 1 processors, where each chiplet has its own DF instance
>     instead of a single IOD.
>   * Any configurations with multiple IODs in a single socket.
> 
> Address this by using the Node ID available in ECX[7:0] of CPUID leaf
> 0x8000001e which is already provided by topology_amd_node_id(). Replace
> the use of topology_logical_package_id() with topology_amd_node_id() in
> order to correctly identify domains for context sharing.
> 
> Fixes: 07888daa056e ("perf/x86/amd/uncore: Move discovery and registration")
> Signed-off-by: Sandipan Das <sandipan.das@amd.com>
> ---
>  arch/x86/events/amd/uncore.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/x86/events/amd/uncore.c b/arch/x86/events/amd/uncore.c
> index 9293ce50574d..9a13a9f21d2f 100644
> --- a/arch/x86/events/amd/uncore.c
> +++ b/arch/x86/events/amd/uncore.c
> @@ -700,7 +700,7 @@ void amd_uncore_df_ctx_scan(struct amd_uncore *uncore, unsigned int cpu)
>  	info.split.aux_data = 0;
>  	info.split.num_pmcs = NUM_COUNTERS_NB;
>  	info.split.gid = 0;
> -	info.split.cid = topology_logical_package_id(cpu);
> +	info.split.cid = topology_amd_node_id(cpu);
>  
>  	if (pmu_version >= 2) {
>  		ebx.full = cpuid_ebx(EXT_PERFMON_DEBUG_FEATURES);
> @@ -999,8 +999,8 @@ void amd_uncore_umc_ctx_scan(struct amd_uncore *uncore, unsigned int cpu)
>  	cpuid(EXT_PERFMON_DEBUG_FEATURES, &eax, &ebx.full, &ecx, &edx);
>  	info.split.aux_data = ecx;	/* stash active mask */
>  	info.split.num_pmcs = ebx.split.num_umc_pmc;
> -	info.split.gid = topology_logical_package_id(cpu);
> -	info.split.cid = topology_logical_package_id(cpu);
> +	info.split.gid = topology_amd_node_id(cpu);
> +	info.split.cid = topology_amd_node_id(cpu);
>  	*per_cpu_ptr(uncore->info, cpu) = info;
>  }
>  
> -- 
> 2.43.0
> 
> 

<formletter>

This is not the correct way to submit patches for inclusion in the
stable kernel tree.  Please read:
    https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html
for how to do this properly.

</formletter>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-01-22  6:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-22  6:45 [PATCH] perf/x86/amd/uncore: Use Node ID to identify DF and UMC domains Sandipan Das
2026-01-22  6:48 ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox