Re: [PATCH v3] x86: tsc: make TSC calibration immune to interrupts

From: Kasper Pedersen
Date: Wed May 25 2011 - 18:09:25 EST


On 05/25/2011 12:51 PM, Thomas Gleixner wrote:
>> The 8 additional samples costs us 28 microseconds in startup
>> time.
>
> That's a good reason to avoid the whole conditional thing and just do
> the best of 5 always.

I do not mind removing it again.
The additional 170us only happen when quick_pit_calibrate fails,
and then native_calibrate_tsc burns 30ms extra anyway.

>> +
>> + *p = tp;
>
> The value is completely uninteresting when we return ULLONG_MAX.
>

native_calibrate_tsc() depends on *p being written regardless of
whether we can get a SMI-free reading:

/* We don't have an alternative source, disable TSC */
if (!hpet && !ref1 && !ref2) {
printk("TSC: No reference (HPET/PMTIMER) available\n");
return 0;
}

this works since acpi_pm_read_early() returns 0 when pmtmr_ioport
is 0, or CONFIG_X86_PM_TIMER is not set.

Without it we would report "calibration failed" rather than
"No reference" or "Using PIT" when there is neither pmtimer nor
hpet.

/Kasper Pedersen
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/