[Intel-gfx] [PATCH i-g-t 1/2] lib: Immediately cancel a spinner for an expired timeout

Chris Wilson chris at chris-wilson.co.uk
Tue Jan 5 21:26:05 UTC 2021


If the relative timeout to igt_spin_set_timeout() is in the past,
immediately end the spinner.

Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/2903
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
 lib/igt_dummyload.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lib/igt_dummyload.c b/lib/igt_dummyload.c
index 6ecaf8506..34ad92216 100644
--- a/lib/igt_dummyload.c
+++ b/lib/igt_dummyload.c
@@ -485,10 +485,14 @@ void igt_spin_set_timeout(igt_spin_t *spin, int64_t ns)
 	pthread_attr_t attr;
 	int timerfd;
 
-	igt_assert(ns > 0);
 	if (!spin)
 		return;
 
+	if (ns <= 0) {
+		igt_spin_end(spin);
+		return;
+	}
+
 	igt_assert(spin->timerfd == -1);
 	timerfd = timerfd_create(CLOCK_MONOTONIC, 0);
 	igt_assert(timerfd >= 0);
-- 
2.30.0



More information about the Intel-gfx mailing list