mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: wen.yang@linux.dev
To: Thomas Gleixner <tglx@linutronix.de>,
	Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>
Cc: Wen Yang <wen.yang@linux.dev>,
	Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>,
	Ryo Takakura <ryotkkr98@gmail.com>,
	K Prateek Nayak <kprateek.nayak@amd.com>,
	linux-kernel@vger.kernel.org
Subject: [PATCH] softirq: allow raising NET_RX_SOFTIRQ from SMP call on RT
Date: Sat, 20 Dec 2025 01:58:48 +0800	[thread overview]
Message-ID: <20251219175848.28587-1-wen.yang@linux.dev> (raw)

From: Wen Yang <wen.yang@linux.dev>

RPS distributes network processing load across CPUs by enqueuing
packets on a remote CPU's backlog and raising NET_RX_SOFTIRQ to
process them. This is done via an smp_call_function.

On PREEMPT_RT kernels, raising a softirq from an SMP call function
can increase preemption-off latencies. A WARN_ON_ONCE() in
do_softirq_post_smp_call_flush() enforces this.

A previous commit 6675ce20046d ("softirq: Allow raising SCHED_SOFTIRQ from SMP-call-function on RT kernel")
allowed SCHED_SOFTIRQ to be raised for idle load balancing purposes.
A similar issue exists for RPS. When RPS targets a remote CPU, it uses
an SMP call to raise NET_RX_SOFTIRQ, which triggers the warning.

This patch extends the exception to also allow NET_RX_SOFTIRQ, preventing
the warning when RPS is active on an RT kernel.

Signed-off-by: Wen Yang <wen.yang@linux.dev>
Cc: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Cc: Ryo Takakura <ryotkkr98@gmail.com>
Cc: K Prateek Nayak <kprateek.nayak@amd.com>
Cc: linux-kernel@vger.kernel.org
---
 kernel/softirq.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/kernel/softirq.c b/kernel/softirq.c
index 5f435c1e48d8..53cccdb29a8f 100644
--- a/kernel/softirq.c
+++ b/kernel/softirq.c
@@ -341,15 +341,15 @@ static inline void invoke_softirq(void)
 		wakeup_softirqd();
 }
 
-#define SCHED_SOFTIRQ_MASK	BIT(SCHED_SOFTIRQ)
+#define SCHED_SOFTIRQ_MASK	(BIT(SCHED_SOFTIRQ) | BIT(NET_RX_SOFTIRQ))
 
 /*
  * flush_smp_call_function_queue() can raise a soft interrupt in a function
  * call. On RT kernels this is undesired and the only known functionalities
  * are in the block layer which is disabled on RT, and in the scheduler for
  * idle load balancing. If soft interrupts get raised which haven't been
- * raised before the flush, warn if it is not a SCHED_SOFTIRQ so it can be
- * investigated.
+ * raised before the flush, warn if it is not SCHED_SOFTIRQ or NET_RX_SOFTIRQ
+ * so it can be investigated.
  */
 void do_softirq_post_smp_call_flush(unsigned int was_pending)
 {
-- 
2.25.1


             reply	other threads:[~2025-12-19 17:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-19 17:58 wen.yang [this message]
2025-12-22  6:03 ` K Prateek Nayak
2025-12-24 16:08   ` Wen Yang

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=20251219175848.28587-1-wen.yang@linux.dev \
    --to=wen.yang@linux.dev \
    --cc=bigeasy@linutronix.de \
    --cc=kprateek.nayak@amd.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=penguin-kernel@I-love.SAKURA.ne.jp \
    --cc=peterz@infradead.org \
    --cc=ryotkkr98@gmail.com \
    --cc=tglx@linutronix.de \
    /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

all inboxes | Powered by JetHome®