* [patch, -rc5-mm1] lock validator: introduce irq_[disable/enable]_lockdep()
@ 2006-05-31 19:59 Ingo Molnar
2006-05-31 20:01 ` Ingo Molnar
0 siblings, 1 reply; 2+ messages in thread
From: Ingo Molnar @ 2006-05-31 19:59 UTC (permalink / raw)
To: Andrew Morton; +Cc: Arjan van de Ven, linux-kernel
Subject: lock validator: introduce irq_[disable/enable]_lockdep()
From: Ingo Molnar <mingo@elte.hu>
Special lockdep variants of irq line disabling/enabling.
These should be used for locking constructs that
know that a particular irq context which is disabled,
and which is the only irq-context user of a lock,
that it's safe to take the lock in the irq-disabled
section without disabling hardirqs.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
include/linux/interrupt.h | 35 +++++++++++++++++++++++++++++++++++
1 file changed, 35 insertions(+)
Index: linux/include/linux/interrupt.h
===================================================================
--- linux.orig/include/linux/interrupt.h
+++ linux/include/linux/interrupt.h
@@ -53,6 +53,41 @@ static inline int disable_irq_wake(unsig
#endif
+/*
+ * Special lockdep variants of irq disabling/enabling.
+ * These should be used for locking constructs that
+ * know that a particular irq context which is disabled,
+ * and which is the only irq-context user of a lock,
+ * that it's safe to take the lock in the irq-disabled
+ * section without disabling hardirqs.
+ *
+ * On !CONFIG_LOCKDEP they are equivalent to the normal
+ * irq disable/enable methods.
+ */
+static void disable_irq_nosync_lockdep(unsigned int irq)
+{
+ disable_irq_nosync(irq);
+#ifdef CONFIG_LOCKDEP
+ local_irq_disable();
+#endif
+}
+
+static void disable_irq_lockdep(unsigned int irq)
+{
+ disable_irq(irq);
+#ifdef CONFIG_LOCKDEP
+ local_irq_disable();
+#endif
+}
+
+static void enable_irq_lockdep(unsigned int irq)
+{
+#ifdef CONFIG_LOCKDEP
+ local_irq_enable();
+#endif
+ enable_irq(irq);
+}
+
#ifndef __ARCH_SET_SOFTIRQ_PENDING
#define set_softirq_pending(x) (local_softirq_pending() = (x))
#define or_softirq_pending(x) (local_softirq_pending() |= (x))
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [patch, -rc5-mm1] lock validator: introduce irq_[disable/enable]_lockdep()
2006-05-31 19:59 [patch, -rc5-mm1] lock validator: introduce irq_[disable/enable]_lockdep() Ingo Molnar
@ 2006-05-31 20:01 ` Ingo Molnar
0 siblings, 0 replies; 2+ messages in thread
From: Ingo Molnar @ 2006-05-31 20:01 UTC (permalink / raw)
To: Andrew Morton; +Cc: Arjan van de Ven, linux-kernel
doh - wrong patch version. Correct one below:
----------------
Subject: lock validator: introduce irq_[disable/enable]_lockdep()
From: Ingo Molnar <mingo@elte.hu>
Special lockdep variants of irq line disabling/enabling.
These should be used for locking constructs that
know that a particular irq context which is disabled,
and which is the only irq-context user of a lock,
that it's safe to take the lock in the irq-disabled
section without disabling hardirqs.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
include/linux/interrupt.h | 35 +++++++++++++++++++++++++++++++++++
1 file changed, 35 insertions(+)
Index: linux/include/linux/interrupt.h
===================================================================
--- linux.orig/include/linux/interrupt.h
+++ linux/include/linux/interrupt.h
@@ -53,6 +53,41 @@ static inline int disable_irq_wake(unsig
#endif
+/*
+ * Special lockdep variants of irq disabling/enabling.
+ * These should be used for locking constructs that
+ * know that a particular irq context which is disabled,
+ * and which is the only irq-context user of a lock,
+ * that it's safe to take the lock in the irq-disabled
+ * section without disabling hardirqs.
+ *
+ * On !CONFIG_LOCKDEP they are equivalent to the normal
+ * irq disable/enable methods.
+ */
+static inline void disable_irq_nosync_lockdep(unsigned int irq)
+{
+ disable_irq_nosync(irq);
+#ifdef CONFIG_LOCKDEP
+ local_irq_disable();
+#endif
+}
+
+static inline void disable_irq_lockdep(unsigned int irq)
+{
+ disable_irq(irq);
+#ifdef CONFIG_LOCKDEP
+ local_irq_disable();
+#endif
+}
+
+static inline void enable_irq_lockdep(unsigned int irq)
+{
+#ifdef CONFIG_LOCKDEP
+ local_irq_enable();
+#endif
+ enable_irq(irq);
+}
+
#ifndef __ARCH_SET_SOFTIRQ_PENDING
#define set_softirq_pending(x) (local_softirq_pending() = (x))
#define or_softirq_pending(x) (local_softirq_pending() |= (x))
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2006-05-31 20:01 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-05-31 19:59 [patch, -rc5-mm1] lock validator: introduce irq_[disable/enable]_lockdep() Ingo Molnar
2006-05-31 20:01 ` Ingo Molnar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox