public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Thomas Schlichter <schlicht@uni-mannheim.de>
To: Andrew Morton <akpm@digeo.com>, Dave Jones <davej@codemonkey.org.uk>
Cc: torvalds@transmeta.com, hugh@veritas.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH][2.5] fix preempt-issues with smp_call_function()
Date: Wed, 26 Feb 2003 11:52:45 +0100	[thread overview]
Message-ID: <200302261152.51479.schlicht@uni-mannheim.de> (raw)
In-Reply-To: <20030226022819.44e1873a.akpm@digeo.com>

[-- Attachment #1: signed data --]
[-- Type: text/plain, Size: 2002 bytes --]

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

[-- Attachment #2: signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

  reply	other threads:[~2003-02-26 10:42 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-02-25 18:08 [PATCH][2.5] fix preempt-issues with smp_call_function() Thomas Schlichter
2003-02-26  9:27 ` Andrew Morton
2003-02-26 10:37 ` Dave Jones
2003-02-26  9:54   ` Andrew Morton
2003-02-26 10:14     ` Thomas Schlichter
2003-02-26 11:19     ` Dave Jones
2003-02-26 10:28       ` Andrew Morton
2003-02-26 10:52         ` Thomas Schlichter [this message]
2003-02-26 11:28         ` Dave Jones
2003-02-26 13:39         ` Alan Cox
2003-02-26 18:47           ` Andrew Morton
2003-02-26 20:11             ` Alan Cox
2003-02-26 16:00         ` Martin J. Bligh
  -- strict thread matches above, loose matches on Subject: below --
2003-02-21 14:20 [PATCH][2.5] replace flush_map() in arch/i386/mm/pageattr.c w ith flush_tlb_all() Dave Jones
2003-02-21 17:36 ` Dave Jones
2003-02-22  3:23   ` [PATCH][2.5] fix preempt-issues with smp_call_function() Thomas Schlichter

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=200302261152.51479.schlicht@uni-mannheim.de \
    --to=schlicht@uni-mannheim.de \
    --cc=akpm@digeo.com \
    --cc=davej@codemonkey.org.uk \
    --cc=hugh@veritas.com \
    --cc=linux-kernel@vger.kernel.org \
    --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