public inbox for intel-gfx@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: Daniel Vetter <daniel.vetter@ffwll.ch>
Subject: Re: [PATCH] drm/i915: Restore inhibiting the load of the default context
Date: Fri, 27 Nov 2015 13:32:11 +0200	[thread overview]
Message-ID: <87zixz4r0k.fsf@gaia.fi.intel.com> (raw)
In-Reply-To: <1448618850-23514-1-git-send-email-chris@chris-wilson.co.uk>

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

> Following a GPU reset, we may leave the context in a poorly defined
> state, and reloading from that context will leave the GPU flummoxed. For
> secondary contexts, this will lead to that context being banned - but
> currently it is also causing the default context to become banned,
> leading to turmoil in the shared state.
>
> This is a regression from
>
> commit 6702cf16e0ba8b0129f5aa1b6609d4e9c70bc13b [v4.1]
> Author: Ben Widawsky <benjamin.widawsky@intel.com>
> Date:   Mon Mar 16 16:00:58 2015 +0000
>
>     drm/i915: Initialize all contexts
>
> which quietly introduced the removal of the MI_RESTORE_INHIBIT on the
> default context.
>

As we never submit anything except driver initialization commands
for that context, what would cause this context to become corrupted?

Please consider:

diff --git a/drivers/gpu/drm/i915/i915_gem_context.c
b/drivers/gpu/drm/i915/i915_gem_context.c
index 43761c5..45b9a39 100644
--- a/drivers/gpu/drm/i915/i915_gem_context.c
+++ b/drivers/gpu/drm/i915/i915_gem_context.c
@@ -332,6 +332,7 @@ void i915_gem_context_reset(struct drm_device *dev)
        for (i = 0; i < I915_NUM_RINGS; i++) {
                struct intel_engine_cs *ring = &dev_priv->ring[i];
                struct intel_context *lctx = ring->last_context;
+               struct intel_context *dctx = ring->default_context;
 
                if (lctx) {
                        if (lctx->legacy_hw_ctx.rcs_state && i == RCS)
@@ -340,6 +341,9 @@ void i915_gem_context_reset(struct drm_device *dev)
                        i915_gem_context_unreference(lctx);
                        ring->last_context = NULL;
                }
+
+               if (dctx)
+                       dctx->legacy_hw_ctx.initialized = false;
        }
 }

To achieve the same effect and as a bonus, get the
same default context (with workarounds) as we
did in driver init.

I also think that we should zero the global
default context in here to gain similarity wrt
module init.

-Mika

> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Michel Thierry <michel.thierry@intel.com>
> Cc: Mika Kuoppala <mika.kuoppala@intel.com>
> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> ---
>  drivers/gpu/drm/i915/i915_gem_context.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_gem_context.c b/drivers/gpu/drm/i915/i915_gem_context.c
> index 43761c5bcaca..1041099d285a 100644
> --- a/drivers/gpu/drm/i915/i915_gem_context.c
> +++ b/drivers/gpu/drm/i915/i915_gem_context.c
> @@ -708,7 +708,7 @@ static int do_switch(struct drm_i915_gem_request *req)
>  	if (ret)
>  		goto unpin_out;
>  
> -	if (!to->legacy_hw_ctx.initialized) {
> +	if (!to->legacy_hw_ctx.initialized || i915_gem_context_is_default(to)) {
>  		hw_flags |= MI_RESTORE_INHIBIT;
>  		/* NB: If we inhibit the restore, the context is not allowed to
>  		 * die because future work may end up depending on valid address
> -- 
> 2.6.2
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2015-11-27 11:33 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-27 10:07 [PATCH] drm/i915: Restore inhibiting the load of the default context Chris Wilson
2015-11-27 11:32 ` Mika Kuoppala [this message]
2015-11-27 13:14   ` Chris Wilson
2015-11-27 13:28   ` [PATCH v2] " Chris Wilson
2015-12-10 10:19     ` Mika Kuoppala
2015-12-10 10:45       ` Daniel Vetter
2016-01-06 10:07         ` Daniel Vetter
2015-12-10 13:24       ` Francisco Jerez
2015-12-10 13:37         ` Chris Wilson
2015-12-10 13:57           ` Francisco Jerez
2015-12-10 14:03           ` Daniel Vetter

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=87zixz4r0k.fsf@gaia.fi.intel.com \
    --to=mika.kuoppala@linux.intel.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=daniel.vetter@ffwll.ch \
    --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