From 770018c2a05d7e75da42531a1e4c1a8a74441106 Mon Sep 17 00:00:00 2001 From: Glauber Costa Date: Mon, 3 Mar 2008 14:12:46 -0300 Subject: [PATCH] --- yaml --- r: 88714 b: refs/heads/master c: 3a36d1e435af79ec3bc5ead871e5b22d5558ebf3 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/arch/x86/kernel/smp_64.c | 34 +++++++++++++++++++++++++++++++++- 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/[refs] b/[refs] index 0e06690e5c83..fec749b34edd 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: e32640a2cd530e1259a06e34a72b0cdb73738ce2 +refs/heads/master: 3a36d1e435af79ec3bc5ead871e5b22d5558ebf3 diff --git a/trunk/arch/x86/kernel/smp_64.c b/trunk/arch/x86/kernel/smp_64.c index 1d8b863fa357..aa2edb7f3a51 100644 --- a/trunk/arch/x86/kernel/smp_64.c +++ b/trunk/arch/x86/kernel/smp_64.c @@ -322,6 +322,38 @@ void unlock_ipi_call_lock(void) spin_unlock_irq(&call_lock); } +static void __smp_call_function(void (*func) (void *info), void *info, + int nonatomic, int wait) +{ + struct call_data_struct data; + int cpus = num_online_cpus() - 1; + + if (!cpus) + return; + + data.func = func; + data.info = info; + atomic_set(&data.started, 0); + data.wait = wait; + if (wait) + atomic_set(&data.finished, 0); + + call_data = &data; + mb(); + + /* Send a message to all other CPUs and wait for them to respond */ + send_IPI_allbutself(CALL_FUNCTION_VECTOR); + + /* Wait for response */ + while (atomic_read(&data.started) != cpus) + cpu_relax(); + + if (wait) + while (atomic_read(&data.finished) != cpus) + cpu_relax(); +} + + /* * this function sends a 'generic call function' IPI to all other CPU * of the system defined in the mask. @@ -424,7 +456,7 @@ void smp_send_stop(void) /* Don't deadlock on the call lock in panic */ nolock = !spin_trylock(&call_lock); local_irq_save(flags); - __smp_call_function_mask(cpu_online_map, stop_this_cpu, NULL, 0); + __smp_call_function(stop_this_cpu, NULL, 0, 0); if (!nolock) spin_unlock(&call_lock); disable_local_APIC();