All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFT] Please test rdtsc on various x86-64 hardware (app included)
@ 2011-04-18 19:32 Andrew Lutomirski
  2011-04-18 20:16 ` Linus Torvalds
                   ` (5 more replies)
  0 siblings, 6 replies; 15+ messages in thread
From: Andrew Lutomirski @ 2011-04-18 19:32 UTC (permalink / raw)
  To: linux-kernel, Ingo Molnar, Linus Torvalds, Andi Kleen, x86

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

or pull from:

git://gitorious.org/linux-test-utils/linux-clock-tests.git

or see it online at:

https://gitorious.org/linux-test-utils/linux-clock-tests

No kernel patches required.  If you have an old glibc then timing_test
will fail to build.  You can ignore that problem, because I'm only
really interested in what evil-clock-test says.

On Sandy Bridge, you'll see something like:

$ ./evil-clock-test
CPU vendor   : GenuineIntel
CPU model    : Intel(R) Core(TM) i7-2600 CPU @ 3.40GHz
CPU stepping : 7
TSC flags    : tsc rdtscp constant_tsc nonstop_tsc
Using lfence_rdtsc because you have an Intel CPU
Will test the "lfence;rdtsc" clock.
Now test passed  : margin 68 with 78370992 samples
Load3 test passed: margin 71 with 12740250 samples
Load test passed : margin 60 with 17743461 samples
Store test failed as expected: worst error 3316 with 14666029 samples

I've tested on Sandy Bridge, Allendale (i.e. Pentium Dual-Core),
Bloomfield. and C2D.  I don't have any AMD machines with usable tscs,
and I haven't tested on systems with multiple packages.  (If you're
feeling adventurous, you can play with the -p option.  If you give it
two cpu numbers, comma-separated, which live on different packages,
maybe you'll learn something interesting.  It might also be
interesting to try evil-clock-test -3 -p a,b,c where c is on a
different package from a and b.

(Oddly enough, the test *passes* on my C2D box, even though the kernel
thinks that my TSC halts in idle.  This is with a fair amount of time
spent in C6 and even after a suspend/resume cycle.  I'm not sure
what's going on there.)

For those of you who really care about this stuff, the 'store test'
will *fail* on most Intel systems.  IMO that's OK, since fixing it
would slow everything down and since I don't think it deserves to
pass, even though it looks like the tsc is warping.

--Andy

^ permalink raw reply	[flat|nested] 15+ messages in thread
* Re: [RFT] Please test rdtsc on various x86-64 hardware (app included)
@ 2011-04-19  5:06 George Spelvin
  2011-04-19  6:09 ` George Spelvin
  0 siblings, 1 reply; 15+ messages in thread
From: George Spelvin @ 2011-04-19  5:06 UTC (permalink / raw)
  To: luto; +Cc: linux, linux-kernel

I'm not doing so well:

$ ./evil-clock-test
CPU vendor   : AuthenticAMD
CPU model    : AMD Phenom(tm) 9850 Quad-Core Processor
CPU stepping : 3
TSC flags    : tsc rdtscp constant_tsc nonstop_tsc
Using mfence_rdtsc because you don't have an Intel CPU
Will test the "mfence;rdtsc" clock.
Now test passed  : margin 168 with 15744696 samples
Load3 test got no data
Load test got no data
Store test failed: worst error 10 with 617583 samples

$ ./evil-clock-test
CPU vendor   : AuthenticAMD
CPU model    : AMD Phenom(tm) 9850 Quad-Core Processor
CPU stepping : 3
TSC flags    : tsc rdtscp constant_tsc nonstop_tsc
Using mfence_rdtsc because you don't have an Intel CPU
Will test the "mfence;rdtsc" clock.
Now test passed  : margin 168 with 15666016 samples
Load3 test got no data
Load test got no data
Store test got no data

$ ./evil-clock-test
CPU vendor   : AuthenticAMD
CPU model    : AMD Phenom(tm) 9850 Quad-Core Processor
CPU stepping : 3
TSC flags    : tsc rdtscp constant_tsc nonstop_tsc
Using mfence_rdtsc because you don't have an Intel CPU
Will test the "mfence;rdtsc" clock.
Now test passed  : margin 168 with 15981720 samples
Load3 test got no data
Load test got no data
Store test got no data

Compiled from git revision 8f7d7a62, "Add script to test all pairs."
Running as root makes no difference.

Other programs:

$ ./now_test_all_pairs.sh
0,1: Now test passed  : margin 168 with 15007304 samples
0,2: Now test passed  : margin 168 with 15288360 samples
0,3: Now test passed  : margin 168 with 15539776 samples
1,0: Now test passed  : margin 168 with 14890744 samples
1,2: Now test passed  : margin 168 with 15266128 samples
1,3: Now test passed  : margin 168 with 15322480 samples
2,0: Now test passed  : margin 168 with 14978320 samples
2,1: Now test passed  : margin 168 with 15109872 samples
2,3: Now test passed  : margin 168 with 15207616 samples
3,0: Now test passed  : margin 168 with 15043208 samples
3,1: Now test passed  : margin 168 with 14686352 samples
3,2: Now test passed  : margin 168 with 14945840 samples

$ ./timing_test
Usage: time <Miters> <mode> [POSIX clock id]

Clocks are:
  0 (CLOCK_REALTIME)  resolution = 0.000000001
  1 (CLOCK_MONOTONIC)  resolution = 0.000000001
  5 (CLOCK_REALTIME_COARSE)  resolution = 0.010000000
  6 (CLOCK_MONOTONIC_COARSE)  resolution = 0.010000000

System is 2.6.38.2 with 8 GB ECC RAM.  ATI RD790/SB600 chipset.

Hope this helps!

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2011-04-22 14:37 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-18 19:32 [RFT] Please test rdtsc on various x86-64 hardware (app included) Andrew Lutomirski
2011-04-18 20:16 ` Linus Torvalds
2011-04-18 20:37   ` Ingo Molnar
2011-04-19  0:38     ` Markus Trippelsdorf
2011-04-18 20:23 ` Colin Walters
2011-04-18 20:27   ` Andrew Lutomirski
2011-04-18 20:35     ` Colin Walters
2011-04-18 20:39       ` Andrew Lutomirski
2011-04-18 22:10 ` Andi Kleen
2011-04-19  2:15   ` Andrew Lutomirski
2011-04-19  0:49 ` Mihai Donțu
2011-04-19  8:10 ` Frank Kingswood
2011-04-22 14:33 ` Jan Ceuleers
  -- strict thread matches above, loose matches on Subject: below --
2011-04-19  5:06 George Spelvin
2011-04-19  6:09 ` George Spelvin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.