Skip to content

Commit 8380c81

Browse files
Sebastian Andrzej Siewiordavem330
authored andcommitted
net: Treat __napi_schedule_irqoff() as __napi_schedule() on PREEMPT_RT
__napi_schedule_irqoff() is an optimized version of __napi_schedule() which can be used where it is known that interrupts are disabled, e.g. in interrupt-handlers, spin_lock_irq() sections or hrtimer callbacks. On PREEMPT_RT enabled kernels this assumptions is not true. Force- threaded interrupt handlers and spinlocks are not disabling interrupts and the NAPI hrtimer callback is forced into softirq context which runs with interrupts enabled as well. Chasing all usage sites of __napi_schedule_irqoff() is a whack-a-mole game so make __napi_schedule_irqoff() invoke __napi_schedule() for PREEMPT_RT kernels. The callers of ____napi_schedule() in the networking core have been audited and are correct on PREEMPT_RT kernels as well. Reported-by: Juri Lelli <[email protected]> Signed-off-by: Sebastian Andrzej Siewior <[email protected]> Reviewed-by: Thomas Gleixner <[email protected]> Reviewed-by: Juri Lelli <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 4a5fe57 commit 8380c81

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

net/core/dev.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6501,11 +6501,18 @@ EXPORT_SYMBOL(napi_schedule_prep);
65016501
* __napi_schedule_irqoff - schedule for receive
65026502
* @n: entry to schedule
65036503
*
6504-
* Variant of __napi_schedule() assuming hard irqs are masked
6504+
* Variant of __napi_schedule() assuming hard irqs are masked.
6505+
*
6506+
* On PREEMPT_RT enabled kernels this maps to __napi_schedule()
6507+
* because the interrupt disabled assumption might not be true
6508+
* due to force-threaded interrupts and spinlock substitution.
65056509
*/
65066510
void __napi_schedule_irqoff(struct napi_struct *n)
65076511
{
6508-
____napi_schedule(this_cpu_ptr(&softnet_data), n);
6512+
if (!IS_ENABLED(CONFIG_PREEMPT_RT))
6513+
____napi_schedule(this_cpu_ptr(&softnet_data), n);
6514+
else
6515+
__napi_schedule(n);
65096516
}
65106517
EXPORT_SYMBOL(__napi_schedule_irqoff);
65116518

0 commit comments

Comments
 (0)