From: Zwane Mwaikambo <zwane@zwane.ca>
To: Linux Kernel <linux-kernel@vger.kernel.org>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>,
Linus Torvalds <torvalds@transmeta.com>
Subject: [PATCH][2.5][8/14] smp_call_function_on_cpu - s390
Date: Fri, 14 Feb 2003 04:35:01 -0500 (EST) [thread overview]
Message-ID: <Pine.LNX.4.50.0302140405170.3518-100000@montezuma.mastecende.com> (raw)
smp.c | 49 ++++++++++++++++++++++++++++++++-----------------
1 files changed, 32 insertions(+), 17 deletions(-)
Index: linux-2.5.60/arch/s390/kernel/smp.c
===================================================================
RCS file: /build/cvsroot/linux-2.5.60/arch/s390/kernel/smp.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 smp.c
--- linux-2.5.60/arch/s390/kernel/smp.c 10 Feb 2003 22:15:54 -0000 1.1.1.1
+++ linux-2.5.60/arch/s390/kernel/smp.c 14 Feb 2003 07:31:47 -0000
@@ -102,27 +102,34 @@
* in the system.
*/
-int smp_call_function (void (*func) (void *info), void *info, int nonatomic,
- int wait)
/*
- * [SUMMARY] Run a function on all other CPUs.
- * <func> The function to run. This must be fast and non-blocking.
- * <info> An arbitrary pointer to pass to the function.
- * <nonatomic> currently unused.
- * <wait> If true, wait (atomically) until function has completed on other CPUs.
- * [RETURNS] 0 on success, else a negative status code. Does not return until
- * remote CPUs are nearly ready to execute <<func>> or are or have executed.
+ * 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_on_cpu (void (*func) (void *info), void *info, int wait,
+ unsigned long mask)
{
struct call_data_struct data;
- int cpus = num_online_cpus()-1;
+ int i, cpu, num_cpus;
- /* FIXME: get cpu lock -hc */
- if (cpus <= 0)
- return 0;
+ cpu = get_cpu();
+ mask &= (1UL << cpu);
+ num_cpus = hweight32(mask);
+ if (num_cpus == 0) {
+ put_cpu_no_resched();
+ return -EINVAL;
+ }
data.func = func;
data.info = info;
@@ -134,18 +141,26 @@
spin_lock(&call_lock);
call_data = &data;
/* Send a message to all other CPUs and wait for them to respond */
- smp_ext_bitcall_others(ec_call_function);
+ for (i = 0; i < NR_CPUS; i++) {
+ if (cpu_online(i) && ((1UL << cpu) && mask))
+ smp_ext_bitcall(i, ec_call_function);
+ }
/* Wait for response */
- while (atomic_read(&data.started) != cpus)
+ while (atomic_read(&data.started) != num_cpus)
barrier();
if (wait)
- while (atomic_read(&data.finished) != cpus)
+ while (atomic_read(&data.finished) != num_cpus)
barrier();
spin_unlock(&call_lock);
-
+ put_cpu_no_resched();
return 0;
+}
+
+int smp_call_function (void (*func) (void *info), void *info, int nonatomic, int wait)
+{
+ return smp_call_function_on_cpu(func, info, wait, cpu_online_map);
}
static inline void do_send_stop(void)
next reply other threads:[~2003-02-14 9:29 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-02-14 9:35 Zwane Mwaikambo [this message]
2003-02-14 12:48 ` [PATCH][2.5][8/14] smp_call_function_on_cpu - s390 Zwane Mwaikambo
2003-02-14 22:30 Ulrich Weigand
2003-02-15 2:18 ` Zwane Mwaikambo
2003-02-15 14:29 ` Zwane Mwaikambo
2003-02-15 15:31 ` Ulrich Weigand
2003-02-15 15:38 ` Zwane Mwaikambo
2003-02-15 16:04 ` Ulrich Weigand
2003-02-15 16:56 ` Zwane Mwaikambo
2003-02-15 18:04 ` Ulrich Weigand
2003-02-15 19:01 ` Zwane Mwaikambo
2003-02-15 22:07 ` Ulrich Weigand
2003-02-15 22:39 ` Zwane Mwaikambo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.LNX.4.50.0302140405170.3518-100000@montezuma.mastecende.com \
--to=zwane@zwane.ca \
--cc=linux-kernel@vger.kernel.org \
--cc=schwidefsky@de.ibm.com \
--cc=torvalds@transmeta.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).