Commit 10d3858950557cd3cc05f647ede597114c610177

Authored by Heiko Carstens
Committed by Martin Schwidefsky
1 parent 2dedf0d9ea

[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>

Showing 2 changed files with 8 additions and 1 deletions Side-by-side Diff

arch/s390/include/asm/topology.h
... ... @@ -7,8 +7,10 @@
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);
arch/s390/kernel/topology.c
... ... @@ -37,7 +37,8 @@
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 {
... ... @@ -58,6 +59,7 @@
58 59  
59 60 struct core_info {
60 61 struct core_info *next;
  62 + unsigned char id;
61 63 cpumask_t mask;
62 64 };
63 65  
... ... @@ -73,6 +75,7 @@
73 75 static DEFINE_SPINLOCK(topology_lock);
74 76  
75 77 cpumask_t cpu_core_map[NR_CPUS];
  78 +unsigned char cpu_core_id[NR_CPUS];
76 79  
77 80 static cpumask_t cpu_coregroup_map(unsigned int cpu)
78 81 {
... ... @@ -116,6 +119,7 @@
116 119 for_each_present_cpu(lcpu) {
117 120 if (cpu_logical_map(lcpu) == rcpu) {
118 121 cpu_set(lcpu, core->mask);
  122 + cpu_core_id[lcpu] = core->id;
119 123 smp_cpu_polarization[lcpu] = tl_cpu->pp;
120 124 }
121 125 }
... ... @@ -158,6 +162,7 @@
158 162 break;
159 163 case 1:
160 164 core = core->next;
  165 + core->id = tle->container.id;
161 166 break;
162 167 case 0:
163 168 add_cpus_to_core(&tle->cpu, core);