From patchwork Wed Jun 29 12:00:34 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Kazior X-Patchwork-Id: 9205001 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id DF2A16075F for ; Wed, 29 Jun 2016 11:59:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CF69228634 for ; Wed, 29 Jun 2016 11:59:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C3BF428655; Wed, 29 Jun 2016 11:59:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4E70C28634 for ; Wed, 29 Jun 2016 11:59:21 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bIE9A-0002AA-KD; Wed, 29 Jun 2016 11:59:12 +0000 Received: from mail-lf0-x233.google.com ([2a00:1450:4010:c07::233]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bIE98-00023e-5t for ath10k@lists.infradead.org; Wed, 29 Jun 2016 11:59:10 +0000 Received: by mail-lf0-x233.google.com with SMTP id l188so31744637lfe.2 for ; Wed, 29 Jun 2016 04:58:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tieto.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=rBibQHgLVGsiqzp8GLMtZWv3leNJLtOMLV2kTpygwKI=; b=TnEXN4cKJdiNIw1wJpmn57lzvTL8PyZcfWNi9YKAnBBu4E2exiDPDUCev5P9bxN8xO la+LbI4RX7UimWU+P08g4w92bEjAbqgwJ0g0/IqcmNEy/8r4OBz1GOtC1yA8kTpWimLZ iFlZxJzn6kxiG4y8ut7coq/qBOiMgTzOyPSUU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=rBibQHgLVGsiqzp8GLMtZWv3leNJLtOMLV2kTpygwKI=; b=OWmFVUSLenFiWPwyPipmpdz3aaBQ7iniEJQ6VfC2QwPOWg7phG8a4lWtIWIr+DhDEf btea5XcN1COuciXOKqNK+2FNftxXRSyJLA7pByHToSCspdrdtAif6Ovo8StR0dNI+lnJ 8UYpkPZ7g3ZSH/SteN+oEqvHTj1OOytewVDTk0q0Tih21Op+UqoQzpkMSuldZMaO7JyR dj3ecQqhLiIqvYgBPvr93XiOWnmTo+J4KjLjGD8nUzWntGPmM3i9JNLivpjg+4stCD1m ODrdEZLt8bBqLQ1wDK5+sx5+2HGajN8kEuXEBGMtGlmb+mKgbceJbvavIn8YKv9frTVc kFig== X-Gm-Message-State: ALyK8tI8VggruGFd0TYIltZ+1Xxv3IwH1+VI6dmeKFtLW/sQZ3gVBFq46zf7RRu04eGlAangFAiqNIPEx11YZUdZ1dEL0NLqc+E59geb22N/rWx9gQ+/vkS5ZcTOeO08ZZNTr/m8 X-Received: by 10.25.212.77 with SMTP id l74mr2458984lfg.176.1467201528219; Wed, 29 Jun 2016 04:58:48 -0700 (PDT) Received: from localhost.localdomain ([91.198.246.8]) by smtp.gmail.com with ESMTPSA id 78sm583091lfs.29.2016.06.29.04.58.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 29 Jun 2016 04:58:46 -0700 (PDT) From: Michal Kazior To: johannes@sipsolutions.net Subject: [PATCH] mac80211: fix fq lockdep warnings Date: Wed, 29 Jun 2016 14:00:34 +0200 Message-Id: <1467201634-11060-1-git-send-email-michal.kazior@tieto.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1467026569-19329-1-git-send-email-michal.kazior@tieto.com> References: <1467026569-19329-1-git-send-email-michal.kazior@tieto.com> X-DomainID: tieto.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160629_045910_438598_F20A2486 X-CRM114-Status: GOOD ( 10.40 ) X-BeenThere: ath10k@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kvalo@qca.qualcomm.com, linux-wireless@vger.kernel.org, Michal Kazior , ath10k@lists.infradead.org MIME-Version: 1.0 Sender: "ath10k" Errors-To: ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Some lockdep assertions were not fulfilled and resulted in a kernel warning/call trace if driver used intermediate software queues (e.g. ath10k). Existing code sequences should've guranteed safety but it's always good to be extra careful. The call trace could look like this: [ 237.335805] ------------[ cut here ]------------ [ 237.335852] WARNING: CPU: 3 PID: 1921 at include/net/fq_impl.h:22 fq_flow_dequeue+0xed/0x140 [mac80211] [ 237.335855] Modules linked in: ath10k_pci(E-) ath10k_core(E) ath(E) mac80211(E) cfg80211(E) [ 237.335913] CPU: 3 PID: 1921 Comm: rmmod Tainted: G W E 4.7.0-rc4-wt-ath+ #1377 [ 237.335916] Hardware name: Hewlett-Packard HP ProBook 6540b/1722, BIOS 68CDD Ver. F.04 01/27/2010 [ 237.335918] 00200286 00200286 eff85dac c14151e2 f901574e 00000000 eff85de0 c1081075 [ 237.335928] c1ab91f0 00000003 00000781 f901574e 00000016 f8fbabad f8fbabad 00000016 [ 237.335938] eb24ff60 00000000 ef3886c0 eff85df4 c10810ba 00000009 00000000 00000000 [ 237.335948] Call Trace: [ 237.335953] [] dump_stack+0x76/0xb4 [ 237.335957] [] __warn+0xe5/0x100 [ 237.336002] [] ? fq_flow_dequeue+0xed/0x140 [mac80211] [ 237.336046] [] ? fq_flow_dequeue+0xed/0x140 [mac80211] [ 237.336053] [] warn_slowpath_null+0x2a/0x30 [ 237.336095] [] fq_flow_dequeue+0xed/0x140 [mac80211] [ 237.336137] [] fq_flow_reset.constprop.56+0x2a/0x90 [mac80211] [ 237.336180] [] fq_reset.constprop.59+0x2a/0x50 [mac80211] [ 237.336222] [] ieee80211_txq_teardown_flows+0x38/0x40 [mac80211] [ 237.336258] [] ieee80211_unregister_hw+0xe4/0x120 [mac80211] [ 237.336275] [] ath10k_mac_unregister+0x16/0x50 [ath10k_core] [ 237.336292] [] ath10k_core_unregister+0x3d/0x90 [ath10k_core] [ 237.336301] [] ath10k_pci_remove+0x36/0xa0 [ath10k_pci] [ 237.336307] [] pci_device_remove+0x38/0xb0 ... Fixes: 5caa328e3811 ("mac80211: implement codel on fair queuing flows") Fixes: fa962b92120b ("mac80211: implement fair queueing per txq") Tested-by: Kalle Valo Reported-by: Kalle Valo Signed-off-by: Michal Kazior --- Notes: v1: - added Tested-by [Kalle] - swapped first/last name in Reported-by to match Tested-by - improve commit log net/mac80211/tx.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index fa8d38eb9236..91461c415525 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c @@ -1449,7 +1449,9 @@ int ieee80211_txq_setup_flows(struct ieee80211_local *local) local->cvars = kcalloc(fq->flows_cnt, sizeof(local->cvars[0]), GFP_KERNEL); if (!local->cvars) { + spin_lock_bh(&fq->lock); fq_reset(fq, fq_skb_free_func); + spin_unlock_bh(&fq->lock); return -ENOMEM; } @@ -1469,7 +1471,9 @@ void ieee80211_txq_teardown_flows(struct ieee80211_local *local) kfree(local->cvars); local->cvars = NULL; + spin_lock_bh(&fq->lock); fq_reset(fq, fq_skb_free_func); + spin_unlock_bh(&fq->lock); } struct sk_buff *ieee80211_tx_dequeue(struct ieee80211_hw *hw,