linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] sched/rt: silence double clock update warning by using rq_lock wrappers
@ 2019-08-15 14:53 Phil Auld
  2019-08-15 17:24 ` Valentin Schneider
  0 siblings, 1 reply; 3+ messages in thread
From: Phil Auld @ 2019-08-15 14:53 UTC (permalink / raw)
  To: linux-kernel
  Cc: Peter Zijlstra, Ingo Molnar, Valentin Schneider, Dietmar Eggemann

With WARN_DOUBLE_CLOCK enabled a false positive warning can occur in rt

        [] rq->clock_update_flags & RQCF_UPDATED
        [] WARNING: CPU: 6 PID: 21426 at kernel/sched/core.c:225 
						update_rq_clock+0x90/0x130
          [] Call Trace:
          []  update_rq_clock+0x90/0x130
          []  sched_rt_period_timer+0x11f/0x340
          []  __hrtimer_run_queues+0x100/0x280
          []  hrtimer_interrupt+0x100/0x220
          []  smp_apic_timer_interrupt+0x6a/0x130
          []  apic_timer_interrupt+0xf/0x20

sched_rt_period_timer does:
                raw_spin_lock(&rq->lock);
                update_rq_clock(rq);

which triggers the warning because of not using the rq_lock wrappers.
So, use the wrappers.

Signed-off-by: Phil Auld <pauld@redhat.com>
Cc: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Valentin Schneider <valentin.schneider@arm.com>
Cc: Dietmar Eggemann <dietmar.eggemann@arm.com>
---
 kernel/sched/rt.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
index a532558a5176..0846e71114ee 100644
--- a/kernel/sched/rt.c
+++ b/kernel/sched/rt.c
@@ -831,6 +831,7 @@ static int do_sched_rt_period_timer(struct rt_bandwidth *rt_b, int overrun)
 		int enqueue = 0;
 		struct rt_rq *rt_rq = sched_rt_period_rt_rq(rt_b, i);
 		struct rq *rq = rq_of_rt_rq(rt_rq);
+		struct rq_flags rf;
 		int skip;
 
 		/*
@@ -845,7 +846,7 @@ static int do_sched_rt_period_timer(struct rt_bandwidth *rt_b, int overrun)
 		if (skip)
 			continue;
 
-		raw_spin_lock(&rq->lock);
+		rq_lock(rq, &rf);
 		update_rq_clock(rq);
 
 		if (rt_rq->rt_time) {
@@ -883,7 +884,7 @@ static int do_sched_rt_period_timer(struct rt_bandwidth *rt_b, int overrun)
 
 		if (enqueue)
 			sched_rt_rq_enqueue(rt_rq);
-		raw_spin_unlock(&rq->lock);
+		rq_unlock(rq, &rf);
 	}
 
 	if (!throttled && (!rt_bandwidth_enabled() || rt_b->rt_runtime == RUNTIME_INF))
-- 
2.18.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] sched/rt: silence double clock update warning by using rq_lock wrappers
  2019-08-15 14:53 [PATCH] sched/rt: silence double clock update warning by using rq_lock wrappers Phil Auld
@ 2019-08-15 17:24 ` Valentin Schneider
  2019-09-16  8:56   ` Valentin Schneider
  0 siblings, 1 reply; 3+ messages in thread
From: Valentin Schneider @ 2019-08-15 17:24 UTC (permalink / raw)
  To: Phil Auld, linux-kernel; +Cc: Peter Zijlstra, Ingo Molnar, Dietmar Eggemann

On 15/08/2019 15:53, Phil Auld wrote:
> With WARN_DOUBLE_CLOCK enabled a false positive warning can occur in rt
> 
>         [] rq->clock_update_flags & RQCF_UPDATED
>         [] WARNING: CPU: 6 PID: 21426 at kernel/sched/core.c:225 
> 						update_rq_clock+0x90/0x130
>           [] Call Trace:
>           []  update_rq_clock+0x90/0x130
>           []  sched_rt_period_timer+0x11f/0x340
>           []  __hrtimer_run_queues+0x100/0x280
>           []  hrtimer_interrupt+0x100/0x220
>           []  smp_apic_timer_interrupt+0x6a/0x130
>           []  apic_timer_interrupt+0xf/0x20
> 
> sched_rt_period_timer does:
>                 raw_spin_lock(&rq->lock);
>                 update_rq_clock(rq);
> 
> which triggers the warning because of not using the rq_lock wrappers.
> So, use the wrappers.
> 
> Signed-off-by: Phil Auld <pauld@redhat.com>
> Cc: Peter Zijlstra (Intel) <peterz@infradead.org>
> Cc: Ingo Molnar <mingo@redhat.com>
> Cc: Valentin Schneider <valentin.schneider@arm.com>
> Cc: Dietmar Eggemann <dietmar.eggemann@arm.com>

Looks sane to me, and no missing _irqsave this time around ;)

Reviewed-by: Valentin Schneider <valentin.schneider@arm.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] sched/rt: silence double clock update warning by using rq_lock wrappers
  2019-08-15 17:24 ` Valentin Schneider
@ 2019-09-16  8:56   ` Valentin Schneider
  0 siblings, 0 replies; 3+ messages in thread
From: Valentin Schneider @ 2019-09-16  8:56 UTC (permalink / raw)
  To: Phil Auld, linux-kernel
  Cc: Peter Zijlstra, Ingo Molnar, Dietmar Eggemann, Steven Rostedt

[Added Steven to Cc]

On 15/08/2019 18:24, Valentin Schneider wrote:
> On 15/08/2019 15:53, Phil Auld wrote:
>> With WARN_DOUBLE_CLOCK enabled a false positive warning can occur in rt
>>
>>         [] rq->clock_update_flags & RQCF_UPDATED
>>         [] WARNING: CPU: 6 PID: 21426 at kernel/sched/core.c:225 
>> 						update_rq_clock+0x90/0x130
>>           [] Call Trace:
>>           []  update_rq_clock+0x90/0x130
>>           []  sched_rt_period_timer+0x11f/0x340
>>           []  __hrtimer_run_queues+0x100/0x280
>>           []  hrtimer_interrupt+0x100/0x220
>>           []  smp_apic_timer_interrupt+0x6a/0x130
>>           []  apic_timer_interrupt+0xf/0x20
>>
>> sched_rt_period_timer does:
>>                 raw_spin_lock(&rq->lock);
>>                 update_rq_clock(rq);
>>
>> which triggers the warning because of not using the rq_lock wrappers.
>> So, use the wrappers.
>>
>> Signed-off-by: Phil Auld <pauld@redhat.com>
>> Cc: Peter Zijlstra (Intel) <peterz@infradead.org>
>> Cc: Ingo Molnar <mingo@redhat.com>
>> Cc: Valentin Schneider <valentin.schneider@arm.com>
>> Cc: Dietmar Eggemann <dietmar.eggemann@arm.com>
> 
> Looks sane to me, and no missing _irqsave this time around ;)
> 
> Reviewed-by: Valentin Schneider <valentin.schneider@arm.com>
> 

Stumbled on that one while reviewing my inbox, ping?

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-09-16  8:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-15 14:53 [PATCH] sched/rt: silence double clock update warning by using rq_lock wrappers Phil Auld
2019-08-15 17:24 ` Valentin Schneider
2019-09-16  8:56   ` Valentin Schneider

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).