All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Dixit, Ashutosh" <ashutosh.dixit@intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>
Cc: igt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org,
	michal.winiarski@intel.com
Subject: Re: [igt-dev] [Intel-gfx] [PATCH i-g-t] lib: Use read() for timerfd timeout detection
Date: Tue, 14 Apr 2020 14:37:44 -0700	[thread overview]
Message-ID: <87r1wp4ul3.wl-ashutosh.dixit@intel.com> (raw)
In-Reply-To: <20200414190509.2868509-1-chris@chris-wilson.co.uk>

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 <chris@chris-wilson.co.uk>
> ---
>  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

WARNING: multiple messages have this Message-ID (diff)
From: "Dixit, Ashutosh" <ashutosh.dixit@intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>
Cc: igt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org,
	michal.winiarski@intel.com
Subject: Re: [Intel-gfx] [PATCH i-g-t] lib: Use read() for timerfd timeout detection
Date: Tue, 14 Apr 2020 14:37:44 -0700	[thread overview]
Message-ID: <87r1wp4ul3.wl-ashutosh.dixit@intel.com> (raw)
In-Reply-To: <20200414190509.2868509-1-chris@chris-wilson.co.uk>

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 <chris@chris-wilson.co.uk>
> ---
>  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

  parent reply	other threads:[~2020-04-14 21:37 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-14 19:05 [igt-dev] [PATCH i-g-t] lib: Use read() for timerfd timeout detection Chris Wilson
2020-04-14 19:05 ` [Intel-gfx] " Chris Wilson
2020-04-14 19:58 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
2020-04-14 21:37 ` Dixit, Ashutosh [this message]
2020-04-14 21:37   ` [Intel-gfx] [PATCH i-g-t] " Dixit, Ashutosh
2020-04-14 21:54   ` [igt-dev] " Chris Wilson
2020-04-14 21:54     ` Chris Wilson
2020-04-15 11:57 ` [igt-dev] ✗ Fi.CI.IGT: failure for " Patchwork
2020-04-15 12:54 ` [igt-dev] [PATCH i-g-t] " Chris Wilson
2020-04-15 12:54   ` [Intel-gfx] " Chris Wilson
2020-04-15 13:36 ` [igt-dev] ✗ Fi.CI.BUILD: failure for lib: Use read() for timerfd timeout detection (rev2) Patchwork
2020-04-15 13:39 ` [igt-dev] ✗ GitLab.Pipeline: warning " Patchwork
2020-04-15 14:39 ` [igt-dev] [PATCH i-g-t] lib: Use read() for timerfd timeout detection Chris Wilson
2020-04-15 14:39   ` [Intel-gfx] " Chris Wilson
2020-04-15 18:04   ` [igt-dev] " Dixit, Ashutosh
2020-04-15 18:04     ` [Intel-gfx] " Dixit, Ashutosh
2020-04-15 15:16 ` [igt-dev] ✓ Fi.CI.BAT: success for lib: Use read() for timerfd timeout detection (rev3) Patchwork
2020-04-16 10:55 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87r1wp4ul3.wl-ashutosh.dixit@intel.com \
    --to=ashutosh.dixit@intel.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=michal.winiarski@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.