From: Namhyung Kim <namhyung@kernel.org>
To: Chun-Tse Shao <ctshao@google.com>
Cc: linux-kernel@vger.kernel.org, Zide Chen <zide.chen@intel.com>,
Ian Rogers <irogers@google.com>,
peterz@infradead.org, mingo@redhat.com, acme@kernel.org,
mark.rutland@arm.com, alexander.shishkin@linux.intel.com,
jolsa@kernel.org, adrian.hunter@intel.com,
james.clark@linaro.org, ravi.bangoria@amd.com,
linux-perf-users@vger.kernel.org
Subject: Re: [PATCH v5 2/2] perf pmu intel: Adjust cpumaks for sub-NUMA clusters on Emeraldrapids
Date: Thu, 9 Apr 2026 21:43:17 -0700 [thread overview]
Message-ID: <adh_5WvH10yQrIRw@google.com> (raw)
In-Reply-To: <20260407203918.3178481-2-ctshao@google.com>
On Tue, Apr 07, 2026 at 01:38:43PM -0700, Chun-Tse Shao wrote:
> Similar to GNR [1], Emeraldrapids supports sub-NUMA clusters as well.
> Adjust cpumasks as the logic for GNR in [1].
>
> Tested on Emeraldrapids with SNC2 enabled:
> $ perf stat --per-node -e 'UNC_CHA_CLOCKTICKS,UNC_M_CLOCKTICKS' -a -- sleep 1
>
> Performance counter stats for 'system wide':
>
> N0 30 72125876670 UNC_CHA_CLOCKTICKS
> N0 4 8815163648 UNC_M_CLOCKTICKS
> N1 30 72124958844 UNC_CHA_CLOCKTICKS
> N1 4 8815014974 UNC_M_CLOCKTICKS
> N2 30 72121049022 UNC_CHA_CLOCKTICKS
> N2 4 8814592626 UNC_M_CLOCKTICKS
> N3 30 72117133854 UNC_CHA_CLOCKTICKS
> N3 4 8814012840 UNC_M_CLOCKTICKS
>
> 1.001574118 seconds time elapsed
>
> [1] lore.kernel.org/20250515181417.491401-1-irogers@google.com
>
> Reviewed-by: Zide Chen <zide.chen@intel.com>
> Reviewed-by: Ian Rogers <irogers@google.com>
> Signed-off-by: Chun-Tse Shao <ctshao@google.com>
> ---
> tools/perf/arch/x86/util/pmu.c | 56 +++++++++++++++++++++++-----------
> 1 file changed, 38 insertions(+), 18 deletions(-)
>
> diff --git a/tools/perf/arch/x86/util/pmu.c b/tools/perf/arch/x86/util/pmu.c
> index 938be36ec0f7..3743f5145505 100644
> --- a/tools/perf/arch/x86/util/pmu.c
> +++ b/tools/perf/arch/x86/util/pmu.c
> @@ -30,8 +30,9 @@ static bool x86__is_snc_supported(void)
>
> if (!checked_if_snc_supported) {
>
> - /* Graniterapids supports SNC configuration. */
> + /* Emeraldrapids Graniterapids support SNC configuration. */
> static const char *const supported_cpuids[] = {
> + "GenuineIntel-6-CF", /* Emeraldrapids */
> "GenuineIntel-6-A[DE]", /* Graniterapids */
It'd be great if we can share these string literals..
> };
> char *cpuid = get_cpuid_str((struct perf_cpu){0});
> @@ -141,23 +142,42 @@ static int uncore_imc_snc(struct perf_pmu *pmu)
> // Compute the IMC SNC using lookup tables.
> unsigned int imc_num;
> int snc_nodes = snc_nodes_per_l3_cache();
> - const u8 snc2_map[] = {1, 1, 0, 0};
> - const u8 snc3_map[] = {1, 1, 0, 0, 2, 2};
> - const u8 *snc_map;
> - size_t snc_map_len;
> -
> - switch (snc_nodes) {
> - case 2:
> - snc_map = snc2_map;
> - snc_map_len = ARRAY_SIZE(snc2_map);
> - break;
> - case 3:
> - snc_map = snc3_map;
> - snc_map_len = ARRAY_SIZE(snc3_map);
> - break;
> - default:
> - /* Error or no lookup support for SNC with >3 nodes. */
> - return 0;
> + char *cpuid;
> + static const u8 emr_snc2_map[] = { 0, 0, 1, 1 };
> + static const u8 gnr_snc2_map[] = { 1, 1, 0, 0 };
> + static const u8 snc3_map[] = { 1, 1, 0, 0, 2, 2 };
> + static const u8 *snc_map;
> + static size_t snc_map_len;
> +
> + /* snc_map is not inited yet. We only look up once to avoid expensive operations. */
> + if (!snc_map) {
> + switch (snc_nodes) {
> + case 2:
> + cpuid = get_cpuid_str((struct perf_cpu){ 0 });
> + if (cpuid) {
> + if (strcmp_cpuid_str("GenuineIntel-6-CF", cpuid) == 0) {
> + snc_map = emr_snc2_map;
> + snc_map_len = ARRAY_SIZE(emr_snc2_map);
> + } else if (strcmp_cpuid_str("GenuineIntel-6-A[DE]", cpuid) == 0) {
> + snc_map = gnr_snc2_map;
> + snc_map_len = ARRAY_SIZE(gnr_snc2_map);
... in here as well.
Thanks,
Namhyung
> + }
> + free(cpuid);
> + }
> + break;
> + case 3:
> + snc_map = snc3_map;
> + snc_map_len = ARRAY_SIZE(snc3_map);
> + break;
> + default:
> + /* Error or no lookup support for SNC with >3 nodes. */
> + return 0;
> + }
> +
> + if (!snc_map) {
> + pr_warning("Unexpected: can not find snc map config");
> + return 0;
> + }
> }
>
> /* Compute SNC for PMU. */
> --
> 2.53.0.1213.gd9a14994de-goog
>
next prev parent reply other threads:[~2026-04-10 4:43 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-07 20:38 [PATCH v5 1/2] perf pmu intel: Generalize SNC cpumask adjustment for multiple platforms Chun-Tse Shao
2026-04-07 20:38 ` [PATCH v5 2/2] perf pmu intel: Adjust cpumaks for sub-NUMA clusters on Emeraldrapids Chun-Tse Shao
2026-04-10 4:43 ` Namhyung Kim [this message]
2026-05-15 17:29 ` Chun-Tse Shao
2026-04-10 4:39 ` [PATCH v5 1/2] perf pmu intel: Generalize SNC cpumask adjustment for multiple platforms Namhyung Kim
2026-04-22 20:53 ` Chen, Zide
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=adh_5WvH10yQrIRw@google.com \
--to=namhyung@kernel.org \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=ctshao@google.com \
--cc=irogers@google.com \
--cc=james.clark@linaro.org \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=ravi.bangoria@amd.com \
--cc=zide.chen@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.