Search Linux Wireless

Re: [PATCH] net: mac80211: Disable preeemption when updating stat counters

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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




[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Wireless Regulations]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux