Re: [PATCH] lguest-fix-divide-error-implement-sched_clock

From: H. Peter Anvin
Date: Tue Jun 05 2007 - 14:44:23 EST


Andi Kleen wrote:
>
> I don't think it's a good idea for the TSC. There are various
> setups where it is unreliable and also often simulators don't
> implement it correctly. And it's always a valuable workaround
> to be able to turn it off.
>

I dug some more into the TSC code, and found some other annoying stuff:

/*
* Make an educated guess if the TSC is trustworthy and synchronized
* over all CPUs.
*/
__cpuinit int unsynchronized_tsc(void)
{
if (!cpu_has_tsc || tsc_unstable)
return 1;
/*
* Intel systems are normally all synchronized.
* Exceptions must mark TSC as unstable:
*/
if (boot_cpu_data.x86_vendor != X86_VENDOR_INTEL) {
/* assume multi socket systems are not synchronized: */
if (num_possible_cpus() > 1)
tsc_unstable = 1;
}
return tsc_unstable;
}

That's a vendor check foul. That should be a CPU feature flag.

Looks like there is some work to be done here.

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