[patch] lock validator: clean up IRQ entry/exit

From: Ingo Molnar
Date: Thu Jun 22 2006 - 04:19:02 EST


Subject: lock validator: clean up IRQ entry/exit
From: Ingo Molnar <mingo@xxxxxxx>

preparation for the resurrection of handling NMIs under the lock
validator:

- introduce __irq_exit() as a no-softirqs variant of IRQ exit
- make NMI exit use __irq_exit()
- make the locking API self-tests use irq_enter/__irq_exit.

Signed-off-by: Ingo Molnar <mingo@xxxxxxx>
---
include/linux/hardirq.h | 23 ++++++++++++++++-------
lib/locking-selftest.c | 4 ++--
2 files changed, 18 insertions(+), 9 deletions(-)

Index: linux/include/linux/hardirq.h
===================================================================
--- linux.orig/include/linux/hardirq.h
+++ linux/include/linux/hardirq.h
@@ -86,13 +86,6 @@ extern void synchronize_irq(unsigned int
# define synchronize_irq(irq) barrier()
#endif

-#define nmi_enter() irq_enter()
-#define nmi_exit() \
- do { \
- sub_preempt_count(HARDIRQ_OFFSET); \
- trace_hardirq_exit(); \
- } while (0)
-
struct task_struct;

#ifndef CONFIG_VIRT_CPU_ACCOUNTING
@@ -114,6 +107,22 @@ static inline void account_system_vtime(
trace_hardirq_enter(); \
} while (0)

+/*
+ * Exit irq context without processing softirqs:
+ */
+#define __irq_exit() \
+ do { \
+ trace_hardirq_exit(); \
+ account_system_vtime(current); \
+ sub_preempt_count(HARDIRQ_OFFSET); \
+ } while (0)
+
+/*
+ * Exit irq context and process softirqs if needed:
+ */
extern void irq_exit(void);

+#define nmi_enter() irq_enter()
+#define nmi_exit() __irq_exit()
+
#endif /* LINUX_HARDIRQ_H */
Index: linux/lib/locking-selftest.c
===================================================================
--- linux.orig/lib/locking-selftest.c
+++ linux/lib/locking-selftest.c
@@ -144,11 +144,11 @@ static void init_shared_types(void)

#define HARDIRQ_ENTER() \
local_irq_disable(); \
- nmi_enter(); \
+ irq_enter(); \
WARN_ON(!in_irq());

#define HARDIRQ_EXIT() \
- nmi_exit(); \
+ __irq_exit(); \
local_irq_enable();

#define SOFTIRQ_DISABLE local_bh_disable
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/