Return-path: Received: from mga02.intel.com ([134.134.136.20]:37207 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752425AbYCEB5k convert rfc822-to-8bit (ORCPT ); Tue, 4 Mar 2008 20:57:40 -0500 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Subject: RE: [PATCH 4/8] mac80211: RCU-ify STA info structure access Date: Tue, 4 Mar 2008 17:57:08 -0800 Message-ID: (sfid-20080305_015801_816748_E7CBCBBE) In-Reply-To: <20080222111749.689180000@sipsolutions.net> References: <20080222111644.183587000@sipsolutions.net> <20080222111749.689180000@sipsolutions.net> From: "Chatre, Reinette" To: "Johannes Berg" , "John Linville" , "Winkler, Tomas" Cc: , "Rindjunsky, Ron" Sender: linux-wireless-owner@vger.kernel.org List-ID: On , Johannes Berg wrote: > This makes access to the STA hash table/list use RCU to protect > against freeing of items. However, it's not a true RCU, the > copy step is missing: whenever somebody changes a STA item it > is simply updated. That will be addressed by a later change. > This patch is causing some problems in the iwlwifi driver. Often when one of these RCU locks are held the driver tries to send a command to the device and waits for the response, or it does some other activity requiring sleeping. This causes numerous BUG messages as seen below: BUG: sleeping function called from invalid context at /home/rchatre/wifi/repos.git/iwlwifi-2.6/kernel/mutex.c:209 in_atomic():1, irqs_disabled():0 3 locks held by iwl3945/3831: #0: ((name)){--..}, at: [] run_workqueue+0x80/0x18b #1: (&ifsta->work){--..}, at: [] run_workqueue+0x80/0x18b #2: (rcu_read_lock){..--}, at: [] ieee80211_rx_mgmt_assoc_resp+0x273/0x773 [mac80211] Pid: 3831, comm: iwl3945 Not tainted 2.6.25-rc3-wl #7 [] __might_sleep+0xc2/0xc9 [] mutex_lock_nested+0x1d/0x231 [] ? sys_timer_settime+0x2a/0x225 [] ? _spin_unlock_irqrestore+0x38/0x58 [] iwl3945_mac_conf_tx+0x1b0/0x234 [iwl3945] [] ieee80211_sta_wmm_params+0x165/0x195 [mac80211] [] ieee80211_rx_mgmt_assoc_resp+0x6ff/0x773 [mac80211] [] ? cache_flusharray+0xdf/0xf2 [] ? __lock_acquire+0xb0c/0xb39 [] ieee80211_sta_work+0x726/0xfde [mac80211] [] ? __lock_acquire+0xb1d/0xb39 [] ? run_workqueue+0x80/0x18b [] run_workqueue+0xbb/0x18b [] ? run_workqueue+0x80/0x18b [] ? ieee80211_sta_work+0x0/0xfde [mac80211] [] worker_thread+0xb6/0xc2 [] ? autoremove_wake_function+0x0/0x30 [] ? worker_thread+0x0/0xc2 [] kthread+0x3b/0x63 [] ? kthread+0x0/0x63 [] kernel_thread_helper+0x7/0x10 ======================= BUG: scheduling while atomic: iwl3945/3831/0x00000002 4 locks held by iwl3945/3831: #0: ((name)){--..}, at: [] run_workqueue+0x80/0x18b #1: (&ifsta->work){--..}, at: [] run_workqueue+0x80/0x18b #2: (rcu_read_lock){..--}, at: [] ieee80211_rx_mgmt_assoc_resp+0x273/0x773 [mac80211] #3: (&priv->mutex){--..}, at: [] iwl3945_mac_conf_tx+0x1b0/0x234 [iwl3945] Pid: 3831, comm: iwl3945 Not tainted 2.6.25-rc3-wl #7 [] __schedule_bug+0x59/0x60 [] schedule+0x91/0x5f7 [] ? mark_held_locks+0x4e/0x66 [] ? mutex_lock_nested+0x135/0x231 [] mutex_lock_nested+0x14a/0x231 [] ? iwl3945_mac_conf_tx+0x1b0/0x234 [iwl3945] [] iwl3945_mac_conf_tx+0x1b0/0x234 [iwl3945] [] ieee80211_sta_wmm_params+0x165/0x195 [mac80211] [] ieee80211_rx_mgmt_assoc_resp+0x6ff/0x773 [mac80211] [] ? cache_flusharray+0xdf/0xf2 [] ? __lock_acquire+0xb0c/0xb39 [] ieee80211_sta_work+0x726/0xfde [mac80211] [] ? __lock_acquire+0xb1d/0xb39 [] ? run_workqueue+0x80/0x18b [] run_workqueue+0xbb/0x18b [] ? run_workqueue+0x80/0x18b [] ? ieee80211_sta_work+0x0/0xfde [mac80211] [] worker_thread+0xb6/0xc2 [] ? autoremove_wake_function+0x0/0x30 [] ? worker_thread+0x0/0xc2 [] kthread+0x3b/0x63 [] ? kthread+0x0/0x63 [] kernel_thread_helper+0x7/0x10 ======================= BUG: scheduling while atomic: iwl3945/3831/0x00000002 4 locks held by iwl3945/3831: #0: ((name)){--..}, at: [] run_workqueue+0x80/0x18b #1: (&ifsta->work){--..}, at: [] run_workqueue+0x80/0x18b #2: (rcu_read_lock){..--}, at: [] ieee80211_rx_mgmt_assoc_resp+0x273/0x773 [mac80211] #3: (&priv->mutex){--..}, at: [] iwl3945_mac_conf_tx+0x1b0/0x234 [iwl3945] Pid: 3831, comm: iwl3945 Not tainted 2.6.25-rc3-wl #7 [] __schedule_bug+0x59/0x60 [] schedule+0x91/0x5f7 [] ? _spin_unlock_irqrestore+0x42/0x58 [] ? __mod_timer+0xa5/0xb0 [] schedule_timeout+0x6d/0x8b [] ? process_timeout+0x0/0xa [] ? schedule_timeout+0x68/0x8b [] iwl3945_send_cmd_sync+0x5e9/0x1180 [iwl3945] [] ? autoremove_wake_function+0x0/0x30 [] iwl3945_send_cmd_pdu+0x2f/0x37 [iwl3945] [] iwl3945_activate_qos+0xce/0xd7 [iwl3945] [] iwl3945_mac_conf_tx+0x1da/0x234 [iwl3945] [] ieee80211_sta_wmm_params+0x165/0x195 [mac80211] [] ieee80211_rx_mgmt_assoc_resp+0x6ff/0x773 [mac80211] [] ? cache_flusharray+0xdf/0xf2 [] ? __lock_acquire+0xb0c/0xb39 [] ieee80211_sta_work+0x726/0xfde [mac80211] [] ? __lock_acquire+0xb1d/0xb39 [] ? run_workqueue+0x80/0x18b [] run_workqueue+0xbb/0x18b [] ? run_workqueue+0x80/0x18b [] ? ieee80211_sta_work+0x0/0xfde [mac80211] [] worker_thread+0xb6/0xc2 [] ? autoremove_wake_function+0x0/0x30 [] ? worker_thread+0x0/0xc2 [] kthread+0x3b/0x63 [] ? kthread+0x0/0x63 [] kernel_thread_helper+0x7/0x10 ======================= BUG: scheduling while atomic: iwl3945/3831/0x00000002 4 locks held by iwl3945/3831: #0: ((name)){--..}, at: [] run_workqueue+0x80/0x18b #1: (&ifsta->work){--..}, at: [] run_workqueue+0x80/0x18b #2: (rcu_read_lock){..--}, at: [] ieee80211_rx_mgmt_assoc_resp+0x273/0x773 [mac80211] #3: (&priv->mutex){--..}, at: [] iwl3945_mac_conf_tx+0x1b0/0x234 [iwl3945] Pid: 3831, comm: iwl3945 Not tainted 2.6.25-rc3-wl #7 [] __schedule_bug+0x59/0x60 [] schedule+0x91/0x5f7 [] ? _spin_unlock_irqrestore+0x42/0x58 [] ? __mod_timer+0xa5/0xb0 [] schedule_timeout+0x6d/0x8b [] ? process_timeout+0x0/0xa [] ? schedule_timeout+0x68/0x8b [] iwl3945_send_cmd_sync+0x5e9/0x1180 [iwl3945] [] ? autoremove_wake_function+0x0/0x30 [] iwl3945_send_cmd_pdu+0x2f/0x37 [iwl3945] [] iwl3945_activate_qos+0xce/0xd7 [iwl3945] [] iwl3945_mac_conf_tx+0x1da/0x234 [iwl3945] [] ieee80211_sta_wmm_params+0x165/0x195 [mac80211] [] ieee80211_rx_mgmt_assoc_resp+0x6ff/0x773 [mac80211] [] ? cache_flusharray+0xdf/0xf2 [] ? __lock_acquire+0xb0c/0xb39 [] ieee80211_sta_work+0x726/0xfde [mac80211] [] ? __lock_acquire+0xb1d/0xb39 [] ? run_workqueue+0x80/0x18b [] run_workqueue+0xbb/0x18b [] ? run_workqueue+0x80/0x18b [] ? ieee80211_sta_work+0x0/0xfde [mac80211] [] worker_thread+0xb6/0xc2 [] ? autoremove_wake_function+0x0/0x30 [] ? worker_thread+0x0/0xc2 [] kthread+0x3b/0x63 [] ? kthread+0x0/0x63 [] kernel_thread_helper+0x7/0x10 ======================= BUG: scheduling while atomic: iwl3945/3831/0x00000002 4 locks held by iwl3945/3831: #0: ((name)){--..}, at: [] run_workqueue+0x80/0x18b #1: (&ifsta->work){--..}, at: [] run_workqueue+0x80/0x18b #2: (rcu_read_lock){..--}, at: [] ieee80211_rx_mgmt_assoc_resp+0x273/0x773 [mac80211] #3: (&priv->mutex){--..}, at: [] iwl3945_mac_conf_tx+0x1b0/0x234 [iwl3945] Pid: 3831, comm: iwl3945 Not tainted 2.6.25-rc3-wl #7 [] __schedule_bug+0x59/0x60 [] schedule+0x91/0x5f7 [] ? _spin_unlock_irqrestore+0x42/0x58 [] ? __mod_timer+0xa5/0xb0 [] schedule_timeout+0x6d/0x8b [] ? process_timeout+0x0/0xa [] ? schedule_timeout+0x68/0x8b [] iwl3945_send_cmd_sync+0x5e9/0x1180 [iwl3945] [] ? autoremove_wake_function+0x0/0x30 [] iwl3945_send_cmd_pdu+0x2f/0x37 [iwl3945] [] iwl3945_activate_qos+0xce/0xd7 [iwl3945] [] iwl3945_mac_conf_tx+0x1da/0x234 [iwl3945] [] ieee80211_sta_wmm_params+0x165/0x195 [mac80211] [] ieee80211_rx_mgmt_assoc_resp+0x6ff/0x773 [mac80211] [] ? cache_flusharray+0xdf/0xf2 [] ? __lock_acquire+0xb0c/0xb39 [] ieee80211_sta_work+0x726/0xfde [mac80211] [] ? __lock_acquire+0xb1d/0xb39 [] ? run_workqueue+0x80/0x18b [] run_workqueue+0xbb/0x18b [] ? run_workqueue+0x80/0x18b [] ? ieee80211_sta_work+0x0/0xfde [mac80211] [] worker_thread+0xb6/0xc2 [] ? autoremove_wake_function+0x0/0x30 [] ? worker_thread+0x0/0xc2 [] kthread+0x3b/0x63 [] ? kthread+0x0/0x63 [] kernel_thread_helper+0x7/0x10 ======================= BUG: scheduling while atomic: iwl3945/3831/0x00000002 4 locks held by iwl3945/3831: #0: ((name)){--..}, at: [] run_workqueue+0x80/0x18b #1: (&ifsta->work){--..}, at: [] run_workqueue+0x80/0x18b #2: (rcu_read_lock){..--}, at: [] ieee80211_rx_mgmt_assoc_resp+0x273/0x773 [mac80211] #3: (&priv->mutex){--..}, at: [] iwl3945_mac_conf_tx+0x1b0/0x234 [iwl3945] Pid: 3831, comm: iwl3945 Not tainted 2.6.25-rc3-wl #7 [] __schedule_bug+0x59/0x60 [] schedule+0x91/0x5f7 [] ? _spin_unlock_irqrestore+0x42/0x58 [] ? __mod_timer+0xa5/0xb0 [] schedule_timeout+0x6d/0x8b [] ? process_timeout+0x0/0xa [] ? schedule_timeout+0x68/0x8b [] iwl3945_send_cmd_sync+0x5e9/0x1180 [iwl3945] [] ? autoremove_wake_function+0x0/0x30 [] iwl3945_send_cmd_pdu+0x2f/0x37 [iwl3945] [] iwl3945_activate_qos+0xce/0xd7 [iwl3945] [] iwl3945_mac_conf_tx+0x1da/0x234 [iwl3945] [] ieee80211_sta_wmm_params+0x165/0x195 [mac80211] [] ieee80211_rx_mgmt_assoc_resp+0x6ff/0x773 [mac80211] [] ? cache_flusharray+0xdf/0xf2 [] ? __lock_acquire+0xb0c/0xb39 [] ieee80211_sta_work+0x726/0xfde [mac80211] [] ? __lock_acquire+0xb1d/0xb39 [] ? run_workqueue+0x80/0x18b [] run_workqueue+0xbb/0x18b [] ? run_workqueue+0x80/0x18b [] ? ieee80211_sta_work+0x0/0xfde [mac80211] [] worker_thread+0xb6/0xc2 [] ? autoremove_wake_function+0x0/0x30 [] ? worker_thread+0x0/0xc2 [] kthread+0x3b/0x63 [] ? kthread+0x0/0x63 [] kernel_thread_helper+0x7/0x10 =======================