diff options
Diffstat (limited to 'arch/x86/kernel/smp_64.c')
-rw-r--r-- | arch/x86/kernel/smp_64.c | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/arch/x86/kernel/smp_64.c b/arch/x86/kernel/smp_64.c index 1d8b863fa357..aa2edb7f3a51 100644 --- a/arch/x86/kernel/smp_64.c +++ b/arch/x86/kernel/smp_64.c | |||
@@ -322,6 +322,38 @@ void unlock_ipi_call_lock(void) | |||
322 | spin_unlock_irq(&call_lock); | 322 | spin_unlock_irq(&call_lock); |
323 | } | 323 | } |
324 | 324 | ||
325 | static void __smp_call_function(void (*func) (void *info), void *info, | ||
326 | int nonatomic, int wait) | ||
327 | { | ||
328 | struct call_data_struct data; | ||
329 | int cpus = num_online_cpus() - 1; | ||
330 | |||
331 | if (!cpus) | ||
332 | return; | ||
333 | |||
334 | data.func = func; | ||
335 | data.info = info; | ||
336 | atomic_set(&data.started, 0); | ||
337 | data.wait = wait; | ||
338 | if (wait) | ||
339 | atomic_set(&data.finished, 0); | ||
340 | |||
341 | call_data = &data; | ||
342 | mb(); | ||
343 | |||
344 | /* Send a message to all other CPUs and wait for them to respond */ | ||
345 | send_IPI_allbutself(CALL_FUNCTION_VECTOR); | ||
346 | |||
347 | /* Wait for response */ | ||
348 | while (atomic_read(&data.started) != cpus) | ||
349 | cpu_relax(); | ||
350 | |||
351 | if (wait) | ||
352 | while (atomic_read(&data.finished) != cpus) | ||
353 | cpu_relax(); | ||
354 | } | ||
355 | |||
356 | |||
325 | /* | 357 | /* |
326 | * this function sends a 'generic call function' IPI to all other CPU | 358 | * this function sends a 'generic call function' IPI to all other CPU |
327 | * of the system defined in the mask. | 359 | * of the system defined in the mask. |
@@ -424,7 +456,7 @@ void smp_send_stop(void) | |||
424 | /* Don't deadlock on the call lock in panic */ | 456 | /* Don't deadlock on the call lock in panic */ |
425 | nolock = !spin_trylock(&call_lock); | 457 | nolock = !spin_trylock(&call_lock); |
426 | local_irq_save(flags); | 458 | local_irq_save(flags); |
427 | __smp_call_function_mask(cpu_online_map, stop_this_cpu, NULL, 0); | 459 | __smp_call_function(stop_this_cpu, NULL, 0, 0); |
428 | if (!nolock) | 460 | if (!nolock) |
429 | spin_unlock(&call_lock); | 461 | spin_unlock(&call_lock); |
430 | disable_local_APIC(); | 462 | disable_local_APIC(); |