| Zhang, Yanmin | 69dcc99 | 2006-02-03 03:04:36 -0800 | [diff] [blame] | 1 |  | 
| Jesper Juhl | ded23ac | 2006-03-28 01:56:52 -0800 | [diff] [blame] | 2 | Export cpu topology info via sysfs. Items (attributes) are similar | 
| Zhang, Yanmin | 69dcc99 | 2006-02-03 03:04:36 -0800 | [diff] [blame] | 3 | to /proc/cpuinfo. | 
 | 4 |  | 
 | 5 | 1) /sys/devices/system/cpu/cpuX/topology/physical_package_id: | 
 | 6 | represent the physical package id of  cpu X; | 
 | 7 | 2) /sys/devices/system/cpu/cpuX/topology/core_id: | 
 | 8 | represent the cpu core id to cpu X; | 
 | 9 | 3) /sys/devices/system/cpu/cpuX/topology/thread_siblings: | 
 | 10 | represent the thread siblings to cpu X in the same core; | 
 | 11 | 4) /sys/devices/system/cpu/cpuX/topology/core_siblings: | 
 | 12 | represent the thread siblings to cpu X in the same physical package; | 
 | 13 |  | 
 | 14 | To implement it in an architecture-neutral way, a new source file, | 
| Jesper Juhl | ded23ac | 2006-03-28 01:56:52 -0800 | [diff] [blame] | 15 | drivers/base/topology.c, is to export the 4 attributes. | 
| Zhang, Yanmin | 69dcc99 | 2006-02-03 03:04:36 -0800 | [diff] [blame] | 16 |  | 
| Ben Hutchings | c50cbb0 | 2008-06-04 21:47:29 -0700 | [diff] [blame] | 17 | For an architecture to support this feature, it must define some of | 
 | 18 | these macros in include/asm-XXX/topology.h: | 
| Zhang, Yanmin | 69dcc99 | 2006-02-03 03:04:36 -0800 | [diff] [blame] | 19 | #define topology_physical_package_id(cpu) | 
 | 20 | #define topology_core_id(cpu) | 
 | 21 | #define topology_thread_siblings(cpu) | 
 | 22 | #define topology_core_siblings(cpu) | 
 | 23 |  | 
 | 24 | The type of **_id is int. | 
 | 25 | The type of siblings is cpumask_t. | 
 | 26 |  | 
| Ben Hutchings | c50cbb0 | 2008-06-04 21:47:29 -0700 | [diff] [blame] | 27 | To be consistent on all architectures, include/linux/topology.h | 
 | 28 | provides default definitions for any of the above macros that are | 
 | 29 | not defined by include/asm-XXX/topology.h: | 
 | 30 | 1) physical_package_id: -1 | 
 | 31 | 2) core_id: 0 | 
 | 32 | 3) thread_siblings: just the given CPU | 
 | 33 | 4) core_siblings: just the given CPU |