public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net: Handle napi_schedule() calls from non-interrupt
@ 2025-02-21 17:30 Frederic Weisbecker
  2025-02-21 17:59 ` Joe Damato
  0 siblings, 1 reply; 4+ messages in thread
From: Frederic Weisbecker @ 2025-02-21 17:30 UTC (permalink / raw)
  To: LKML
  Cc: Frederic Weisbecker, netdev, Breno Leitao, Jakub Kicinski,
	David S. Miller, Eric Dumazet, Paolo Abeni, Francois Romieu,
	Paul Menzel

napi_schedule() is expected to be called either:

* From an interrupt, where raised softirqs are handled on IRQ exit

* From a softirq disabled section, where raised softirqs are handled on
  the next call to local_bh_enable().

* From a softirq handler, where raised softirqs are handled on the next
  round in do_softirq(), or further deferred to a dedicated kthread.

Other bare tasks context may end up ignoring the raised NET_RX vector
until the next random softirq handling opportunity, which may not
happen before a while if the CPU goes idle afterwards with the tick
stopped.

Such "misuses" have been detected on several places thanks to messages
of the kind:

	"NOHZ tick-stop error: local softirq work is pending, handler #08!!!"

Chasing each and every misuse can be a long journey given the amount of
existing callers. Fixing them can also prove challenging if the caller
may be called from different kind of context.

Therefore fix this from napi_schedule() itself with waking up ksoftirqd
when softirqs are raised from task contexts.

Reported-by: Paul Menzel <pmenzel@molgen.mpg.de>
Closes: 354a2690-9bbf-4ccb-8769-fa94707a9340@molgen.mpg.de
Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
---
 net/core/dev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/core/dev.c b/net/core/dev.c
index c0021cbd28fc..2419cc558a64 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -4692,7 +4692,7 @@ static inline void ____napi_schedule(struct softnet_data *sd,
 	 * we have to raise NET_RX_SOFTIRQ.
 	 */
 	if (!sd->in_net_rx_action)
-		__raise_softirq_irqoff(NET_RX_SOFTIRQ);
+		raise_softirq_irqoff(NET_RX_SOFTIRQ);
 }
 
 #ifdef CONFIG_RPS
-- 
2.48.1


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

end of thread, other threads:[~2025-03-03  9:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-21 17:30 [PATCH] net: Handle napi_schedule() calls from non-interrupt Frederic Weisbecker
2025-02-21 17:59 ` Joe Damato
2025-02-21 22:12   ` Frederic Weisbecker
2025-03-03  9:46     ` MOESSBAUER, Felix

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox