From patchwork Fri May 4 17:51:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Andrzej Siewior X-Patchwork-Id: 10381271 X-Patchwork-Delegate: johannes@sipsolutions.net 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 B59B860159 for ; Fri, 4 May 2018 17:53:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A3B79223A4 for ; Fri, 4 May 2018 17:53:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 96CBD28535; Fri, 4 May 2018 17:53:13 +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=-7.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 27AAC223A4 for ; Fri, 4 May 2018 17:53:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751721AbeEDRwH (ORCPT ); Fri, 4 May 2018 13:52:07 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:42369 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751492AbeEDRwF (ORCPT ); Fri, 4 May 2018 13:52:05 -0400 Received: from localhost ([127.0.0.1] helo=bazinga.breakpoint.cc) by Galois.linutronix.de with esmtp (Exim 4.80) (envelope-from ) id 1fEes7-0000Yf-GU; Fri, 04 May 2018 19:51:55 +0200 From: Sebastian Andrzej Siewior To: linux-kernel@vger.kernel.org Cc: tglx@linutronix.de, Peter Zijlstra , Ingo Molnar , "David S. Miller" , Johannes Berg , Alexander Aring , Stefan Schmidt , netdev@vger.kernel.org, linux-wireless@vger.kernel.org, linux-wpan@vger.kernel.org, Anna-Maria Gleixner , Sebastian Andrzej Siewior Subject: [RFC PATCH 2/2] net: mac808211: mac802154: use lockdep_assert_in_softirq() instead own warning Date: Fri, 4 May 2018 19:51:44 +0200 Message-Id: <20180504175144.12179-3-bigeasy@linutronix.de> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180504175144.12179-1-bigeasy@linutronix.de> References: <20180504175144.12179-1-bigeasy@linutronix.de> MIME-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Anna-Maria Gleixner The warning in ieee802154_rx() and ieee80211_rx_napi() is there to ensure the softirq context for the subsequent netif_receive_skb() call. The check could be moved into the netif_receive_skb() function to prevent all calling functions implement the checks on their own. Use the lockdep variant for softirq context check. While at it, add a lockdep based check for irq enabled as mentioned in the comment above netif_receive_skb(). Signed-off-by: Anna-Maria Gleixner Signed-off-by: Sebastian Andrzej Siewior --- net/core/dev.c | 3 +++ net/mac80211/rx.c | 2 -- net/mac802154/rx.c | 2 -- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/net/core/dev.c b/net/core/dev.c index af0558b00c6c..7b4b8611cc21 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -4750,6 +4750,9 @@ static int netif_receive_skb_internal(struct sk_buff *skb) */ int netif_receive_skb(struct sk_buff *skb) { + lockdep_assert_irqs_enabled(); + lockdep_assert_in_softirq(); + trace_netif_receive_skb_entry(skb); return netif_receive_skb_internal(skb); diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c index 03102aff0953..653332d81c17 100644 --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c @@ -4324,8 +4324,6 @@ void ieee80211_rx_napi(struct ieee80211_hw *hw, struct ieee80211_sta *pubsta, struct ieee80211_supported_band *sband; struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); - WARN_ON_ONCE(softirq_count() == 0); - if (WARN_ON(status->band >= NUM_NL80211_BANDS)) goto drop; diff --git a/net/mac802154/rx.c b/net/mac802154/rx.c index 4dcf6e18563a..66916c270efc 100644 --- a/net/mac802154/rx.c +++ b/net/mac802154/rx.c @@ -258,8 +258,6 @@ void ieee802154_rx(struct ieee802154_local *local, struct sk_buff *skb) { u16 crc; - WARN_ON_ONCE(softirq_count() == 0); - if (local->suspended) goto drop;