public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Mika Kuoppala <mika.kuoppala@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] [Intel-gfx] [PATCH i-g-t 2/2] igt/gem_ctx_exec: Exercise I915_CONTEXT_PARAM_RECOVERABLE
Date: Mon, 18 Feb 2019 14:49:31 +0200	[thread overview]
Message-ID: <87va1hxnvo.fsf@gaia.fi.intel.com> (raw)
In-Reply-To: <20190218115736.25683-2-chris@chris-wilson.co.uk>

Chris Wilson <chris@chris-wilson.co.uk> writes:

> When RECOVERABLE is set, the kernel will attempt to automatically recover
> a context after a hang. But if it is unset, the kernel will ban the
> guilty context on a hang, preventing subsequent execution.
>
> v2: Create a has_recoverable_param()
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Mika Kuoppala <mika.kuoppala@intel.com>

Reviewed-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>

Not a topic for this testcase but just brought up thoughts
that we could reap ppgtt and some selected bits in driver
when we ban. Perhaps a future exercise.


> ---
>  tests/i915/gem_ctx_exec.c | 48 +++++++++++++++++++++++++++++++++++++++
>  1 file changed, 48 insertions(+)
>
> diff --git a/tests/i915/gem_ctx_exec.c b/tests/i915/gem_ctx_exec.c
> index 908b59af2..760b58d81 100644
> --- a/tests/i915/gem_ctx_exec.c
> +++ b/tests/i915/gem_ctx_exec.c
> @@ -147,6 +147,51 @@ static void invalid_context(int fd, unsigned ring, uint32_t handle)
>  	igt_assert_eq(__gem_execbuf(fd, &execbuf), -ENOENT);
>  }
>  
> +static bool has_recoverable_param(int i915)
> +{
> +	struct drm_i915_gem_context_param param = {
> +		.param = I915_CONTEXT_PARAM_RECOVERABLE
> +	};
> +
> +	return __gem_context_get_param(i915, &param) == 0;
> +}
> +
> +static void norecovery(int i915)
> +{
> +	igt_require(has_recoverable_param(i915));
> +
> +	for (int pass = 1; pass >= 0; pass--) {
> +		struct drm_i915_gem_context_param param = {
> +			.ctx_id = gem_context_create(i915),
> +			.param = I915_CONTEXT_PARAM_RECOVERABLE,
> +			.value = pass,
> +		};
> +		int expect = pass == 0 ? -EIO : 0;
> +		igt_spin_t *spin;
> +
> +		gem_context_set_param(i915, &param);
> +
> +		param.value = !pass;
> +		gem_context_get_param(i915, &param);
> +		igt_assert_eq(param.value, pass);
> +
> +		spin = __igt_spin_batch_new(i915,
> +					    .ctx = param.ctx_id,
> +					    .flags = IGT_SPIN_POLL_RUN);
> +		igt_assert(spin->running);
> +
> +		while (!READ_ONCE(*spin->running))
> +			;
> +		igt_force_gpu_reset(i915);
> +
> +		igt_spin_batch_end(spin);
> +		igt_assert_eq(__gem_execbuf(i915, &spin->execbuf), expect);
> +		igt_spin_batch_free(i915, spin);
> +
> +		gem_context_destroy(i915, param.ctx_id);
> +	}
> +}
> +
>  igt_main
>  {
>  	const uint32_t batch[2] = { 0, MI_BATCH_BUFFER_END };
> @@ -190,6 +235,9 @@ igt_main
>  	igt_subtest("eviction")
>  		big_exec(fd, handle, 0);
>  
> +	igt_subtest("norecovery")
> +		norecovery(fd);
> +
>  	igt_subtest("reset-pin-leak") {
>  		int i;
>  
> -- 
> 2.20.1
>
> _______________________________________________
> 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

  reply	other threads:[~2019-02-18 12:49 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-18 11:57 [igt-dev] [PATCH i-g-t 1/2] drm-uapi: Update i915_drm.h for I915_CONTEXT_PARAM_RECOVERABLE Chris Wilson
2019-02-18 11:57 ` [igt-dev] [PATCH i-g-t 2/2] igt/gem_ctx_exec: Exercise I915_CONTEXT_PARAM_RECOVERABLE Chris Wilson
2019-02-18 12:49   ` Mika Kuoppala [this message]
2019-02-18 12:56     ` [igt-dev] [Intel-gfx] " Chris Wilson
2019-02-18 12:50 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/2] drm-uapi: Update i915_drm.h for I915_CONTEXT_PARAM_RECOVERABLE Patchwork
2019-02-18 16:07 ` [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=87va1hxnvo.fsf@gaia.fi.intel.com \
    --to=mika.kuoppala@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