Blame view
Documentation/cputopology.txt
3.84 KB
69dcc9919 [PATCH] Export cp... |
1 |
|
663fb2fc7 Documentation: AB... |
2 |
Export CPU topology info via sysfs. Items (attributes) are similar |
69dcc9919 [PATCH] Export cp... |
3 4 5 |
to /proc/cpuinfo. 1) /sys/devices/system/cpu/cpuX/topology/physical_package_id: |
663fb2fc7 Documentation: AB... |
6 7 8 9 |
physical package id of cpuX. Typically corresponds to a physical socket number, but the actual value is architecture and platform dependent. |
69dcc9919 [PATCH] Export cp... |
10 |
2) /sys/devices/system/cpu/cpuX/topology/core_id: |
663fb2fc7 Documentation: AB... |
11 12 13 14 |
the CPU core ID of cpuX. Typically it is the hardware platform's identifier (rather than the kernel's). The actual value is architecture and platform dependent. |
b40d8ed4e topology/sysfs: P... |
15 16 17 18 19 20 21 |
3) /sys/devices/system/cpu/cpuX/topology/book_id: the book ID of cpuX. Typically it is the hardware platform's identifier (rather than the kernel's). The actual value is architecture and platform dependent. 4) /sys/devices/system/cpu/cpuX/topology/thread_siblings: |
663fb2fc7 Documentation: AB... |
22 23 24 |
internel kernel map of cpuX's hardware threads within the same core as cpuX |
b40d8ed4e topology/sysfs: P... |
25 |
5) /sys/devices/system/cpu/cpuX/topology/core_siblings: |
663fb2fc7 Documentation: AB... |
26 27 28 |
internal kernel map of cpuX's hardware threads within the same physical_package_id. |
69dcc9919 [PATCH] Export cp... |
29 |
|
b40d8ed4e topology/sysfs: P... |
30 31 32 33 |
6) /sys/devices/system/cpu/cpuX/topology/book_siblings: internal kernel map of cpuX's hardware threads within the same book_id. |
69dcc9919 [PATCH] Export cp... |
34 |
To implement it in an architecture-neutral way, a new source file, |
b40d8ed4e topology/sysfs: P... |
35 36 |
drivers/base/topology.c, is to export the 4 or 6 attributes. The two book related sysfs files will only be created if CONFIG_SCHED_BOOK is selected. |
69dcc9919 [PATCH] Export cp... |
37 |
|
c50cbb05a cpu topology: alw... |
38 39 |
For an architecture to support this feature, it must define some of these macros in include/asm-XXX/topology.h: |
69dcc9919 [PATCH] Export cp... |
40 41 |
#define topology_physical_package_id(cpu) #define topology_core_id(cpu) |
b40d8ed4e topology/sysfs: P... |
42 |
#define topology_book_id(cpu) |
fbd59a8d1 cpumask: Use topo... |
43 44 |
#define topology_thread_cpumask(cpu) #define topology_core_cpumask(cpu) |
b40d8ed4e topology/sysfs: P... |
45 |
#define topology_book_cpumask(cpu) |
69dcc9919 [PATCH] Export cp... |
46 47 |
The type of **_id is int. |
fbd59a8d1 cpumask: Use topo... |
48 |
The type of siblings is (const) struct cpumask *. |
69dcc9919 [PATCH] Export cp... |
49 |
|
c50cbb05a cpu topology: alw... |
50 51 52 53 54 55 56 |
To be consistent on all architectures, include/linux/topology.h provides default definitions for any of the above macros that are not defined by include/asm-XXX/topology.h: 1) physical_package_id: -1 2) core_id: 0 3) thread_siblings: just the given CPU 4) core_siblings: just the given CPU |
d62720ade sysfs: add docume... |
57 |
|
b40d8ed4e topology/sysfs: P... |
58 59 |
For architectures that don't support books (CONFIG_SCHED_BOOK) there are no default definitions for topology_book_id() and topology_book_cpumask(). |
663fb2fc7 Documentation: AB... |
60 |
Additionally, CPU topology information is provided under |
d62720ade sysfs: add docume... |
61 62 |
/sys/devices/system/cpu and includes these files. The internal source for the output is in brackets ("[]"). |
663fb2fc7 Documentation: AB... |
63 |
kernel_max: the maximum CPU index allowed by the kernel configuration. |
d62720ade sysfs: add docume... |
64 |
[NR_CPUS-1] |
663fb2fc7 Documentation: AB... |
65 |
offline: CPUs that are not online because they have been |
d62720ade sysfs: add docume... |
66 |
HOTPLUGGED off (see cpu-hotplug.txt) or exceed the limit |
663fb2fc7 Documentation: AB... |
67 |
of CPUs allowed by the kernel configuration (kernel_max |
d62720ade sysfs: add docume... |
68 |
above). [~cpu_online_mask + cpus >= NR_CPUS] |
663fb2fc7 Documentation: AB... |
69 |
online: CPUs that are online and being scheduled [cpu_online_mask] |
d62720ade sysfs: add docume... |
70 |
|
663fb2fc7 Documentation: AB... |
71 |
possible: CPUs that have been allocated resources and can be |
d62720ade sysfs: add docume... |
72 |
brought online if they are present. [cpu_possible_mask] |
663fb2fc7 Documentation: AB... |
73 |
present: CPUs that have been identified as being present in the |
d62720ade sysfs: add docume... |
74 75 76 77 |
system. [cpu_present_mask] The format for the above output is compatible with cpulist_parse() [see <linux/cpumask.h>]. Some examples follow. |
663fb2fc7 Documentation: AB... |
78 |
In this example, there are 64 CPUs in the system but cpus 32-63 exceed |
d62720ade sysfs: add docume... |
79 |
the kernel max which is limited to 0..31 by the NR_CPUS config option |
663fb2fc7 Documentation: AB... |
80 |
being 32. Note also that CPUs 2 and 4-31 are not online but could be |
d62720ade sysfs: add docume... |
81 82 83 84 85 86 87 88 89 |
brought online as they are both present and possible. kernel_max: 31 offline: 2,4-31,32-63 online: 0-1,3 possible: 0-31 present: 0-31 In this example, the NR_CPUS config option is 128, but the kernel was |
663fb2fc7 Documentation: AB... |
90 91 |
started with possible_cpus=144. There are 4 CPUs in the system and cpu2 was manually taken offline (and is the only CPU that can be brought |
d62720ade sysfs: add docume... |
92 93 94 95 96 97 98 99 100 |
online.) kernel_max: 127 offline: 2,4-127,128-143 online: 0-1,3 possible: 0-127 present: 0-3 See cpu-hotplug.txt for the possible_cpus=NUM kernel start parameter |
663fb2fc7 Documentation: AB... |
101 |
as well as more information on the various cpumasks. |