summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHeiko Carstens <heiko.carstens@de.ibm.com>2016-05-21 05:10:13 -0400
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2016-06-13 09:58:27 -0400
commita62247e1f5c13b926f535bb64ecbd7f9fdef7b21 (patch)
tree4ef1e9a1ec7b54531246af5007781f48e0e1a779
parent0599eead5833d9dd0970b59fed3844441b44fe0c (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.txt40
-rw-r--r--drivers/base/topology.c13
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
234) /sys/devices/system/cpu/cpuX/topology/thread_siblings: 234) /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
295) /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
285) /sys/devices/system/cpu/cpuX/topology/thread_siblings_list: 346) /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
336) /sys/devices/system/cpu/cpuX/topology/core_siblings: 397) /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
387) /sys/devices/system/cpu/cpuX/topology/core_siblings_list: 448) /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
438) /sys/devices/system/cpu/cpuX/topology/book_siblings: 499) /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
489) /sys/devices/system/cpu/cpuX/topology/book_siblings_list: 5410) /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
5911) /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
6412) /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
53To implement it in an architecture-neutral way, a new source file, 69To implement it in an architecture-neutral way, a new source file,
54drivers/base/topology.c, is to export the 6 or 9 attributes. The three book 70drivers/base/topology.c, is to export the 6 to 12 attributes. The book
55related sysfs files will only be created if CONFIG_SCHED_BOOK is selected. 71and drawer related sysfs files will only be created if CONFIG_SCHED_BOOK
72and CONFIG_SCHED_DRAWER are selected.
73
74CONFIG_SCHED_BOOK and CONFIG_DRAWER are currently only used on s390, where
75they reflect the cpu and cache hierarchy.
56 76
57For an architecture to support this feature, it must define some of 77For an architecture to support this feature, it must define some of
58these macros in include/asm-XXX/topology.h: 78these 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
66The type of **_id macros is int. 88The type of **_id macros is int.
67The type of **_cpumask macros is (const) struct cpumask *. The latter 89The type of **_cpumask macros is (const) struct cpumask *. The latter
@@ -78,6 +100,8 @@ not defined by include/asm-XXX/topology.h:
78 100
79For architectures that don't support books (CONFIG_SCHED_BOOK) there are no 101For architectures that don't support books (CONFIG_SCHED_BOOK) there are no
80default definitions for topology_book_id() and topology_book_cpumask(). 102default definitions for topology_book_id() and topology_book_cpumask().
103For architectures that don't support drawes (CONFIG_SCHED_DRAWER) there are
104no default definitions for topology_drawer_id() and topology_drawer_cpumask().
81 105
82Additionally, CPU topology information is provided under 106Additionally, 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);
77static DEVICE_ATTR_RO(book_siblings_list); 77static DEVICE_ATTR_RO(book_siblings_list);
78#endif 78#endif
79 79
80#ifdef CONFIG_SCHED_DRAWER
81define_id_show_func(drawer_id);
82static DEVICE_ATTR_RO(drawer_id);
83define_siblings_show_func(drawer_siblings, drawer_cpumask);
84static DEVICE_ATTR_RO(drawer_siblings);
85static DEVICE_ATTR_RO(drawer_siblings_list);
86#endif
87
80static struct attribute *default_attrs[] = { 88static 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