From e3a0ed9855a2e9d77cfd0c770ceadac5b7030e4e Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Mon, 5 Mar 2018 10:51:06 +0000 Subject: Bump measure_ring_size() timer interval It appears that waiting for a 100us period whereby we are unable to submit another batch and proclaim the ring full, may have the false positive where the scheduler intervenes and we are signalled twice before having slept on ring space. Increasing the interval reduces the likelihood of the scheduler stealing the cpu from us, but does not eliminate it. Fortuitously it appears to be a rare false positive. For the library routine, we can fork a RT process but that seems a bit overkill! References: https://bugs.freedesktop.org/show_bug.cgi?id=105343 Signed-off-by: Chris Wilson Cc: Antonio Argenziano Reviewed-by: Antonio Argenziano --- lib/i915/gem_ring.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'lib/i915') diff --git a/lib/i915/gem_ring.c b/lib/i915/gem_ring.c index 7326673a..df92e620 100644 --- a/lib/i915/gem_ring.c +++ b/lib/i915/gem_ring.c @@ -31,6 +31,18 @@ #include "ioctl_wrappers.h" #include "igt_dummyload.h" +static int __execbuf(int fd, struct drm_i915_gem_execbuffer2 *execbuf) +{ + int err; + + err = 0; + if (ioctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, execbuf)) + err = -errno; + + errno = 0; + return err; +} + static void alarm_handler(int sig) { } @@ -81,15 +93,15 @@ gem_measure_ring_inflight(int fd, unsigned int engine, enum measure_ring_flags f sigaction(SIGALRM, &sa, &old_sa); itv.it_interval.tv_sec = 0; - itv.it_interval.tv_usec = 100; + itv.it_interval.tv_usec = 1000; itv.it_value.tv_sec = 0; - itv.it_value.tv_usec = 1000; + itv.it_value.tv_usec = 10000; setitimer(ITIMER_REAL, &itv, NULL); last = -1; count = 0; do { - if (ioctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &execbuf) == 0) { + if (__execbuf(fd, &execbuf) == 0) { count++; continue; } @@ -100,6 +112,8 @@ gem_measure_ring_inflight(int fd, unsigned int engine, enum measure_ring_flags f last = count; } while (1); + igt_assert_eq(__execbuf(fd, &execbuf), -EINTR); + memset(&itv, 0, sizeof(itv)); setitimer(ITIMER_REAL, &itv, NULL); sigaction(SIGALRM, &old_sa, NULL); -- cgit v1.2.3