Commit b6db80ee authored by Thomas Gleixner's avatar Thomas Gleixner

x86: fix setup of cyc2ns in tsc_64.c

When the TSC is calibrated against the PIT due to the nonavailability
of PMTIMER/HPET or due to SMI interference then the setup of the per
CPU cyc2ns variables is skipped. This is unlikely to happen but it
would definitely render sched_clock() unusable.

This was introduced with commit 53d517cd

    x86: scale cyc_2_nsec according to CPU frequency

Update the per CPU cyc2ns variables in all exit pathes of tsc_calibrate.
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Cc: stable@kernel.org
parent 75d3bce2
...@@ -227,14 +227,14 @@ void __init tsc_calibrate(void) ...@@ -227,14 +227,14 @@ void __init tsc_calibrate(void)
/* hpet or pmtimer available ? */ /* hpet or pmtimer available ? */
if (!hpet && !pm1 && !pm2) { if (!hpet && !pm1 && !pm2) {
printk(KERN_INFO "TSC calibrated against PIT\n"); printk(KERN_INFO "TSC calibrated against PIT\n");
return; goto out;
} }
/* Check, whether the sampling was disturbed by an SMI */ /* Check, whether the sampling was disturbed by an SMI */
if (tsc1 == ULONG_MAX || tsc2 == ULONG_MAX) { if (tsc1 == ULONG_MAX || tsc2 == ULONG_MAX) {
printk(KERN_WARNING "TSC calibration disturbed by SMI, " printk(KERN_WARNING "TSC calibration disturbed by SMI, "
"using PIT calibration result\n"); "using PIT calibration result\n");
return; goto out;
} }
tsc2 = (tsc2 - tsc1) * 1000000L; tsc2 = (tsc2 - tsc1) * 1000000L;
...@@ -255,6 +255,7 @@ void __init tsc_calibrate(void) ...@@ -255,6 +255,7 @@ void __init tsc_calibrate(void)
tsc_khz = tsc2 / tsc1; tsc_khz = tsc2 / tsc1;
out:
for_each_possible_cpu(cpu) for_each_possible_cpu(cpu)
set_cyc2ns_scale(tsc_khz, cpu); set_cyc2ns_scale(tsc_khz, cpu);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment