Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755453Ab1BCJMk (ORCPT ); Thu, 3 Feb 2011 04:12:40 -0500 Received: from mail-pz0-f46.google.com ([209.85.210.46]:38986 "EHLO mail-pz0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755250Ab1BCJMg (ORCPT ); Thu, 3 Feb 2011 04:12:36 -0500 DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:reply-to:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; b=a/DPYetw2numwNvRI7t609udNqTDqfmyk77oz0EIYyEsiLTMQtRnZJOyJ0JW2s4Md+ 2fQPSTCJvXpTPQTBcAwXbXYAXaIzb9aoIn57SwQneaGUqHpf4tFhLno3+xG4r2jLvHWi 88964IhE3V5kZICqbKD8OQBkCfZmRDg1O+C1s= Date: Thu, 3 Feb 2011 17:12:27 +0800 From: Yong Zhang To: Nick Bowler Cc: linux-kernel@vger.kernel.org, Andrew Morton , Thomas Gleixner Subject: Re: Regression: WARNINGS and lockdep spews in 2.6.38-rc3+ (bisected). Message-ID: <20110203091227.GA1603@zhy> Reply-To: Yong Zhang References: <20110203031943.GA8910@elliptictech.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20110203031943.GA8910@elliptictech.com> User-Agent: Mutt/1.5.20 (2009-06-14) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 5342 Lines: 130 Hi Nick, Thanks for reporting this. Could you please try below patch? Thanks, Yong --- From: Yong Zhang Subject: [PATCH] timer: use _local_bh_enable() in del_timer_sync() Nick Bowler reported: ================================= [ INFO: inconsistent lock state ] 2.6.38-rc3-bisect-00062-g8c007a1 #92 --------------------------------- inconsistent {HARDIRQ-ON-W} -> {IN-HARDIRQ-W} usage. swapper/0 [HC1[1]:SC0[0]:HE0:SE1] takes: (&(&dev->event_lock)->rlock){?.+...}, at: [] input_event+0x41/0x83 {HARDIRQ-ON-W} state was registered at: [] mark_held_locks+0x52/0x70 [] trace_hardirqs_on_caller+0xf7/0x135 [] trace_hardirqs_on+0xd/0xf [] __do_softirq+0x62/0x160 [] call_softirq+0x1c/0x28 [] _local_bh_enable_ip+0xb3/0xe3 [] local_bh_enable+0xd/0xf [] del_timer_sync+0x4f/0x8e [] rfkill_schedule_global_op+0x41/0x84 [rfkill] [] rfkill_schedule_evsw_rfkillall+0x17/0x19 [rfkill] [] rfkill_event+0x58/0x5a [rfkill] [] input_pass_event+0x97/0xea [] input_handle_event+0x460/0x46f [] input_event+0x66/0x83 [] tpacpi_send_radiosw_update+0x7f/0xc4 [thinkpad_acpi] [] hotkey_notify+0x507/0x581 [thinkpad_acpi] [] dispatch_acpi_notify+0x29/0x2b [thinkpad_acpi] [] acpi_ev_notify_dispatch+0x62/0x7c [] acpi_os_execute_deferred+0x24/0x31 [] process_one_work+0x204/0x33b [] worker_thread+0x136/0x255 [] kthread+0x7d/0x85 [] kernel_thread_helper+0x4/0x10 irq event stamp: 559266 hardirqs last enabled at (559263): [] acpi_idle_enter_bm+0x236/0x275 hardirqs last disabled at (559264): [] save_args+0x6a/0x70 softirqs last enabled at (559266): [] _local_bh_enable+0xe/0x10 softirqs last disabled at (559265): [] irq_enter+0x3d/0x6f other info that might help us debug this: 1 lock held by swapper/0: #0: (&serio->lock){-.-...}, at: [] serio_interrupt+0x24/0x7e stack backtrace: Pid: 0, comm: swapper Tainted: G W 2.6.38-rc3-bisect-00062-g8c007a1 #92 Call Trace: [] ? valid_state+0x17e/0x191 [] ? save_stack_trace+0x28/0x45 [] ? check_usage_forwards+0x0/0x87 [] ? mark_lock+0x113/0x22d [] ? __lock_acquire+0x2ac/0xd01 [] ? mark_lock+0x2d/0x22d [] ? mark_lock+0x2d/0x22d [] ? mark_lock+0x2d/0x22d [] ? lock_acquire+0x64/0x81 [] ? input_event+0x41/0x83 [] ? _raw_spin_lock_irqsave+0x53/0x65 [] ? input_event+0x41/0x83 [] ? input_event+0x41/0x83 [] ? atkbd_interrupt+0x9a/0x574 [] ? serio_interrupt+0x40/0x7e [] ? i8042_interrupt+0x28e/0x2a8 [] ? handle_IRQ_event+0x20/0xae [] ? handle_edge_irq+0xde/0x12a [] ? handle_irq+0x1f/0x2a [] ? do_IRQ+0x48/0xaf [] ? ret_from_intr+0x0/0x1a [] ? native_sched_clock+0x2d/0x5f [] ? acpi_idle_enter_bm+0x23d/0x275 [] ? acpi_idle_enter_bm+0x236/0x275 [] ? cpuidle_idle_call+0x9f/0xd5 [] ? cpu_idle+0x61/0xaa [] ? rest_init+0xcd/0xd4 [] ? rest_init+0x0/0xd4 [] ? start_kernel+0x3a6/0x3b1 [] ? x86_64_start_reservations+0xb8/0xbc [] ? x86_64_start_kernel+0x106/0x115 The cause is that local_bh_enable() could call do_softirq() in certain time, thus break irq status and make lock bite us. Reported-and-bisected-by: Nick Bowler Signed-off-by: Yong Zhang Cc: Andrew Morton Cc: Thomas Gleixner --- kernel/timer.c | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-) diff --git a/kernel/timer.c b/kernel/timer.c index 43ca993..253aefe 100644 --- a/kernel/timer.c +++ b/kernel/timer.c @@ -969,10 +969,15 @@ EXPORT_SYMBOL(try_to_del_timer_sync); int del_timer_sync(struct timer_list *timer) { #ifdef CONFIG_LOCKDEP + unsigned long flags; + local_bh_disable(); lock_map_acquire(&timer->lockdep_map); lock_map_release(&timer->lockdep_map); - local_bh_enable(); + /* raw_local_irq_[save|restore] is to protect _local_bh_enable() */ + raw_local_irq_save(flags); + _local_bh_enable(); + raw_local_irq_restore(flags); #endif /* * don't use it in hardirq context, because it -- 1.7.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/