[RT,03/25] sched/deadline: Ensure inactive_timer runs in hardirq context
diff mbox series

Message ID 11a532007a600928e64e761722da7100e19a0c5f.1582320278.git.zanussi@kernel.org
State New
Headers show
Series
  • Linux v4.14.170-rt75-rc1
Related show

Commit Message

Tom Zanussi Feb. 21, 2020, 9:24 p.m. UTC
From: Juri Lelli <juri.lelli@redhat.com>

v4.14.170-rt75-rc1 stable review patch.
If anyone has any objections, please let me know.

-----------


[ Upstream commit ba94e7aed7405c58251b1380e6e7d73aa8284b41 ]

SCHED_DEADLINE inactive timer needs to run in hardirq context (as
dl_task_timer already does) on PREEMPT_RT

Change the mode to HRTIMER_MODE_REL_HARD.

[ tglx: Fixed up the start site, so mode debugging works ]

Signed-off-by: Juri Lelli <juri.lelli@redhat.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lkml.kernel.org/r/20190731103715.4047-1-juri.lelli@redhat.com
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Tom Zanussi <zanussi@kernel.org>
---
 kernel/sched/deadline.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Sebastian Andrzej Siewior Feb. 24, 2020, 8:33 a.m. UTC | #1
On 2020-02-21 15:24:31 [-0600], zanussi@kernel.org wrote:
> [ Upstream commit ba94e7aed7405c58251b1380e6e7d73aa8284b41 ]
> 
> SCHED_DEADLINE inactive timer needs to run in hardirq context (as
> dl_task_timer already does) on PREEMPT_RT

The message says "dl_task_timer already does" but this is not true for
v4.14 as it still runs in softirq context on RT. v4.19 has this either
via
  https://lkml.kernel.org/r/20190731103715.4047-1-juri.lelli@redhat.com

or the patch which got merged upstream.

Juri, I guess we want this for v4.14, too?

> Change the mode to HRTIMER_MODE_REL_HARD.
> 
> [ tglx: Fixed up the start site, so mode debugging works ]
> 
> Signed-off-by: Juri Lelli <juri.lelli@redhat.com>
> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
> Link: https://lkml.kernel.org/r/20190731103715.4047-1-juri.lelli@redhat.com
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> Signed-off-by: Tom Zanussi <zanussi@kernel.org>
> ---
>  kernel/sched/deadline.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
> index eb68f7fb8a36..7b04e54bea01 100644
> --- a/kernel/sched/deadline.c
> +++ b/kernel/sched/deadline.c
> @@ -252,7 +252,7 @@ static void task_non_contending(struct task_struct *p)
>  
>  	dl_se->dl_non_contending = 1;
>  	get_task_struct(p);
> -	hrtimer_start(timer, ns_to_ktime(zerolag_time), HRTIMER_MODE_REL);
> +	hrtimer_start(timer, ns_to_ktime(zerolag_time), HRTIMER_MODE_REL_HARD);
>  }
>  
>  static void task_contending(struct sched_dl_entity *dl_se, int flags)
> @@ -1234,7 +1234,7 @@ void init_dl_inactive_task_timer(struct sched_dl_entity *dl_se)
>  {
>  	struct hrtimer *timer = &dl_se->inactive_timer;
>  
> -	hrtimer_init(timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
> +	hrtimer_init(timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL_HARD);
>  	timer->function = inactive_task_timer;
>  }
>  

Sebastian
Juri Lelli Feb. 25, 2020, 2:50 p.m. UTC | #2
Hi,

On 24/02/20 09:33, Sebastian Andrzej Siewior wrote:
> On 2020-02-21 15:24:31 [-0600], zanussi@kernel.org wrote:
> > [ Upstream commit ba94e7aed7405c58251b1380e6e7d73aa8284b41 ]
> > 
> > SCHED_DEADLINE inactive timer needs to run in hardirq context (as
> > dl_task_timer already does) on PREEMPT_RT
> 
> The message says "dl_task_timer already does" but this is not true for
> v4.14 as it still runs in softirq context on RT. v4.19 has this either
> via
>   https://lkml.kernel.org/r/20190731103715.4047-1-juri.lelli@redhat.com
> 
> or the patch which got merged upstream.
> 
> Juri, I guess we want this for v4.14, too?

Indeed. v4.14 needs this as well.

Thanks for noticing!

Best,

Juri

Patch
diff mbox series

diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
index eb68f7fb8a36..7b04e54bea01 100644
--- a/kernel/sched/deadline.c
+++ b/kernel/sched/deadline.c
@@ -252,7 +252,7 @@  static void task_non_contending(struct task_struct *p)
 
 	dl_se->dl_non_contending = 1;
 	get_task_struct(p);
-	hrtimer_start(timer, ns_to_ktime(zerolag_time), HRTIMER_MODE_REL);
+	hrtimer_start(timer, ns_to_ktime(zerolag_time), HRTIMER_MODE_REL_HARD);
 }
 
 static void task_contending(struct sched_dl_entity *dl_se, int flags)
@@ -1234,7 +1234,7 @@  void init_dl_inactive_task_timer(struct sched_dl_entity *dl_se)
 {
 	struct hrtimer *timer = &dl_se->inactive_timer;
 
-	hrtimer_init(timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
+	hrtimer_init(timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL_HARD);
 	timer->function = inactive_task_timer;
 }