Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1613475

[PATCH 8/9] timers, sched_clock: Update timeout for clock wrap

From John Stultz <john.stultz@linaro.org>
Newsgroups linux.kernel
Subject [PATCH 8/9] timers, sched_clock: Update timeout for clock wrap
Date 2017-03-30 23:10 +0200
Message-ID <tqPuq-3KZ-33@gated-at.bofh.it> (permalink)
References <tqPup-3KZ-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[GIT PULL][PATCH 0/9] Timekeeping changes for 4.12 John Stultz <john.stultz@linaro.org> - 2017-03-30 23:10 +0200
  [PATCH 5/9] clocksource: h8300_timer8: Don't reset rate in ->set_state_oneshot() John Stultz <john.stultz@linaro.org> - 2017-03-30 23:10 +0200
  [PATCH 3/9] clocksource: em_sti: Split clock prepare and enable steps John Stultz <john.stultz@linaro.org> - 2017-03-30 23:10 +0200
  [PATCH 9/9] sysrq: Reset the watchdog timers while displaying high-resolution timers John Stultz <john.stultz@linaro.org> - 2017-03-30 23:10 +0200
  [PATCH 7/9] MAINTAINERS: Add Stephen Boyd as timekeeping reviewer John Stultz <john.stultz@linaro.org> - 2017-03-30 23:10 +0200
  [PATCH 8/9] timers, sched_clock: Update timeout for clock wrap John Stultz <john.stultz@linaro.org> - 2017-03-30 23:10 +0200
  [PATCH 2/9] clocksource: sh_tmu: Compute rate before registration again John Stultz <john.stultz@linaro.org> - 2017-03-30 23:10 +0200
  [PATCH 4/9] clocksource: em_sti: Compute rate before registration John Stultz <john.stultz@linaro.org> - 2017-03-30 23:10 +0200
  [PATCH 1/9] clocksource: sh_cmt: Compute rate before registration again John Stultz <john.stultz@linaro.org> - 2017-03-30 23:10 +0200
  [PATCH 6/9] clockevents: Make clockevents_config() static John Stultz <john.stultz@linaro.org> - 2017-03-30 23:10 +0200

csiph-web