From: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 2/2] drm/i915/execlists: Reset RING registers upon resume
Date: Mon, 19 Sep 2016 11:24:20 +0300 [thread overview]
Message-ID: <1474273460.3344.3.camel@linux.intel.com> (raw)
In-Reply-To: <20160916192318.14030-2-chris@chris-wilson.co.uk>
On pe, 2016-09-16 at 20:23 +0100, Chris Wilson wrote:
> void intel_lr_context_resume(struct drm_i915_private *dev_priv)
> {
> > - struct i915_gem_context *ctx = dev_priv->kernel_context;
> > struct intel_engine_cs *engine;
> > + struct i915_gem_context *ctx;
> +
> > + /* Because we emit WA_TAIL_DWORDS there may be a disparity
> > + * between our bookkeeping in ce->ring->head and ce->ring->tail and
> + * that stored in context. As we only write new comamnds from
"new commands"
> + * ce->ring->tail onwards, everything before that is junk. If the GPU
> > + * starts reading from its RING_HEAD from the context, it may try to
> > + * execute that junk and die.
> > + *
> > + * So to avoid that we reset the context images upon resume. For
> > + * simplicity, we just zero everything out.
> > + */
> > + list_for_each_entry(ctx, &dev_priv->context_list, link) {
> > + for_each_engine(engine, dev_priv) {
> > + struct intel_context *ce = &ctx->engine[engine->id];
> > + u32 *reg_state;
>
> > - for_each_engine(engine, dev_priv) {
> > - struct intel_context *ce = &ctx->engine[engine->id];
> > - void *vaddr;
> > - uint32_t *reg_state;
> -
> > - if (!ce->state)
> > - continue;
> -
> > - vaddr = i915_gem_object_pin_map(ce->state->obj, I915_MAP_WB);
> > - if (WARN_ON(IS_ERR(vaddr)))
> > - continue;
> > + if (!ce->state)
> > + continue;
>
> > - reg_state = vaddr + LRC_STATE_PN * PAGE_SIZE;
> > + reg_state = i915_gem_object_pin_map(ce->state->obj,
> > + I915_MAP_WB);
> > + if (WARN_ON(IS_ERR(reg_state)))
> > + continue;
>
> > - reg_state[CTX_RING_HEAD+1] = 0;
> > - reg_state[CTX_RING_TAIL+1] = 0;
> + reg_state += LRC_STATE_PN * PAGE_SIZE / sizeof(u32);
/ sizeof(*reg_state) I presume.
Also add a newline here.
With those;
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Regards, Joonas
--
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2016-09-19 8:24 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-16 19:23 [PATCH 1/2] drm/i915: Only shrink the unbound objects during freeze Chris Wilson
2016-09-16 19:23 ` [PATCH 2/2] drm/i915/execlists: Reset RING registers upon resume Chris Wilson
2016-09-19 8:24 ` Joonas Lahtinen [this message]
2016-09-19 8:31 ` [PATCH 1/2] drm/i915: Only shrink the unbound objects during freeze Joonas Lahtinen
2016-09-19 8:38 ` Chris Wilson
2016-09-19 12:09 ` Joonas Lahtinen
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=1474273460.3344.3.camel@linux.intel.com \
--to=joonas.lahtinen@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).