powerpc: Add irqtrace support for 32-bit powerpc
PATCH 1/1 powerpc: Add irqtrace support for 32-bit powerpc
Based on initial work from: Dale Farnsworth <[email protected]>
Add the low level irq tracing hooks for 32-bit powerpc needed to enable full lockdep functionality.
The approach taken to deal with the code in entry_32.S is that we don't trace all the transitions of MSR:EE when we just turn it off to peek at TI_FLAGS without races. Only when we are calling into C code or returning from exceptions with a state that have changed from what lockdep thinks.
There's a little bugger though: If we take an exception that keeps interrupts enabled (such as an alignment exception) while interrupts are enabled, we will call trace_hardirqs_on() on the way back spurriously. Not a big deal, but to get rid of it would require remembering in pt_regs that the exception was one of the type that kept interrupts enabled which we don't know at this stage. (Well, we could test all cases for regs->trap but that sucks too much).
---
Not very well tested ... got issues with my u-boot on the 440 board and I didn't have much time to test elsewhere. FSL welcome to test on funky configs. It's likely to still be subtely broken :-)
arch/powerpc/Kconfig | 1 arch/powerpc/include/asm/hw_irq.h | 20 +++--- arch/powerpc/kernel/entry_32.S | 126 ++++++++++++++++++++++++++++++++++++-- arch/powerpc/kernel/setup_32.c | 2 arch/powerpc/kernel/udbg.c | 1 5 files changed, 135 insertions(+), 15 deletions(-)
arch/powerpc/Kconfig +0 -1
@@ -62,7 +62,6 @@ config HAVE_LATENCYTOP_SUPPORT config TRACE_IRQFLAGS_SUPPORT bool - depends on PPC64 default y config LOCKDEP_SUPPORT
arch/powerpc/kernel/entry_32.S +122 -4
208 lines not on this page · raw message
arch/powerpc/kernel/setup_32.c +2 -0
@@ -119,6 +119,8 @@ notrace unsigned long __init early_init(*/ notrace void __init machine_init(unsigned long dt_ptr) { +lockdep_init (); +/* Enable early debugging if any specified (see udbg.h) */ udbg_early_init ();
arch/powerpc/include/asm/hw_irq.h +10 -10
@@ -68,13 +68,13 @@ static inline int irqs_disabled_flags(un#if defined(CONFIG_BOOKE )#define SET_MSR_EE (x) mtmsr(x) -#define local_irq_restore (flags) __asm__ __volatile__("wrtee %0" : : "r" (flags) : "memory") +#define raw_local_irq_restore (flags) __asm__ __volatile__("wrtee %0" : : "r" (flags) : "memory")#else #define SET_MSR_EE (x) mtmsr(x) -#define local_irq_restore (flags) mtmsr(flags) +#define raw_local_irq_restore (flags) mtmsr(flags)#endif -static inline void local_irq_disable (void ) +static inline void raw_local_irq_disable (void ) {#ifdef CONFIG_BOOKE __asm__ __volatile__("wrteei 0" : : :"memory" );
@@ -86,7 +86,7 @@ static inline void local_irq_disable(voi#endif } -static inline void local_irq_enable (void ) +static inline void raw_local_irq_enable (void ) {#ifdef CONFIG_BOOKE __asm__ __volatile__("wrteei 1" : : :"memory" );
@@ -98,7 +98,7 @@ static inline void local_irq_enable(void#endif } -static inline void local_irq_save_ptr (unsigned long *flags) +static inline void raw_local_irq_save_ptr (unsigned long *flags) {unsigned long msr; msr =mfmsr ();
@@ -110,12 +110,12 @@ static inline void local_irq_save_ptr(un#endif } -#define local_save_flags (flags) ((flags) = mfmsr()) -#define local_irq_save (flags) local_irq_save_ptr(&flags) -#define irqs_disabled () ((mfmsr() & MSR_EE) == 0) +#define raw_local_save_flags (flags) ((flags) = mfmsr()) +#define raw_local_irq_save (flags) raw_local_irq_save_ptr(&flags) +#define raw_irqs_disabled () ((mfmsr() & MSR_EE) == 0) +#define raw_irqs_disabled_flags (flags) (((flags) & MSR_EE) == 0) -#define hard_irq_enable () local_irq_enable() -#define hard_irq_disable () local_irq_disable() +#define hard_irq_disable () raw_local_irq_disable()static inline int irqs_disabled_flags (unsigned long flags) {
arch/powerpc/kernel/udbg.c +1 -0
@@ -65,6 +65,7 @@ void __init udbg_early_init(void)#ifdef CONFIG_PPC_EARLY_DEBUG console_loglevel =10 ;#endif +register_early_udbg_console (); }/* udbg library, used by xmon et al */