public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: Chris Wilson <chris@chris-wilson.co.uk>
Cc: igt-dev@lists.freedesktop.org
Subject: Re: [igt-dev] [PATCH i-g-t] prime_vgem: Replace nanosleep with igt_waitchildren_timeout
Date: Tue, 2 Apr 2019 10:56:59 +0200	[thread overview]
Message-ID: <20190402085659.GG2665@phenom.ffwll.local> (raw)
In-Reply-To: <20190401075840.28344-1-chris@chris-wilson.co.uk>

On Mon, Apr 01, 2019 at 08:58:40AM +0100, Chris Wilson wrote:
> We want to use a child in order to detect an uninterruptable sleep (a
> potential bug we might hit), but we can use igt_waitchildren_timeout()
> to replace our risky self-signaling + nanosleep.
> 
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=103182
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

On a spree it seems ... I guess same changes needed as for kms_busy to
ditch the signal handler setup? On the presumed v2:

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>


> ---
>  tests/prime_vgem.c | 20 +++++++-------------
>  1 file changed, 7 insertions(+), 13 deletions(-)
> 
> diff --git a/tests/prime_vgem.c b/tests/prime_vgem.c
> index 60bb951c8..fe28322a6 100644
> --- a/tests/prime_vgem.c
> +++ b/tests/prime_vgem.c
> @@ -697,29 +697,24 @@ static void flip_to_vgem(int i915, int vgem,
>  			 unsigned hang,
>  			 const char *name)
>  {
> -	const struct timespec tv = { 1, 0 };
>  	struct pollfd pfd = { i915, POLLIN };
>  	struct drm_event_vblank vbl;
>  	uint32_t fence;
>  
>  	fence = vgem_fence_attach(vgem, bo, VGEM_FENCE_WRITE | hang);
>  
> -	igt_fork(child, 1) {
> +	igt_fork(child, 1) { /* Use a child in case we block uninterruptibly */
> +		/* Check we don't block nor flip before the fence is ready */
>  		do_or_die(drmModePageFlip(i915, crtc_id, fb_id,
>  					  DRM_MODE_PAGE_FLIP_EVENT, &fb_id));
> -		kill(getppid(), SIGHUP);
> -
> -		/* Check we don't flip before the fence is ready */
> -		for (int n = 0; n < 5; n++) {
> +		for (int n = 0; n < 5; n++) { /* 5 frames should be <100ms */
>  			igt_assert_f(poll(&pfd, 1, 0) == 0,
>  				     "flip to %s completed whilst busy\n",
> -				      name);
> +				     name);
>  			get_vblank(i915, 0, DRM_VBLANK_NEXTONMISS);
>  		}
>  	}
> -
> -	igt_assert_f(nanosleep(&tv, NULL) == -1,
> -		     "flip to busy %s blocked\n", name);
> +	igt_waitchildren_timeout(2, "flip blocked by waiting for busy vgem fence");
>  
>  	/* And then the flip is completed as soon as it is ready */
>  	if (!hang) {
> @@ -734,12 +729,11 @@ static void flip_to_vgem(int i915, int vgem,
>  		get_vblank(i915, 0, DRM_VBLANK_NEXTONMISS);
>  		igt_assert_eq(poll(&pfd, 1, 0), 1);
>  	}
> +
>  	/* Even if hung, the flip must complete *eventually* */
> -	igt_set_timeout(20, "Ignored hang"); /* XXX lower fail threshold? */
> +	igt_set_timeout(20, "flip blocked by hanging vgem fence"); /* XXX lower fail threshold? */
>  	igt_assert_eq(read(i915, &vbl, sizeof(vbl)), sizeof(vbl));
>  	igt_reset_timeout();
> -
> -	igt_waitchildren();
>  }
>  
>  static void test_flip(int i915, int vgem, unsigned hang)
> -- 
> 2.20.1
> 
> _______________________________________________
> igt-dev mailing list
> igt-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/igt-dev

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

  parent reply	other threads:[~2019-04-02  8:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-01  7:58 [igt-dev] [PATCH i-g-t] prime_vgem: Replace nanosleep with igt_waitchildren_timeout Chris Wilson
2019-04-01  8:35 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
2019-04-01 10:23 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2019-04-02  8:56 ` Daniel Vetter [this message]
2019-04-02  9:02   ` [igt-dev] [PATCH i-g-t] " Chris Wilson

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=20190402085659.GG2665@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=chris@chris-wilson.co.uk \
    --cc=igt-dev@lists.freedesktop.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox