Re: [PATCH] x86 (64): make calibrate_APIC_clock() SMI-safe (take 2)

From: Cyrill Gorcunov
Date: Fri Jul 25 2008 - 09:00:30 EST


[Martin Wilck - Fri, Jul 25, 2008 at 02:29:23PM +0200]
> Cyrill Gorcunov wrote:
>
>> Hi Martin, what about the patch below - I simplified it a bit.
>> Actually we have to handle 32bit mode as well I think.
>
> Yes.
>
>> Anyway,
>> take a look. I don't really mind against your patch but we better
>> should wait until Maciej could take a look (he will be able in
>> a week or maybe a bit later).
>>
>
>> + for (i = 0; i < MAX_ITER; i++) {
>> + rdtscll(tsc0);
>> + *apic = apic_read(APIC_TMCCT);
>> + rdtscll(tsc1);
>> + diff = tsc1 - tsc0;
>> + if (diff < MAX_DIFFERENCE) {
>> + *tsc = tsc0 + diff / 2;
>> + return 0;
>> + }
>> + }
> > +
> > + return -EIO ;
>
> This is wrong - you need to set *tsc also in the -EIO case, otherwise
> the function can return total bogus.

indeed, thanks! that is not the only problem - I also initialized 'i'
twice :)

>
> I have to say that my simplified patch failed to do the calibration
> correctly on our test system (the original patch worked well). Please
> stay tuned, we are investigating this currently.
>
> Martin
>

ok, Martin, I'm leaving for vacation soon - hope someone else could
take a look :)

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