sched: Switch wait_task_inactive to HRTIMER_MODE_REL_HARD
PATCH 1/1 sched: Switch wait_task_inactive to HRTIMER_MODE_REL_HARD
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 a user interface to abuse it and create a mass wake up of several tasks at the same time leading 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.
--- kernel/sched/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/sched/core.c +1 -1
@@ -3081,7 +3081,7 @@ unsigned long wait_task_inactive(struct task_struct *p, unsigned int match_statektime_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 ; }
Signature · 1 line
2.33.0
Peter Zijlstra
maintainerQuoted 15 lines · Sebastian Andrzej Siewior
With
PREEMPT_RTenabled all hrtimers callbacks will be invoked in
softirq mode unless they are explicitly marked asHRTIMER_MODE_HARD.
During bootkthread_bind()is used for the creation of per-CPU threads
and then hangs inwait_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 callschedule()")but enabling function trace on boot reliably leads to the freeze on boot behaviour again.
The timer inwait_task_inactive()can not be directly used by a user interface to abuse it and create a mass wake up of several tasks at the same time leading to long sections with disabled interrupts. Therefore it is safe to make the timerHRTIMER_MODE_REL_HARD.
Quoted 3 lines
Switch the timer to
HRTIMER_MODE_REL_HARD.Signed-off-by Sebastian Andrzej Siewior <[email protected]>
Thanks!
The following commit has been merged into the sched/core branch of tip:
The following commit has been merged into the sched/core branch of tip:
Commit-ID: e9e5ba93a24d946d6e70d5c85f74254335a6555b Gitweb: https://git.kernel.org/tip/e9e5ba93a24d946d6e70d5c85f74254335a6555b Author: Sebastian Andrzej Siewior <[email protected]> AuthorDate: Thu, 26 Aug 2021 19:04:08 +02:00 Committer: Peter Zijlstra <[email protected]> CommitterDate: Thu, 09 Sep 2021 11:27:30 +02:00
sched: Switch wait_task_inactive to HRTIMER_MODE_REL_HARD
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 a user interface to abuse it and create a mass wake up of several tasks at the same time leading 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.
--- kernel/sched/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/sched/core.c +1 -1
@@ -3234,7 +3234,7 @@ unsigned long wait_task_inactive(struct task_struct *p, unsigned int match_statektime_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 ; }
The following commit has been merged into the sched/core branch of tip:
The following commit has been merged into the sched/core branch of tip:
Commit-ID: c33627e9a1143afb988fb98d917c4a2faa16f9d9 Gitweb: https://git.kernel.org/tip/c33627e9a1143afb988fb98d917c4a2faa16f9d9 Author: Sebastian Andrzej Siewior <[email protected]> AuthorDate: Thu, 26 Aug 2021 19:04:08 +02:00 Committer: Peter Zijlstra <[email protected]> CommitterDate: Tue, 05 Oct 2021 15:51:32 +02:00
sched: Switch wait_task_inactive to HRTIMER_MODE_REL_HARD
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 a user interface to abuse it and create a mass wake up of several tasks at the same time leading 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.
--- kernel/sched/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/sched/core.c +1 -1
@@ -3251,7 +3251,7 @@ unsigned long wait_task_inactive(struct task_struct *p, unsigned int match_statektime_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 ; }