[PATCH] lockdep: annotate genirq
authorIngo Molnar <mingo@elte.hu>
Mon, 3 Jul 2006 07:25:06 +0000 (00:25 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Mon, 3 Jul 2006 22:27:06 +0000 (15:27 -0700)
Teach special (recursive) locking code to the lock validator.  Has no effect
on non-lockdep kernels.

Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
include/linux/lockdep.h
init/main.c
kernel/irq/handle.c

index 80ec7a4dbc989474ead6b518a490643dbdf9c3cf..316e0fb8d7b1f6533afe0afa5e89057f5afaed63 100644 (file)
@@ -270,6 +270,12 @@ static inline int lockdep_internal(void)
 struct lock_class_key { };
 #endif /* !LOCKDEP */
 
+#if defined(CONFIG_TRACE_IRQFLAGS) && defined(CONFIG_GENERIC_HARDIRQS)
+extern void early_init_irq_lock_class(void);
+#else
+# define early_init_irq_lock_class()           do { } while (0)
+#endif
+
 #ifdef CONFIG_TRACE_IRQFLAGS
 extern void early_boot_irqs_off(void);
 extern void early_boot_irqs_on(void);
index fc473d4b56fdf626ce5ac7681dcd86c4845c9af9..628b8e9e841ae9ed86fedd98cdd850a5af2815f6 100644 (file)
@@ -466,6 +466,7 @@ asmlinkage void __init start_kernel(void)
 
        local_irq_disable();
        early_boot_irqs_off();
+       early_init_irq_lock_class();
 
 /*
  * Interrupts are still disabled. Do necessary setups, then
index aeb6e391276cc78f48f4c7cda119f46a13e4614a..a7b497ee919e2f38039fbcef4a9e4e1b9b37906d 100644 (file)
@@ -249,3 +249,19 @@ out:
        return 1;
 }
 
+#ifdef CONFIG_TRACE_IRQFLAGS
+
+/*
+ * lockdep: we want to handle all irq_desc locks as a single lock-class:
+ */
+static struct lock_class_key irq_desc_lock_class;
+
+void early_init_irq_lock_class(void)
+{
+       int i;
+
+       for (i = 0; i < NR_IRQS; i++)
+               lockdep_set_class(&irq_desc[i].lock, &irq_desc_lock_class);
+}
+
+#endif