Commit a62247e1 authored by Heiko Carstens's avatar Heiko Carstens Committed by Martin Schwidefsky

topology/sysfs: provide drawer id and siblings attributes

The s390 cpu topology gained another hierarchy level. The top level is
now called drawer and contains several books. A book used to be the
top level.

In order to expose the cpu topology to user space allow to create new
sysfs attributes dependent on CONFIG_SCHED_DRAWER which an
architecture may define and select.

These additional attributes will be available:

/sys/devices/system/cpu/cpuX/topology/drawer_id
/sys/devices/system/cpu/cpuX/topology/drawer_siblings
/sys/devices/system/cpu/cpuX/topology/drawer_siblings_list
Signed-off-by: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
Acked-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent 0599eead
...@@ -20,48 +20,70 @@ to /proc/cpuinfo output of some architectures: ...@@ -20,48 +20,70 @@ to /proc/cpuinfo output of some architectures:
identifier (rather than the kernel's). The actual value is identifier (rather than the kernel's). The actual value is
architecture and platform dependent. architecture and platform dependent.
4) /sys/devices/system/cpu/cpuX/topology/thread_siblings: 4) /sys/devices/system/cpu/cpuX/topology/drawer_id:
the drawer ID of cpuX. Typically it is the hardware platform's
identifier (rather than the kernel's). The actual value is
architecture and platform dependent.
5) /sys/devices/system/cpu/cpuX/topology/thread_siblings:
internal kernel map of cpuX's hardware threads within the same internal kernel map of cpuX's hardware threads within the same
core as cpuX. core as cpuX.
5) /sys/devices/system/cpu/cpuX/topology/thread_siblings_list: 6) /sys/devices/system/cpu/cpuX/topology/thread_siblings_list:
human-readable list of cpuX's hardware threads within the same human-readable list of cpuX's hardware threads within the same
core as cpuX. core as cpuX.
6) /sys/devices/system/cpu/cpuX/topology/core_siblings: 7) /sys/devices/system/cpu/cpuX/topology/core_siblings:
internal kernel map of cpuX's hardware threads within the same internal kernel map of cpuX's hardware threads within the same
physical_package_id. physical_package_id.
7) /sys/devices/system/cpu/cpuX/topology/core_siblings_list: 8) /sys/devices/system/cpu/cpuX/topology/core_siblings_list:
human-readable list of cpuX's hardware threads within the same human-readable list of cpuX's hardware threads within the same
physical_package_id. physical_package_id.
8) /sys/devices/system/cpu/cpuX/topology/book_siblings: 9) /sys/devices/system/cpu/cpuX/topology/book_siblings:
internal kernel map of cpuX's hardware threads within the same internal kernel map of cpuX's hardware threads within the same
book_id. book_id.
9) /sys/devices/system/cpu/cpuX/topology/book_siblings_list: 10) /sys/devices/system/cpu/cpuX/topology/book_siblings_list:
human-readable list of cpuX's hardware threads within the same human-readable list of cpuX's hardware threads within the same
book_id. book_id.
11) /sys/devices/system/cpu/cpuX/topology/drawer_siblings:
internal kernel map of cpuX's hardware threads within the same
drawer_id.
12) /sys/devices/system/cpu/cpuX/topology/drawer_siblings_list:
human-readable list of cpuX's hardware threads within the same
drawer_id.
To implement it in an architecture-neutral way, a new source file, To implement it in an architecture-neutral way, a new source file,
drivers/base/topology.c, is to export the 6 or 9 attributes. The three book drivers/base/topology.c, is to export the 6 to 12 attributes. The book
related sysfs files will only be created if CONFIG_SCHED_BOOK is selected. and drawer related sysfs files will only be created if CONFIG_SCHED_BOOK
and CONFIG_SCHED_DRAWER are selected.
CONFIG_SCHED_BOOK and CONFIG_DRAWER are currently only used on s390, where
they reflect the cpu and cache hierarchy.
For an architecture to support this feature, it must define some of For an architecture to support this feature, it must define some of
these macros in include/asm-XXX/topology.h: these macros in include/asm-XXX/topology.h:
#define topology_physical_package_id(cpu) #define topology_physical_package_id(cpu)
#define topology_core_id(cpu) #define topology_core_id(cpu)
#define topology_book_id(cpu) #define topology_book_id(cpu)
#define topology_drawer_id(cpu)
#define topology_sibling_cpumask(cpu) #define topology_sibling_cpumask(cpu)
#define topology_core_cpumask(cpu) #define topology_core_cpumask(cpu)
#define topology_book_cpumask(cpu) #define topology_book_cpumask(cpu)
#define topology_drawer_cpumask(cpu)
The type of **_id macros is int. The type of **_id macros is int.
The type of **_cpumask macros is (const) struct cpumask *. The latter The type of **_cpumask macros is (const) struct cpumask *. The latter
...@@ -78,6 +100,8 @@ not defined by include/asm-XXX/topology.h: ...@@ -78,6 +100,8 @@ not defined by include/asm-XXX/topology.h:
For architectures that don't support books (CONFIG_SCHED_BOOK) there are no For architectures that don't support books (CONFIG_SCHED_BOOK) there are no
default definitions for topology_book_id() and topology_book_cpumask(). default definitions for topology_book_id() and topology_book_cpumask().
For architectures that don't support drawes (CONFIG_SCHED_DRAWER) there are
no default definitions for topology_drawer_id() and topology_drawer_cpumask().
Additionally, CPU topology information is provided under Additionally, CPU topology information is provided under
/sys/devices/system/cpu and includes these files. The internal /sys/devices/system/cpu and includes these files. The internal
......
...@@ -77,6 +77,14 @@ static DEVICE_ATTR_RO(book_siblings); ...@@ -77,6 +77,14 @@ static DEVICE_ATTR_RO(book_siblings);
static DEVICE_ATTR_RO(book_siblings_list); static DEVICE_ATTR_RO(book_siblings_list);
#endif #endif
#ifdef CONFIG_SCHED_DRAWER
define_id_show_func(drawer_id);
static DEVICE_ATTR_RO(drawer_id);
define_siblings_show_func(drawer_siblings, drawer_cpumask);
static DEVICE_ATTR_RO(drawer_siblings);
static DEVICE_ATTR_RO(drawer_siblings_list);
#endif
static struct attribute *default_attrs[] = { static struct attribute *default_attrs[] = {
&dev_attr_physical_package_id.attr, &dev_attr_physical_package_id.attr,
&dev_attr_core_id.attr, &dev_attr_core_id.attr,
...@@ -88,6 +96,11 @@ static struct attribute *default_attrs[] = { ...@@ -88,6 +96,11 @@ static struct attribute *default_attrs[] = {
&dev_attr_book_id.attr, &dev_attr_book_id.attr,
&dev_attr_book_siblings.attr, &dev_attr_book_siblings.attr,
&dev_attr_book_siblings_list.attr, &dev_attr_book_siblings_list.attr,
#endif
#ifdef CONFIG_SCHED_DRAWER
&dev_attr_drawer_id.attr,
&dev_attr_drawer_siblings.attr,
&dev_attr_drawer_siblings_list.attr,
#endif #endif
NULL NULL
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment