[igt-dev] [PATCH i-g-t 3/3] tests/perf_pmu: Give sampling more time

Chris Wilson chris at chris-wilson.co.uk
Mon Feb 12 10:02:33 UTC 2018


Quoting Tvrtko Ursulin (2018-02-08 08:01:31)
> From: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
> 
> 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.
> 
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
> ---
>  tests/perf_pmu.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/tests/perf_pmu.c b/tests/perf_pmu.c
> index 07b25765f1f6..34aab6fd537f 100644
> --- a/tests/perf_pmu.c
> +++ b/tests/perf_pmu.c
> @@ -608,7 +608,9 @@ sema_wait(int gem_fd, const struct intel_execution_engine2 *e,
>         do { /* wait for the batch to start executing */
>                 usleep(5e3);
>         } while (!obj_ptr[1]);
> -       usleep(5e3); /* wait for the register sampling */
> +
> +       pmu_read_single(fd); /* dummy read to prime pmu? */
> +       usleep(50e3); /* wait for the register sampling */

Maybe something like
igt_assert_f(igt_wait(pmu_read_single(fd) != val[0], 10),
	"sampling failed to start within 10msecs");

Bonus is that we will get an igt_debug() telling us how long it took.
-Chris


More information about the igt-dev mailing list