lkml.org 
[lkml]   [2003]   [Feb]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH][2.5][4/14] smp_call_function_on_cpu - MIPS
 smp.c |   43 +++++++++++++++++++++++++++++--------------
1 files changed, 29 insertions(+), 14 deletions(-)

Index: linux-2.5.60/arch/mips/kernel/smp.c
===================================================================
RCS file: /build/cvsroot/linux-2.5.60/arch/mips/kernel/smp.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 smp.c
--- linux-2.5.60/arch/mips/kernel/smp.c 10 Feb 2003 22:15:04 -0000 1.1.1.1
+++ linux-2.5.60/arch/mips/kernel/smp.c 14 Feb 2003 06:09:00 -0000
@@ -185,22 +185,32 @@
smp_call_function(reschedule_this_cpu, NULL, 0, 0);
}

-
/*
- * The caller of this wants the passed function to run on every cpu. If wait
- * is set, wait until all cpus have finished the function before returning.
- * The lock is here to protect the call structure.
+ * smp_call_function_on_cpu - Runs func on all processors in the mask
+ *
+ * @func: The function to run. This must be fast and non-blocking.
+ * @info: An arbitrary pointer to pass to the function.
+ * @wait: If true, wait (atomically) until function has completed on other CPUs.
+ * @mask The bitmask of CPUs to call the function
+ *
+ * Returns 0 on success, else a negative status code. Does not return until
+ * remote CPUs are nearly ready to execute func or have executed it.
+ *
* You must not call this function with disabled interrupts or from a
* hardware interrupt handler or from a bottom half handler.
*/
-int smp_call_function (void (*func) (void *info), void *info, int retry,
- int wait)
+
+int smp_call_function_on_cpu (void (*func) (void *info), void *info, int wait,
+ unsigned long mask)
{
- int cpus = smp_num_cpus - 1;
- int i;
+ int cpu, i, num_cpus;

- if (smp_num_cpus < 2) {
- return 0;
+ cpu = get_cpu();
+ mask &= ~(1UL << cpu);
+ num_cpus = hweight32(mask);
+ if (num_cpus == 0) {
+ put_cpu_no_resched();
+ return -EINVAL;
}

spin_lock(&smp_fn_call.lock);
@@ -209,19 +219,24 @@
smp_fn_call.fn = func;
smp_fn_call.data = info;

- for (i = 0; i < smp_num_cpus; i++) {
- if (i != smp_processor_id()) {
+ for (i = 0; i < NR_CPUS; i++) {
+ if (cpu_online(i) && ((1UL << i) & mask))
/* Call the board specific routine */
core_call_function(i);
- }
}

if (wait) {
- while(atomic_read(&smp_fn_call.finished) != cpus) {}
+ while(atomic_read(&smp_fn_call.finished) != num_cpus) {}
}

spin_unlock(&smp_fn_call.lock);
+ put_cpu_no_resched();
return 0;
+}
+
+int smp_call_function (void (*func) (void *info), void *info, int retry, int wait)
+{
+ return smp_call_function_on_cpu(func, info, wait, cpu_online_map);
}

void synchronize_irq(void)
-
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/
\
 
 \ /
  Last update: 2005-03-22 13:33    [W:0.030 / U:2.584 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site