提交 048c8bc9 编写于 作者: H Hugh Dickins 提交者: Paul Mackerras

[POWERPC] ppc64: support CONFIG_DEBUG_PREEMPT

Add CONFIG_DEBUG_PREEMPT support to ppc64: it was useful for testing
get_paca() preemption.  Cheat a little, just use debug_smp_processor_id()
in the debug version of get_paca(): it contains all the right checks and
reporting, though get_paca() doesn't really use smp_processor_id().

Use local_paca for what might have been called __raw_get_paca().
Silence harmless warnings from io.h and lparcfg.c with local_paca -
it is okay for iseries_lparcfg_data to be referencing shared_proc
with preemption enabled: all cpus should show the same value for
shared_proc.

Why do other architectures need TRACE_IRQFLAGS_SUPPORT for DEBUG_PREEMPT?
I don't know, ppc64 appears to get along fine without it.
Signed-off-by: NHugh Dickins <hugh@veritas.com>
Signed-off-by: NPaul Mackerras <paulus@samba.org>
上级 5669c3cf
...@@ -77,7 +77,7 @@ static int iseries_lparcfg_data(struct seq_file *m, void *v) ...@@ -77,7 +77,7 @@ static int iseries_lparcfg_data(struct seq_file *m, void *v)
int processors, max_processors; int processors, max_processors;
unsigned long purr = get_purr(); unsigned long purr = get_purr();
shared = (int)(get_lppaca()->shared_proc); shared = (int)(local_paca->lppaca_ptr->shared_proc);
seq_printf(m, "system_active_processors=%d\n", seq_printf(m, "system_active_processors=%d\n",
(int)HvLpConfig_getSystemPhysicalProcessors()); (int)HvLpConfig_getSystemPhysicalProcessors());
......
...@@ -86,7 +86,7 @@ extern unsigned long pci_dram_offset; ...@@ -86,7 +86,7 @@ extern unsigned long pci_dram_offset;
*/ */
#ifdef CONFIG_PPC64 #ifdef CONFIG_PPC64
#define IO_SET_SYNC_FLAG() do { get_paca()->io_sync = 1; } while(0) #define IO_SET_SYNC_FLAG() do { local_paca->io_sync = 1; } while(0)
#else #else
#define IO_SET_SYNC_FLAG() #define IO_SET_SYNC_FLAG()
#endif #endif
......
...@@ -21,7 +21,18 @@ ...@@ -21,7 +21,18 @@
#include <asm/mmu.h> #include <asm/mmu.h>
register struct paca_struct *local_paca asm("r13"); register struct paca_struct *local_paca asm("r13");
#if defined(CONFIG_DEBUG_PREEMPT) && defined(CONFIG_SMP)
extern unsigned int debug_smp_processor_id(void); /* from linux/smp.h */
/*
* Add standard checks that preemption cannot occur when using get_paca():
* otherwise the paca_struct it points to may be the wrong one just after.
*/
#define get_paca() ((void) debug_smp_processor_id(), local_paca)
#else
#define get_paca() local_paca #define get_paca() local_paca
#endif
#define get_lppaca() (get_paca()->lppaca_ptr) #define get_lppaca() (get_paca()->lppaca_ptr)
#define get_slb_shadow() (get_paca()->slb_shadow_ptr) #define get_slb_shadow() (get_paca()->slb_shadow_ptr)
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
/* var is in discarded region: offset to particular copy we want */ /* var is in discarded region: offset to particular copy we want */
#define per_cpu(var, cpu) (*RELOC_HIDE(&per_cpu__##var, __per_cpu_offset(cpu))) #define per_cpu(var, cpu) (*RELOC_HIDE(&per_cpu__##var, __per_cpu_offset(cpu)))
#define __get_cpu_var(var) (*RELOC_HIDE(&per_cpu__##var, __my_cpu_offset())) #define __get_cpu_var(var) (*RELOC_HIDE(&per_cpu__##var, __my_cpu_offset()))
#define __raw_get_cpu_var(var) (*RELOC_HIDE(&per_cpu__##var, __my_cpu_offset())) #define __raw_get_cpu_var(var) (*RELOC_HIDE(&per_cpu__##var, local_paca->data_offset))
/* A macro to avoid #include hell... */ /* A macro to avoid #include hell... */
#define percpu_modcopy(pcpudst, src, size) \ #define percpu_modcopy(pcpudst, src, size) \
......
...@@ -45,7 +45,7 @@ void generic_mach_cpu_die(void); ...@@ -45,7 +45,7 @@ void generic_mach_cpu_die(void);
#endif #endif
#ifdef CONFIG_PPC64 #ifdef CONFIG_PPC64
#define raw_smp_processor_id() (get_paca()->paca_index) #define raw_smp_processor_id() (local_paca->paca_index)
#define hard_smp_processor_id() (get_paca()->hw_cpu_id) #define hard_smp_processor_id() (get_paca()->hw_cpu_id)
#else #else
/* 32-bit */ /* 32-bit */
......
...@@ -167,7 +167,7 @@ config SLUB_DEBUG_ON ...@@ -167,7 +167,7 @@ config SLUB_DEBUG_ON
config DEBUG_PREEMPT config DEBUG_PREEMPT
bool "Debug preemptible kernel" bool "Debug preemptible kernel"
depends on DEBUG_KERNEL && PREEMPT && TRACE_IRQFLAGS_SUPPORT depends on DEBUG_KERNEL && PREEMPT && (TRACE_IRQFLAGS_SUPPORT || PPC64)
default y default y
help help
If you say Y here then the kernel will use a debug variant of the If you say Y here then the kernel will use a debug variant of the
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册