diff mbox

[i-g-t,3/3] lib: Double check ring measurement

Message ID 20180530103314.30565-3-chris@chris-wilson.co.uk (mailing list archive)
State New, archived
Headers show

Commit Message

Chris Wilson May 30, 2018, 10:33 a.m. UTC
Check twice for the signal interrupting the execbuf, because the real
world is messy.

References: https://bugs.freedesktop.org/show_bug.cgi?id=106695
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Antonio Argenziano <antonio.argenziano@intel.com>
---
 lib/i915/gem_ring.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Antonio Argenziano May 30, 2018, 5:42 p.m. UTC | #1
On 30/05/18 03:33, Chris Wilson wrote:
> Check twice for the signal interrupting the execbuf, because the real
> world is messy.
> 
> References: https://bugs.freedesktop.org/show_bug.cgi?id=106695
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Antonio Argenziano <antonio.argenziano@intel.com>

LGTM.

Reviewed-by: Antonio Argenziano <antonio.argenziano@intel.com>
Chris Wilson May 31, 2018, 4:57 p.m. UTC | #2
Quoting Antonio Argenziano (2018-05-30 18:42:28)
> 
> 
> On 30/05/18 03:33, Chris Wilson wrote:
> > Check twice for the signal interrupting the execbuf, because the real
> > world is messy.
> > 
> > References: https://bugs.freedesktop.org/show_bug.cgi?id=106695
> > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> > Cc: Antonio Argenziano <antonio.argenziano@intel.com>
> 
> LGTM.
> 
> Reviewed-by: Antonio Argenziano <antonio.argenziano@intel.com>

Picked up to sweep the bug under the carpet hopefully never to be heard
off again.
-Chris
diff mbox

Patch

diff --git a/lib/i915/gem_ring.c b/lib/i915/gem_ring.c
index 0c061000c..0708c8a2e 100644
--- a/lib/i915/gem_ring.c
+++ b/lib/i915/gem_ring.c
@@ -55,7 +55,7 @@  __gem_measure_ring_inflight(int fd, unsigned int engine, enum measure_ring_flags
 	struct drm_i915_gem_exec_object2 obj[2];
 	struct drm_i915_gem_execbuffer2 execbuf;
 	const uint32_t bbe = MI_BATCH_BUFFER_END;
-	unsigned int count, last;
+	unsigned int last[2]= { -1, -1 }, count;
 	struct itimerval itv;
 	IGT_CORK_HANDLE(cork);
 
@@ -85,7 +85,6 @@  __gem_measure_ring_inflight(int fd, unsigned int engine, enum measure_ring_flags
 	itv.it_value.tv_usec = 10000;
 	setitimer(ITIMER_REAL, &itv, NULL);
 
-	last = -1;
 	count = 0;
 	do {
 		if (__execbuf(fd, &execbuf) == 0) {
@@ -93,12 +92,13 @@  __gem_measure_ring_inflight(int fd, unsigned int engine, enum measure_ring_flags
 			continue;
 		}
 
-		if (last == count)
+		if (last[1] == count)
 			break;
 
 		/* sleep until the next timer interrupt (woken on signal) */
 		pause();
-		last = count;
+		last[1] = last[0];
+		last[0] = count;
 	} while (1);
 
 	igt_assert_eq(__execbuf(fd, &execbuf), -EINTR);