* [PATCH] smp_call_function_single() should be a macro on UP
@ 2007-07-17 21:29 Al Viro
2007-07-17 21:40 ` David Miller
0 siblings, 1 reply; 5+ messages in thread
From: Al Viro @ 2007-07-17 21:29 UTC (permalink / raw)
To: Linus Torvalds; +Cc: linux-kernel, Avi Kivity
... or we end up with header include order problems from hell.
E.g. on m68k this is 100% fatal - local_irq_enable() there
wants preempt_count(), which wants task_struct fields, which
we won't have when we are in smp.h pulled from sched.h.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
diff --git a/include/linux/smp.h b/include/linux/smp.h
index 8039dac..259a13c 100644
--- a/include/linux/smp.h
+++ b/include/linux/smp.h
@@ -7,7 +7,6 @@
*/
#include <linux/errno.h>
-#include <asm/system.h>
extern void cpu_idle(void);
@@ -100,15 +99,14 @@ static inline int up_smp_call_function(void)
static inline void smp_send_reschedule(int cpu) { }
#define num_booting_cpus() 1
#define smp_prepare_boot_cpu() do {} while (0)
-static inline int smp_call_function_single(int cpuid, void (*func) (void *info),
- void *info, int retry, int wait)
-{
- WARN_ON(cpuid != 0);
- local_irq_disable();
- func(info);
- local_irq_enable();
- return 0;
-}
+#define smp_call_function_single(cpuid, func, info, retry, wait) \
+({ \
+ WARN_ON(cpuid != 0); \
+ local_irq_disable(); \
+ (func)(info); \
+ local_irq_enable(); \
+ 0; \
+})
#endif /* !SMP */
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] smp_call_function_single() should be a macro on UP
2007-07-17 21:29 [PATCH] smp_call_function_single() should be a macro on UP Al Viro
@ 2007-07-17 21:40 ` David Miller
2007-07-17 23:54 ` Ben Dooks
0 siblings, 1 reply; 5+ messages in thread
From: David Miller @ 2007-07-17 21:40 UTC (permalink / raw)
To: viro; +Cc: torvalds, linux-kernel, avi
From: Al Viro <viro@ftp.linux.org.uk>
Date: Tue, 17 Jul 2007 22:29:46 +0100
> ... or we end up with header include order problems from hell.
> E.g. on m68k this is 100% fatal - local_irq_enable() there
> wants preempt_count(), which wants task_struct fields, which
> we won't have when we are in smp.h pulled from sched.h.
>
> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Acked-by: David S. Miller <davem@davemloft.net>
I was going to fix the sparc64/UP build fallout by
adding linux/kernel.h include to linux/smp.h but that
definitely would not handle this m68k case at all.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] smp_call_function_single() should be a macro on UP
2007-07-17 21:40 ` David Miller
@ 2007-07-17 23:54 ` Ben Dooks
2007-07-18 0:00 ` Al Viro
2007-07-18 0:07 ` Linus Torvalds
0 siblings, 2 replies; 5+ messages in thread
From: Ben Dooks @ 2007-07-17 23:54 UTC (permalink / raw)
To: David Miller; +Cc: viro, torvalds, linux-kernel, avi
On Tue, Jul 17, 2007 at 02:40:42PM -0700, David Miller wrote:
> From: Al Viro <viro@ftp.linux.org.uk>
> Date: Tue, 17 Jul 2007 22:29:46 +0100
>
> > ... or we end up with header include order problems from hell.
> > E.g. on m68k this is 100% fatal - local_irq_enable() there
> > wants preempt_count(), which wants task_struct fields, which
> > we won't have when we are in smp.h pulled from sched.h.
> >
> > Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
>
> Acked-by: David S. Miller <davem@davemloft.net>
>
> I was going to fix the sparc64/UP build fallout by
> adding linux/kernel.h include to linux/smp.h but that
> definitely would not handle this m68k case at all.
This has broken _all_ ARM builds, due to using WARN_ON()
in this header. Warn on needs <asm/bug.h> and this is
needs <linux/kernel.h> to make it compile cleanly on ARM
which is unfortuantely what we where trying to avoid in
the first place?
This patch fixes the compile on ARM, but moves the
includes out of the CONFIG_SMP block.
diff -urpN -X linux-2.6.22-git9/Documentation/dontdiff linux-2.6.22-git9/include/linux/smp.h linux-2.6.22-git9-fix1/include/linux/smp.h
--- linux-2.6.22-git9/include/linux/smp.h 2007-07-18 00:40:45.000000000 +0100
+++ linux-2.6.22-git9-fix1/include/linux/smp.h 2007-07-18 00:43:24.000000000 +0100
@@ -7,15 +7,17 @@
*/
#include <linux/errno.h>
+#include <linux/kernel.h>
+#include <linux/compiler.h>
+
#include <asm/system.h>
+#include <asm/bug.h>
extern void cpu_idle(void);
#ifdef CONFIG_SMP
#include <linux/preempt.h>
-#include <linux/kernel.h>
-#include <linux/compiler.h>
#include <linux/thread_info.h>
#include <asm/smp.h>
--
Ben (ben@fluff.org, http://www.fluff.org/)
'a smiley only costs 4 bytes'
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] smp_call_function_single() should be a macro on UP
2007-07-17 23:54 ` Ben Dooks
@ 2007-07-18 0:00 ` Al Viro
2007-07-18 0:07 ` Linus Torvalds
1 sibling, 0 replies; 5+ messages in thread
From: Al Viro @ 2007-07-18 0:00 UTC (permalink / raw)
To: Ben Dooks; +Cc: David Miller, torvalds, linux-kernel, avi
On Wed, Jul 18, 2007 at 12:54:17AM +0100, Ben Dooks wrote:
> This has broken _all_ ARM builds, due to using WARN_ON()
> in this header. Warn on needs <asm/bug.h> and this is
> needs <linux/kernel.h> to make it compile cleanly on ARM
> which is unfortuantely what we where trying to avoid in
> the first place?
>
> This patch fixes the compile on ARM, but moves the
> includes out of the CONFIG_SMP block.
Which "this" are you refering to? Original introduction of inline
or switch to a macro on top of it?
FWIW, with "turn to macro" all arm builds I have here pass fine.
Please, check if current Linus' tree (already with that patch)
works for you; I very much object to pulling more includes in
there, that way lies a lot of breakage.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] smp_call_function_single() should be a macro on UP
2007-07-17 23:54 ` Ben Dooks
2007-07-18 0:00 ` Al Viro
@ 2007-07-18 0:07 ` Linus Torvalds
1 sibling, 0 replies; 5+ messages in thread
From: Linus Torvalds @ 2007-07-18 0:07 UTC (permalink / raw)
To: Ben Dooks; +Cc: David Miller, viro, linux-kernel, avi
On Wed, 18 Jul 2007, Ben Dooks wrote:
>
> This has broken _all_ ARM builds, due to using WARN_ON()
> in this header.
I think Al's patch already fixes that, since now it's back to being a
macro, and thus the whole WARN_ON() is only visible where the macro is
_used_, not in the header itself.
Linus
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2007-07-18 0:08 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-17 21:29 [PATCH] smp_call_function_single() should be a macro on UP Al Viro
2007-07-17 21:40 ` David Miller
2007-07-17 23:54 ` Ben Dooks
2007-07-18 0:00 ` Al Viro
2007-07-18 0:07 ` Linus Torvalds
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.