[patch, -rc5-mm1] lock validator, irqtrace: support non-x86 architectures

Ingo Molnar
2006-05-30T10:09:01Z

Subject: lock validator, irqtrace: support non-x86 architectures
From: Ingo Molnar <mingo@elte.hu>

add TRACE_IRQFLAGS_SUPPORT method for architectures to signal
whether they have irq-flags tracing infrastructure.

Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
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(-)

Index: linux/arch/i386/Kconfig.debug
===================================================================
--- linux.orig/arch/i386/Kconfig.debug
+++ linux/arch/i386/Kconfig.debug
@@ -1,5 +1,9 @@
menu "Kernel hacking"

+config TRACE_IRQFLAGS_SUPPORT
+ bool
+ default y
+
source "lib/Kconfig.debug"

config EARLY_PRINTK
Index: linux/arch/x86_64/Kconfig.debug
===================================================================
--- linux.orig/arch/x86_64/Kconfig.debug
+++ linux/arch/x86_64/Kconfig.debug
@@ -1,5 +1,9 @@
menu "Kernel hacking"

+config TRACE_IRQFLAGS_SUPPORT
+ bool
+ default y
+
source "lib/Kconfig.debug"

config DEBUG_RODATA
Index: linux/include/linux/trace_irqflags.h
===================================================================
--- linux.orig/include/linux/trace_irqflags.h
+++ linux/include/linux/trace_irqflags.h
@@ -11,12 +11,6 @@
#ifndef _LINUX_TRACE_IRQFLAGS_H
#define _LINUX_TRACE_IRQFLAGS_H

-#include <asm/irqflags.h>
-
-/*
- * 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 <asm/irqflags.h>
+
#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(); \
Index: linux/lib/Kconfig.debug
===================================================================
--- linux.orig/lib/Kconfig.debug
+++ linux/lib/Kconfig.debug
@@ -123,6 +123,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
@@ -347,6 +348,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
@@ -355,6 +357,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