On Sun, 16 Jun 2013 08:01:44 -1000 Linus Torvalds 
<[email protected]> wrote:

> On Sat, Jun 15, 2013 at 10:36 PM, Geert Uytterhoeven
> <[email protected]> wrote:
> >
> > On Sun, Jun 16, 2013 at 12:12 AM, Linus Torvalds
> > <[email protected]> wrote:
> > > David Daney (3):
> > >       smp.h: Use local_irq_{save,restore}() in !SMP version of 
> > > on_each_cpu().
> >
> > This change (commit f21afc25f9ed45b8ffe200d0f071b0caec3ed2ef, which hasn't
> > been in linux-next), broke at least mn10300 and ia64:
> >
> > include/linux/smp.h:148:2: error: implicit declaration of function 
> > 'local_irq_save' [-Werror=implicit-function-declaration]
> 
> Hmm. DavidD already added the include for <linux/irqflags.h>, I wonder
> why that doesn't end up working. Do we have some silly header file
> circular include that means that we're already half-way through that
> irqflags.h file and thus will skip it the second time we see it, or
> why does it end up being undeclared?

Heaven knows; I don't think now is the time to try to fix this.

If I'd thought for two seconds I wouldn't have sent that patch at this
time - additional low-level includes in low-level header files are
often problematic.

> Anyway, I see a few options:
> 
>  - we could just make it a macro like it used to be (keeping the
> include and assuming that will sort out any circular include mess) and
> use a rare name for the internal "flags" variable (just prepending
> double underscores is the common one we tend to use in situations like
> this)
> 
>  - we could just make it a real function, the way the SMP one is, and
> take the extra call overhead (it's not like this should be all that
> critical in an UP environment).
> 
>  - somebody figures out why the <linux/irqflags.h> include ends up not
> working on nm10300 and ia64..

Methinks we should fight this battle at a later date.  I queued this:

From: Andrew Morton <[email protected]>
Subject: include/linux/smp.h:on_each_cpu(): switch back to a macro

f21afc25f9ed4 ("smp.h: Use local_irq_{save,restore}() in !SMP version of
on_each_cpu()") converted on_each_cpu() to a C function.  This required
inclusion of irqflags.h, which broke ia64 and mn10300 (at least) due to
header ordering hell.

Switch on_each_cpu() back to a macro to fix this.

Reported-by: Geert Uytterhoeven <[email protected]>
Cc: David Daney <[email protected]>
Cc: Ralf Baechle <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
---

 include/linux/smp.h |   20 ++++++++------------
 1 file changed, 8 insertions(+), 12 deletions(-)

diff -puN 
include/linux/smp.h~include-linux-smph-on_each_cpu-switch-back-to-a-macro 
include/linux/smp.h
--- a/include/linux/smp.h~include-linux-smph-on_each_cpu-switch-back-to-a-macro
+++ a/include/linux/smp.h
@@ -11,7 +11,6 @@
 #include <linux/list.h>
 #include <linux/cpumask.h>
 #include <linux/init.h>
-#include <linux/irqflags.h>
 
 extern void cpu_idle(void);
 
@@ -140,17 +139,14 @@ static inline int up_smp_call_function(s
 }
 #define smp_call_function(func, info, wait) \
                        (up_smp_call_function(func, info))
-
-static inline int on_each_cpu(smp_call_func_t func, void *info, int wait)
-{
-       unsigned long flags;
-
-       local_irq_save(flags);
-       func(info);
-       local_irq_restore(flags);
-       return 0;
-}
-
+#define on_each_cpu(func,info,wait)            \
+       ({                                      \
+               unsigned long flags;            \
+               local_irq_save(flags);          \
+               func(info);                     \
+               local_irq_restore(flags);       \
+               0;                              \
+       })
 /*
  * Note we still need to test the mask even for UP
  * because we actually can get an empty mask from
_

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to