From: "Gautham R. Shenoy" <gautham.shenoy@amd.com>
To: Dhananjay Ugwekar <Dhananjay.Ugwekar@amd.com>
Cc: peterz@infradead.org, mingo@redhat.com, rui.zhang@intel.com,
acme@kernel.org, namhyung@kernel.org, mark.rutland@arm.com,
alexander.shishkin@linux.intel.com, jolsa@kernel.org,
irogers@google.com, adrian.hunter@intel.com,
kan.liang@linux.intel.com, tglx@linutronix.de, bp@alien8.de,
dave.hansen@linux.intel.com, ananth.narayan@amd.com,
kprateek.nayak@amd.com, ravi.bangoria@amd.com, x86@kernel.org,
linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org,
Oleksandr Natalenko <oleksandr@natalenko.name>
Subject: Re: [PATCH v6 02/10] x86/topology: Introduce topology_logical_core_id()
Date: Mon, 28 Oct 2024 13:57:27 +0530 [thread overview]
Message-ID: <Zx9K77OBe+ADuu1g@BLRRASHENOY1.amd.com> (raw)
In-Reply-To: <20241025111348.3810-3-Dhananjay.Ugwekar@amd.com>
On Fri, Oct 25, 2024 at 11:13:40AM +0000, Dhananjay Ugwekar wrote:
> From: K Prateek Nayak <kprateek.nayak@amd.com>
>
> On x86, topology_core_id() returns a unique core ID within the PKG
> domain. Looking at match_smt() suggests that a core ID just needs to be
> unique within a LLC domain. For use cases such as the core RAPL PMU,
> there exists a need for a unique core ID across the entire system with
> multiple PKG domains. Introduce topology_logical_core_id() to derive a
> unique core ID across the system.
>
> Signed-off-by: K Prateek Nayak <kprateek.nayak@amd.com>
> Reviewed-by: Zhang Rui <rui.zhang@intel.com>
> Tested-by: K Prateek Nayak <kprateek.nayak@amd.com>
> Tested-by: Oleksandr Natalenko <oleksandr@natalenko.name>
> Signed-off-by: Dhananjay Ugwekar <Dhananjay.Ugwekar@amd.com>
LGTM
Reviewed-by: Gautham R. Shenoy <gautham.shenoy@amd.com>
--
Thanks and Regards
gautham.
> ---
> Documentation/arch/x86/topology.rst | 4 ++++
> arch/x86/include/asm/processor.h | 1 +
> arch/x86/include/asm/topology.h | 1 +
> arch/x86/kernel/cpu/debugfs.c | 1 +
> arch/x86/kernel/cpu/topology_common.c | 1 +
> 5 files changed, 8 insertions(+)
>
> diff --git a/Documentation/arch/x86/topology.rst b/Documentation/arch/x86/topology.rst
> index 7352ab89a55a..c12837e61bda 100644
> --- a/Documentation/arch/x86/topology.rst
> +++ b/Documentation/arch/x86/topology.rst
> @@ -135,6 +135,10 @@ Thread-related topology information in the kernel:
> The ID of the core to which a thread belongs. It is also printed in /proc/cpuinfo
> "core_id."
>
> + - topology_logical_core_id();
> +
> + The logical core ID to which a thread belongs.
> +
>
>
> System topology examples
> diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h
> index 4a686f0e5dbf..595859cbf7ff 100644
> --- a/arch/x86/include/asm/processor.h
> +++ b/arch/x86/include/asm/processor.h
> @@ -98,6 +98,7 @@ struct cpuinfo_topology {
> // Logical ID mappings
> u32 logical_pkg_id;
> u32 logical_die_id;
> + u32 logical_core_id;
>
> // AMD Node ID and Nodes per Package info
> u32 amd_node_id;
> diff --git a/arch/x86/include/asm/topology.h b/arch/x86/include/asm/topology.h
> index aef70336d624..672fccf9f845 100644
> --- a/arch/x86/include/asm/topology.h
> +++ b/arch/x86/include/asm/topology.h
> @@ -137,6 +137,7 @@ extern const struct cpumask *cpu_clustergroup_mask(int cpu);
> #define topology_logical_package_id(cpu) (cpu_data(cpu).topo.logical_pkg_id)
> #define topology_physical_package_id(cpu) (cpu_data(cpu).topo.pkg_id)
> #define topology_logical_die_id(cpu) (cpu_data(cpu).topo.logical_die_id)
> +#define topology_logical_core_id(cpu) (cpu_data(cpu).topo.logical_core_id)
> #define topology_die_id(cpu) (cpu_data(cpu).topo.die_id)
> #define topology_core_id(cpu) (cpu_data(cpu).topo.core_id)
> #define topology_ppin(cpu) (cpu_data(cpu).ppin)
> diff --git a/arch/x86/kernel/cpu/debugfs.c b/arch/x86/kernel/cpu/debugfs.c
> index 3baf3e435834..b1eb6d7828db 100644
> --- a/arch/x86/kernel/cpu/debugfs.c
> +++ b/arch/x86/kernel/cpu/debugfs.c
> @@ -24,6 +24,7 @@ static int cpu_debug_show(struct seq_file *m, void *p)
> seq_printf(m, "core_id: %u\n", c->topo.core_id);
> seq_printf(m, "logical_pkg_id: %u\n", c->topo.logical_pkg_id);
> seq_printf(m, "logical_die_id: %u\n", c->topo.logical_die_id);
> + seq_printf(m, "logical_core_id: %u\n", c->topo.logical_core_id);
> seq_printf(m, "llc_id: %u\n", c->topo.llc_id);
> seq_printf(m, "l2c_id: %u\n", c->topo.l2c_id);
> seq_printf(m, "amd_node_id: %u\n", c->topo.amd_node_id);
> diff --git a/arch/x86/kernel/cpu/topology_common.c b/arch/x86/kernel/cpu/topology_common.c
> index 9a6069e7133c..23722aa21e2f 100644
> --- a/arch/x86/kernel/cpu/topology_common.c
> +++ b/arch/x86/kernel/cpu/topology_common.c
> @@ -151,6 +151,7 @@ static void topo_set_ids(struct topo_scan *tscan, bool early)
> if (!early) {
> c->topo.logical_pkg_id = topology_get_logical_id(apicid, TOPO_PKG_DOMAIN);
> c->topo.logical_die_id = topology_get_logical_id(apicid, TOPO_DIE_DOMAIN);
> + c->topo.logical_core_id = topology_get_logical_id(apicid, TOPO_CORE_DOMAIN);
> }
>
> /* Package relative core ID */
> --
> 2.34.1
>
next prev parent reply other threads:[~2024-10-28 8:27 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-25 11:13 [PATCH v6 00/10] Add RAPL core energy counter support for AMD CPUs Dhananjay Ugwekar
2024-10-25 11:13 ` [PATCH v6 01/10] perf/x86/rapl: Remove the unused get_rapl_pmu_cpumask() function Dhananjay Ugwekar
2024-10-28 6:12 ` Gautham R. Shenoy
2024-10-28 6:38 ` Dhananjay Ugwekar
2024-11-01 7:20 ` Zhang, Rui
2024-10-25 11:13 ` [PATCH v6 02/10] x86/topology: Introduce topology_logical_core_id() Dhananjay Ugwekar
2024-10-28 8:27 ` Gautham R. Shenoy [this message]
2024-10-25 11:13 ` [PATCH v6 03/10] perf/x86/rapl: Remove the cpu_to_rapl_pmu() function Dhananjay Ugwekar
2024-10-28 8:53 ` Gautham R. Shenoy
2024-10-28 9:19 ` Dhananjay Ugwekar
2024-11-01 8:06 ` Zhang, Rui
2024-11-04 3:15 ` Dhananjay Ugwekar
2024-11-04 7:15 ` Zhang, Rui
2024-11-04 8:04 ` Dhananjay Ugwekar
2024-11-01 7:28 ` Zhang, Rui
2024-10-25 11:13 ` [PATCH v6 04/10] perf/x86/rapl: Rename rapl_pmu variables Dhananjay Ugwekar
2024-10-28 9:01 ` Gautham R. Shenoy
2024-11-01 7:29 ` Zhang, Rui
2024-10-25 11:13 ` [PATCH v6 05/10] perf/x86/rapl: Make rapl_model struct global Dhananjay Ugwekar
2024-11-01 7:29 ` Zhang, Rui
2024-11-08 10:12 ` Gautham R. Shenoy
2024-10-25 11:13 ` [PATCH v6 06/10] perf/x86/rapl: Add arguments to the init and cleanup functions Dhananjay Ugwekar
2024-10-28 12:31 ` Gautham R. Shenoy
2024-11-01 7:29 ` Zhang, Rui
2024-10-25 11:13 ` [PATCH v6 07/10] perf/x86/rapl: Modify the generic variable names to *_pkg* Dhananjay Ugwekar
2024-10-28 14:27 ` Gautham R. Shenoy
2024-11-01 7:29 ` Zhang, Rui
2024-10-25 11:13 ` [PATCH v6 08/10] perf/x86/rapl: Remove the global variable rapl_msrs Dhananjay Ugwekar
2024-10-28 14:35 ` Gautham R. Shenoy
2024-11-01 7:30 ` Zhang, Rui
2024-10-25 11:13 ` [PATCH v6 09/10] perf/x86/rapl: Move the cntr_mask to rapl_pmus struct Dhananjay Ugwekar
2024-10-28 14:54 ` Gautham R. Shenoy
2024-11-01 7:37 ` Zhang, Rui
2024-10-25 11:13 ` [PATCH v6 10/10] perf/x86/rapl: Add core energy counter support for AMD CPUs Dhananjay Ugwekar
2024-11-08 9:52 ` Gautham R. Shenoy
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=Zx9K77OBe+ADuu1g@BLRRASHENOY1.amd.com \
--to=gautham.shenoy@amd.com \
--cc=Dhananjay.Ugwekar@amd.com \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=ananth.narayan@amd.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=irogers@google.com \
--cc=jolsa@kernel.org \
--cc=kan.liang@linux.intel.com \
--cc=kprateek.nayak@amd.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=oleksandr@natalenko.name \
--cc=peterz@infradead.org \
--cc=ravi.bangoria@amd.com \
--cc=rui.zhang@intel.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox