>>> On 20.06.16 at 14:59, <[email protected]> wrote:
> On 15/06/16 11:27, Jan Beulich wrote:
>> Matching Linux commit 03b9730b76 ("x86/asm/tsc: Add rdtsc_ordered() and
>> use it in trivial call sites") and earlier ones it builds upon, let's
>> make sure timing loops don't have their rdtsc()-s re-ordered, as that
>> would harm precision of the result (values were observed to be several
>> hundred clocks off without this adjustment).
>>
>> Signed-off-by: Jan Beulich <[email protected]>
>
> Reviewed-by: Andrew Cooper <[email protected]>
I have these two additional hunks for v2:
@@ -1124,16 +1124,13 @@ static void local_time_calibration(void)
*/
static void check_tsc_warp(unsigned long tsc_khz, unsigned long *max_warp)
{
-#define rdtsc_barrier() mb()
static DEFINE_SPINLOCK(sync_lock);
static cycles_t last_tsc;
cycles_t start, now, prev, end;
int i;
- rdtsc_barrier();
- start = get_cycles();
- rdtsc_barrier();
+ start = rdtsc_ordered();
/* The measurement runs for 20 msecs: */
end = start + tsc_khz * 20ULL;
@@ -1148,9 +1145,7 @@ static void check_tsc_warp(unsigned long
*/
spin_lock(&sync_lock);
prev = last_tsc;
- rdtsc_barrier();
- now = get_cycles();
- rdtsc_barrier();
+ now = rdtsc_ordered();
last_tsc = now;
spin_unlock(&sync_lock);
May I consider those covered as well?
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel