Re: [RFT] Please test rdtsc on various x86-64 hardware (app included)

From: Colin Walters
Date: Mon Apr 18 2011 - 16:23:51 EST


On Mon, Apr 18, 2011 at 3:32 PM, Andrew Lutomirski <luto@xxxxxxx> wrote:
> Hi all-
>
> I'd appreciate some help testing rdtsc's ordering wrt memory on
> various hardware. ÂYou can download evil-clock-test code at:
>
> https://gitorious.org/linux-test-utils/linux-clock-tests/blobs/raw/master/evil-clock-test.cc

Hmm...the first time I ran it, it started OK, then printed over and over:

ERROR! Time1 went back by 2380216472
ERROR! Time1 went back by 2380216080
ERROR! Time1 went back by 2380215704
ERROR! Time1 went back by 2380215320

and the original output was lost in the terminal emulator history.
After piping it to tee a second time, of course it worked and didn't
print any errors =)

CPU vendor : GenuineIntel
CPU model : Intel(R) Core(TM)2 Quad CPU Q9400 @ 2.66GHz
CPU stepping : 10
TSC flags : tsc constant_tsc
Using lfence_rdtsc because you have an Intel CPU
Will test the "lfence;rdtsc" clock.
Now test passed : margin 160 with 28911200 samples
Load3 test passed: margin 144 with 2493322 samples
Load test passed : margin 120 with 4929138 samples
Store test failed as expected: worst error 2184 with 4409828 samples

What's interesting is it seems unpredictable when running it whether
it will error out =/ Here's the start of a failing trace:

CPU vendor : GenuineIntel
CPU model : Intel(R) Core(TM)2 Quad CPU Q9400 @ 2.66GHz
CPU stepping : 10
TSC flags : tsc constant_tsc
Using lfence_rdtsc because you have an Intel CPU
Will test the "lfence;rdtsc" clock.
Now test failed : worst error 2399269920 with 28704328 samples
ERROR! Time1 went back by 2399197568
ERROR! Time1 went back by 2399196984
--
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/