softirq: Allow to drop the softirq-BKL lock on PREEMPT_RT
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>
Thu, 4 Sep 2025 14:25:25 +0000 (16:25 +0200)
committerThomas Gleixner <tglx@linutronix.de>
Wed, 17 Sep 2025 14:25:41 +0000 (16:25 +0200)
commit3253cb49cbad4772389d6ef55be75db1f97da910
tree2c628c0f0f9dd8177184507a35c48f5b83a19912
parentfd4e876f59b7e70283b4025c717cad8948397be1
softirq: Allow to drop the softirq-BKL lock on PREEMPT_RT

softirqs are preemptible on PREEMPT_RT. There is synchronisation between
individual sections which disable bottom halves. This in turn means that
a forced threaded interrupt cannot preempt another forced threaded
interrupt. Instead it will PI-boost the other handler and wait for its
completion.

This is required because code within a softirq section is assumed to be
non-preemptible and may expect exclusive access to per-CPU resources
such as variables or pinned timers.

Code with such expectation has been identified and updated to use
local_lock_nested_bh() for locking of the per-CPU resource. This means the
softirq lock can be removed.

Disable the softirq synchronization, but add a new config switch
CONFIG_PREEMPT_RT_NEEDS_BH_LOCK which allows to re-enable the synchronized
behavior in case that there are issues, which haven't been detected yet.

The softirq_ctrl.cnt accounting remains to let the NOHZ code know if
softirqs are currently handled.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
kernel/Kconfig.preempt
kernel/softirq.c