diff options
author | Heiko Carstens <heiko.carstens@de.ibm.com> | 2016-05-21 05:10:13 -0400 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2016-06-13 09:58:27 -0400 |
commit | a62247e1f5c13b926f535bb64ecbd7f9fdef7b21 (patch) | |
tree | 4ef1e9a1ec7b54531246af5007781f48e0e1a779 | |
parent | 0599eead5833d9dd0970b59fed3844441b44fe0c (diff) |
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: Heiko Carstens <heiko.carstens@de.ibm.com>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
-rw-r--r-- | Documentation/cputopology.txt | 40 | ||||
-rw-r--r-- | drivers/base/topology.c | 13 |
2 files changed, 45 insertions, 8 deletions
diff --git a/Documentation/cputopology.txt b/Documentation/cputopology.txt index 12b1b25b4da9..f722f227a73b 100644 --- a/Documentation/cputopology.txt +++ b/Documentation/cputopology.txt | |||
@@ -20,48 +20,70 @@ to /proc/cpuinfo output of some architectures: | |||
20 | identifier (rather than the kernel's). The actual value is | 20 | identifier (rather than the kernel's). The actual value is |
21 | architecture and platform dependent. | 21 | architecture and platform dependent. |
22 | 22 | ||
23 | 4) /sys/devices/system/cpu/cpuX/topology/thread_siblings: | 23 | 4) /sys/devices/system/cpu/cpuX/topology/drawer_id: |
24 | |||
25 | the drawer ID of cpuX. Typically it is the hardware platform's | ||
26 | identifier (rather than the kernel's). The actual value is | ||
27 | architecture and platform dependent. | ||
28 | |||
29 | 5) /sys/devices/system/cpu/cpuX/topology/thread_siblings: | ||
24 | 30 | ||
25 | internal kernel map of cpuX's hardware threads within the same | 31 | internal kernel map of cpuX's hardware threads within the same |
26 | core as cpuX. | 32 | core as cpuX. |
27 | 33 | ||
28 | 5) /sys/devices/system/cpu/cpuX/topology/thread_siblings_list: | 34 | 6) /sys/devices/system/cpu/cpuX/topology/thread_siblings_list: |
29 | 35 | ||
30 | human-readable list of cpuX's hardware threads within the same | 36 | human-readable list of cpuX's hardware threads within the same |
31 | core as cpuX. | 37 | core as cpuX. |
32 | 38 | ||
33 | 6) /sys/devices/system/cpu/cpuX/topology/core_siblings: | 39 | 7) /sys/devices/system/cpu/cpuX/topology/core_siblings: |
34 | 40 | ||
35 | internal kernel map of cpuX's hardware threads within the same | 41 | internal kernel map of cpuX's hardware threads within the same |
36 | physical_package_id. | 42 | physical_package_id. |
37 | 43 | ||
38 | 7) /sys/devices/system/cpu/cpuX/topology/core_siblings_list: | 44 | 8) /sys/devices/system/cpu/cpuX/topology/core_siblings_list: |
39 | 45 | ||
40 | human-readable list of cpuX's hardware threads within the same | 46 | human-readable list of cpuX's hardware threads within the same |
41 | physical_package_id. | 47 | physical_package_id. |
42 | 48 | ||
43 | 8) /sys/devices/system/cpu/cpuX/topology/book_siblings: | 49 | 9) /sys/devices/system/cpu/cpuX/topology/book_siblings: |
44 | 50 | ||
45 | internal kernel map of cpuX's hardware threads within the same | 51 | internal kernel map of cpuX's hardware threads within the same |
46 | book_id. | 52 | book_id. |
47 | 53 | ||
48 | 9) /sys/devices/system/cpu/cpuX/topology/book_siblings_list: | 54 | 10) /sys/devices/system/cpu/cpuX/topology/book_siblings_list: |
49 | 55 | ||
50 | human-readable list of cpuX's hardware threads within the same | 56 | human-readable list of cpuX's hardware threads within the same |
51 | book_id. | 57 | book_id. |
52 | 58 | ||
59 | 11) /sys/devices/system/cpu/cpuX/topology/drawer_siblings: | ||
60 | |||
61 | internal kernel map of cpuX's hardware threads within the same | ||
62 | drawer_id. | ||
63 | |||
64 | 12) /sys/devices/system/cpu/cpuX/topology/drawer_siblings_list: | ||
65 | |||
66 | human-readable list of cpuX's hardware threads within the same | ||
67 | drawer_id. | ||
68 | |||
53 | To implement it in an architecture-neutral way, a new source file, | 69 | To implement it in an architecture-neutral way, a new source file, |
54 | drivers/base/topology.c, is to export the 6 or 9 attributes. The three book | 70 | drivers/base/topology.c, is to export the 6 to 12 attributes. The book |
55 | related sysfs files will only be created if CONFIG_SCHED_BOOK is selected. | 71 | and drawer related sysfs files will only be created if CONFIG_SCHED_BOOK |
72 | and CONFIG_SCHED_DRAWER are selected. | ||
73 | |||
74 | CONFIG_SCHED_BOOK and CONFIG_DRAWER are currently only used on s390, where | ||
75 | they reflect the cpu and cache hierarchy. | ||
56 | 76 | ||
57 | For an architecture to support this feature, it must define some of | 77 | For an architecture to support this feature, it must define some of |
58 | these macros in include/asm-XXX/topology.h: | 78 | these macros in include/asm-XXX/topology.h: |
59 | #define topology_physical_package_id(cpu) | 79 | #define topology_physical_package_id(cpu) |
60 | #define topology_core_id(cpu) | 80 | #define topology_core_id(cpu) |
61 | #define topology_book_id(cpu) | 81 | #define topology_book_id(cpu) |
82 | #define topology_drawer_id(cpu) | ||
62 | #define topology_sibling_cpumask(cpu) | 83 | #define topology_sibling_cpumask(cpu) |
63 | #define topology_core_cpumask(cpu) | 84 | #define topology_core_cpumask(cpu) |
64 | #define topology_book_cpumask(cpu) | 85 | #define topology_book_cpumask(cpu) |
86 | #define topology_drawer_cpumask(cpu) | ||
65 | 87 | ||
66 | The type of **_id macros is int. | 88 | The type of **_id macros is int. |
67 | The type of **_cpumask macros is (const) struct cpumask *. The latter | 89 | The type of **_cpumask macros is (const) struct cpumask *. The latter |
@@ -78,6 +100,8 @@ not defined by include/asm-XXX/topology.h: | |||
78 | 100 | ||
79 | For architectures that don't support books (CONFIG_SCHED_BOOK) there are no | 101 | For architectures that don't support books (CONFIG_SCHED_BOOK) there are no |
80 | default definitions for topology_book_id() and topology_book_cpumask(). | 102 | default definitions for topology_book_id() and topology_book_cpumask(). |
103 | For architectures that don't support drawes (CONFIG_SCHED_DRAWER) there are | ||
104 | no default definitions for topology_drawer_id() and topology_drawer_cpumask(). | ||
81 | 105 | ||
82 | Additionally, CPU topology information is provided under | 106 | Additionally, CPU topology information is provided under |
83 | /sys/devices/system/cpu and includes these files. The internal | 107 | /sys/devices/system/cpu and includes these files. The internal |
diff --git a/drivers/base/topology.c b/drivers/base/topology.c index 8b7d7f8e5851..df3c97cb4c99 100644 --- a/drivers/base/topology.c +++ b/drivers/base/topology.c | |||
@@ -77,6 +77,14 @@ static DEVICE_ATTR_RO(book_siblings); | |||
77 | static DEVICE_ATTR_RO(book_siblings_list); | 77 | static DEVICE_ATTR_RO(book_siblings_list); |
78 | #endif | 78 | #endif |
79 | 79 | ||
80 | #ifdef CONFIG_SCHED_DRAWER | ||
81 | define_id_show_func(drawer_id); | ||
82 | static DEVICE_ATTR_RO(drawer_id); | ||
83 | define_siblings_show_func(drawer_siblings, drawer_cpumask); | ||
84 | static DEVICE_ATTR_RO(drawer_siblings); | ||
85 | static DEVICE_ATTR_RO(drawer_siblings_list); | ||
86 | #endif | ||
87 | |||
80 | static struct attribute *default_attrs[] = { | 88 | static struct attribute *default_attrs[] = { |
81 | &dev_attr_physical_package_id.attr, | 89 | &dev_attr_physical_package_id.attr, |
82 | &dev_attr_core_id.attr, | 90 | &dev_attr_core_id.attr, |
@@ -89,6 +97,11 @@ static struct attribute *default_attrs[] = { | |||
89 | &dev_attr_book_siblings.attr, | 97 | &dev_attr_book_siblings.attr, |
90 | &dev_attr_book_siblings_list.attr, | 98 | &dev_attr_book_siblings_list.attr, |
91 | #endif | 99 | #endif |
100 | #ifdef CONFIG_SCHED_DRAWER | ||
101 | &dev_attr_drawer_id.attr, | ||
102 | &dev_attr_drawer_siblings.attr, | ||
103 | &dev_attr_drawer_siblings_list.attr, | ||
104 | #endif | ||
92 | NULL | 105 | NULL |
93 | }; | 106 | }; |
94 | 107 | ||