aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390/kernel/topology.c
diff options
context:
space:
mode:
authorHeiko Carstens <heiko.carstens@de.ibm.com>2012-09-04 08:26:03 -0400
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2012-09-26 09:45:08 -0400
commitfade4dc49101e3b68fb375fd2b00d0ef1f31a36f (patch)
tree302bd25e0575ce0b0ad33e34378577ad506bb786 /arch/s390/kernel/topology.c
parent34cda99260247873df53ae00885fb0f426b149a5 (diff)
s390/sysinfo,topology: fix cpu topology maximum nesting detection
The maximum nesting of the cpu topology is evaluated when /proc/sysinfo is the first time read. This happens without a lock and a concurrent reader on a different cpu can see and use an invalid intermediate value. Besides the fact that this race is quite unlikely the worst thing that could happen is that /proc/sysinfo would contain bogus information about the machine's cpu topology. Nevertheless this should be fixed. So move the detection code to the early machine detection code and since now the value is early available use it in the topology code as well. Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'arch/s390/kernel/topology.c')
-rw-r--r--arch/s390/kernel/topology.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/arch/s390/kernel/topology.c b/arch/s390/kernel/topology.c
index fc957f2eef7c..80ca4ba759f6 100644
--- a/arch/s390/kernel/topology.c
+++ b/arch/s390/kernel/topology.c
@@ -251,12 +251,10 @@ static void update_cpu_core_map(void)
251 251
252void store_topology(struct sysinfo_15_1_x *info) 252void store_topology(struct sysinfo_15_1_x *info)
253{ 253{
254 int rc; 254 if (topology_max_mnest >= 3)
255 255 stsi(info, 15, 1, 3);
256 rc = stsi(info, 15, 1, 3); 256 else
257 if (rc != -ENOSYS) 257 stsi(info, 15, 1, 2);
258 return;
259 stsi(info, 15, 1, 2);
260} 258}
261 259
262int arch_update_cpu_topology(void) 260int arch_update_cpu_topology(void)