From: Ingo Molnar Add TRACE_IRQFLAGS_SUPPORT method for architectures to signal whether they have irq-flags tracing infrastructure. Signed-off-by: Ingo Molnar Signed-off-by: Andrew Morton --- arch/i386/Kconfig.debug | 4 ++++ arch/x86_64/Kconfig.debug | 4 ++++ include/linux/trace_irqflags.h | 30 +++++++++++++++--------------- lib/Kconfig.debug | 3 +++ 4 files changed, 26 insertions(+), 15 deletions(-) diff -puN arch/i386/Kconfig.debug~lock-validator-irqtrace-support-non-x86-architectures arch/i386/Kconfig.debug --- devel/arch/i386/Kconfig.debug~lock-validator-irqtrace-support-non-x86-architectures 2006-06-09 15:18:44.000000000 -0700 +++ devel-akpm/arch/i386/Kconfig.debug 2006-06-09 15:18:44.000000000 -0700 @@ -1,5 +1,9 @@ menu "Kernel hacking" +config TRACE_IRQFLAGS_SUPPORT + bool + default y + source "lib/Kconfig.debug" config EARLY_PRINTK diff -puN arch/x86_64/Kconfig.debug~lock-validator-irqtrace-support-non-x86-architectures arch/x86_64/Kconfig.debug --- devel/arch/x86_64/Kconfig.debug~lock-validator-irqtrace-support-non-x86-architectures 2006-06-09 15:18:44.000000000 -0700 +++ devel-akpm/arch/x86_64/Kconfig.debug 2006-06-09 15:18:44.000000000 -0700 @@ -1,5 +1,9 @@ menu "Kernel hacking" +config TRACE_IRQFLAGS_SUPPORT + bool + default y + source "lib/Kconfig.debug" config DEBUG_RODATA diff -puN include/linux/trace_irqflags.h~lock-validator-irqtrace-support-non-x86-architectures include/linux/trace_irqflags.h --- devel/include/linux/trace_irqflags.h~lock-validator-irqtrace-support-non-x86-architectures 2006-06-09 15:18:44.000000000 -0700 +++ devel-akpm/include/linux/trace_irqflags.h 2006-06-09 15:18:44.000000000 -0700 @@ -11,12 +11,6 @@ #ifndef _LINUX_TRACE_IRQFLAGS_H #define _LINUX_TRACE_IRQFLAGS_H -#include - -/* - * The local_irq_*() APIs are equal to the raw_local_irq*() - * if !TRACE_IRQFLAGS. - */ #ifdef CONFIG_TRACE_IRQFLAGS extern void trace_hardirqs_on(void); extern void trace_hardirqs_off(void); @@ -31,7 +25,6 @@ # define trace_softirq_enter() do { current->softirq_context++; } while (0) # define trace_softirq_exit() do { current->softirq_context--; } while (0) # define INIT_TRACE_IRQFLAGS .softirqs_enabled = 1, - #else # define trace_hardirqs_on() do { } while (0) # define trace_hardirqs_off() do { } while (0) @@ -48,7 +41,10 @@ # define INIT_TRACE_IRQFLAGS #endif -#ifdef CONFIG_X86 +#ifdef CONFIG_TRACE_IRQFLAGS_SUPPORT + +#include + #define local_irq_enable() \ do { trace_hardirqs_on(); raw_local_irq_enable(); } while (0) #define local_irq_disable() \ @@ -66,12 +62,16 @@ raw_local_irq_restore(flags); \ } \ } while (0) -#else -#define raw_local_irq_disable() local_irq_disable() -#define raw_local_irq_enable() local_irq_enable() -#define raw_local_irq_save(flags) local_irq_save(flags) -#define raw_local_irq_restore(flags) local_irq_restore(flags) -#endif /* CONFIG_X86 */ +#else /* !CONFIG_TRACE_IRQFLAGS_SUPPORT */ +/* + * The local_irq_*() APIs are equal to the raw_local_irq*() + * if !TRACE_IRQFLAGS. + */ +# define raw_local_irq_disable() local_irq_disable() +# define raw_local_irq_enable() local_irq_enable() +# define raw_local_irq_save(flags) local_irq_save(flags) +# define raw_local_irq_restore(flags) local_irq_restore(flags) +#endif /* CONFIG_TRACE_IRQFLAGS_SUPPORT */ /* * On lockdep we dont want to enable hardirqs in hardirq @@ -86,7 +86,7 @@ # define local_irq_enable_in_hardirq() local_irq_enable() #endif -#ifdef CONFIG_X86 +#ifdef CONFIG_TRACE_IRQFLAGS_SUPPORT #define safe_halt() \ do { \ trace_hardirqs_on(); \ diff -puN lib/Kconfig.debug~lock-validator-irqtrace-support-non-x86-architectures lib/Kconfig.debug --- devel/lib/Kconfig.debug~lock-validator-irqtrace-support-non-x86-architectures 2006-06-09 15:18:44.000000000 -0700 +++ devel-akpm/lib/Kconfig.debug 2006-06-09 15:18:44.000000000 -0700 @@ -109,6 +109,7 @@ config DEBUG_PREEMPT bool "Debug preemptible kernel" depends on DEBUG_KERNEL && PREEMPT default y + depends on TRACE_IRQFLAGS_SUPPORT help If you say Y here then the kernel will use a debug variant of the commonly used smp_processor_id() function and will print warnings @@ -336,6 +337,7 @@ config DEBUG_LOCKDEP bool "Lock dependency engine debugging" depends on LOCKDEP default y + depends on TRACE_IRQFLAGS_SUPPORT help If you say Y here, the lock dependency engine will do additional runtime checks to debug itself, at the price @@ -344,6 +346,7 @@ config DEBUG_LOCKDEP config TRACE_IRQFLAGS bool default y + depends on TRACE_IRQFLAGS_SUPPORT depends on PROVE_SPIN_LOCKING || PROVE_RW_LOCKING config DEBUG_SPINLOCK_SLEEP _