linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] percpu: fix DEBUG_PREEMPT per_cpu checking
@ 2008-02-08 18:23 Hugh Dickins
  2008-02-11 19:37 ` Mike Travis
  0 siblings, 1 reply; 5+ messages in thread
From: Hugh Dickins @ 2008-02-08 18:23 UTC (permalink / raw)
  To: Mike Travis
  Cc: Paul Mackerras, Ingo Molnar, David Miller, Martin Schwidefsky,
	linux-kernel

Recent percpu changes have broken CONFIG_DEBUG_PREEMPT's per_cpu checking
on several architectures.  On s390, sparc64 and x86 it's been weakened to
not checking at all; whereas on powerpc64 it's become too strict, issuing
warnings from __raw_get_cpu_var in io_schedule and init_timer for example.

Fix this by weakening powerpc's __my_cpu_offset to use the non-checking
local_paca instead of get_paca (which itself contains such a check);
and strengthening the generic my_cpu_offset to go the old slow way via
smp_processor_id when CONFIG_DEBUG_PREEMPT (debug_smp_processor_id is
where all the knowledge of what's correct when lives).

Signed-off-by: Hugh Dickins <hugh@veritas.com>
---
ia64 would be in the first group too, but does not support DEBUG_PREEMPT?

 include/asm-generic/percpu.h |    2 ++
 include/asm-powerpc/percpu.h |    2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

--- 2.6.24-git18/include/asm-generic/percpu.h	2008-02-08 11:31:30.000000000 +0000
+++ linux/include/asm-generic/percpu.h	2008-02-08 12:27:08.000000000 +0000
@@ -32,6 +32,8 @@ extern unsigned long __per_cpu_offset[NR
  */
 #ifndef __my_cpu_offset
 #define __my_cpu_offset per_cpu_offset(raw_smp_processor_id())
+#endif
+#ifdef CONFIG_DEBUG_PREEMPT
 #define my_cpu_offset per_cpu_offset(smp_processor_id())
 #else
 #define my_cpu_offset __my_cpu_offset
--- 2.6.24-git18/include/asm-powerpc/percpu.h	2008-02-08 11:31:31.000000000 +0000
+++ linux/include/asm-powerpc/percpu.h	2008-02-08 12:29:17.000000000 +0000
@@ -13,7 +13,7 @@
 #include <asm/paca.h>
 
 #define __per_cpu_offset(cpu) (paca[cpu].data_offset)
-#define __my_cpu_offset get_paca()->data_offset
+#define __my_cpu_offset local_paca->data_offset
 #define per_cpu_offset(x) (__per_cpu_offset(x))
 
 #endif /* CONFIG_SMP */

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

* Re: [PATCH] percpu: fix DEBUG_PREEMPT per_cpu checking
  2008-02-08 18:23 [PATCH] percpu: fix DEBUG_PREEMPT per_cpu checking Hugh Dickins
@ 2008-02-11 19:37 ` Mike Travis
  0 siblings, 0 replies; 5+ messages in thread
From: Mike Travis @ 2008-02-11 19:37 UTC (permalink / raw)
  To: Hugh Dickins
  Cc: Paul Mackerras, Ingo Molnar, David Miller, Martin Schwidefsky,
	linux-kernel

Thanks Hugh for catching this.  I've added it to my test code base
and it works fine for x86_64...

Reviewed-by: Mike Travis <travis@sgi.com>

