lkml.org 
[lkml]   [2003]   [Feb]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
SubjectRe: [PATCH][2.5] fix preempt-issues with smp_call_function()
Date
Dave Jones <davej@codemonkey.org.uk> wrote:
> btw, (unrelated) shouldn't smp_call_function be doing magick checks
> with cpu_online() ?

Andrew Morton wrote:
> Looks OK? It sprays the IPI out to all the other CPUs in cpu_online_map,
> and waits for num_online_cpus()-1 CPUs to answer.
>
> All very racy in the presence of CPUs going offline, but that's all over
> the place. Depends how the offlining will be done I guess.

Well, now I see the check for num_online_cpus() != 1 in smp_call_function(),
too, so the check in on_each_cpu() is not needed and possibly better this
patch should apply to the include/linux/smp.h file...

Thomas

--- linux-2.5.63/include/linux/smp.h.orig Mon Feb 24 20:05:33 2003
+++ linux-2.5.63/include/linux/smp.h Wed Feb 26 11:41:45 2003
@@ -10,9 +10,10 @@

#ifdef CONFIG_SMP

+#include <linux/preempt.h>
#include <linux/kernel.h>
#include <linux/compiler.h>
-#include <linux/threads.h>
+#include <linux/thread_info.h>
#include <asm/smp.h>
#include <asm/bug.h>

@@ -54,6 +55,24 @@
int retry, int wait);

/*
+ * Call a function on all processors
+ */
+static inline int on_each_cpu(void (*func) (void *info), void *info,
+ int retry, int wait)
+{
+ int ret;
+
+ preempt_disable();
+
+ ret = smp_call_function(func, info, retry, wait);
+ func(info);
+
+ preempt_enable();
+
+ return ret;
+}
+
+/*
* True once the per process idle is forked
*/
extern int smp_threads_ready;
@@ -96,6 +115,7 @@
#define hard_smp_processor_id() 0
#define smp_threads_ready 1
#define smp_call_function(func,info,retry,wait) ({ 0; })
+#define on_each_cpu(func,info,retry,wait) ({ func(info); 0; })
static inline void smp_send_reschedule(int cpu) { }
static inline void smp_send_reschedule_all(void) { }
#define cpu_online_map 1[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2005-03-22 13:33    [W:0.257 / U:1.236 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site