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 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F1888C2BB1D for ; Tue, 14 Apr 2020 21:37:46 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C58672074D for ; Tue, 14 Apr 2020 21:37:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C58672074D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=intel-gfx-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 382716E59B; Tue, 14 Apr 2020 21:37:46 +0000 (UTC) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by gabe.freedesktop.org (Postfix) with ESMTPS id B1B856E59B; Tue, 14 Apr 2020 21:37:45 +0000 (UTC) IronPort-SDR: kgCKLB9uqzGfI9ucWRDSu7IuPvOeOVu+zY9UEjPya36XZxA3siZEt8pEiryBGSSHaELHLGiXHu BUk6JdxA4jYA== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Apr 2020 14:37:45 -0700 IronPort-SDR: HAt34M2C3c/blyoy/L/Sh0968KmjiLSjwgri4yVwkzvMrZuiEiXPc5sMFxuAQhci6FXW7vR5g6 q9k4e4p1F+0Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,384,1580803200"; d="scan'208";a="453692606" Received: from adixit-mobl.amr.corp.intel.com (HELO adixit-arch.intel.com) ([10.212.39.201]) by fmsmga005.fm.intel.com with ESMTP; 14 Apr 2020 14:37:44 -0700 Date: Tue, 14 Apr 2020 14:37:44 -0700 Message-ID: <87r1wp4ul3.wl-ashutosh.dixit@intel.com> From: "Dixit, Ashutosh" To: Chris Wilson In-Reply-To: <20200414190509.2868509-1-chris@chris-wilson.co.uk> References: <20200414190509.2868509-1-chris@chris-wilson.co.uk> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM/1.14.9 (=?ISO-8859-4?Q?Goj=F2?=) APEL/10.8 EasyPG/1.0.0 Emacs/26 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Subject: Re: [Intel-gfx] [PATCH i-g-t] lib: Use read() for timerfd timeout detection X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: igt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, michal.winiarski@intel.com Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" 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 _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx