All of lore.kernel.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
Subject: Re: [PATCH 3/6] drm/i915/selftests: Fixup atomic reset checking
Date: Wed, 26 Jun 2019 16:35:01 +0300	[thread overview]
Message-ID: <8736jw5v22.fsf@gaia.fi.intel.com> (raw)
In-Reply-To: <20190626065303.31624-3-chris@chris-wilson.co.uk>

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

> We require that the intel_gpu_reset() was atomic, not the whole of
> i915_reset() which is guarded by a mutex. However, we do require that
> i915_reset_engine() is atomic for use from within the submission tasklet.
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> ---
>  drivers/gpu/drm/i915/gt/selftest_reset.c | 65 +++++++++++++++++++++++-
>  1 file changed, 63 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/gt/selftest_reset.c b/drivers/gpu/drm/i915/gt/selftest_reset.c
> index 64c2c8ab64ec..641cf3aee8d5 100644
> --- a/drivers/gpu/drm/i915/gt/selftest_reset.c
> +++ b/drivers/gpu/drm/i915/gt/selftest_reset.c
> @@ -73,11 +73,13 @@ static int igt_atomic_reset(void *arg)
>  	for (p = igt_atomic_phases; p->name; p++) {
>  		GEM_TRACE("intel_gpu_reset under %s\n", p->name);
>  
> -		p->critical_section_begin();
>  		reset_prepare(i915);
> +		p->critical_section_begin();
> +
>  		err = intel_gpu_reset(i915, ALL_ENGINES);
> -		reset_finish(i915);
> +
>  		p->critical_section_end();
> +		reset_finish(i915);
>  
>  		if (err) {
>  			pr_err("intel_gpu_reset failed under %s\n", p->name);
> @@ -95,12 +97,71 @@ static int igt_atomic_reset(void *arg)
>  	return err;
>  }
>  
> +static int igt_atomic_engine_reset(void *arg)
> +{
> +	struct drm_i915_private *i915 = arg;
> +	const typeof(*igt_atomic_phases) *p;

I did admire the nastyness of this array.

> +	struct intel_engine_cs *engine;
> +	enum intel_engine_id id;
> +	int err = 0;
> +
> +	/* Check that the resets are usable from atomic context */
> +
> +	if (!intel_has_reset_engine(i915))
> +		return 0;
> +
> +	if (USES_GUC_SUBMISSION(i915))
> +		return 0;
> +
> +	intel_gt_pm_get(&i915->gt);
> +	igt_global_reset_lock(i915);
> +
> +	/* Flush any requests before we get started and check basics */
> +	if (!igt_force_reset(i915))
> +		goto out_unlock;

I would still go out with error if the prerequisites
are not met?

-Mika

> +
> +	for_each_engine(engine, i915, id) {
> +		tasklet_disable_nosync(&engine->execlists.tasklet);
> +		intel_engine_pm_get(engine);
> +
> +		for (p = igt_atomic_phases; p->name; p++) {
> +			GEM_TRACE("i915_reset_engine(%s) under %s\n",
> +				  engine->name, p->name);
> +
> +			p->critical_section_begin();
> +			err = i915_reset_engine(engine, NULL);
> +			p->critical_section_end();
> +
> +			if (err) {
> +				pr_err("i915_reset_engine(%s) failed under %s\n",
> +				       engine->name, p->name);
> +				break;
> +			}
> +		}
> +
> +		intel_engine_pm_put(engine);
> +		tasklet_enable(&engine->execlists.tasklet);
> +		if (err)
> +			break;
> +	}
> +
> +	/* As we poke around the guts, do a full reset before continuing. */
> +	igt_force_reset(i915);
> +
> +out_unlock:
> +	igt_global_reset_unlock(i915);
> +	intel_gt_pm_put(&i915->gt);
> +
> +	return err;
> +}
> +
>  int intel_reset_live_selftests(struct drm_i915_private *i915)
>  {
>  	static const struct i915_subtest tests[] = {
>  		SUBTEST(igt_global_reset), /* attempt to recover GPU first */
>  		SUBTEST(igt_wedged_reset),
>  		SUBTEST(igt_atomic_reset),
> +		SUBTEST(igt_atomic_engine_reset),
>  	};
>  	intel_wakeref_t wakeref;
>  	int err = 0;
> -- 
> 2.20.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2019-06-26 13:35 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-26  6:52 [PATCH 1/6] drm/i915/selftests: Serialise nop reset with retirement Chris Wilson
2019-06-26  6:52 ` [PATCH 2/6] drm/i915/selftests: Drop manual request wakerefs around hangcheck Chris Wilson
2019-06-26 13:19   ` Chris Wilson
2019-06-26 13:27   ` Mika Kuoppala
2019-06-26  6:53 ` [PATCH 3/6] drm/i915/selftests: Fixup atomic reset checking Chris Wilson
2019-06-26 13:35   ` Mika Kuoppala [this message]
2019-06-26 13:39     ` Chris Wilson
2019-06-26 13:43       ` Mika Kuoppala
2019-06-26  6:53 ` [PATCH 4/6] drm/i915: Add a wakeref getter for iff the wakeref is already active Chris Wilson
2019-06-26 13:43   ` Mika Kuoppala
2019-06-26 13:46     ` Chris Wilson
2019-06-26 14:37       ` Mika Kuoppala
2019-06-26  6:53 ` [PATCH 5/6] drm/i915: Only recover active engines Chris Wilson
2019-06-26 14:44   ` Mika Kuoppala
2019-06-26 14:47     ` Chris Wilson
2019-06-26  6:53 ` [PATCH 6/6] drm/i915: Lift intel_engines_resume() to callers Chris Wilson
2019-06-26  8:20 ` ✗ Fi.CI.CHECKPATCH: warning for series starting with [1/6] drm/i915/selftests: Serialise nop reset with retirement Patchwork
2019-06-26  9:35 ` ✓ Fi.CI.BAT: success " Patchwork
2019-06-26 13:11 ` [PATCH 1/6] " Mika Kuoppala
2019-06-26 13:22   ` Chris Wilson
2019-06-26 15:32 ` ✓ Fi.CI.IGT: success for series starting with [1/6] " 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=8736jw5v22.fsf@gaia.fi.intel.com \
    --to=mika.kuoppala@linux.intel.com \
    --cc=chris@chris-wilson.co.uk \
    --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 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.