From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Tue, 14 Apr 2020 14:37:44 -0700 Message-ID: <87r1wp4ul3.wl-ashutosh.dixit@intel.com> From: "Dixit, Ashutosh" In-Reply-To: <20200414190509.2868509-1-chris@chris-wilson.co.uk> References: <20200414190509.2868509-1-chris@chris-wilson.co.uk> MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Subject: Re: [igt-dev] [Intel-gfx] [PATCH i-g-t] lib: Use read() for timerfd timeout detection List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: igt-dev-bounces@lists.freedesktop.org Sender: "igt-dev" To: Chris Wilson Cc: igt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, michal.winiarski@intel.com List-ID: On Tue, 14 Apr 2020 12:05:09 -0700, Chris Wilson wrote: > > The poll() is proving unreliable, where our tests timeout without the > spinner being terminated. Let's try a blocking read instead! Weird, wondering if all we need to do is set TFD_NONBLOCK on the fd? > > Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/1676 > Signed-off-by: Chris Wilson > --- > lib/igt_dummyload.c | 11 ++++++----- > 1 file changed, 6 insertions(+), 5 deletions(-) > > diff --git a/lib/igt_dummyload.c b/lib/igt_dummyload.c > index 99ca84ad8..a59afd45b 100644 > --- a/lib/igt_dummyload.c > +++ b/lib/igt_dummyload.c > @@ -399,12 +399,13 @@ 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; > + int ret; > > - if (poll(&pfd, 1, -1) >= 0) > + do { > + ret = read(spin->timerfd, &overruns, sizeof(overruns)); > + } while (ret == -1 && errno == EINTR); do {} while (!overruns) and skip if () below? > + if (overruns) > igt_spin_end(spin); > > return NULL; > -- > 2.26.0 > > _______________________________________________ > Intel-gfx mailing list > Intel-gfx@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/intel-gfx _______________________________________________ igt-dev mailing list igt-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/igt-dev