From: Johannes Berg <johannes@sipsolutions.net>
To: Aaron Hill <aa1ronham@gmail.com>, linux-wireless@vger.kernel.org
Cc: "David S. Miller" <davem@davemloft.net>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
"Jiri Kosina" <jikos@kernel.org>,
"Toke Høiland-Jørgensen" <toke@redhat.com>
Subject: Re: [PATCH] net: mac80211: Disable preeemption when updating stat counters
Date: Tue, 01 Oct 2019 12:00:52 +0200 [thread overview]
Message-ID: <457e2714b0cdf05eb404b8efcf5b8c6c0c47aeaa.camel@sipsolutions.net> (raw)
In-Reply-To: <20190927154102.GA117350@ArchLaptop> (sfid-20190927_174105_775365_206EE7BA)
On Fri, 2019-09-27 at 11:41 -0400, Aaron Hill wrote:
> The mac80211 subsystem maintains per-cpu stat counters for receive and
> transmit operations. Previously, preemption was not disabled when
> updating these counters. This creates a race condition where two cpus
> could attempt to update the same counters using non-atomic operations.
>
> This was causing a
> 'BUG: using smp_processor_id() in preemptible [00000000] code'
> message to be printed, along with a stacktrace. This was reported
> in a few different places:
>
> * https://www.spinics.net/lists/linux-wireless/msg189992.html
> * https://bugzilla.kernel.org/show_bug.cgi?id=204127
>
> This patch adds calls to preempt_disable() and preempt_enable()
> surrounding the updating of the stat counters.
That seems like basically the same as what Jiri reported, but now I'm
even more confused...
Ah. CONFIG_PREEMPT_RCU...
But if we keep BHs disabled, it should still be OK, so what I suggested
to Jiri will also address this I think?
diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index 051a02ddcb85..ad1e88958da2 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -273,9 +273,9 @@ static void __ieee80211_wake_txqs(struct ieee80211_sub_if_data *sdata, int ac)
&txqi->flags))
continue;
- spin_unlock_bh(&fq->lock);
+ spin_unlock(&fq->lock);
drv_wake_tx_queue(local, txqi);
- spin_lock_bh(&fq->lock);
+ spin_lock(&fq->lock);
}
}
johannes
prev parent reply other threads:[~2019-10-01 10:01 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-27 15:41 [PATCH] net: mac80211: Disable preeemption when updating stat counters Aaron Hill
2019-10-01 10:00 ` Johannes Berg [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=457e2714b0cdf05eb404b8efcf5b8c6c0c47aeaa.camel@sipsolutions.net \
--to=johannes@sipsolutions.net \
--cc=aa1ronham@gmail.com \
--cc=davem@davemloft.net \
--cc=jikos@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=toke@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).