v6.3.1-rt13
Dear RT folks!
I'm pleased to announce the v6.3.1-rt13 patch set.
Changes since v6.3.1-rt12:
- Two posix-timers picked-up from the list. They are scheduled for upstream inclusion. One of prevents a livelock on PREEMPT_RT in itimer_delete(). Patches by Thomas Gleixner.
- A softirq handling patch from the list 'revert: "softirq: Let ksoftirqd do its job' from Paolo Abeni. This revert should reduce a lot of trouble which start once ksoftirqd is woken up. The 6.1-RT series has the ktimersd thread which mitigates some of the pain. This patch should render the patch obsolete. Should everything work out as expected I intend to backport this patch the earlier RT series and revert the ktimersd patch in the v6.1 series.
Known issues
None
The delta patch against v6.3.1-rt12 is appended below and can be found here:
https://cdn.kernel.org/pub/linux/kernel/projects/rt/6.3/incr/patch-6.3.1-rt12-rt13.patch.xz
You can get this release via the git tree at:
git://git.kernel.org/pub/scm/linux/kernel/git/rt/linux-rt-devel.git v6.3.1-rt13
The RT patch against v6.3.1 can be found here:
https://cdn.kernel.org/pub/linux/kernel/projects/rt/6.3/older/patch-6.3.1-rt13.patch.xz
The split quilt queue is available at:
https://cdn.kernel.org/pub/linux/kernel/projects/rt/6.3/older/patches-6.3.1-rt13.tar.xz
Sebastian
include/linux/sched/signal.h +1 -1
@@ -136,7 +136,7 @@ struct signal_struct {#ifdef CONFIG_POSIX_TIMERS /* POSIX.1b Interval Timers */ -int posix_timer_id; +unsigned int next_posix_timer_id;struct list_head posix_timers;/* ITIMER_REAL timer for the process */
kernel/softirq.c +2 -20
@@ -80,21 +80,6 @@ static void wakeup_softirqd(void)wake_up_process (tsk); } -/* -* If ksoftirqd is scheduled, we do not want to process pending softirqs -* right now. Let ksoftirqd handle this at its own rate, to get fairness, -* unless we're doing some of the synchronous softirqs. -*/ -#define SOFTIRQ_NOW_MASK ((1 << HI_SOFTIRQ) | (1 << TASKLET_SOFTIRQ)) -static bool ksoftirqd_running (unsigned long pending) -{ -struct task_struct *tsk =__this_cpu_read (ksoftirqd); - -if (pending &SOFTIRQ_NOW_MASK ) -return false; -return tsk &&task_is_running (tsk) && !__kthread_should_park (tsk); -} -#ifdef CONFIG_TRACE_IRQFLAGS DEFINE_PER_CPU (int, hardirqs_enabled);DEFINE_PER_CPU (int, hardirq_context);
@@ -236,7 +221,7 @@ void __local_bh_enable_ip(unsigned long ip, unsigned int cnt) goto out; pending =local_softirq_pending (); -if (!pending ||ksoftirqd_running (pending)) +if (!pending) goto out;/*
@@ -432,9 +417,6 @@ static inline bool should_wake_ksoftirqd(void)static inline void invoke_softirq (void ) { -if (ksoftirqd_running (local_softirq_pending ())) -return ; -if (!force_irqthreads () || !__this_cpu_read (ksoftirqd)) {#ifdef CONFIG_HAVE_IRQ_EXIT_ON_IRQ_STACK /*
@@ -468,7 +450,7 @@ asmlinkage __visible void do_softirq(void) pending =local_softirq_pending (); -if (pending && !ksoftirqd_running (pending)) +if (pending)do_softirq_own_stack ();local_irq_restore (flags);
kernel/time/posix-timers.c +59 -21
121 lines not on this page · raw message
localversion-rt +1 -1
@@ -1 +1 @@ --rt12 +-rt13
Quoted 10 lines · Sebastian Andrzej Siewior
Dear RT folks!
I'm pleased to announce the v6.3.1-rt13 patch set.
Changes since v6.3.1-rt12:
- Two posix-timers picked-up from the list. They are scheduled for upstream inclusion. One of prevents a livelock on
PREEMPT_RTinitimer_delete(). Patches by Thomas Gleixner.
Quoted 8 lines
- A softirq handling patch from the list 'revert: "softirq: Let ksoftirqd do its job' from Paolo Abeni. This revert should reduce a lot of trouble which start once ksoftirqd is woken up. The 6.1-RT series has the ktimersd thread which mitigates some of the pain. This patch should render the patch obsolete. Should everything work out as expected I intend to backport this patch the earlier RT series and revert the ktimersd patch in the v6.1 series.
The ktimersd threads solved some priority inversion problem we were seeing, IIRC it looked something like so:
- GP kthread is waiting on swait_event_idle_timeout_exclusive(...)
- p0 (CFS NICE0) did spin_lock(L) then got throttled by CFS bandwidth
- p1 (CFS NICE0) did local_bh_disable() + did spin_lock(L)
So p0 owns L, but cannot get bandwidth replenished since local softirqs are disabled, and the GP kthread can't be woken up by timeout to initiate boosting either.
Even if ksoftirqd has its priority tuned to ensure timers can be expired, the above never wakes ksoftirqd due to:
static inline bool should_wake_ksoftirqd(void)
{
return !this_cpu_read(softirq_ctrl.cnt);
}on the other hand, ktimersd are woken up unconditionally, so in this scenario it gets to run and donate its priority via
ksoftirqd_run_begin()
`\
local_lock(&softirq_ctrl.lock)(note that this only solves the CFS bandwidth issue if ktimersd are FIFO or above, but they are spawned as FIFO1)
TL;DR: for RT, I think we should also kill should_wake_ksoftirqd()
Quoted 25 lines · Valentin Schneider
The ktimersd threads solved some priority inversion problem we were seeing, IIRC it looked something like so:
- GP kthread is waiting onswait_event_idle_timeout_exclusive(...)
- p0 (CFS NICE0) didspin_lock(L)then got throttled by CFS bandwidth
- p1 (CFS NICE0) didlocal_bh_disable()+ didspin_lock(L)So p0 owns L, but cannot get bandwidth replenished since local softirqs are disabled, and the GP kthread can't be woken up by timeout to initiate boosting either.
Even if ksoftirqd has its priority tuned to ensure timers can be expired, the above never wakes ksoftirqd due to:
static inline bool
should_wake_ksoftirqd(void){ return !this_cpu_read(softirq_ctrl.cnt); }on the other hand, ktimersd are woken up unconditionally, so in this scenario it gets to run and donate its priority via
ksoftirqd_run_begin() `\ local_lock(&softirq_ctrl.lock)
Quoted 5 lines
(note that this only solves the CFS bandwidth issue if ktimersd are FIFO or above, but they are spawned as FIFO1)
TL;DR: for RT, I think we should also kill
should_wake_ksoftirqd()
If I remember correctly this check was to avoid waking ksoftirqd because softirqs are already handled. In this case the systems stalls until p0/1 makes some progress. Waking ksoftirqd makes sense if its scheduling policy is elevated.
Now we need overloading strategy since the current idea is to solve it by moving everything to ksoftirqd and letting it run at SCHED_OTHER.
Sebastian