Skip to contentSkip to conversation

sched/deadline: Make inactive timer run in hardirq context

PATCH In review Juri Lelli 5 participants 8 messages Jul 31, 2019 – Aug 13, 2019 Scheduler

lore
Share & tools
lore

Juri Lelli

author maintainer
#0 lore raw

PATCH 1/1 sched/deadline: Make inactive timer run in hardirq context

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

Make it HRTIMER_MODE_REL_HARD.

---
Hi,

Both v4.19-rt and v5.2-rt need this.

Mainline "sched: Mark hrtimers to expire in hard interrupt context" series needs this as well ([email protected] in particular). Do I need to send out a separate patch for it?

Best,

Juri

---
 kernel/sched/deadline.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/sched/deadline.c +1 -1
index 1794e152d888..0889674b8915 100644
@@ -1292,7 +1292,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;
 }
 
Signature · 1 line
2.17.2
#1 lore raw

[tip:timers/core] sched/deadline: Ensure inactive_timer runs in hardirq context

sched/deadline: Ensure inactive_timer runs in hardirq context
Commit-ID:  b223cc1bb098ebd1077a5390c434db411806d6b8
Gitweb:     https://git.kernel.org/tip/b223cc1bb098ebd1077a5390c434db411806d6b8
Author:     Juri Lelli <[email protected]>
AuthorDate: Wed, 31 Jul 2019 12:37:15 +0200
Committer:  Thomas Gleixner <[email protected]>
CommitDate: Wed, 31 Jul 2019 13:01:26 +0200

sched/deadline: Ensure inactive_timer runs in hardirq context

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 ]

---
 kernel/sched/deadline.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/sched/deadline.c +2 -2
index 0359612d5443..83a663a34196 100644
@@ -287,7 +287,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)
@@ -1292,7 +1292,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;
 }
 
Acked-by on v1 1/1
#3 lore raw
In reply to Juri Lelli
Quoted 38 lines · On Wed, 31 Jul 2019 12:37:15 +0200 Juri Lelli <[email protected]> wrote:

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

Make it HRTIMER_MODE_REL_HARD.

---
Hi,

Both v4.19-rt and v5.2-rt need this.

Mainline "sched: Mark hrtimers to expire in hard interrupt context" series needs this as well ([email protected] in particular). Do I need to send out a separate patch for it?

Best,

Juri

---
 kernel/sched/deadline.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/sched/deadline.c +1 -1
index 1794e152d888..0889674b8915 100644
@@ -1292,7 +1292,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;
 }
 
Signature · 1 line
2.17.2
Signature · 2 lines
The United States Coast Guard
Ruining Natural Selection since 1790
#4 lore raw

[tip:timers/core] sched/deadline: Ensure inactive_timer runs in hardirq context

In reply to Juri Lelli
sched/deadline: Ensure inactive_timer runs in hardirq context
Commit-ID:  4394ba872c36255d25c6bde151b061f04655ebfb
Gitweb:     https://git.kernel.org/tip/4394ba872c36255d25c6bde151b061f04655ebfb
Author:     Juri Lelli <[email protected]>
AuthorDate: Wed, 31 Jul 2019 12:37:15 +0200
Committer:  Thomas Gleixner <[email protected]>
CommitDate: Thu, 1 Aug 2019 17:43:20 +0200

sched/deadline: Ensure inactive_timer runs in hardirq context

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 ]

---
 kernel/sched/deadline.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/sched/deadline.c +2 -2
index 0359612d5443..83a663a34196 100644
@@ -287,7 +287,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)
@@ -1292,7 +1292,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;
 }
 
#5 lore raw

[tip:timers/core] sched/deadline: Ensure inactive_timer runs in hardirq context

In reply to Juri Lelli
sched/deadline: Ensure inactive_timer runs in hardirq context
Commit-ID:  850377a875a481c393ce59111b0c9725005e0eb4
Gitweb:     https://git.kernel.org/tip/850377a875a481c393ce59111b0c9725005e0eb4
Author:     Juri Lelli <[email protected]>
AuthorDate: Wed, 31 Jul 2019 12:37:15 +0200
Committer:  Thomas Gleixner <[email protected]>
CommitDate: Thu, 1 Aug 2019 20:51:22 +0200

sched/deadline: Ensure inactive_timer runs in hardirq context

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 ]

---
 kernel/sched/deadline.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/sched/deadline.c +2 -2
index 0359612d5443..83a663a34196 100644
@@ -287,7 +287,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)
@@ -1292,7 +1292,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;
 }
 
#6 lore raw
In reply to Juri Lelli
Quoted 1 line · Juri Lelli

Hi,

Hi,

Quoted 5 lines

Both v4.19-rt and v5.2-rt need this.

Mainline "sched: Mark hrtimers to expire in hard interrupt context" series needs this as well ([email protected] in particular). Do I need to send out a separate patch for it?

time will show. I applied it now to my tree and will ping tglx later…

Quoted 3 lines

Best,

Juri

Sebastian

author maintainer
#7 lore raw
Quoted 11 lines · Sebastian Andrzej Siewior
Quoted 1 line · Juri Lelli

Hi,

Hi,

Quoted 5 lines

Both v4.19-rt and v5.2-rt need this.

Mainline "sched: Mark hrtimers to expire in hard interrupt context" series needs this as well ([email protected] in particular). Do I need to send out a separate patch for it?

time will show. I applied it now to my tree and will ping tglx later…

Thanks. tglx actually already applied it to tip (with a fixup):

https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git/commit/?id=4394ba872c36255d25c6bde151b061f04655ebfb

Best,

Juri