linux-wpan.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH 0/2] Introduce assert_in_softirq()
@ 2018-05-04 17:51 Sebastian Andrzej Siewior
  2018-05-04 17:51 ` [RFC PATCH 1/2] lockdep: Add a assert_in_softirq() Sebastian Andrzej Siewior
  2018-05-04 17:51 ` [RFC PATCH 2/2] net: mac808211: mac802154: use lockdep_assert_in_softirq() instead own warning Sebastian Andrzej Siewior
  0 siblings, 2 replies; 9+ messages in thread
From: Sebastian Andrzej Siewior @ 2018-05-04 17:51 UTC (permalink / raw)
  To: linux-kernel
  Cc: tglx, Peter Zijlstra, Ingo Molnar, David S. Miller,
	Johannes Berg, Alexander Aring, Stefan Schmidt, netdev,
	linux-wireless, linux-wpan

ieee80211_rx_napi() has a check to ensure that it is invoked in softirq
context / with BH disabled. It is there because it invokes
netif_receive_skb() which has this requirement.
On -RT this check does not work as expected so there is always this
warning.
Tree wide there are two users of this check: ieee80211_rx_napi() and
ieee802154_rx(). This approach introduces assert_in_softirq() which does
the check if lockdep is enabled. This check could then become a nop on
-RT.

As an alternative netif_receive_skb() (or ieee80211_rx_napi() could do
local_bh_disable() / local_bh_enable() unconditionally. The _disable()
part is very cheap. The _enable() part is more expensive because it
includes a function call. We could avoid that jump in the likely case
when BH was already disabled by something like:

 static inline void local_bh_enable(void)
 {
         if (softirq_count() == SOFTIRQ_DISABLE_OFFSET)
                 __local_bh_enable_ip(_THIS_IP_, SOFTIRQ_DISABLE_OFFSET);
         else
                 preempt_count_sub(SOFTIRQ_DISABLE_OFFSET);
 }

Which would make bh_enable() cheaper for everyone.

Sebastian



^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2018-05-05  7:07 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-04 17:51 [RFC PATCH 0/2] Introduce assert_in_softirq() Sebastian Andrzej Siewior
2018-05-04 17:51 ` [RFC PATCH 1/2] lockdep: Add a assert_in_softirq() Sebastian Andrzej Siewior
2018-05-04 17:51 ` [RFC PATCH 2/2] net: mac808211: mac802154: use lockdep_assert_in_softirq() instead own warning Sebastian Andrzej Siewior
2018-05-04 18:32   ` Peter Zijlstra
2018-05-04 18:45     ` Sebastian Andrzej Siewior
2018-05-04 18:51       ` Peter Zijlstra
2018-05-04 19:07         ` Sebastian Andrzej Siewior
2018-05-04 20:09           ` Peter Zijlstra
2018-05-05  7:06           ` Ingo Molnar

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).