diff mbox

[i-g-t] igt/syncobj_wait: Don't close the timeline early in wait_snapshot

Message ID 1507665740-6703-1-git-send-email-jason.ekstrand@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jason Ekstrand Oct. 10, 2017, 8:02 p.m. UTC
Closing the sw_sync timeline now signals any remaining fences upon it;
but test_wait_snapshot requires the fence to continue to be busy so that
the __syncobj_wait() will return with -ETIME.
---
 tests/syncobj_wait.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Chris Wilson Oct. 10, 2017, 8:11 p.m. UTC | #1
Quoting Jason Ekstrand (2017-10-10 21:02:20)
> Closing the sw_sync timeline now signals any remaining fences upon it;
> but test_wait_snapshot requires the fence to continue to be busy so that
> the __syncobj_wait() will return with -ETIME.

Snap!

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Tested-by: Chris Wilson <chris@chris-wilson.co.uk>
-Chris
Chris Wilson Oct. 10, 2017, 8:21 p.m. UTC | #2
Quoting Jason Ekstrand (2017-10-10 21:02:20)
> Closing the sw_sync timeline now signals any remaining fences upon it;
> but test_wait_snapshot requires the fence to continue to be busy so that
> the __syncobj_wait() will return with -ETIME.

Fwiw, you are not going mad as it did used to work. The change was
kernel commit ea4d5a270b57 ("dma-buf/sw_sync: force signal all
unsignaled fences on dying timeline")
-Chris
diff mbox

Patch

diff --git a/tests/syncobj_wait.c b/tests/syncobj_wait.c
index 385d8cd..1842f9c 100644
--- a/tests/syncobj_wait.c
+++ b/tests/syncobj_wait.c
@@ -525,7 +525,7 @@  test_wait_snapshot(int fd, uint32_t test_flags)
 {
 	struct wait_thread_data wait = { 0 };
 	uint32_t syncobjs[2];
-	int timelines[2] = { -1, -1 };
+	int timelines[3] = { -1, -1, -1 };
 	pthread_t thread;
 
 	syncobjs[0] = syncobj_create(fd, 0);
@@ -570,8 +570,7 @@  test_wait_snapshot(int fd, uint32_t test_flags)
 	 * the kernel picks up on the new fence (it shouldn't), we'll get a
 	 * timeout.
 	 */
-	close(timelines[0]);
-	timelines[0] = syncobj_attach_sw_sync(fd, syncobjs[0]);
+	timelines[2] = syncobj_attach_sw_sync(fd, syncobjs[0]);
 
 	sleep_nsec(SHORT_TIME_NSEC / 5);
 
@@ -589,6 +588,7 @@  test_wait_snapshot(int fd, uint32_t test_flags)
 
 	close(timelines[0]);
 	close(timelines[1]);
+	close(timelines[2]);
 	syncobj_destroy(fd, syncobjs[0]);
 	syncobj_destroy(fd, syncobjs[1]);
 }