From: John Stultz <john.stultz@linaro.org>
To: lkml <linux-kernel@vger.kernel.org>
Cc: David Engraf <david.engraf@sysgo.com>,
Ingo Molnar <mingo@kernel.org>,
Thomas Gleixner <tglx@linutronix.de>,
Daniel Lezcano <daniel.lezcano@linaro.org>,
Richard Cochran <richardcochran@gmail.com>,
Prarit Bhargava <prarit@redhat.com>,
Stephen Boyd <sboyd@codeaurora.org>,
John Stultz <john.stultz@linaro.org>
Subject: [PATCH 8/9] timers, sched_clock: Update timeout for clock wrap
Date: Thu, 30 Mar 2017 14:01:23 -0700 [thread overview]
Message-ID: <1490907684-11186-9-git-send-email-john.stultz@linaro.org> (raw)
In-Reply-To: <1490907684-11186-1-git-send-email-john.stultz@linaro.org>
From: David Engraf <david.engraf@sysgo.com>
The scheduler clock framework may not use the correct timeout for the clock
wrap. This happens when a new clock driver calls sched_clock_register()
after the kernel called sched_clock_postinit(). In this case the clock wrap
timeout is too long thus sched_clock_poll() is called too late and the clock
already wrapped.
On my ARM system the scheduler was no longer scheduling any other task than
the idle task because the sched_clock() wrapped.
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: Richard Cochran <richardcochran@gmail.com>
Cc: Prarit Bhargava <prarit@redhat.com>
Cc: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: David Engraf <david.engraf@sysgo.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
---
kernel/time/sched_clock.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/kernel/time/sched_clock.c b/kernel/time/sched_clock.c
index ea6b610..2d8f05a 100644
--- a/kernel/time/sched_clock.c
+++ b/kernel/time/sched_clock.c
@@ -206,6 +206,11 @@ sched_clock_register(u64 (*read)(void), int bits, unsigned long rate)
update_clock_read_data(&rd);
+ if (sched_clock_timer.function != NULL) {
+ /* update timeout for clock wrap */
+ hrtimer_start(&sched_clock_timer, cd.wrap_kt, HRTIMER_MODE_REL);
+ }
+
r = rate;
if (r >= 4000000) {
r /= 1000000;
--
2.7.4
next prev parent reply other threads:[~2017-03-30 21:02 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-30 21:01 [GIT PULL][PATCH 0/9] Timekeeping changes for 4.12 John Stultz
2017-03-30 21:01 ` [PATCH 1/9] clocksource: sh_cmt: Compute rate before registration again John Stultz
2017-03-30 21:01 ` [PATCH 2/9] clocksource: sh_tmu: " John Stultz
2017-03-30 21:01 ` [PATCH 3/9] clocksource: em_sti: Split clock prepare and enable steps John Stultz
2017-03-30 21:01 ` [PATCH 4/9] clocksource: em_sti: Compute rate before registration John Stultz
2017-03-30 21:01 ` [PATCH 5/9] clocksource: h8300_timer8: Don't reset rate in ->set_state_oneshot() John Stultz
2017-03-30 21:01 ` [PATCH 6/9] clockevents: Make clockevents_config() static John Stultz
2017-03-30 21:01 ` [PATCH 7/9] MAINTAINERS: Add Stephen Boyd as timekeeping reviewer John Stultz
2017-03-30 21:01 ` John Stultz [this message]
2017-03-30 21:01 ` [PATCH 9/9] sysrq: Reset the watchdog timers while displaying high-resolution timers John Stultz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1490907684-11186-9-git-send-email-john.stultz@linaro.org \
--to=john.stultz@linaro.org \
--cc=daniel.lezcano@linaro.org \
--cc=david.engraf@sysgo.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=prarit@redhat.com \
--cc=richardcochran@gmail.com \
--cc=sboyd@codeaurora.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®