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
Cc: matthew.auld@intel.com
Subject: Re: [Intel-gfx] [PATCH 5/6] drm/i915/gt: Discard stale context state from across idling
Date: Mon, 30 Dec 2019 18:30:21 +0200	[thread overview]
Message-ID: <877e2drd2a.fsf@gaia.fi.intel.com> (raw)
In-Reply-To: <20191230160112.3838434-5-chris@chris-wilson.co.uk>

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

> Before we idle, on parking, we switch to the kernel context such that we
> have a scratch context loaded while the GPU idle, protecting any
> precious user state. Be paranoid and assume that the idle state may have
> been trashed, and reset the kernel_context image after idling.
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Imre Deak <imre.deak@intel.com>
> ---
>  drivers/gpu/drm/i915/gt/intel_engine_pm.c | 6 ++++++
>  drivers/gpu/drm/i915/gt/intel_gt_pm.c     | 8 --------
>  drivers/gpu/drm/i915/gt/mock_engine.c     | 5 +++++
>  3 files changed, 11 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/gt/intel_engine_pm.c b/drivers/gpu/drm/i915/gt/intel_engine_pm.c
> index cd82f0baef49..1b9f73948f22 100644
> --- a/drivers/gpu/drm/i915/gt/intel_engine_pm.c
> +++ b/drivers/gpu/drm/i915/gt/intel_engine_pm.c
> @@ -20,6 +20,7 @@ static int __engine_unpark(struct intel_wakeref *wf)
>  {
>  	struct intel_engine_cs *engine =
>  		container_of(wf, typeof(*engine), wakeref);
> +	struct intel_context *ce;
>  	void *map;
>  
>  	ENGINE_TRACE(engine, "\n");
> @@ -34,6 +35,11 @@ static int __engine_unpark(struct intel_wakeref *wf)
>  	if (!IS_ERR_OR_NULL(map))
>  		engine->pinned_default_state = map;
>  
> +	/* Discard stale context state from across idling */
> +	ce = engine->kernel_context;
> +	if (ce)
> +		ce->ops->reset(ce);
> +

Expect the worst, sure.
Checksum would get us datapoints tho.

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


>  	if (engine->unpark)
>  		engine->unpark(engine);
>  
> diff --git a/drivers/gpu/drm/i915/gt/intel_gt_pm.c b/drivers/gpu/drm/i915/gt/intel_gt_pm.c
> index 9b220c930ebc..d1c2f034296a 100644
> --- a/drivers/gpu/drm/i915/gt/intel_gt_pm.c
> +++ b/drivers/gpu/drm/i915/gt/intel_gt_pm.c
> @@ -213,16 +213,8 @@ int intel_gt_resume(struct intel_gt *gt)
>  	intel_llc_enable(&gt->llc);
>  
>  	for_each_engine(engine, gt, id) {
> -		struct intel_context *ce;
> -
>  		intel_engine_pm_get(engine);
>  
> -		ce = engine->kernel_context;
> -		if (ce) {
> -			GEM_BUG_ON(!intel_context_is_pinned(ce));
> -			ce->ops->reset(ce);
> -		}
> -
>  		engine->serial++; /* kernel context lost */
>  		err = engine->resume(engine);
>  
> diff --git a/drivers/gpu/drm/i915/gt/mock_engine.c b/drivers/gpu/drm/i915/gt/mock_engine.c
> index 4e1eafa94be9..d0e68ce9aa51 100644
> --- a/drivers/gpu/drm/i915/gt/mock_engine.c
> +++ b/drivers/gpu/drm/i915/gt/mock_engine.c
> @@ -152,6 +152,10 @@ static int mock_context_pin(struct intel_context *ce)
>  	return intel_context_active_acquire(ce);
>  }
>  
> +static void mock_context_reset(struct intel_context *ce)
> +{
> +}
> +
>  static const struct intel_context_ops mock_context_ops = {
>  	.alloc = mock_context_alloc,
>  
> @@ -161,6 +165,7 @@ static const struct intel_context_ops mock_context_ops = {
>  	.enter = intel_context_enter_engine,
>  	.exit = intel_context_exit_engine,
>  
> +	.reset = mock_context_reset,
>  	.destroy = mock_context_destroy,
>  };
>  
> -- 
> 2.25.0.rc0
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2019-12-30 16:30 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-30 16:01 [Intel-gfx] [PATCH 1/6] drm/i915/selftests: Flush the context worker Chris Wilson
2019-12-30 16:01 ` [Intel-gfx] [PATCH 2/6] drm/i915/gt: Clear LRC image inline Chris Wilson
2019-12-30 16:01 ` [Intel-gfx] [PATCH 3/6] drm/i915/gt: Leave RING_BB_STATE to default value Chris Wilson
2019-12-30 16:13   ` Chris Wilson
2019-12-30 16:18   ` Mika Kuoppala
2019-12-30 16:01 ` [Intel-gfx] [PATCH 4/6] drm/i915/gt: Ignore stale context state upon resume Chris Wilson
2019-12-30 16:14   ` Chris Wilson
2019-12-30 16:01 ` [Intel-gfx] [PATCH 5/6] drm/i915/gt: Discard stale context state from across idling Chris Wilson
2019-12-30 16:26   ` Chris Wilson
2019-12-30 16:30   ` Mika Kuoppala [this message]
2019-12-30 16:36     ` Chris Wilson
2019-12-30 16:01 ` [Intel-gfx] [PATCH 6/6] drm/i915/gt: Always poison the kernel_context image before unparking Chris Wilson
2019-12-30 16:23   ` Mika Kuoppala
2019-12-30 16:25     ` Chris Wilson
2019-12-30 16:03 ` [Intel-gfx] [PATCH 1/6] drm/i915/selftests: Flush the context worker Mika Kuoppala
2019-12-30 16:53 ` [Intel-gfx] ✗ Fi.CI.BAT: failure for series starting with [1/6] " Patchwork
2019-12-30 17:08   ` 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=877e2drd2a.fsf@gaia.fi.intel.com \
    --to=mika.kuoppala@linux.intel.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=matthew.auld@intel.com \
    /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.