|
|
Subscribe / Log in / New account

lock validator: clean up IRQ entry/exit

From:  Ingo Molnar <mingo@elte.hu>
To:  Andrew Morton <akpm@osdl.org>
Subject:  [patch] lock validator: clean up IRQ entry/exit
Date:  Thu, 22 Jun 2006 10:15:10 +0200
Cc:  linux-kernel@vger.kernel.org, Arjan van de Ven <arjan@infradead.org>

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

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@elte.hu>
---
 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


Copyright © 2006, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds