diff options
author | Kevin Corry <kevcorry@us.ibm.com> | 2007-07-31 16:19:46 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2007-08-03 05:36:00 -0400 |
commit | 17aa3a82aa2173a22405f862c4444656f0494a3f (patch) | |
tree | f721aec8c56ce1d45958b80bc59d661e1ad5745b /arch/powerpc/kernel/smp.c | |
parent | cba684f56d7e8b82b08d4372375a42d6ebeab47d (diff) |
[POWERPC] Fix num_cpus calculation in smp_call_function_map()
In smp_call_function_map(), num_cpus is set to the number of online
CPUs minus one. However, if the CPU mask does not include all CPUs
(except the one we're running on), the routine will hang in the first
while() loop until the 8 second timeout occurs.
The num_cpus should be set to the number of CPUs specified in the mask
passed into the routine, after we've made any modifications to the
mask. With this change, we can also get rid of the call to
cpus_empty() and avoid adding another pass through the bitmask.
Signed-off-by: Kevin Corry <kevcorry@us.ibm.com>
Signed-off-by: Carl Love <carll@us.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/kernel/smp.c')
-rw-r--r-- | arch/powerpc/kernel/smp.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c index 087c92f2a3eb..1ea43160f543 100644 --- a/arch/powerpc/kernel/smp.c +++ b/arch/powerpc/kernel/smp.c | |||
@@ -212,11 +212,6 @@ int smp_call_function_map(void (*func) (void *info), void *info, int nonatomic, | |||
212 | atomic_set(&data.finished, 0); | 212 | atomic_set(&data.finished, 0); |
213 | 213 | ||
214 | spin_lock(&call_lock); | 214 | spin_lock(&call_lock); |
215 | /* Must grab online cpu count with preempt disabled, otherwise | ||
216 | * it can change. */ | ||
217 | num_cpus = num_online_cpus() - 1; | ||
218 | if (!num_cpus) | ||
219 | goto done; | ||
220 | 215 | ||
221 | /* remove 'self' from the map */ | 216 | /* remove 'self' from the map */ |
222 | if (cpu_isset(smp_processor_id(), map)) | 217 | if (cpu_isset(smp_processor_id(), map)) |
@@ -224,7 +219,9 @@ int smp_call_function_map(void (*func) (void *info), void *info, int nonatomic, | |||
224 | 219 | ||
225 | /* sanity check the map, remove any non-online processors. */ | 220 | /* sanity check the map, remove any non-online processors. */ |
226 | cpus_and(map, map, cpu_online_map); | 221 | cpus_and(map, map, cpu_online_map); |
227 | if (cpus_empty(map)) | 222 | |
223 | num_cpus = cpus_weight(map); | ||
224 | if (!num_cpus) | ||
228 | goto done; | 225 | goto done; |
229 | 226 | ||
230 | call_data = &data; | 227 | call_data = &data; |