Skip to content

Commit aa7b630

Browse files
Peter Zijlstraingomolnar
authored andcommitted
x86/tsc: Feed refined TSC calibration into sched_clock()
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> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Mike Galbraith <efault@gmx.de> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: linux-kernel@vger.kernel.org Signed-off-by: Ingo Molnar <mingo@kernel.org>
1 parent 615cd03 commit aa7b630

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

‎arch/x86/kernel/tsc.c‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1161,6 +1161,7 @@ static void tsc_refine_calibration_work(struct work_struct *work)
11611161
static int hpet;
11621162
u64 tsc_stop, ref_stop, delta;
11631163
unsigned long freq;
1164+
int cpu;
11641165

11651166
/* Don't bother refining TSC on unstable systems */
11661167
if (check_tsc_unstable())
@@ -1211,6 +1212,10 @@ static void tsc_refine_calibration_work(struct work_struct *work)
12111212
/* Inform the TSC deadline clockevent devices about the recalibration */
12121213
lapic_update_tsc_freq();
12131214

1215+
/* Update the sched_clock() rate to match the clocksource one */
1216+
for_each_possible_cpu(cpu)
1217+
__set_cyc2ns_scale(tsc_khz, cpu, tsc_stop);
1218+
12141219
out:
12151220
if (boot_cpu_has(X86_FEATURE_ART))
12161221
art_related_clocksource = &clocksource_tsc;

0 commit comments

Comments
 (0)