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


Groups > linux.kernel > #1628395

[PATCH 2/9] x86,tsc: Feed refined TSC calibration into sched_clock

From Peter Zijlstra <peterz@infradead.org>
Newsgroups linux.kernel
Subject [PATCH 2/9] x86,tsc: Feed refined TSC calibration into sched_clock
Date 2017-04-21 19:50 +0200
Message-ID <tyKQV-gp-17@gated-at.bofh.it> (permalink)
References <tyKee-8vc-21@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


For the (older) CPUs that still need the refined TSC calibration, also
update the sched_clock rate.

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
---
 arch/x86/kernel/tsc.c |    5 +++++
 1 file changed, 5 insertions(+)

--- a/arch/x86/kernel/tsc.c
+++ b/arch/x86/kernel/tsc.c
@@ -1267,6 +1267,7 @@ static void tsc_refine_calibration_work(
 	static int hpet;
 	u64 tsc_stop, ref_stop, delta;
 	unsigned long freq;
+	int cpu;
 
 	/* Don't bother refining TSC on unstable systems */
 	if (check_tsc_unstable())
@@ -1317,6 +1318,10 @@ static void tsc_refine_calibration_work(
 	/* Inform the TSC deadline clockevent devices about the recalibration */
 	lapic_update_tsc_freq();
 
+	/* Update the sched_clock() rate to match the clocksource one */
+	for_each_possible_cpu(cpu)
+		set_cyc2ns_scale(tsc_khz, cpu);
+
 out:
 	if (boot_cpu_has(X86_FEATURE_ART))
 		art_related_clocksource = &clocksource_tsc;

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


Thread

[PATCH 2/9] x86,tsc: Feed refined TSC calibration into sched_clock Peter Zijlstra <peterz@infradead.org> - 2017-04-21 19:50 +0200

csiph-web