Commit 658e5ce7 authored by Heiko Carstens's avatar Heiko Carstens Committed by Martin Schwidefsky

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: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent fa968ee2
...@@ -8,6 +8,9 @@ struct cpu; ...@@ -8,6 +8,9 @@ struct cpu;
#ifdef CONFIG_SCHED_BOOK #ifdef CONFIG_SCHED_BOOK
extern unsigned char cpu_socket_id[NR_CPUS];
#define topology_physical_package_id(cpu) (cpu_socket_id[cpu])
extern unsigned char cpu_core_id[NR_CPUS]; extern unsigned char cpu_core_id[NR_CPUS];
extern cpumask_t cpu_core_map[NR_CPUS]; extern cpumask_t cpu_core_map[NR_CPUS];
......
...@@ -40,6 +40,7 @@ static DEFINE_SPINLOCK(topology_lock); ...@@ -40,6 +40,7 @@ static DEFINE_SPINLOCK(topology_lock);
static struct mask_info core_info; static struct mask_info core_info;
cpumask_t cpu_core_map[NR_CPUS]; cpumask_t cpu_core_map[NR_CPUS];
unsigned char cpu_core_id[NR_CPUS]; unsigned char cpu_core_id[NR_CPUS];
unsigned char cpu_socket_id[NR_CPUS];
static struct mask_info book_info; static struct mask_info book_info;
cpumask_t cpu_book_map[NR_CPUS]; 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,11 +84,12 @@ static struct mask_info *add_cpus_to_mask(struct topology_cpu *tl_cpu,
cpumask_set_cpu(lcpu, &book->mask); cpumask_set_cpu(lcpu, &book->mask);
cpu_book_id[lcpu] = book->id; cpu_book_id[lcpu] = book->id;
cpumask_set_cpu(lcpu, &core->mask); cpumask_set_cpu(lcpu, &core->mask);
cpu_core_id[lcpu] = rcpu;
if (one_core_per_cpu) { if (one_core_per_cpu) {
cpu_core_id[lcpu] = rcpu; cpu_socket_id[lcpu] = rcpu;
core = core->next; core = core->next;
} else { } else {
cpu_core_id[lcpu] = core->id; cpu_socket_id[lcpu] = core->id;
} }
smp_cpu_set_polarization(lcpu, tl_cpu->pp); smp_cpu_set_polarization(lcpu, tl_cpu->pp);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment