Re: [RFC patch 0/4] TSC calibration improvements

From: Ingo Molnar
Date: Thu Sep 04 2008 - 17:21:58 EST



* Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> 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
--
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/