From: Ingo Molnar Teach special (recursive) locking code to the lock validator. Has no effect on non-lockdep kernels. Signed-off-by: Ingo Molnar Signed-off-by: Arjan van de Ven Signed-off-by: Andrew Morton --- include/linux/lockdep.h | 6 ++++++ init/main.c | 1 + kernel/irq/handle.c | 16 ++++++++++++++++ 3 files changed, 23 insertions(+) diff -puN include/linux/lockdep.h~lockdep-annotate-genirq include/linux/lockdep.h --- a/include/linux/lockdep.h~lockdep-annotate-genirq +++ a/include/linux/lockdep.h @@ -271,6 +271,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); diff -puN init/main.c~lockdep-annotate-genirq init/main.c --- a/init/main.c~lockdep-annotate-genirq +++ a/init/main.c @@ -492,6 +492,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 diff -puN kernel/irq/handle.c~lockdep-annotate-genirq kernel/irq/handle.c --- a/kernel/irq/handle.c~lockdep-annotate-genirq +++ a/kernel/irq/handle.c @@ -231,3 +231,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 _