2019-07-31 11:28:17

by Juri Lelli

[permalink] [raw]
Subject: [RT PATCH] 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.

Signed-off-by: Juri Lelli <[email protected]>
---
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(-)

diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
index 1794e152d888..0889674b8915 100644
--- a/kernel/sched/deadline.c
+++ b/kernel/sched/deadline.c
@@ -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;
}

--
2.17.2


Subject: [tip:timers/core] 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 ]

Signed-off-by: Juri Lelli <[email protected]>
Signed-off-by: Thomas Gleixner <[email protected]>
Link: https://lkml.kernel.org/r/[email protected]
---
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 0359612d5443..83a663a34196 100644
--- a/kernel/sched/deadline.c
+++ b/kernel/sched/deadline.c
@@ -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;
}

Subject: Re: [RT PATCH] sched/deadline: Make inactive timer run in hardirq context



On 31/07/2019 12:37, Juri Lelli wrote:
> SCHED_DEADLINE inactive timer needs to run in hardirq context (as
> dl_task_timer already does).
>
> Make it HRTIMER_MODE_REL_HARD.
>
> Signed-off-by: Juri Lelli <[email protected]>

Acked-by: Daniel Bristot de Oliveira <[email protected]>

-- Daniel

2019-07-31 15:23:07

by Clark Williams

[permalink] [raw]
Subject: Re: [RT PATCH] sched/deadline: Make inactive timer run in hardirq context

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.
>
> Signed-off-by: Juri Lelli <[email protected]>
> ---
> 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(-)
>
> diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
> index 1794e152d888..0889674b8915 100644
> --- a/kernel/sched/deadline.c
> +++ b/kernel/sched/deadline.c
> @@ -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;
> }
>
> --
> 2.17.2
>
Acked-by: Clark Williams <[email protected]>

--
The United States Coast Guard
Ruining Natural Selection since 1790

Subject: [tip:timers/core] 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 ]

Signed-off-by: Juri Lelli <[email protected]>
Signed-off-by: Thomas Gleixner <[email protected]>
Link: https://lkml.kernel.org/r/[email protected]

---
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 0359612d5443..83a663a34196 100644
--- a/kernel/sched/deadline.c
+++ b/kernel/sched/deadline.c
@@ -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;
}

Subject: [tip:timers/core] 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 ]

Signed-off-by: Juri Lelli <[email protected]>
Signed-off-by: Thomas Gleixner <[email protected]>
Link: https://lkml.kernel.org/r/[email protected]


---
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 0359612d5443..83a663a34196 100644
--- a/kernel/sched/deadline.c
+++ b/kernel/sched/deadline.c
@@ -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;
}

Subject: Re: [RT PATCH] sched/deadline: Make inactive timer run in hardirq context

On 2019-07-31 12:37:15 [+0200], Juri Lelli wrote:
> Hi,
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?

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

> Best,
>
> Juri

Sebastian

2019-08-13 13:21:20

by Juri Lelli

[permalink] [raw]
Subject: Re: [RT PATCH] sched/deadline: Make inactive timer run in hardirq context

On 13/08/19 15:09, Sebastian Andrzej Siewior wrote:
> On 2019-07-31 12:37:15 [+0200], Juri Lelli wrote:
> > Hi,
> 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?
>
> 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