Re: [PATCH i-g-t] lib: Use read() for timerfd timeout detection

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <chris@xxxxxxxxxxxxxxxxxx>
> Cc: "Dixit, Ashutosh" <ashutosh.dixit@xxxxxxxxx>


Reviewed-by: Ashutosh Dixit <ashutosh.dixit@xxxxxxxxx>


> ---
>  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@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx



[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux