From 28c670cb9b0df7c8579f78c9d06e148896378cf4 Mon Sep 17 00:00:00 2001 From: Russell King Date: Sat, 26 May 2007 12:08:29 +0100 Subject: [PATCH] [ARM] oprofile: avoid lockdep warnings on mpcore oprofile init Fix lockdep warnings, caused by 'set_affinity' being called without the correct locks taken and local interrupts disabled: ================================= [ INFO: inconsistent lock state ] 2.6.22-rc2 #1 --------------------------------- inconsistent {in-hardirq-W} -> {hardirq-on-W} usage. swapper/1 [HC0[0]:SC0[0]:HE1:SE1] takes: (irq_controller_lock){++..}, at: [] gic_set_cpu+0x60/0xa0 {in-hardirq-W} state was registered at: [] lock_acquire+0x58/0x6c [] _spin_lock+0x40/0x50 [] gic_mask_irq+0x2c/0x6c [] handle_level_irq+0x11c/0x14c [] asm_do_IRQ+0x60/0x84 [] __irq_svc+0x4c/0xc0 [] __alloc_bootmem_nopanic+0x74/0x88 [] __alloc_bootmem+0x18/0x3c [] alloc_large_system_hash+0x16c/0x200 [] inode_init_early+0x5c/0xa4 [] vfs_caches_init_early+0x24/0xa0 [] start_kernel+0x220/0x2fc [<00008078>] 0x8078 irq event stamp: 88438 hardirqs last enabled at (88438): [] preempt_return+0x20/0x2c hardirqs last disabled at (88436): [] __do_softirq+0xb0/0x138 softirqs last enabled at (88437): [] __do_softirq+0x104/0x138 softirqs last disabled at (88428): [] irq_exit+0x68/0x7c other info that might help us debug this: no locks held by swapper/1. stack backtrace: [] (dump_stack+0x0/0x14) from [] (print_usage_bug+0x138/0x168) [] (print_usage_bug+0x0/0x168) from [] (mark_lock+0x484/0x6a0) [] (mark_lock+0x0/0x6a0) from [] (__lock_acquire+0x3c0/0x10c8) [] (__lock_acquire+0x0/0x10c8) from [] (lock_acquire+0x58/0x6c) [] (lock_acquire+0x0/0x6c) from [] (_spin_lock+0x40/0x50) [] (_spin_lock+0x0/0x50) from [] (gic_set_cpu+0x60/0xa0) [] (gic_set_cpu+0x0/0xa0) from [] (em_route_irq+0x38/0x40) [] (em_route_irq+0x0/0x40) from [] (em_setup+0x18/0xa4) [] (em_setup+0x0/0xa4) from [] (oprofile_arch_init+0x24/0xe8) [] (oprofile_arch_init+0x0/0xe8) from [] (oprofile_init+0x1c/0x64) [] (oprofile_init+0x0/0x64) from [] (kernel_init+0x154/0x368) [] (kernel_init+0x0/0x368) from [] (do_exit+0x0/0x904) oprofile: using arm/mpcore Signed-off-by: Russell King --- arch/arm/oprofile/op_model_mpcore.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/arch/arm/oprofile/op_model_mpcore.c b/arch/arm/oprofile/op_model_mpcore.c index 898500718249..7791da791f5f 100644 --- a/arch/arm/oprofile/op_model_mpcore.c +++ b/arch/arm/oprofile/op_model_mpcore.c @@ -257,8 +257,13 @@ static void em_stop(void) */ static void em_route_irq(int irq, unsigned int cpu) { - irq_desc[irq].affinity = cpumask_of_cpu(cpu); - irq_desc[irq].chip->set_affinity(irq, cpumask_of_cpu(cpu)); + struct irq_desc *desc = irq_desc + irq; + cpumask_t mask = cpumask_of_cpu(cpu); + + spin_lock_irq(&desc->lock); + desc->affinity = mask; + desc->chip->set_affinity(irq, mask); + spin_unlock_irq(&desc->lock); } static int em_setup(void) -- 2.20.1