diff options
| author | Heiko Carstens <heiko.carstens@de.ibm.com> | 2012-11-10 05:04:27 -0500 |
|---|---|---|
| committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2012-11-12 10:24:38 -0500 |
| commit | 658e5ce705f2a09ab681eb61ca7c8619bb7a783d (patch) | |
| tree | d97179ea3d442bb6acb9e4db36c8235f24a1f0b5 | |
| parent | fa968ee215c0ca91e4a9c3a69ac2405aae6e5d2f (diff) | |
s390/topology: fix core id vs physical package id mix-up
The current topology code confuses core id vs physical package id.
In other words /sys/devices/system/cpu/cpuX/topology/core_id
displays the physical_package_id (aka socket id) instead of the
core id.
The physical_package_id sysfs attribute always displays "-1"
instead of the socket id.
Fix this mix-up with a small patch which defines and initializes
topology_physical_package_id correctly and fixes the broken
core id handling.
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
| -rw-r--r-- | arch/s390/include/asm/topology.h | 3 | ||||
| -rw-r--r-- | arch/s390/kernel/topology.c | 6 |
2 files changed, 7 insertions, 2 deletions
diff --git a/arch/s390/include/asm/topology.h b/arch/s390/include/asm/topology.h index 9ca305383760..9935cbd6a46f 100644 --- a/arch/s390/include/asm/topology.h +++ b/arch/s390/include/asm/topology.h | |||
| @@ -8,6 +8,9 @@ struct cpu; | |||
| 8 | 8 | ||
| 9 | #ifdef CONFIG_SCHED_BOOK | 9 | #ifdef CONFIG_SCHED_BOOK |
| 10 | 10 | ||
| 11 | extern unsigned char cpu_socket_id[NR_CPUS]; | ||
| 12 | #define topology_physical_package_id(cpu) (cpu_socket_id[cpu]) | ||
| 13 | |||
| 11 | extern unsigned char cpu_core_id[NR_CPUS]; | 14 | extern unsigned char cpu_core_id[NR_CPUS]; |
| 12 | extern cpumask_t cpu_core_map[NR_CPUS]; | 15 | extern cpumask_t cpu_core_map[NR_CPUS]; |
| 13 | 16 | ||
diff --git a/arch/s390/kernel/topology.c b/arch/s390/kernel/topology.c index 54d93f4b6818..dd55f7c20104 100644 --- a/arch/s390/kernel/topology.c +++ b/arch/s390/kernel/topology.c | |||
| @@ -40,6 +40,7 @@ static DEFINE_SPINLOCK(topology_lock); | |||
| 40 | static struct mask_info core_info; | 40 | static struct mask_info core_info; |
| 41 | cpumask_t cpu_core_map[NR_CPUS]; | 41 | cpumask_t cpu_core_map[NR_CPUS]; |
| 42 | unsigned char cpu_core_id[NR_CPUS]; | 42 | unsigned char cpu_core_id[NR_CPUS]; |
| 43 | unsigned char cpu_socket_id[NR_CPUS]; | ||
| 43 | 44 | ||
| 44 | static struct mask_info book_info; | 45 | static struct mask_info book_info; |
| 45 | cpumask_t cpu_book_map[NR_CPUS]; | 46 | cpumask_t cpu_book_map[NR_CPUS]; |
| @@ -83,11 +84,12 @@ static struct mask_info *add_cpus_to_mask(struct topology_cpu *tl_cpu, | |||
| 83 | cpumask_set_cpu(lcpu, &book->mask); | 84 | cpumask_set_cpu(lcpu, &book->mask); |
| 84 | cpu_book_id[lcpu] = book->id; | 85 | cpu_book_id[lcpu] = book->id; |
| 85 | cpumask_set_cpu(lcpu, &core->mask); | 86 | cpumask_set_cpu(lcpu, &core->mask); |
| 87 | cpu_core_id[lcpu] = rcpu; | ||
| 86 | if (one_core_per_cpu) { | 88 | if (one_core_per_cpu) { |
| 87 | cpu_core_id[lcpu] = rcpu; | 89 | cpu_socket_id[lcpu] = rcpu; |
| 88 | core = core->next; | 90 | core = core->next; |
| 89 | } else { | 91 | } else { |
| 90 | cpu_core_id[lcpu] = core->id; | 92 | cpu_socket_id[lcpu] = core->id; |
| 91 | } | 93 | } |
| 92 | smp_cpu_set_polarization(lcpu, tl_cpu->pp); | 94 | smp_cpu_set_polarization(lcpu, tl_cpu->pp); |
| 93 | } | 95 | } |
