From: Len Brown <lenb@kernel.org>
To: x86@kernel.org
Cc: linux-kernel@vger.kernel.org, Len Brown <len.brown@intel.com>,
linux-doc@vger.kernel.org
Subject: [PATCH 04/11] cpu topology: export die_id
Date: Mon, 18 Feb 2019 22:40:06 -0500 [thread overview]
Message-ID: <a1faeb72345227a49aae0475abf910421dc40a1c.1550545163.git.len.brown@intel.com> (raw)
In-Reply-To: <635b2bf8b1151a191cd9299276b75791a818c0c2.1550545163.git.len.brown@intel.com>
From: Len Brown <len.brown@intel.com>
Export die_id in cpu topology, for the benefit of hardware that
has multiple die per package. die_id is quite similar to core_id,
in that it holds multiple CPUs, but is inside a package.
This needed by topology-aware user-space. In particular,
an application, such as turbostat(8), which needs to know
the actual scope of "package-scope" MSRs.
Signed-off-by: Len Brown <len.brown@intel.com>
Cc: linux-doc@vger.kernel.org
Signed-off-by: Len Brown <len.brown@intel.com>
---
Documentation/cputopology.txt | 10 ++++++++--
arch/x86/include/asm/topology.h | 1 +
drivers/base/topology.c | 4 ++++
include/linux/topology.h | 3 +++
4 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/Documentation/cputopology.txt b/Documentation/cputopology.txt
index 2698da7e4f49..287213b4517b 100644
--- a/Documentation/cputopology.txt
+++ b/Documentation/cputopology.txt
@@ -12,6 +12,12 @@ physical_package_id:
socket number, but the actual value is architecture and platform
dependent.
+die_id:
+
+ the CPU die ID of cpuX. Typically it is the hardware platform's
+ identifier (rather than the kernel's). The actual value is
+ architecture and platform dependent.
+
core_id:
the CPU core ID of cpuX. Typically it is the hardware platform's
@@ -43,12 +49,12 @@ thread_siblings_list:
core_siblings:
internal kernel map of cpuX's hardware threads within the same
- physical_package_id.
+ die_id.
core_siblings_list:
human-readable list of cpuX's hardware threads within the same
- physical_package_id.
+ die_id.
book_siblings:
diff --git a/arch/x86/include/asm/topology.h b/arch/x86/include/asm/topology.h
index 453cf38a1c33..281be6bbc80d 100644
--- a/arch/x86/include/asm/topology.h
+++ b/arch/x86/include/asm/topology.h
@@ -106,6 +106,7 @@ extern const struct cpumask *cpu_coregroup_mask(int cpu);
#define topology_logical_package_id(cpu) (cpu_data(cpu).logical_proc_id)
#define topology_physical_package_id(cpu) (cpu_data(cpu).phys_proc_id)
+#define topology_die_id(cpu) (cpu_data(cpu).cpu_die_id)
#define topology_core_id(cpu) (cpu_data(cpu).cpu_core_id)
#ifdef CONFIG_SMP
diff --git a/drivers/base/topology.c b/drivers/base/topology.c
index 5fd9f167ecc1..50352cf96f85 100644
--- a/drivers/base/topology.c
+++ b/drivers/base/topology.c
@@ -43,6 +43,9 @@ static ssize_t name##_list_show(struct device *dev, \
define_id_show_func(physical_package_id);
static DEVICE_ATTR_RO(physical_package_id);
+define_id_show_func(die_id);
+static DEVICE_ATTR_RO(die_id);
+
define_id_show_func(core_id);
static DEVICE_ATTR_RO(core_id);
@@ -72,6 +75,7 @@ static DEVICE_ATTR_RO(drawer_siblings_list);
static struct attribute *default_attrs[] = {
&dev_attr_physical_package_id.attr,
+ &dev_attr_die_id.attr,
&dev_attr_core_id.attr,
&dev_attr_thread_siblings.attr,
&dev_attr_thread_siblings_list.attr,
diff --git a/include/linux/topology.h b/include/linux/topology.h
index cb0775e1ee4b..5cc8595dd0e4 100644
--- a/include/linux/topology.h
+++ b/include/linux/topology.h
@@ -184,6 +184,9 @@ static inline int cpu_to_mem(int cpu)
#ifndef topology_physical_package_id
#define topology_physical_package_id(cpu) ((void)(cpu), -1)
#endif
+#ifndef topology_die_id
+#define topology_die_id(cpu) ((void)(cpu), -1)
+#endif
#ifndef topology_core_id
#define topology_core_id(cpu) ((void)(cpu), 0)
#endif
--
2.18.0-rc0
next prev parent reply other threads:[~2019-02-19 3:41 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-19 3:40 [PATCH 0/11] multi-die/package support Len Brown
2019-02-19 3:40 ` [PATCH 01/11] x86 topology: fix doc typo Len Brown
2019-02-19 3:40 ` [PATCH 02/11] topolgy: simplify cputopology.txt formatting and wording Len Brown
[not found] ` <9108bd98-e9f4-fee3-80c7-72d540c48291@infradead.org>
2019-02-19 20:33 ` [linux-drivers-review] " Brown, Len
2019-02-19 3:40 ` [PATCH 03/11] x86 topology: Add CPUID.1F multi-die/package support Len Brown
2019-02-19 16:49 ` Liang, Kan
2019-02-19 19:27 ` Brown, Len
2019-02-20 2:59 ` Like Xu
2019-02-20 6:10 ` Len Brown
2019-02-20 10:55 ` Peter Zijlstra
2019-02-20 15:08 ` Len Brown
2019-02-26 13:54 ` Peter Zijlstra
2019-02-28 15:59 ` Len Brown
2019-02-28 17:56 ` Peter Zijlstra
2019-02-24 10:04 ` Brice Goglin
2019-02-25 5:31 ` Like Xu
2019-02-25 8:08 ` Brown, Len
2019-02-19 3:40 ` Len Brown [this message]
2019-02-19 3:40 ` [PATCH 05/11] x86 topology: export die_siblings Len Brown
2019-02-19 16:56 ` Liang, Kan
2019-02-19 18:43 ` Brown, Len
2019-02-19 19:33 ` Liang, Kan
2019-02-20 10:58 ` Peter Zijlstra
2019-02-20 21:52 ` Brice Goglin
2019-02-21 7:41 ` Len Brown
2019-02-21 8:38 ` Brice Goglin
2019-02-19 3:40 ` [PATCH 06/11] x86 topology: define topology_unique_die_id() Len Brown
2019-02-19 3:40 ` [PATCH 07/11] powercap/intel_rapl: simplify rapl_find_package() Len Brown
2019-02-19 9:11 ` Rafael J. Wysocki
2019-02-19 3:40 ` [PATCH 08/11] powercap/intel_rapl: Support multi-die/package Len Brown
2019-02-19 9:10 ` Rafael J. Wysocki
2019-02-20 11:02 ` Peter Zijlstra
2019-02-21 5:44 ` Len Brown
2019-02-26 4:41 ` Len Brown
2019-02-26 6:55 ` Zhang Rui
2019-02-19 3:40 ` [PATCH 09/11] powercap/intel_rapl: update rapl domain name and debug messages Len Brown
2019-02-19 9:10 ` Rafael J. Wysocki
2019-02-19 3:40 ` [PATCH 10/11] thermal/x86_pkg_temp_thermal: Support multi-die/package Len Brown
2019-02-19 3:40 ` [PATCH 11/11] hwmon/coretemp: " Len Brown
2019-02-19 16:46 ` Guenter Roeck
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=a1faeb72345227a49aae0475abf910421dc40a1c.1550545163.git.len.brown@intel.com \
--to=lenb@kernel.org \
--cc=len.brown@intel.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--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;
as well as URLs for NNTP newsgroup(s).