Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Abdiel Janulgue <abdiel.janulgue@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, intel-gfx@lists.freedesktop.org
Cc: igt-dev@lists.freedesktop.org
Subject: Re: [igt-dev] [PATCH igt 1/5] lib/dummyload: Avoid assertions in lowlevel spin constructor
Date: Thu, 1 Mar 2018 09:28:26 +0200	[thread overview]
Message-ID: <b911f1c7-e2c1-c7d0-79b5-a95ebc3b96e5@linux.intel.com> (raw)
In-Reply-To: <20180228155138.16168-1-chris@chris-wilson.co.uk>



On 02/28/2018 05:51 PM, Chris Wilson wrote:
> __igt_spin_batch_new() may be used inside a background helper which is
> competing against the GPU being reset. As such, we cannot even assert
> that the spin->handle is busy immediately after submission as it may
> have already been reset by another client writing to i915_wedged.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

Reviewed-by: Abdiel Janulgue <abdiel.janulgue@linux.intel.com>

> ---
>  lib/igt_dummyload.c | 17 ++++++++++++++---
>  tests/pm_rps.c      |  4 +++-
>  2 files changed, 17 insertions(+), 4 deletions(-)
> 
> diff --git a/lib/igt_dummyload.c b/lib/igt_dummyload.c
> index ddd43451..4b20f23d 100644
> --- a/lib/igt_dummyload.c
> +++ b/lib/igt_dummyload.c
> @@ -25,6 +25,7 @@
>  #include <time.h>
>  #include <signal.h>
>  #include <pthread.h>
> +#include <sys/poll.h>
>  
>  #include <i915_drm.h>
>  
> @@ -207,7 +208,6 @@ ___igt_spin_batch_new(int fd, uint32_t ctx, unsigned engine, uint32_t dep,
>  
>  	spin->out_fence = emit_recursive_batch(spin, fd, ctx, engine, dep,
>  					       out_fence);
> -	igt_assert(gem_bo_busy(fd, spin->handle));
>  
>  	pthread_mutex_lock(&list_lock);
>  	igt_list_add(&spin->link, &spin_list);
> @@ -240,9 +240,14 @@ __igt_spin_batch_new(int fd, uint32_t ctx, unsigned engine, uint32_t dep)
>  igt_spin_t *
>  igt_spin_batch_new(int fd, uint32_t ctx, unsigned engine, uint32_t dep)
>  {
> +	igt_spin_t *spin;
> +
>  	igt_require_gem(fd);
>  
> -	return __igt_spin_batch_new(fd, ctx, engine, dep);
> +	spin = __igt_spin_batch_new(fd, ctx, engine, dep);
> +	igt_assert(gem_bo_busy(fd, spin->handle));
> +
> +	return spin;
>  }
>  
>  igt_spin_t *
> @@ -269,10 +274,16 @@ __igt_spin_batch_new_fence(int fd, uint32_t ctx, unsigned engine)
>  igt_spin_t *
>  igt_spin_batch_new_fence(int fd, uint32_t ctx, unsigned engine)
>  {
> +	igt_spin_t *spin;
> +
>  	igt_require_gem(fd);
>  	igt_require(gem_has_exec_fence(fd));
>  
> -	return __igt_spin_batch_new_fence(fd, ctx, engine);
> +	spin = __igt_spin_batch_new_fence(fd, ctx, engine);
> +	igt_assert(gem_bo_busy(fd, spin->handle));
> +	igt_assert(poll(&(struct pollfd){spin->out_fence, POLLIN}, 1, 0) == 0);
> +
> +	return spin;
>  }
>  
>  static void notify(union sigval arg)
> diff --git a/tests/pm_rps.c b/tests/pm_rps.c
> index f71976ed..006d084b 100644
> --- a/tests/pm_rps.c
> +++ b/tests/pm_rps.c
> @@ -221,6 +221,8 @@ static void load_helper_run(enum load load)
>  		return;
>  	}
>  
> +	igt_require_gem(drm_fd);
> +
>  	lh.exit = false;
>  	lh.load = load;
>  
> @@ -233,7 +235,7 @@ static void load_helper_run(enum load load)
>  
>  		igt_debug("Applying %s load...\n", lh.load ? "high" : "low");
>  
> -		spin[0] = igt_spin_batch_new(drm_fd, 0, 0, 0);
> +		spin[0] = __igt_spin_batch_new(drm_fd, 0, 0, 0);
>  		if (lh.load == HIGH)
>  			spin[1] = __igt_spin_batch_new(drm_fd, 0, 0, 0);
>  		while (!lh.exit) {
> 
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

  parent reply	other threads:[~2018-03-01  7:28 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-28 15:51 [igt-dev] [PATCH igt 1/5] lib/dummyload: Avoid assertions in lowlevel spin constructor Chris Wilson
2018-02-28 15:51 ` [igt-dev] [PATCH igt 2/5] igt/gem_spin_batch: Avoid waiting when running concurrently Chris Wilson
2018-03-03 10:15   ` [Intel-gfx] " Chris Wilson
2018-03-05  9:52   ` [Intel-gfx] [igt-dev] " Michał Winiarski
2018-02-28 15:51 ` [Intel-gfx] [PATCH igt 3/5] igt/gem_ctx_switch: Exercise all engines at once Chris Wilson
2018-02-28 19:10   ` [igt-dev] " Antonio Argenziano
2018-03-01  7:51   ` [Intel-gfx] [PATCH igt v2] " Chris Wilson
2018-03-01 16:09     ` [igt-dev] " Antonio Argenziano
2018-02-28 15:51 ` [Intel-gfx] [PATCH igt 4/5] igt/gem_exec_capture: Exercise readback of userptr Chris Wilson
2018-03-01 11:21   ` [igt-dev] " Michał Winiarski
2018-02-28 15:51 ` [igt-dev] [PATCH igt 5/5] igt/gem_exec_fence: Exercise merging fences Chris Wilson
2018-02-28 22:44   ` Antonio Argenziano
2018-03-01  7:12     ` Chris Wilson
2018-02-28 17:14 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [1/5] lib/dummyload: Avoid assertions in lowlevel spin constructor Patchwork
2018-02-28 21:33 ` [igt-dev] ✗ Fi.CI.IGT: warning " Patchwork
2018-03-01  7:28 ` Abdiel Janulgue [this message]
2018-03-01  8:54 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [1/5] lib/dummyload: Avoid assertions in lowlevel spin constructor (rev2) Patchwork
2018-03-01 10:52 ` [igt-dev] ✗ Fi.CI.IGT: warning " 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=b911f1c7-e2c1-c7d0-79b5-a95ebc3b96e5@linux.intel.com \
    --to=abdiel.janulgue@linux.intel.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=intel-gfx@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