From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Wed, 15 Apr 2020 11:04:08 -0700 Message-ID: <87k12g4odj.wl-ashutosh.dixit@intel.com> From: "Dixit, Ashutosh" In-Reply-To: <20200415143900.2927491-1-chris@chris-wilson.co.uk> References: <20200414190509.2868509-1-chris@chris-wilson.co.uk> <20200415143900.2927491-1-chris@chris-wilson.co.uk> MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Subject: Re: [igt-dev] [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 List-ID: On Wed, 15 Apr 2020 07:39:00 -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! > > Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/1676 > Signed-off-by: Chris Wilson > Cc: "Dixit, Ashutosh" Reviewed-by: Ashutosh Dixit > --- > lib/igt_dummyload.c | 12 ++++++------ > 1 file changed, 6 insertions(+), 6 deletions(-) > > diff --git a/lib/igt_dummyload.c b/lib/igt_dummyload.c > index 99ca84ad8..ae0fb9378 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; > } > > -- > 2.26.0 > _______________________________________________ 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 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 DA39CC2BA19 for ; Wed, 15 Apr 2020 18:04:11 +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 AEDAD206D9 for ; Wed, 15 Apr 2020 18:04:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AEDAD206D9 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 3996A6EA55; Wed, 15 Apr 2020 18:04:11 +0000 (UTC) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by gabe.freedesktop.org (Postfix) with ESMTPS id 51F966EA54; Wed, 15 Apr 2020 18:04:10 +0000 (UTC) IronPort-SDR: CBO/a0nN/mSWaBDHKmeHOWeLTl1Nmgu6MhYLW+abW7VrLFohKEftyLqHj6yHkJD/wRskTredDm Iilwwz2LdWHg== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Apr 2020 11:04:09 -0700 IronPort-SDR: qyG69yoH+gEPhtf4MaZsTqV+l6u9JgYeDtAa8PNF5+EFglrsIwIZt9lEqckC4Cl5ToqunozPnI /ppZ+LW3bFEw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,388,1580803200"; d="scan'208";a="253596217" Received: from adixit-mobl.amr.corp.intel.com (HELO adixit-arch.intel.com) ([10.209.23.241]) by orsmga003.jf.intel.com with ESMTP; 15 Apr 2020 11:04:08 -0700 Date: Wed, 15 Apr 2020 11:04:08 -0700 Message-ID: <87k12g4odj.wl-ashutosh.dixit@intel.com> From: "Dixit, Ashutosh" To: Chris Wilson In-Reply-To: <20200415143900.2927491-1-chris@chris-wilson.co.uk> References: <20200414190509.2868509-1-chris@chris-wilson.co.uk> <20200415143900.2927491-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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" On Wed, 15 Apr 2020 07:39:00 -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! > > Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/1676 > Signed-off-by: Chris Wilson > Cc: "Dixit, Ashutosh" Reviewed-by: Ashutosh Dixit > --- > lib/igt_dummyload.c | 12 ++++++------ > 1 file changed, 6 insertions(+), 6 deletions(-) > > diff --git a/lib/igt_dummyload.c b/lib/igt_dummyload.c > index 99ca84ad8..ae0fb9378 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; > } > > -- > 2.26.0 > _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx