Return-path: Received: from fmailhost01.isp.att.net ([204.127.217.101]:61199 "EHLO fmailhost01.isp.att.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755596AbZGMTrU (ORCPT ); Mon, 13 Jul 2009 15:47:20 -0400 Message-ID: <4A5B8F57.5020601@lwfinger.net> Date: Mon, 13 Jul 2009 14:47:35 -0500 From: Larry Finger MIME-Version: 1.0 To: Johannes Berg CC: John W Linville , linux-wireless@vger.kernel.org Subject: Re: [RFC/RFT] rtl8187: Fix for kernel oops when unloading with LEDs enabled References: <4a5b563e.AuhPXmHA0dUFYtzx%Larry.Finger@lwfinger.net> <1247501812.4166.24.camel@johannes.local> In-Reply-To: <1247501812.4166.24.camel@johannes.local> Content-Type: text/plain; charset=ISO-8859-1 Sender: linux-wireless-owner@vger.kernel.org List-ID: Johannes Berg wrote: > On Mon, 2009-07-13 at 10:43 -0500, Larry Finger wrote: >> When rtl8187 is unloaded and CONFIG_RTL8187_LEDS is set, the kernel >> may oops when the module is unloaded as the workqueue for led_on was >> not being cancelled. To prevent interference between cfg80211 and rtl8187, >> a separate workqueue has also been established. > > It doesn't seem like a separate workqueue should be necessary -- why is > it? Might make more sense to fix cfg80211 or mac80211 instead. Probably. Attached is the dump for the locking error when b43 is unloaded. ======================================================= [ INFO: possible circular locking dependency detected ] 2.6.31-rc2-wl #178 ------------------------------------------------------- modprobe/14721 is trying to acquire lock: (&rdev->conn_work){+.+.+.}, at: [] __cancel_work_timer+0xd9/0x222 but task is already holding lock: (cfg80211_mutex){+.+.+.}, at: [] wiphy_unregister+0x3a/0xf8 [cfg80211] which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #2 (cfg80211_mutex){+.+.+.}: [] __lock_acquire+0x12d3/0x1621 [] lock_acquire+0xb9/0xdd [] mutex_lock_nested+0x56/0x2a8 [] cfg80211_get_dev_from_ifindex+0x17/0x8a [cfg80211] [] cfg80211_wext_giwscan+0x40/0xf22 [cfg80211] [] ioctl_standard_iw_point+0x198/0x227 [] ioctl_standard_call+0x95/0xb4 [] wext_ioctl_dispatch+0x9a/0x172 [] wext_handle_ioctl+0x39/0x6f [] dev_ioctl+0x61e/0x647 [] sock_ioctl+0x21d/0x22c [] vfs_ioctl+0x2a/0x78 [] do_vfs_ioctl+0x4aa/0x4e7 [] sys_ioctl+0x42/0x65 [] system_call_fastpath+0x16/0x1b [] 0xffffffffffffffff -> #1 (rtnl_mutex){+.+.+.}: [] __lock_acquire+0x12d3/0x1621 [] lock_acquire+0xb9/0xdd [] mutex_lock_nested+0x56/0x2a8 [] rtnl_lock+0x12/0x14 [] cfg80211_conn_work+0x2b/0x106 [cfg80211] [] worker_thread+0x1fa/0x30a [] kthread+0x88/0x90 [] child_rip+0xa/0x20 [] 0xffffffffffffffff -> #0 (&rdev->conn_work){+.+.+.}: [] __lock_acquire+0x1008/0x1621 [] lock_acquire+0xb9/0xdd [] __cancel_work_timer+0x112/0x222 [] cancel_work_sync+0xb/0xd [] wiphy_unregister+0x71/0xf8 [cfg80211] [] ieee80211_unregister_hw+0xb9/0xd9 [mac80211] [] b43_remove+0x53/0x8a [b43] [] ssb_device_remove+0x2b/0x3f [ssb] [] __device_release_driver+0x80/0xc9 [] driver_detach+0x87/0xad [] bus_remove_driver+0x89/0xb9 [] driver_unregister+0x66/0x6e [] ssb_driver_unregister+0xd/0xf [ssb] [] b43_exit+0x10/0x17 [b43] [] sys_delete_module+0x1d3/0x249 [] system_call_fastpath+0x16/0x1b [] 0xffffffffffffffff other info that might help us debug this: 1 lock held by modprobe/14721: #0: (cfg80211_mutex){+.+.+.}, at: [] wiphy_unregister+0x3a/0xf8 [cfg80211] stack backtrace: Pid: 14721, comm: modprobe Not tainted 2.6.31-rc2-wl #178 Call Trace: [] print_circular_bug_tail+0xc1/0xcc [] __lock_acquire+0x1008/0x1621 [] ? check_noncircular+0xe4/0x118 [] ? check_irq_usage+0xb3/0xc5 [] lock_acquire+0xb9/0xdd [] ? __cancel_work_timer+0xd9/0x222 [] __cancel_work_timer+0x112/0x222 [] ? __cancel_work_timer+0xd9/0x222 [] ? mark_held_locks+0x4d/0x6b [] ? mark_held_locks+0x4d/0x6b [] ? __mutex_unlock_slowpath+0x10d/0x119 [] ? trace_hardirqs_on_caller+0x10b/0x12f [] ? trace_hardirqs_on+0xd/0xf [] cancel_work_sync+0xb/0xd [] wiphy_unregister+0x71/0xf8 [cfg80211] [] ieee80211_unregister_hw+0xb9/0xd9 [mac80211] [] b43_remove+0x53/0x8a [b43] [] ssb_device_remove+0x2b/0x3f [ssb] [] __device_release_driver+0x80/0xc9 [] driver_detach+0x87/0xad [] bus_remove_driver+0x89/0xb9 [] driver_unregister+0x66/0x6e [] ssb_driver_unregister+0xd/0xf [ssb] [] b43_exit+0x10/0x17 [b43] [] sys_delete_module+0x1d3/0x249 [] ? trace_hardirqs_on_caller+0x10b/0x12f [] ? trace_hardirqs_on_thunk+0x3a/0x3f [] system_call_fastpath+0x16/0x1b b43-pci-bridge 0000:04:00.0: PCI INT A disabled