summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2020-04-14 19:52:31 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2020-04-16 09:33:53 +0100
commit85918b965bfeedd28ecf85bb9d601b105dee451c (patch)
tree9f6943f49bf497a8fc688e8b245a1bd041ea7417 /lib
parentf57b7fdbe8d04ce3edf0433a03c7d9d5c3d96680 (diff)
lib: Use read() for timerfd timeout detection
The poll() is proving unreliable, where our tests timeout without the spinner being terminated. Let's try a blocking read instead! Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/1676 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: "Dixit, Ashutosh" <ashutosh.dixit@intel.com> Reviewed-by: "Dixit, Ashutosh" <ashutosh.dixit@intel.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/igt_dummyload.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/igt_dummyload.c b/lib/igt_dummyload.c
index 99ca84ad..ae0fb937 100644
--- a/lib/igt_dummyload.c
+++ b/lib/igt_dummyload.c
@@ -399,14 +399,14 @@ igt_spin_factory(int fd, const struct igt_spin_factory *opts)
static void *timer_thread(void *data)
{
igt_spin_t *spin = data;
- struct pollfd pfd = {
- .fd = spin->timerfd,
- .events = POLLIN,
- };
+ uint64_t overruns = 0;
- if (poll(&pfd, 1, -1) >= 0)
- igt_spin_end(spin);
+ /* Wait until we see the timer fire, or we get cancelled */
+ do {
+ read(spin->timerfd, &overruns, sizeof(overruns));
+ } while (!overruns);
+ igt_spin_end(spin);
return NULL;
}