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

From: Martin Wilck
Date: Fri Jul 25 2008 - 08:29:36 EST


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.

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

--
Martin Wilck
PRIMERGY System Software Engineer
FSC IP ESP DEV 6

Fujitsu Siemens Computers GmbH
Heinz-Nixdorf-Ring 1
33106 Paderborn
Germany

Tel: ++49 5251 8 15113
Fax: ++49 5251 8 20209
Email: mailto:martin.wilck@xxxxxxxxxxxxxxxxxxx
Internet: http://www.fujitsu-siemens.com
Company Details: http://www.fujitsu-siemens.com/imprint.html
--
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/