From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755983AbZKDNA4 (ORCPT ); Wed, 4 Nov 2009 08:00:56 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1755938AbZKDNA4 (ORCPT ); Wed, 4 Nov 2009 08:00:56 -0500 Received: from mail-px0-f179.google.com ([209.85.216.179]:54260 "EHLO mail-px0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755913AbZKDNAz (ORCPT ); Wed, 4 Nov 2009 08:00:55 -0500 DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=sAOV8HPmWWwtOwrftEYggnZKpUsDX/8LLqYtaZMuN7Iwk8c0rEpxhRNE+oHojT51SJ wxedU/axuiIpjiIKZh3bpKAFRf30rgJYN6MltrXoKnU6fATq/I5cEiLhCY/fn51Yha2f iSEXX/vQgf2jxIImCIkqPoOqcZ/UKgvP3LSnQ= MIME-Version: 1.0 In-Reply-To: <2674af740911040449h14eaac35y2ec3016862479bc6@mail.gmail.com> References: <20091103134342.24414.82986.sendpatchset@prarit.bos.redhat.com> <2674af740911030658m76b702cfxb67723984286c4bb@mail.gmail.com> <2674af740911040449h14eaac35y2ec3016862479bc6@mail.gmail.com> Date: Wed, 4 Nov 2009 21:01:00 +0800 Message-ID: <2674af740911040501p4ef8b6c5jcbd11f1a57dbf8b7@mail.gmail.com> Subject: Re: [PATCH]: use spin_lock_irqsave in try_one_irq() From: Yong Zhang To: Thomas Gleixner Cc: Prarit Bhargava , linux-kernel@vger.kernel.org, ebiederm@xmission.com, akpm@linux-foundation.org, Ingo Molnar Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org >>From 83ee4c7591aae764f1656bd68f6e95ae112e2e7a Mon Sep 17 00:00:00 2001 From: Yong Zhang Date: Wed, 4 Nov 2009 20:52:45 +0800 Subject: [PATCH] genirq: try_one_irq() should be called with irq disabled Prarit report this: Booting 2.6.32-rc5 on some IBM systems results in Disabling IRQ #19 ================================= [ INFO: inconsistent lock state ] 2.6.32-rc5 #1 --------------------------------- inconsistent {IN-HARDIRQ-W} -> {HARDIRQ-ON-W} usage. swapper/0 [HC0[0]:SC1[1]:HE1:SE0] takes: (&irq_desc_lock_class){?.-...}, at: [] try_one_irq+0x32/0x138 {IN-HARDIRQ-W} state was registered at: [] __lock_acquire+0x2fc/0xd5d [] lock_acquire+0xf3/0x12d [] _spin_lock+0x40/0x89 [] handle_level_irq+0x30/0x105 [] handle_irq+0x95/0xb7 [] do_IRQ+0x6a/0xe0 [] ret_from_intr+0x0/0x16 irq event stamp: 195096 hardirqs last enabled at (195096): [] _spin_unlock_irq+0x3a/0x5c hardirqs last disabled at (195095): [] _spin_lock_irq+0x29/0x95 softirqs last enabled at (195088): [] __do_softirq+0x1c1/0x1ef softirqs last disabled at (195093): [] call_softirq+0x1c/0x30 other info that might help us debug this: 1 lock held by swapper/0: #0: (kernel/irq/spurious.c:21){+.-...}, at: [] run_timer_softirq+0x1a9/0x315 stack backtrace: Pid: 0, comm: swapper Not tainted 2.6.32-rc5 #1 Call Trace: [] valid_state+0x187/0x1ae [] ? check_usage_backwards+0x0/0xa3 [] mark_lock+0x129/0x253 [] __lock_acquire+0x370/0xd5d [] ? try_one_irq+0x32/0x138 [] ? save_trace+0x4e/0xcd [] lock_acquire+0xf3/0x12d [] ? try_one_irq+0x32/0x138 [] ? run_timer_softirq+0x1a9/0x315 [] ? try_one_irq+0x32/0x138 [] _spin_lock+0x40/0x89 [] ? try_one_irq+0x32/0x138 [] try_one_irq+0x32/0x138 [] poll_all_shared_irqs+0x41/0x6d [] poll_spurious_irqs+0x1c/0x49 [] run_timer_softirq+0x239/0x315 [] ? run_timer_softirq+0x1a9/0x315 [] ? poll_spurious_irqs+0x0/0x49 [] __do_softirq+0x102/0x1ef [] ? tick_dev_program_event+0x46/0xcc [] call_softirq+0x1c/0x30 [] do_softirq+0x59/0xca [] irq_exit+0x58/0xae [] smp_apic_timer_interrupt+0x94/0xba [] apic_timer_interrupt+0x13/0x20 [] ? mwait_idle+0x8c/0xb5 [] ? mwait_idle+0x83/0xb5 [] ? cpu_idle+0xbe/0x100 [] ? start_secondary+0x219/0x270 The reason is that try_one_irq() is called both from hardirq context and softirq context. And by default the timer handler poll_all_shared_irqs() is called with irq enabled. Then the two usage will cause inconsistent. Reported-by: Prarit Bhargava Signed-off-by: Yong Zhang --- kernel/irq/spurious.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/kernel/irq/spurious.c b/kernel/irq/spurious.c index 114e704..bd7273e 100644 --- a/kernel/irq/spurious.c +++ b/kernel/irq/spurious.c @@ -121,7 +121,9 @@ static void poll_all_shared_irqs(void) if (!(status & IRQ_SPURIOUS_DISABLED)) continue; + local_irq_disable(); try_one_irq(i, desc); + local_irq_enable(); } } -- 1.6.3.3