Re: [patch] x86, tsc: fix SMI induced variation inquick_pit_calibrate()

From: Suresh Siddha
Date: Mon Jan 16 2012 - 19:34:52 EST


On Mon, 2012-01-16 at 16:18 -0800, Linus Torvalds wrote:
> So I think your patch is a total hack that just compares the two last
> TSC deltas, but it's actually close to the "correct' thing in that it
> does start taking the time to see the last of the previous MSB into
> account.

yeah, it was a hack but your alternative sounds good.

> Now the delta is twice as big as before (it covers four PIT accesses,
> roughly 4us), so the comments might have to be updated to match, but
> the rest of the code should "just work" (except it might loop a bit
> longer, and maybe it gives closer to 250 ppm precision).
>
> Does this fix it for you? I have NOT tested it in any way.
>

also may be we should change the correction

from: delta += (long)(d2 - d1)/2;
to: delta += (long)(d2 - d1)/4;

I will give this patch a try.

thanks,
suresh



--
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/