summaryrefslogtreecommitdiffstats
path: root/debian/patches-rt/0017-sched-Switch-wait_task_inactive-to-HRTIMER_MODE_REL_.patch
diff options
context:
space:
mode:
Diffstat (limited to 'debian/patches-rt/0017-sched-Switch-wait_task_inactive-to-HRTIMER_MODE_REL_.patch')
-rw-r--r--debian/patches-rt/0017-sched-Switch-wait_task_inactive-to-HRTIMER_MODE_REL_.patch47
1 files changed, 47 insertions, 0 deletions
diff --git a/debian/patches-rt/0017-sched-Switch-wait_task_inactive-to-HRTIMER_MODE_REL_.patch b/debian/patches-rt/0017-sched-Switch-wait_task_inactive-to-HRTIMER_MODE_REL_.patch
new file mode 100644
index 000000000..69e6b1074
--- /dev/null
+++ b/debian/patches-rt/0017-sched-Switch-wait_task_inactive-to-HRTIMER_MODE_REL_.patch
@@ -0,0 +1,47 @@
+From c12c9235290c517ea3420483ee9b9c9d84ecf43e Mon Sep 17 00:00:00 2001
+From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+Date: Tue, 24 Aug 2021 22:47:37 +0200
+Subject: [PATCH 017/158] sched: Switch wait_task_inactive to
+ HRTIMER_MODE_REL_HARD
+Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/5.15/older/patches-5.15.10-rt24.tar.xz
+
+With PREEMPT_RT enabled all hrtimers callbacks will be invoked in
+softirq mode unless they are explicitly marked as HRTIMER_MODE_HARD.
+During boot kthread_bind() is used for the creation of per-CPU threads
+and then hangs in wait_task_inactive() if the ksoftirqd is not
+yet up and running.
+The hang disappeared since commit
+ 26c7295be0c5e ("kthread: Do not preempt current task if it is going to call schedule()")
+
+but enabling function trace on boot reliably leads to the freeze on boot
+behaviour again.
+The timer in wait_task_inactive() can not be directly used by an user
+interface to abuse it and create a mass wake of several tasks at the
+same time which would to long sections with disabled interrupts.
+Therefore it is safe to make the timer HRTIMER_MODE_REL_HARD.
+
+Switch the timer to HRTIMER_MODE_REL_HARD.
+
+Cc: stable-rt@vger.kernel.org
+Link: https://lkml.kernel.org/r/20210826170408.vm7rlj7odslshwch@linutronix.de
+Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+---
+ kernel/sched/core.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/kernel/sched/core.c b/kernel/sched/core.c
+index c5f12805300e..9d31a1b174d2 100644
+--- a/kernel/sched/core.c
++++ b/kernel/sched/core.c
+@@ -3250,7 +3250,7 @@ unsigned long wait_task_inactive(struct task_struct *p, unsigned int match_state
+ ktime_t to = NSEC_PER_SEC / HZ;
+
+ set_current_state(TASK_UNINTERRUPTIBLE);
+- schedule_hrtimeout(&to, HRTIMER_MODE_REL);
++ schedule_hrtimeout(&to, HRTIMER_MODE_REL_HARD);
+ continue;
+ }
+
+--
+2.33.1
+