Skip to content

Commit

Permalink
cpu/topology: Export die_id
Browse files Browse the repository at this point in the history
Export die_id in cpu topology, for the benefit of hardware that has
multiple-die/package.

Signed-off-by: Len Brown <[email protected]>
Signed-off-by: Thomas Gleixner <[email protected]>
Reviewed-by: Ingo Molnar <[email protected]>
Acked-by: Peter Zijlstra (Intel) <[email protected]>
Cc: [email protected]
Link: https://lkml.kernel.org/r/e7d1caaf4fbd24ee40db6d557ab28d7d83298900.1557769318.git.len.brown@intel.com
  • Loading branch information
lenb authored and KAGA-KOKO committed May 23, 2019
1 parent 14d96d6 commit 0e344d8
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
15 changes: 12 additions & 3 deletions Documentation/cputopology.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -81,6 +87,7 @@ For an architecture to support this feature, it must define some of
these macros in include/asm-XXX/topology.h::

#define topology_physical_package_id(cpu)
#define topology_die_id(cpu)
#define topology_core_id(cpu)
#define topology_book_id(cpu)
#define topology_drawer_id(cpu)
Expand All @@ -99,9 +106,11 @@ provides default definitions for any of the above macros that are
not defined by include/asm-XXX/topology.h:

1) topology_physical_package_id: -1
2) topology_core_id: 0
3) topology_sibling_cpumask: just the given CPU
4) topology_core_cpumask: just the given CPU
2) topology_die_id: -1
3) topology_core_id: 0
4) topology_sibling_cpumask: just the given CPU
5) topology_core_cpumask: just the given CPU
6) topology_die_cpumask: just the given CPU

For architectures that don't support books (CONFIG_SCHED_BOOK) there are no
default definitions for topology_book_id() and topology_book_cpumask().
Expand Down
4 changes: 4 additions & 0 deletions drivers/base/topology.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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,
Expand Down
3 changes: 3 additions & 0 deletions include/linux/topology.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 0e344d8

Please sign in to comment.