Messages in this thread | | | Date | Thu, 4 Sep 2008 23:21:30 +0200 | From | Ingo Molnar <> | Subject | Re: [RFC patch 0/4] TSC calibration improvements |
| |
* Linus Torvalds <torvalds@linux-foundation.org> wrote:
> However, this one is: > > > + /* > > + * The iteration assumes that expect never goes below zero: > > + */ > > + BUILD_BUG_ON(QUICK_PIT_ITERATIONS >= 0xff); > > No it doesn't. "expect" is unsigned char and will happily wrap, as > will the PIT timer. The fact that it is in "single shot" mode doesn't > actually mean that the timer stops, it just affects what happens when > it goes down to zero. > > So that BUILD_BUG_ON() is misleading and incorrect.
ah, indeed, that bit of mine is wrong - and the period is programmed to 0xffff so it should all work out just fine. You code in a way too tricky manner ;) I zapped that portion.
In fact ... shouldnt we intentionally include a 'wraparound' event in the test? Some of the erratums/instabilities regarding PITs happened around wraparounds [of the lsb] - maybe the wraparound of the MSB matters too. (Maybe some boards freeze the counter readout until the host OS ACKs the PIT irq or something - which we dont do in this calibration run so if there's some weirdness there we'd detect it.)
So maybe we should start with an expect value of QUICK_PIT_ITERATIONS/2, with a wraparound right in the middle of the measurement?
Ingo
| |