Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[S390] topology: expose core identifier

Provide a topology_core_id define which makes sure that the contents of
/sys/devices/system/cpu/cpuX/topology/core_id
indeed do contain the core id and not always 0.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>

authored by

Heiko Carstens and committed by
Martin Schwidefsky
10d38589 2dedf0d9

+8 -1
+2
arch/s390/include/asm/topology.h
··· 7 7 8 8 const struct cpumask *cpu_coregroup_mask(unsigned int cpu); 9 9 10 + extern unsigned char cpu_core_id[NR_CPUS]; 10 11 extern cpumask_t cpu_core_map[NR_CPUS]; 11 12 13 + #define topology_core_id(cpu) (cpu_core_id[cpu]) 12 14 #define topology_core_cpumask(cpu) (&cpu_core_map[cpu]) 13 15 14 16 int topology_set_cpu_management(int fc);
+6 -1
arch/s390/kernel/topology.c
··· 37 37 }; 38 38 39 39 struct tl_container { 40 - unsigned char reserved[8]; 40 + unsigned char reserved[7]; 41 + unsigned char id; 41 42 }; 42 43 43 44 union tl_entry { ··· 59 58 60 59 struct core_info { 61 60 struct core_info *next; 61 + unsigned char id; 62 62 cpumask_t mask; 63 63 }; 64 64 ··· 75 73 static DEFINE_SPINLOCK(topology_lock); 76 74 77 75 cpumask_t cpu_core_map[NR_CPUS]; 76 + unsigned char cpu_core_id[NR_CPUS]; 78 77 79 78 static cpumask_t cpu_coregroup_map(unsigned int cpu) 80 79 { ··· 119 116 for_each_present_cpu(lcpu) { 120 117 if (cpu_logical_map(lcpu) == rcpu) { 121 118 cpu_set(lcpu, core->mask); 119 + cpu_core_id[lcpu] = core->id; 122 120 smp_cpu_polarization[lcpu] = tl_cpu->pp; 123 121 } 124 122 } ··· 162 158 break; 163 159 case 1: 164 160 core = core->next; 161 + core->id = tle->container.id; 165 162 break; 166 163 case 0: 167 164 add_cpus_to_core(&tle->cpu, core);