From 6d51cf112374ba73f7391b5d846bb83e81b060d3 Mon Sep 17 00:00:00 2001 From: Tvrtko Ursulin Date: Mon, 12 Feb 2018 11:36:07 +0000 Subject: tests/perf_pmu: Give sampling more time We get occasional errors like: (perf_pmu:21315) CRITICAL: Test assertion failure function sema_wait, file perf_pmu.c:631: (perf_pmu:21315) CRITICAL: Failed assertion: (double)(val[1] - val[0]) <= (1.0 + (tolerance)) * (double)(slept) && (double)(val[1] - val[0]) >= (1.0 - (tolerance)) * (double)(slept) (perf_pmu:21315) CRITICAL: 'val[1] - val[0]' != 'slept' (450000000.000000 not within 5.000000% tolerance of 500129618.000000) Suggesting a time disagreement between userspace and the PMU. At the moment I got no better ideas than fiddling with delays to see if it improves things. v2: Wait for sampling to start instead of hardcoded sleep. (Chris Wilson) Signed-off-by: Tvrtko Ursulin Reviewed-by: Chris Wilson --- tests/perf_pmu.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'tests/perf_pmu.c') diff --git a/tests/perf_pmu.c b/tests/perf_pmu.c index 3f2fb911..a7501ca5 100644 --- a/tests/perf_pmu.c +++ b/tests/perf_pmu.c @@ -619,11 +619,15 @@ sema_wait(int gem_fd, const struct intel_execution_engine2 *e, fd = open_pmu(I915_PMU_ENGINE_SEMA(e->class, e->instance)); + val[0] = pmu_read_single(fd); + gem_execbuf(gem_fd, &eb); do { /* wait for the batch to start executing */ usleep(5e3); } while (!obj_ptr[1]); - usleep(5e3); /* wait for the register sampling */ + + igt_assert_f(igt_wait(pmu_read_single(fd) != val[0], 10, 1), + "sampling failed to start withing 10ms"); val[0] = pmu_read_single(fd); slept = measured_usleep(batch_duration_ns / 1000); -- cgit v1.2.3