Hugh Dickins wrote:
> Recent percpu changes have broken CONFIG_DEBUG_PREEMPT's per_cpu checking
> on several architectures.  On s390, sparc64 and x86 it's been weakened to
> not checking at all; whereas on powerpc64 it's become too strict, issuing
> warnings from __raw_get_cpu_var in io_schedule and init_timer for example.
> 
> Fix this by weakening powerpc's __my_cpu_offset to use the non-checking
> local_paca instead of get_paca (which itself contains such a check);
> and strengthening the generic my_cpu_offset to go the old slow way via
> smp_processor_id when CONFIG_DEBUG_PREEMPT (debug_smp_processor_id is
> where all the knowledge of what's correct when lives).
> 
> Signed-off-by: Hugh Dickins <hugh@veritas.com>
> ---
> ia64 would be in the first group too, but does not support DEBUG_PREEMPT?
> 
>  include/asm-generic/percpu.h |    2 ++
>  include/asm-powerpc/percpu.h |    2 +-
>  2 files changed, 3 insertions(+), 1 deletion(-)
> 
> --- 2.6.24-git18/include/asm-generic/percpu.h	2008-02-08 11:31:30.000000000 +0000
> +++ linux/include/asm-generic/percpu.h	2008-02-08 12:27:08.000000000 +0000
> @@ -32,6 +32,8 @@ extern unsigned long __per_cpu_offset[NR
>   */
>  #ifndef __my_cpu_offset
>  #define __my_cpu_offset per_cpu_offset(raw_smp_processor_id())
> +#endif
> +#ifdef CONFIG_DEBUG_PREEMPT
>  #define my_cpu_offset per_cpu_offset(smp_processor_id())
>  #else
>  #define my_cpu_offset __my_cpu_offset
> --- 2.6.24-git18/include/asm-powerpc/percpu.h	2008-02-08 11:31:31.000000000 +0000
> +++ linux/include/asm-powerpc/percpu.h	2008-02-08 12:29:17.000000000 +0000
> @@ -13,7 +13,7 @@
>  #include <asm/paca.h>
>  
>  #define __per_cpu_offset(cpu) (paca[cpu].data_offset)
> -#define __my_cpu_offset get_paca()->data_offset
> +#define __my_cpu_offset local_paca->data_offset
>  #define per_cpu_offset(x) (__per_cpu_offset(x))
>  
>  #endif /* CONFIG_SMP */


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

* Re: [PATCH] percpu: fix DEBUG_PREEMPT per_cpu checking
  2008-02-23 20:06 ` Andrew Morton
@ 2008-02-23 20:09   ` Linus Torvalds
  0 siblings, 0 replies; 5+ messages in thread
From: Linus Torvalds @ 2008-02-23 20:09 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Hugh Dickins, Mike Travis, Paul Mackerras, Ingo Molnar,
	David Miller, Martin Schwidefsky, linux-kernel



On Sat, 23 Feb 2008, Andrew Morton wrote:
> 
> Hopefully Linus will apply the patch from Hugh's email, but that isn't the
> general solution to this increasingly worse problem.

Done.

		Linus

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

* Re: [PATCH] percpu: fix DEBUG_PREEMPT per_cpu checking
  2008-02-23 19:40 Hugh Dickins
@ 2008-02-23 20:06 ` Andrew Morton
  2008-02-23 20:09   ` Linus Torvalds
  0 siblings, 1 reply; 5+ messages in thread
From: Andrew Morton @ 2008-02-23 20:06 UTC (permalink / raw)
  To: Hugh Dickins
  Cc: Linus Torvalds, Mike Travis, Paul Mackerras, Ingo Molnar,
	David Miller, Martin Schwidefsky, linux-kernel

On Sat, 23 Feb 2008 19:40:17 +0000 (GMT) Hugh Dickins <hugh@veritas.com> wrote:

> 2.6.25-rc1 percpu changes broke CONFIG_DEBUG_PREEMPT's per_cpu checking
> on several architectures.  On s390, sparc64 and x86 it's been weakened to
> not checking at all; whereas on powerpc64 it's become too strict, issuing
> warnings from __raw_get_cpu_var in io_schedule and init_timer for example.
> 
> Fix this by weakening powerpc's __my_cpu_offset to use the non-checking
> local_paca instead of get_paca (which itself contains such a check);
> and strengthening the generic my_cpu_offset to go the old slow way via
> smp_processor_id when CONFIG_DEBUG_PREEMPT (debug_smp_processor_id is
> where all the knowledge of what's correct when lives).
> 
> Signed-off-by: Hugh Dickins <hugh@veritas.com>
> Reviewed-by: Mike Travis <travis@sgi.com>
> ---
> I posted this a couple of weeks ago, but it seems we all expected
> someone else to forward it to you.

I merged it, but for non-critical fixes I'll tend to sit on them for a week
or so before sending them in to Linus.

This patch has now turned up in git-sched which is a considerable
inconvenience.

Ingo, please don't just merge everything which crosses your desk.  I'm now
in the position that I either drop the patch and completely lose track of
it or I need to apply then revert it to make your tree apply.

Hopefully Linus will apply the patch from Hugh's email, but that isn't the
general solution to this increasingly worse problem.


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

* [PATCH] percpu: fix DEBUG_PREEMPT per_cpu checking
@ 2008-02-23 19:40 Hugh Dickins
  2008-02-23 20:06 ` Andrew Morton
  0 siblings, 1 reply; 5+ messages in thread
From: Hugh Dickins @ 2008-02-23 19:40 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Mike Travis, Paul Mackerras, Ingo Molnar, David Miller,
	Martin Schwidefsky, Andrew Morton, linux-kernel

2.6.25-rc1 percpu changes broke CONFIG_DEBUG_PREEMPT's per_cpu checking
on several architectures.  On s390, sparc64 and x86 it's been weakened to
not checking at all; whereas on powerpc64 it's become too strict, issuing
warnings from __raw_get_cpu_var in io_schedule and init_timer for example.

Fix this by weakening powerpc's __my_cpu_offset to use the non-checking
local_paca instead of get_paca (which itself contains such a check);
and strengthening the generic my_cpu_offset to go the old slow way via
smp_processor_id when CONFIG_DEBUG_PREEMPT (debug_smp_processor_id is
where all the knowledge of what's correct when lives).

Signed-off-by: Hugh Dickins <hugh@veritas.com>
Reviewed-by: Mike Travis <travis@sgi.com>
---
I posted this a couple of weeks ago, but it seems we all expected
someone else to forward it to you.

 include/asm-generic/percpu.h |    2 ++
 include/asm-powerpc/percpu.h |    2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

--- 2.6.25-rc2-git/include/asm-generic/percpu.h	2008-02-08 11:31:30.000000000 +0000
+++ linux/include/asm-generic/percpu.h	2008-02-08 12:27:08.000000000 +0000
@@ -32,6 +32,8 @@ extern unsigned long __per_cpu_offset[NR
  */
 #ifndef __my_cpu_offset
 #define __my_cpu_offset per_cpu_offset(raw_smp_processor_id())
+#endif
+#ifdef CONFIG_DEBUG_PREEMPT
 #define my_cpu_offset per_cpu_offset(smp_processor_id())
 #else
 #define my_cpu_offset __my_cpu_offset
--- 2.6.25-rc2-git/include/asm-powerpc/percpu.h	2008-02-08 11:31:31.000000000 +0000
+++ linux/include/asm-powerpc/percpu.h	2008-02-08 12:29:17.000000000 +0000
@@ -13,7 +13,7 @@
 #include <asm/paca.h>
 
 #define __per_cpu_offset(cpu) (paca[cpu].data_offset)
-#define __my_cpu_offset get_paca()->data_offset
+#define __my_cpu_offset local_paca->data_offset
 #define per_cpu_offset(x) (__per_cpu_offset(x))
 
 #endif /* CONFIG_SMP */

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

end of thread, other threads:[~2008-02-23 20:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-08 18:23 [PATCH] percpu: fix DEBUG_PREEMPT per_cpu checking Hugh Dickins
2008-02-11 19:37 ` Mike Travis
2008-02-23 19:40 Hugh Dickins
2008-02-23 20:06 ` Andrew Morton
2008-02-23 20:09   ` Linus Torvalds

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).