]> git.baikalelectronics.ru Git - kernel.git/commit
net: dev: Make rps_lock() disable interrupts.
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>
Fri, 11 Feb 2022 23:38:39 +0000 (00:38 +0100)
committerDavid S. Miller <davem@davemloft.net>
Mon, 14 Feb 2022 13:38:35 +0000 (13:38 +0000)
commit37a62ab2b6fb57743b3735bd8a2db7de94ee686d
tree46604408fd501b38af9bba9b363e5eebaa9cf1be
parent43ad27a5b2bf34b590d9e98b4cf8e5fe140df546
net: dev: Make rps_lock() disable interrupts.

Disabling interrupts and in the RPS case locking input_pkt_queue is
split into local_irq_disable() and optional spin_lock().

This breaks on PREEMPT_RT because the spinlock_t typed lock can not be
acquired with disabled interrupts.
The sections in which the lock is acquired is usually short in a sense that it
is not causing long und unbounded latiencies. One exception is the
skb_flow_limit() invocation which may invoke a BPF program (and may
require sleeping locks).

By moving local_irq_disable() + spin_lock() into rps_lock(), we can keep
interrupts disabled on !PREEMPT_RT and enabled on PREEMPT_RT kernels.
Without RPS on a PREEMPT_RT kernel, the needed synchronisation happens
as part of local_bh_disable() on the local CPU.
____napi_schedule() is only invoked if sd is from the local CPU. Replace
it with __napi_schedule_irqoff() which already disables interrupts on
PREEMPT_RT as needed. Move this call to rps_ipi_queued() and rename the
function to napi_schedule_rps as suggested by Jakub.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Reviewed-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/core/dev.c