Re: Dual core Athlons and unsynced TSCs
From: Robert Hancock
Date: Fri Jan 13 2006 - 19:24:00 EST
Lee Revell wrote:
But obviously if the TSC gives wildly inaccurate results, it cannot be
used no matter how low the overhead.
unless we can re-sync the TSCs often enough that apps don't notice.
You'd have to quantify that somehow, in terms of the max drift rate
(ppm), and the max resolution available (< tsc frequency).
Either that, or track an offset, and use one TSC as truth, and update
the correction factor for the other TSCs as often as needed, maybe?
This is kind of analogous to the "drift" NTP calculates against a
free-running oscillator.
So you'd be pushing that functionality deeper into the OS-core.
Dave Mills had that "hardpps" stuff in there for a while, it might be a
starting point.
Just some thoughts for now...
It kind of makes you wonder what in the heck AMD were thinking, whether
they realized that this design decision would cause so many problems at
the OS level (it's broken at least Linux and Solaris). Maybe Windows
keeps time in a way that was unaffected by this?
Sounds to me like they are doing something like what was being mentioned
above:
http://support.microsoft.com/kb/896256/en-us
"When TSC does not increment monotonically, system components that use
the kernel KeQueryPerformanceCounter function may not work correctly. To
address this problem, Microsoft makes it possible for the ACPI Power
Management Timer to be used as the operating system timer that supports
the kernel KeQueryPerformanceCounter function. However, some programs
may directly access the TSC by bypassing the Windows timer APIs. The
multiple-processor Hardware Abstraction Layer (HAL) makes sure that the
TSC registers on all processors on a multiple-processor computer remain
closely synchronized. Therefore, access by system software that may be
directed to different processors does not return different results."
Also, Microsoft's docs for QueryPerformanceCounter specify that
different results on different CPUs will only occur if there are "bugs
in the basic input/output system (BIOS) or the hardware abstraction
layer (HAL)" and recommends that threads using this function set their
affinity to run on one processor only.
--
Robert Hancock Saskatoon, SK, Canada
To email, remove "nospam" from hancockr@xxxxxxxxxxxxx
Home Page: http://www.roberthancock.com/
-
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/