softirq: allow raising NET_RX_SOFTIRQ from SMP call on RT
PATCH 1/1 softirq: allow raising NET_RX_SOFTIRQ from SMP call on RT
From: Wen Yang <[email protected]>
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.
--- kernel/softirq.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
kernel/softirq.c +3 -3
@@ -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) {
Signature · 1 line
2.25.1
Hello Wen,
Quoted 5 lines · On 12/19/2025 11:28 PM, [email protected] wrote:
From: Wen Yang <[email protected]>
RPS distributes network processing load across CPUs by enqueuing packets on a remote CPU's backlog and raising
NET_RX_SOFTIRQto process them. This is done via ansmp_call_function.
I'm assuming net_rps_send_ipi() is the function responsible for IPIs and the only two callers - net_rps_action_and_irq_enable() and dev_cpu_dead() - first check for "!use_backlog_threads()" before sending the IPI which is always false in case of PREEMPT_RT.
What is the path where you end up sending this IPI on PREEMPT_RT? Can you please trace the path of this problematic IPI on the latest upstream and prevent that instead?
Quoted 6 lines
On
PREEMPT_RTkernels, raising a softirq from an SMP call function can increase preemption-off latencies. AWARN_ON_ONCE()indo_softirq_post_smp_call_flush()enforces this.A previous commit
6675ce20046d("softirq: Allow raisingSCHED_SOFTIRQfrom SMP-call-function on RT kernel")
There is also a good justification in 6675ce20046d that idle load balancing periodically checks need_resched() and will bail out immediately if it detects a wakeup but the same cannot be expected of all NET_RX_SOFTIRQ handlers so ignoring the warning isn't a solution.
Signature · 2 lines
Thanks and Regards, Prateek
Quoted 9 lines · K Prateek Nayak
Hello Wen,
Quoted 5 lines · On 12/19/2025 11:28 PM, [email protected] wrote:
From: Wen Yang <[email protected]>
RPS distributes network processing load across CPUs by enqueuing packets on a remote CPU's backlog and raising
NET_RX_SOFTIRQto process them. This is done via ansmp_call_function.
Quoted 9 lines
I'm assuming
net_rps_send_ipi()is the function responsible for IPIs and the only two callers -net_rps_action_and_irq_enable()anddev_cpu_dead()- first check for "!use_backlog_threads()" before sending the IPI which is always false in case ofPREEMPT_RT.What is the path where you end up sending this IPI on
PREEMPT_RT? Can you please trace the path of this problematic IPI on the latest upstream and prevent that instead?
Thank you for your suggestion.
Our production environment uses 6.1 and 6.6 kernels, and after porting commit dad6b9770263 ("net: Allow to use SMP threads for backlog NAPI.") and its dependent patches, this issue has indeed been fixed.
--
Best wishes,
Wen
Quoted 12 lines
Quoted 6 lines
On
PREEMPT_RTkernels, raising a softirq from an SMP call function can increase preemption-off latencies. AWARN_ON_ONCE()indo_softirq_post_smp_call_flush()enforces this.A previous commit
6675ce20046d("softirq: Allow raisingSCHED_SOFTIRQfrom SMP-call-function on RT kernel")There is also a good justification in
6675ce20046dthat idle load balancing periodically checksneed_resched()and will bail out immediately if it detects a wakeup but the same cannot be expected of allNET_RX_SOFTIRQhandlers so ignoring the warning isn't a solution.