[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <efe9cd89b70542facf862ea8e8ae8e2f19c8cc5e.camel@intel.com>
Date: Wed, 26 Jun 2024 14:14:36 +0000
From: "Zhang, Rui" <rui.zhang@...el.com>
To: "alexander.shishkin@...ux.intel.com" <alexander.shishkin@...ux.intel.com>,
"dave.hansen@...ux.intel.com" <dave.hansen@...ux.intel.com>, "Hunter, Adrian"
<adrian.hunter@...el.com>, "mingo@...hat.com" <mingo@...hat.com>,
"irogers@...gle.com" <irogers@...gle.com>, "tglx@...utronix.de"
<tglx@...utronix.de>, "gustavoars@...nel.org" <gustavoars@...nel.org>,
"kan.liang@...ux.intel.com" <kan.liang@...ux.intel.com>, "kees@...nel.org"
<kees@...nel.org>, "mark.rutland@....com" <mark.rutland@....com>,
"peterz@...radead.org" <peterz@...radead.org>, "Dhananjay.Ugwekar@....com"
<Dhananjay.Ugwekar@....com>, "bp@...en8.de" <bp@...en8.de>, "acme@...nel.org"
<acme@...nel.org>, "oleksandr@...alenko.name" <oleksandr@...alenko.name>,
"jolsa@...nel.org" <jolsa@...nel.org>, "x86@...nel.org" <x86@...nel.org>,
"namhyung@...nel.org" <namhyung@...nel.org>
CC: "ravi.bangoria@....com" <ravi.bangoria@....com>, "kprateek.nayak@....com"
<kprateek.nayak@....com>, "gautham.shenoy@....com" <gautham.shenoy@....com>,
"linux-perf-users@...r.kernel.org" <linux-perf-users@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-hardening@...r.kernel.org" <linux-hardening@...r.kernel.org>,
"sandipan.das@....com" <sandipan.das@....com>, "ananth.narayan@....com"
<ananth.narayan@....com>, "linux-pm@...r.kernel.org"
<linux-pm@...r.kernel.org>
Subject: Re: [PATCH v3 01/10] x86/topology: Introduce
topology_logical_core_id()
> For use cases such as the per-core RAPL PMU,
> there exists a need for a unique core ID across the entire system
> with
> multiple PKG domains.
Agreed. And there are other cases that a system unique core ID is
needed, like in drivers/hwmon/coretemp.c, where per-core temperature
info is saved in an array.
> Introduce topology_logical_core_id() to derive a
> unique core ID across the system.
>
> Signed-off-by: K Prateek Nayak <kprateek.nayak@....com>
> Signed-off-by: Dhananjay Ugwekar <Dhananjay.Ugwekar@....com>
Reviewed-by: Zhang Rui <rui.zhang@...el.com>
thanks,
rui
> ---
> 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 4fd3364dbc73..e1eeb42edeaf 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 abe3a8f22cbd..2a6dbf965d92 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_pk
> g_id)
> #define
> topology_physical_package_id(cpu) (cpu_data(cpu).topo.pkg_id)
> #define
> topology_logical_die_id(cpu) (cpu_data(cpu).topo.logical_di
> e_id)
> +#define
> topology_logical_core_id(cpu) (cpu_data(cpu).topo.logical_co
> re_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 */
Powered by blists - more mailing lists