All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH Resend][Trivial] Match on_each_cpu behaviour on UP to SMP
@ 2011-09-08  6:57 Gilad Ben-Yossef
  2011-09-13 19:02 ` Randy Dunlap
  0 siblings, 1 reply; 3+ messages in thread
From: Gilad Ben-Yossef @ 2011-09-08  6:57 UTC (permalink / raw)
  To: linux-kernel; +Cc: Gilad Ben-Yossef, Jiri Kosina

The comment in the SMP implementation of on_each_cpu says:
 "May be used during early boot while
  early_boot_irqs_disabled is set.  Use local_irq_save/restore() instead
  of local_irq_disable/enable()."

but the existing UP macro version uses local_irq_disable/enable().

Do the safe thing - make the UP version match the SMP one.

Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
CC: Jiri Kosina <trivial@kernel.org>
---
 include/linux/smp.h |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/include/linux/smp.h b/include/linux/smp.h
index 8cc38d3..7c9b9d4 100644
--- a/include/linux/smp.h
+++ b/include/linux/smp.h
@@ -127,9 +127,10 @@ static inline int up_smp_call_function(smp_call_func_t func, void *info)
 			(up_smp_call_function(func, info))
 #define on_each_cpu(func,info,wait)		\
 	({					\
-		local_irq_disable();		\
+		unsigned long __flags;		\
+		local_irq_save(__flags);	\
 		func(info);			\
-		local_irq_enable();		\
+		local_irq_retore(__flags);	\
 		0;				\
 	})
 static inline void smp_send_reschedule(int cpu) { }
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH Resend][Trivial] Match on_each_cpu behaviour on UP to SMP
  2011-09-08  6:57 [PATCH Resend][Trivial] Match on_each_cpu behaviour on UP to SMP Gilad Ben-Yossef
@ 2011-09-13 19:02 ` Randy Dunlap
  2011-09-15  7:43   ` Gilad Ben-Yossef
  0 siblings, 1 reply; 3+ messages in thread
From: Randy Dunlap @ 2011-09-13 19:02 UTC (permalink / raw)
  To: Gilad Ben-Yossef; +Cc: linux-kernel, Jiri Kosina

On 09/07/11 23:57, Gilad Ben-Yossef wrote:
> The comment in the SMP implementation of on_each_cpu says:
>  "May be used during early boot while
>   early_boot_irqs_disabled is set.  Use local_irq_save/restore() instead
>   of local_irq_disable/enable()."
> 
> but the existing UP macro version uses local_irq_disable/enable().
> 
> Do the safe thing - make the UP version match the SMP one.
> 
> Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
> CC: Jiri Kosina <trivial@kernel.org>
> ---
>  include/linux/smp.h |    5 +++--
>  1 files changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/include/linux/smp.h b/include/linux/smp.h
> index 8cc38d3..7c9b9d4 100644
> --- a/include/linux/smp.h
> +++ b/include/linux/smp.h
> @@ -127,9 +127,10 @@ static inline int up_smp_call_function(smp_call_func_t func, void *info)
>  			(up_smp_call_function(func, info))
>  #define on_each_cpu(func,info,wait)		\
>  	({					\
> -		local_irq_disable();		\
> +		unsigned long __flags;		\
> +		local_irq_save(__flags);	\
>  		func(info);			\
> -		local_irq_enable();		\
> +		local_irq_retore(__flags);	\

You tested that?          ^^^^^^


>  		0;				\
>  	})
>  static inline void smp_send_reschedule(int cpu) { }


-- 
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH Resend][Trivial] Match on_each_cpu behaviour on UP to SMP
  2011-09-13 19:02 ` Randy Dunlap
@ 2011-09-15  7:43   ` Gilad Ben-Yossef
  0 siblings, 0 replies; 3+ messages in thread
From: Gilad Ben-Yossef @ 2011-09-15  7:43 UTC (permalink / raw)
  To: linux-kernel

On Tuesday, September 13, 2011, Randy Dunlap wrote:

> > +             local_irq_retore(__flags);      \
>
> You tested that?          ^^^^^^

Ouch... that was very very silly of me.  Sorry for the time wasted.

I've just send a fixed patch which I built and booted on a UP x86 machine.

Thanks,
Gilad

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-09-15  7:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-08  6:57 [PATCH Resend][Trivial] Match on_each_cpu behaviour on UP to SMP Gilad Ben-Yossef
2011-09-13 19:02 ` Randy Dunlap
2011-09-15  7:43   ` Gilad Ben-Yossef

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.