[PATCH][2.5][13/15] smp_call_function/_on_cpu - uml

From: Zwane Mwaikambo (zwane@holomorphy.com)
Date: Sun Feb 09 2003 - 07:08:27 EST


 smp.c | 39 +++++++++++++++++++++++++++++++++++++--
 1 files changed, 37 insertions(+), 2 deletions(-)

Index: linux-2.5.59-bk/arch/um/kernel/smp.c
===================================================================
RCS file: /build/cvsroot/linux-2.5.59-bk/arch/um/kernel/smp.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 smp.c
--- linux-2.5.59-bk/arch/um/kernel/smp.c 9 Feb 2003 09:08:37 -0000 1.1.1.1
+++ linux-2.5.59-bk/arch/um/kernel/smp.c 9 Feb 2003 09:23:30 -0000
@@ -255,8 +255,43 @@
         atomic_inc(&scf_finished);
 }
 
-int smp_call_function(void (*_func)(void *info), void *_info, int nonatomic,
- int wait)
+int smp_call_function_on_cpu(void (*_func)(void *info), void *_info, int wait,
+ unsigned long mask)
+{
+ int i, cpu, num_cpus = hweight32(mask);
+
+ if (num_cpus == 0)
+ return 0;
+
+ cpu = get_cpu();
+ if ((1UL << cpu) && mask) {
+ put_cpu_no_resched();
+ return 0;
+ }
+
+ spin_lock_bh(&call_lock);
+ atomic_set(&scf_started, 0);
+ atomic_set(&scf_finished, 0);
+ func = _func;
+ info = _info;
+
+ for (i=0;i<NR_CPUS;i++)
+ if (cpu_online(i) && ((1UL << i) & mask))
+ write(cpu_data[i].ipi_pipe[1], "C", 1);
+
+ while (atomic_read(&scf_started) != num_cpus)
+ barrier();
+
+ if (wait)
+ while (atomic_read(&scf_finished) != num_cpus)
+ barrier();
+
+ spin_unlock_bh(&call_lock);
+ put_cpu_no_resched();
+ return 0;
+}
+
+int smp_call_function(void (*_func)(void *info), void *_info, int wait)
 {
         int cpus = num_online_cpus() - 1;
         int i;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sat Feb 15 2003 - 22:00:22 EST