diff options
author | Glauber Costa <gcosta@redhat.com> | 2008-03-03 12:12:46 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-04-17 11:40:55 -0400 |
commit | 3a36d1e435af79ec3bc5ead871e5b22d5558ebf3 (patch) | |
tree | d7b07427b52a63fce0050cfad4462a113fb76a08 /arch | |
parent | e32640a2cd530e1259a06e34a72b0cdb73738ce2 (diff) |
x86: provide __smp_call_function
This function is used in smp_send_stop(). It's like
smp_call_function_mask, but always go to all online cpus,
and does not take any locks.
It is added to x86_64, but will soon be unified in a common file
Signed-off-by: Glauber Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch')
-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(); |