Return-path: Received: from mail-qy0-f181.google.com ([209.85.216.181]:60887 "EHLO mail-qy0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752937Ab1FUNKu (ORCPT ); Tue, 21 Jun 2011 09:10:50 -0400 Received: by qyk9 with SMTP id 9so1662666qyk.19 for ; Tue, 21 Jun 2011 06:10:49 -0700 (PDT) MIME-Version: 1.0 Date: Tue, 21 Jun 2011 21:10:48 +0800 Message-ID: (sfid-20110621_151052_659498_9526F31F) Subject: [3.0-rc4] lockdep: netdev notifier vs rfkill From: Daniel J Blueman To: Johannes Berg , "John W. Linville" Cc: linux-wireless@vger.kernel.org Content-Type: text/plain; charset=ISO-8859-1 Sender: linux-wireless-owner@vger.kernel.org List-ID: When hitting the hard rfkill in 3.0-rc4, lockdep spots some likely lock misuse: ======================================================= [ INFO: possible circular locking dependency detected ] 3.0.0-rc4-340c #1 ------------------------------------------------------- kworker/0:0/4 is trying to acquire lock: (&rdev->mtx){+.+.+.}, at: [] cfg80211_netdev_notifier_call+0x11e/0x650 but task is already holding lock: (&rdev->devlist_mtx){+.+.+.}, at: [] cfg80211_rfkill_set_block+0x46/0xa0 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #1 (&rdev->devlist_mtx){+.+.+.}: [] validate_chain.clone.23+0x54b/0x630 [] __lock_acquire+0x474/0x960 [] lock_acquire+0x55/0x70 [] mutex_lock_nested+0x5e/0x390 [] cfg80211_netdev_notifier_call+0x457/0x650 [] notifier_call_chain+0x8b/0x100 [] raw_notifier_call_chain+0x11/0x20 [] call_netdevice_notifiers+0x32/0x60 [] __dev_notify_flags+0x34/0x90 [] dev_change_flags+0x40/0x70 [] do_setlink+0x17e/0x890 [] rtnl_setlink+0xe7/0x130 [] rtnetlink_rcv_msg+0x22f/0x260 [] netlink_rcv_skb+0xa9/0xd0 [] rtnetlink_rcv+0x20/0x30 [] netlink_unicast+0x1ee/0x240 [] netlink_sendmsg+0x241/0x3b0 [] sock_sendmsg+0xdc/0x120 [] __sys_sendmsg+0x1d8/0x340 [] sys_sendmsg+0x44/0x80 [] system_call_fastpath+0x16/0x1b -> #0 (&rdev->mtx){+.+.+.}: [] check_prev_add+0x70b/0x720 [] validate_chain.clone.23+0x54b/0x630 [] __lock_acquire+0x474/0x960 [] lock_acquire+0x55/0x70 [] mutex_lock_nested+0x5e/0x390 [] cfg80211_netdev_notifier_call+0x11e/0x650 [] notifier_call_chain+0x8b/0x100 [] raw_notifier_call_chain+0x11/0x20 [] call_netdevice_notifiers+0x32/0x60 [] __dev_close_many+0x4d/0xf0 [] dev_close_many+0x88/0x110 [] dev_close+0x38/0x50 [] cfg80211_rfkill_set_block+0x6a/0xa0 [] cfg80211_rfkill_sync_work+0x24/0x30 [] process_one_work+0x1b7/0x450 [] worker_thread+0x161/0x350 [] kthread+0xb6/0xc0 [] kernel_thread_helper+0x4/0x10 other info that might help us debug this: Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&rdev->devlist_mtx); lock(&rdev->mtx); lock(&rdev->devlist_mtx); lock(&rdev->mtx); *** DEADLOCK *** 4 locks held by kworker/0:0/4: #0: (events){.+.+.+}, at: [] process_one_work+0x159/0x450 #1: ((&rdev->rfkill_sync)){+.+...}, at: [] process_one_work+0x159/0x450 #2: (rtnl_mutex){+.+.+.}, at: [] rtnl_lock+0x12/0x20 #3: (&rdev->devlist_mtx){+.+.+.}, at: [] cfg80211_rfkill_set_block+0x46/0xa0 stack backtrace: Pid: 4, comm: kworker/0:0 Tainted: G C 3.0.0-rc4-340c #1 Call Trace: [] print_circular_bug+0x109/0x110 [] check_prev_add+0x70b/0x720 [] validate_chain.clone.23+0x54b/0x630 [] __lock_acquire+0x474/0x960 [] ? __bfs+0x11e/0x260 [] ? check_irq_usage+0x9f/0xf0 [] ? cfg80211_netdev_notifier_call+0x11e/0x650 [] lock_acquire+0x55/0x70 [] ? cfg80211_netdev_notifier_call+0x11e/0x650 [] ? add_preempt_count+0x9d/0xd0 [] mutex_lock_nested+0x5e/0x390 [] ? cfg80211_netdev_notifier_call+0x11e/0x650 [] ? validate_chain.clone.23+0x54b/0x630 [] cfg80211_netdev_notifier_call+0x11e/0x650 [] ? __lock_acquire+0x474/0x960 [] ? validate_chain.clone.23+0x54b/0x630 [] notifier_call_chain+0x8b/0x100 [] raw_notifier_call_chain+0x11/0x20 [] call_netdevice_notifiers+0x32/0x60 [] __dev_close_many+0x4d/0xf0 [] dev_close_many+0x88/0x110 [] dev_close+0x38/0x50 [] cfg80211_rfkill_set_block+0x6a/0xa0 [] cfg80211_rfkill_sync_work+0x24/0x30 [] process_one_work+0x1b7/0x450 [] ? process_one_work+0x159/0x450 [] ? cfg80211_rfkill_set_block+0xa0/0xa0 [] worker_thread+0x161/0x350 [] ? manage_workers.clone.23+0x120/0x120 [] kthread+0xb6/0xc0 [] ? trace_hardirqs_on_caller+0x13d/0x180 [] kernel_thread_helper+0x4/0x10 [] ? finish_task_switch+0x77/0x100 [] ? retint_restore_args+0xe/0xe [] ? __init_kthread_worker+0x70/0x70 [] ? gs_change+0xb/0xb -- Daniel J Blueman