Skip to content

Commit

Permalink
percpu: fix DEBUG_PREEMPT per_cpu checking
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Mike Travis <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Hugh Dickins authored and Linus Torvalds committed Feb 23, 2008
1 parent 3a2d5b7 commit 1e83527
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions include/asm-generic/percpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ extern unsigned long __per_cpu_offset[NR_CPUS];
*/
#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
Expand Down
2 changes: 1 addition & 1 deletion include/asm-powerpc/percpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down

0 comments on commit 1e83527

Please sign in to comment.