public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH i-g-t] prime_vgem: Replace nanosleep with igt_waitchildren_timeout
@ 2019-04-01  7:58 Chris Wilson
  2019-04-01  8:35 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Chris Wilson @ 2019-04-01  7:58 UTC (permalink / raw)
  To: igt-dev

We want to use a child in order to detect an uninterruptable sleep (a
potential bug we might hit), but we can use igt_waitchildren_timeout()
to replace our risky self-signaling + nanosleep.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=103182
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 tests/prime_vgem.c | 20 +++++++-------------
 1 file changed, 7 insertions(+), 13 deletions(-)

diff --git a/tests/prime_vgem.c b/tests/prime_vgem.c
index 60bb951c8..fe28322a6 100644
--- a/tests/prime_vgem.c
+++ b/tests/prime_vgem.c
@@ -697,29 +697,24 @@ static void flip_to_vgem(int i915, int vgem,
 			 unsigned hang,
 			 const char *name)
 {
-	const struct timespec tv = { 1, 0 };
 	struct pollfd pfd = { i915, POLLIN };
 	struct drm_event_vblank vbl;
 	uint32_t fence;
 
 	fence = vgem_fence_attach(vgem, bo, VGEM_FENCE_WRITE | hang);
 
-	igt_fork(child, 1) {
+	igt_fork(child, 1) { /* Use a child in case we block uninterruptibly */
+		/* Check we don't block nor flip before the fence is ready */
 		do_or_die(drmModePageFlip(i915, crtc_id, fb_id,
 					  DRM_MODE_PAGE_FLIP_EVENT, &fb_id));
-		kill(getppid(), SIGHUP);
-
-		/* Check we don't flip before the fence is ready */
-		for (int n = 0; n < 5; n++) {
+		for (int n = 0; n < 5; n++) { /* 5 frames should be <100ms */
 			igt_assert_f(poll(&pfd, 1, 0) == 0,
 				     "flip to %s completed whilst busy\n",
-				      name);
+				     name);
 			get_vblank(i915, 0, DRM_VBLANK_NEXTONMISS);
 		}
 	}
-
-	igt_assert_f(nanosleep(&tv, NULL) == -1,
-		     "flip to busy %s blocked\n", name);
+	igt_waitchildren_timeout(2, "flip blocked by waiting for busy vgem fence");
 
 	/* And then the flip is completed as soon as it is ready */
 	if (!hang) {
@@ -734,12 +729,11 @@ static void flip_to_vgem(int i915, int vgem,
 		get_vblank(i915, 0, DRM_VBLANK_NEXTONMISS);
 		igt_assert_eq(poll(&pfd, 1, 0), 1);
 	}
+
 	/* Even if hung, the flip must complete *eventually* */
-	igt_set_timeout(20, "Ignored hang"); /* XXX lower fail threshold? */
+	igt_set_timeout(20, "flip blocked by hanging vgem fence"); /* XXX lower fail threshold? */
 	igt_assert_eq(read(i915, &vbl, sizeof(vbl)), sizeof(vbl));
 	igt_reset_timeout();
-
-	igt_waitchildren();
 }
 
 static void test_flip(int i915, int vgem, unsigned hang)
-- 
2.20.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-04-02  9:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-04-01  7:58 [igt-dev] [PATCH i-g-t] prime_vgem: Replace nanosleep with igt_waitchildren_timeout Chris Wilson
2019-04-01  8:35 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
2019-04-01 10:23 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2019-04-02  8:56 ` [igt-dev] [PATCH i-g-t] " Daniel Vetter
2019-04-02  9:02   ` Chris Wilson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox