Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/816118/?format=api
{ "id": 816118, "url": "http://patchwork.ozlabs.org/api/patches/816118/?format=api", "web_url": "http://patchwork.ozlabs.org/project/netdev/patch/20170920101123.23312-1-ville.syrjala@linux.intel.com/", "project": { "id": 7, "url": "http://patchwork.ozlabs.org/api/projects/7/?format=api", "name": "Linux network development", "link_name": "netdev", "list_id": "netdev.vger.kernel.org", "list_email": "netdev@vger.kernel.org", "web_url": null, "scm_url": null, "webscm_url": null, "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20170920101123.23312-1-ville.syrjala@linux.intel.com>", "list_archive_url": null, "date": "2017-09-20T10:11:23", "name": "[v2,1/2] mac80211: Add rcu read side critical sections", "commit_ref": null, "pull_url": null, "state": "awaiting-upstream", "archived": true, "hash": "602931c2ec552fe22adcc1c125daab098cbb939f", "submitter": { "id": 21383, "url": "http://patchwork.ozlabs.org/api/people/21383/?format=api", "name": "Ville Syrjälä", "email": "ville.syrjala@linux.intel.com" }, "delegate": { "id": 34, "url": "http://patchwork.ozlabs.org/api/users/34/?format=api", "username": "davem", "first_name": "David", "last_name": "Miller", "email": "davem@davemloft.net" }, "mbox": "http://patchwork.ozlabs.org/project/netdev/patch/20170920101123.23312-1-ville.syrjala@linux.intel.com/mbox/", "series": [ { "id": 4071, "url": "http://patchwork.ozlabs.org/api/series/4071/?format=api", "web_url": "http://patchwork.ozlabs.org/project/netdev/list/?series=4071", "date": "2017-09-20T10:11:23", "name": "[v2,1/2] mac80211: Add rcu read side critical sections", "version": 2, "mbox": "http://patchwork.ozlabs.org/series/4071/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/816118/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/816118/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<netdev-owner@vger.kernel.org>", "X-Original-To": "patchwork-incoming@ozlabs.org", "Delivered-To": "patchwork-incoming@ozlabs.org", "Authentication-Results": "ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=netdev-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)", "Received": [ "from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xxwWR3LN6z9s81\n\tfor <patchwork-incoming@ozlabs.org>;\n\tWed, 20 Sep 2017 20:11:31 +1000 (AEST)", "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1751568AbdITKL2 (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tWed, 20 Sep 2017 06:11:28 -0400", "from mga14.intel.com ([192.55.52.115]:58398 \"EHLO mga14.intel.com\"\n\trhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP\n\tid S1751468AbdITKL1 (ORCPT <rfc822;netdev@vger.kernel.org>);\n\tWed, 20 Sep 2017 06:11:27 -0400", "from fmsmga002.fm.intel.com ([10.253.24.26])\n\tby fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t20 Sep 2017 03:11:26 -0700", "from stinkbox.fi.intel.com (HELO stinkbox) ([10.237.72.174])\n\tby fmsmga002.fm.intel.com with SMTP; 20 Sep 2017 03:11:24 -0700", "by stinkbox (sSMTP sendmail emulation);\n\tWed, 20 Sep 2017 13:11:23 +0300" ], "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.42,421,1500966000\"; d=\"scan'208\";a=\"1221366122\"", "From": "Ville Syrjala <ville.syrjala@linux.intel.com>", "To": "linux-wireless@vger.kernel.org", "Cc": "Johannes Berg <johannes@sipsolutions.net>, \"David S. Miller\"\n\t<davem@davemloft.net>, netdev@vger.kernel.org, =?utf-8?q?Ville_Syrj?=\n\t=?utf-8?b?w6Rsw6Q=?= <ville.syrjala@linux.intel.com>", "Subject": "[PATCH v2 1/2] mac80211: Add rcu read side critical sections", "Date": "Wed, 20 Sep 2017 13:11:23 +0300", "Message-Id": "<20170920101123.23312-1-ville.syrjala@linux.intel.com>", "X-Mailer": "git-send-email 2.13.5", "In-Reply-To": "<20170918195919.15860-1-ville.syrjala@linux.intel.com>", "References": "<20170918195919.15860-1-ville.syrjala@linux.intel.com>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=UTF-8", "Content-Transfer-Encoding": "8bit", "Sender": "netdev-owner@vger.kernel.org", "Precedence": "bulk", "List-ID": "<netdev.vger.kernel.org>", "X-Mailing-List": "netdev@vger.kernel.org" }, "content": "From: Ville Syrjälä <ville.syrjala@linux.intel.com>\n\nI got the following lockdep warning about the rcu_dereference()s in\nieee80211_tx_h_select_key(). After tracing all callers of\nieee80211_tx_h_select_key() I discovered that ieee80211_get_buffered_bc()\nand ieee80211_build_data_template() had the rcu_read_lock/unlock() but\nthree other places did not. So I just blindly added them and made the\nread side critical section extend as far as the lifetime of 'tx' which\nis where we seem to be stuffing the rcu protected pointers. No real clue\nwhether this is correct or not.\n\n[ 854.573700] ../net/mac80211/tx.c:594 suspicious rcu_dereference_check() usage!\n[ 854.573704]\n other info that might help us debug this:\n\n[ 854.573707]\n rcu_scheduler_active = 2, debug_locks = 1\n[ 854.573712] 6 locks held by kworker/u2:0/2877:\n[ 854.573715] #0: (\"%s\"wiphy_name(local->hw.wiphy)){++++.+}, at: [<c1067f37>] process_one_work+0x127/0x580\n[ 854.573742] #1: ((&sdata->work)){+.+.+.}, at: [<c1067f37>] process_one_work+0x127/0x580\n[ 854.573758] #2: (&wdev->mtx){+.+.+.}, at: [<f83271c3>] ieee80211_sta_work+0x23/0x1c70 [mac80211]\n[ 854.573902] #3: (&local->sta_mtx){+.+.+.}, at: [<f82c9b10>] __sta_info_flush+0x60/0x160 [mac80211]\n[ 854.573947] #4: (&(&txq->axq_lock)->rlock){+.-...}, at: [<f825729c>] ath_tx_node_cleanup+0x5c/0x180 [ath9k]\n[ 854.573973] #5: (&(&fq->lock)->rlock){+.-...}, at: [<f82fb064>] ieee80211_tx_dequeue+0x24/0xa80 [mac80211]\n[ 854.574023]\n stack backtrace:\n[ 854.574028] CPU: 0 PID: 2877 Comm: kworker/u2:0 Not tainted 4.13.0-mgm-ovl+ #52\n[ 854.574032] Hardware name: FUJITSU SIEMENS LIFEBOOK S6120/FJNB16C, BIOS Version 1.26 05/10/2004\n[ 854.574070] Workqueue: phy0 ieee80211_iface_work [mac80211]\n[ 854.574076] Call Trace:\n[ 854.574086] dump_stack+0x16/0x19\n[ 854.574092] lockdep_rcu_suspicious+0xcb/0xf0\n[ 854.574131] ieee80211_tx_h_select_key+0x1b5/0x500 [mac80211]\n[ 854.574171] ieee80211_tx_dequeue+0x283/0xa80 [mac80211]\n[ 854.574181] ath_tid_dequeue+0x84/0xf0 [ath9k]\n[ 854.574189] ath_tx_node_cleanup+0xb8/0x180 [ath9k]\n[ 854.574199] ath9k_sta_state+0x48/0xf0 [ath9k]\n[ 854.574207] ? ath9k_del_ps_key.isra.19+0x60/0x60 [ath9k]\n[ 854.574240] drv_sta_state+0xaf/0x8c0 [mac80211]\n[ 854.574275] __sta_info_destroy_part2+0x10b/0x140 [mac80211]\n[ 854.574309] __sta_info_flush+0xd5/0x160 [mac80211]\n[ 854.574349] ieee80211_set_disassoc+0xd3/0x570 [mac80211]\n[ 854.574390] ieee80211_sta_connection_lost+0x30/0x60 [mac80211]\n[ 854.574431] ieee80211_sta_work+0x1ff/0x1c70 [mac80211]\n[ 854.574436] ? mark_held_locks+0x62/0x90\n[ 854.574443] ? _raw_spin_unlock_irqrestore+0x55/0x70\n[ 854.574447] ? trace_hardirqs_on_caller+0x11c/0x1a0\n[ 854.574452] ? trace_hardirqs_on+0xb/0x10\n[ 854.574459] ? dev_mc_net_exit+0xe/0x20\n[ 854.574467] ? skb_dequeue+0x48/0x70\n[ 854.574504] ieee80211_iface_work+0x2d8/0x320 [mac80211]\n[ 854.574509] process_one_work+0x1d1/0x580\n[ 854.574513] ? process_one_work+0x127/0x580\n[ 854.574519] worker_thread+0x31/0x380\n[ 854.574525] kthread+0xd9/0x110\n[ 854.574529] ? process_one_work+0x580/0x580\n[ 854.574534] ? kthread_create_on_node+0x30/0x30\n[ 854.574540] ret_from_fork+0x19/0x24\n\n[ 854.574548] =============================\n[ 854.574551] WARNING: suspicious RCU usage\n[ 854.574555] 4.13.0-mgm-ovl+ #52 Not tainted\n[ 854.574558] -----------------------------\n[ 854.574561] ../net/mac80211/tx.c:608 suspicious rcu_dereference_check() usage!\n[ 854.574564]\n other info that might help us debug this:\n\n[ 854.574568]\n rcu_scheduler_active = 2, debug_locks = 1\n[ 854.574572] 6 locks held by kworker/u2:0/2877:\n[ 854.574574] #0: (\"%s\"wiphy_name(local->hw.wiphy)){++++.+}, at: [<c1067f37>] process_one_work+0x127/0x580\n[ 854.574590] #1: ((&sdata->work)){+.+.+.}, at: [<c1067f37>] process_one_work+0x127/0x580\n[ 854.574606] #2: (&wdev->mtx){+.+.+.}, at: [<f83271c3>] ieee80211_sta_work+0x23/0x1c70 [mac80211]\n[ 854.574657] #3: (&local->sta_mtx){+.+.+.}, at: [<f82c9b10>] __sta_info_flush+0x60/0x160 [mac80211]\n[ 854.574702] #4: (&(&txq->axq_lock)->rlock){+.-...}, at: [<f825729c>] ath_tx_node_cleanup+0x5c/0x180 [ath9k]\n[ 854.574721] #5: (&(&fq->lock)->rlock){+.-...}, at: [<f82fb064>] ieee80211_tx_dequeue+0x24/0xa80 [mac80211]\n[ 854.574771]\n stack backtrace:\n[ 854.574775] CPU: 0 PID: 2877 Comm: kworker/u2:0 Not tainted 4.13.0-mgm-ovl+ #52\n[ 854.574779] Hardware name: FUJITSU SIEMENS LIFEBOOK S6120/FJNB16C, BIOS Version 1.26 05/10/2004\n[ 854.574814] Workqueue: phy0 ieee80211_iface_work [mac80211]\n[ 854.574821] Call Trace:\n[ 854.574825] dump_stack+0x16/0x19\n[ 854.574830] lockdep_rcu_suspicious+0xcb/0xf0\n[ 854.574869] ieee80211_tx_h_select_key+0x44e/0x500 [mac80211]\n[ 854.574908] ieee80211_tx_dequeue+0x283/0xa80 [mac80211]\n[ 854.574919] ath_tid_dequeue+0x84/0xf0 [ath9k]\n[ 854.574927] ath_tx_node_cleanup+0xb8/0x180 [ath9k]\n[ 854.574936] ath9k_sta_state+0x48/0xf0 [ath9k]\n[ 854.574945] ? ath9k_del_ps_key.isra.19+0x60/0x60 [ath9k]\n[ 854.574978] drv_sta_state+0xaf/0x8c0 [mac80211]\n[ 854.575012] __sta_info_destroy_part2+0x10b/0x140 [mac80211]\n[ 854.575046] __sta_info_flush+0xd5/0x160 [mac80211]\n[ 854.575087] ieee80211_set_disassoc+0xd3/0x570 [mac80211]\n[ 854.575127] ieee80211_sta_connection_lost+0x30/0x60 [mac80211]\n[ 854.575168] ieee80211_sta_work+0x1ff/0x1c70 [mac80211]\n[ 854.575173] ? mark_held_locks+0x62/0x90\n[ 854.575178] ? _raw_spin_unlock_irqrestore+0x55/0x70\n[ 854.575182] ? trace_hardirqs_on_caller+0x11c/0x1a0\n[ 854.575187] ? trace_hardirqs_on+0xb/0x10\n[ 854.575192] ? dev_mc_net_exit+0xe/0x20\n[ 854.575197] ? skb_dequeue+0x48/0x70\n[ 854.575233] ieee80211_iface_work+0x2d8/0x320 [mac80211]\n[ 854.575238] process_one_work+0x1d1/0x580\n[ 854.575243] ? process_one_work+0x127/0x580\n[ 854.575248] worker_thread+0x31/0x380\n[ 854.575253] kthread+0xd9/0x110\n[ 854.575257] ? process_one_work+0x580/0x580\n[ 854.575262] ? kthread_create_on_node+0x30/0x30\n[ 854.575267] ret_from_fork+0x19/0x24\n\nv2: Callers of ieee80211_tx() already have the\n rcu_read_lock/unlock()\n Move the rcu critical section inside the spinlock in\n ieee80211_tx_dequeue() (Johannes Berg)\n\nCc: Johannes Berg <johannes@sipsolutions.net>\nCc: \"David S. Miller\" <davem@davemloft.net>\nCc: netdev@vger.kernel.org\nSigned-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>\n---\n net/mac80211/tx.c | 17 +++++++++++++++--\n 1 file changed, 15 insertions(+), 2 deletions(-)", "diff": "diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c\nindex 94826680cf2b..fc4d8294d664 100644\n--- a/net/mac80211/tx.c\n+++ b/net/mac80211/tx.c\n@@ -1770,15 +1770,21 @@ bool ieee80211_tx_prepare_skb(struct ieee80211_hw *hw,\n \tstruct ieee80211_tx_data tx;\n \tstruct sk_buff *skb2;\n \n-\tif (ieee80211_tx_prepare(sdata, &tx, NULL, skb) == TX_DROP)\n+\trcu_read_lock();\n+\n+\tif (ieee80211_tx_prepare(sdata, &tx, NULL, skb) == TX_DROP) {\n+\t\trcu_read_unlock();\n \t\treturn false;\n+\t}\n \n \tinfo->band = band;\n \tinfo->control.vif = vif;\n \tinfo->hw_queue = vif->hw_queue[skb_get_queue_mapping(skb)];\n \n-\tif (invoke_tx_handlers(&tx))\n+\tif (invoke_tx_handlers(&tx)) {\n+\t\trcu_read_unlock();\n \t\treturn false;\n+\t}\n \n \tif (sta) {\n \t\tif (tx.sta)\n@@ -1792,9 +1798,12 @@ bool ieee80211_tx_prepare_skb(struct ieee80211_hw *hw,\n \tif (WARN_ON(skb2 != skb || !skb_queue_empty(&tx.skbs))) {\n \t\tieee80211_free_txskb(hw, skb2);\n \t\tieee80211_purge_tx_queue(hw, &tx.skbs);\n+\t\trcu_read_unlock();\n \t\treturn false;\n \t}\n \n+\trcu_read_unlock();\n+\n \treturn true;\n }\n EXPORT_SYMBOL(ieee80211_tx_prepare_skb);\n@@ -3413,6 +3422,8 @@ struct sk_buff *ieee80211_tx_dequeue(struct ieee80211_hw *hw,\n \n \tspin_lock_bh(&fq->lock);\n \n+\trcu_read_lock();\n+\n \tif (test_bit(IEEE80211_TXQ_STOP, &txqi->flags))\n \t\tgoto out;\n \n@@ -3511,6 +3522,8 @@ struct sk_buff *ieee80211_tx_dequeue(struct ieee80211_hw *hw,\n \n \tIEEE80211_SKB_CB(skb)->control.vif = vif;\n out:\n+\trcu_read_unlock();\n+\n \tspin_unlock_bh(&fq->lock);\n \n \treturn skb;\n", "prefixes": [ "v2", "1/2" ] }