linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH][2.5][16/18] smp_call_function_on_cpu - uml
@ 2003-01-22  5:49 Zwane Mwaikambo
  2003-01-23  3:27 ` Jeff Dike
  0 siblings, 1 reply; 2+ messages in thread
From: Zwane Mwaikambo @ 2003-01-22  5:49 UTC (permalink / raw)
  To: Linux Kernel; +Cc: Jeff Dike

This one might need eyeballing...

Index: linux-2.5.59/arch/um/kernel/smp.c
===================================================================
RCS file: /build/cvsroot/linux-2.5.59/arch/um/kernel/smp.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 smp.c
--- linux-2.5.59/arch/um/kernel/smp.c	17 Jan 2003 11:14:54 -0000	1.1.1.1
+++ linux-2.5.59/arch/um/kernel/smp.c	22 Jan 2003 02:19:28 -0000
@@ -254,8 +254,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;

-- 
function.linuxpower.ca



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH][2.5][16/18] smp_call_function_on_cpu - uml
  2003-01-22  5:49 [PATCH][2.5][16/18] smp_call_function_on_cpu - uml Zwane Mwaikambo
@ 2003-01-23  3:27 ` Jeff Dike
  0 siblings, 0 replies; 2+ messages in thread
From: Jeff Dike @ 2003-01-23  3:27 UTC (permalink / raw)
  To: Zwane Mwaikambo; +Cc: Linux Kernel

zwane@holomorphy.com said:
> This one might need eyeballing... 

Yup.  That's in the queue...

			Jeff


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-01-23  3:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-01-22  5:49 [PATCH][2.5][16/18] smp_call_function_on_cpu - uml Zwane Mwaikambo
2003-01-23  3:27 ` Jeff Dike

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).