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. Also, remove the -static constraint on tsc's Makefile, since it will cause the compilation to fail in certain boxes. Signed-off-by: Glauber Costa <[email protected]> Signed-off-by: Lucas Meneghel Rodrigues <[email protected]> --- client/tests/tsc/src/Makefile | 1 - client/tests/tsc/src/checktsc.c | 6 ++++++ client/tests/tsc/tsc.py | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/client/tests/tsc/src/Makefile b/client/tests/tsc/src/Makefile index 623bb61..c8843ba 100644 --- a/client/tests/tsc/src/Makefile +++ b/client/tests/tsc/src/Makefile @@ -1,6 +1,5 @@ CC= cc CFLAGS= -O -LDFLAGS= --static LIBS= -lpthread PROGS= checktsc diff --git a/client/tests/tsc/src/checktsc.c b/client/tests/tsc/src/checktsc.c index f7fc879..74290ff 100644 --- a/client/tests/tsc/src/checktsc.c +++ b/client/tests/tsc/src/checktsc.c @@ -218,6 +218,12 @@ tsc_delta(int cpu_a, int cpu_b) wait_for_state(&slave, DONE); t1 = rdtsc(); + /* Ignore roundtrips bigger than 2 * treshold, as one of the threads + * that reads TSC is likely out of the CPU in this case */ + if ((t1 - t0) > 2 * threshold) + continue; + + if ((t1 - t0) < (best_t1 - best_t0)) { best_t0 = t0; best_t1 = t1; diff --git a/client/tests/tsc/tsc.py b/client/tests/tsc/tsc.py index ef3c960..2bac609 100644 --- a/client/tests/tsc/tsc.py +++ b/client/tests/tsc/tsc.py @@ -3,7 +3,7 @@ from autotest_lib.client.bin import test, utils from autotest_lib.client.common_lib import error class tsc(test.test): - version = 2 + version = 3 preserve_srcdir = True -- 1.7.0.1 _______________________________________________ Autotest mailing list [email protected] http://test.kernel.org/cgi-bin/mailman/listinfo/autotest
