+cc: Michael.
---------- Forwarded message ----------
From: Glauber Costa <[email protected]>
Date: Tue, Apr 6, 2010 at 9:02 AM
Subject: [Autotest] increase robustness of tsc test
To: [email protected]
Hi,
I've recently saw a lot of failures on running checktest test
on virtual machines. Investigating further, it seems that running it
into VMs just makes a conceptual problem more likely to happen:
Since we're in userspace, the other thread that should read tsc can be
out of the of the cpu at the moment, so all measures will be very
different.
This is indicated by the tsc roundtrip. In failed measures, they are all
quite big. So I am proposing this patch, that basically ignores roundtrips
that are twice as big as the threshold, or more.
It makes the test pass to me, in machines I would expect them to.
Thanks
_______________________________________________
Autotest mailing list
[email protected]
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest
--- checktsc.c.orig 2008-08-25 16:12:54.000000000 -0300
+++ checktsc.c 2010-04-06 12:56:15.404362025 -0300
@@ -207,7 +207,7 @@ tsc_delta(int cpu_a, int cpu_b)
slave_cpu = cpu_b;
- for (i = 0; i < NUM_ITERS; i++) {
+ while (i < NUM_ITERS) {
set_state(&master, READY);
@@ -218,6 +218,9 @@ tsc_delta(int cpu_a, int cpu_b)
wait_for_state(&slave, DONE);
t1 = rdtsc();
+ if ((t1 - t0) > 2 * threshold)
+ continue;
+
if ((t1 - t0) < (best_t1 - best_t0)) {
best_t0 = t0;
best_t1 = t1;
@@ -225,6 +228,7 @@ tsc_delta(int cpu_a, int cpu_b)
}
if (verbose)
printf("loop %2d: roundtrip = %5Ld\n", i, t1 - t0);
+ i++;
}
delta = (best_t0/2 + best_t1/2 + (best_t0 & best_t1 & 1)) - best_tm;
_______________________________________________
Autotest mailing list
[email protected]
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest