From: Mika Kuoppala <mika.kuoppala@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, intel-gfx@lists.freedesktop.org
Cc: "# v4 . 10+" <stable@vger.kernel.org>
Subject: Re: [PATCH v2 1/3] drm/i915/execlists: Wrap tail pointer after reset tweaking
Date: Mon, 27 Mar 2017 16:05:04 +0300 [thread overview]
Message-ID: <8737dyyinz.fsf@gaia.fi.intel.com> (raw)
In-Reply-To: <20170327130009.4678-1-chris@chris-wilson.co.uk>
Chris Wilson <chris@chris-wilson.co.uk> writes:
> If the request->wa_tail is 0 (because it landed exactly on the end of
> the ringbuffer), when we reconstruct request->tail following a reset we
> fill in an illegal value (-8 or 0x001ffff8). As a result, RING_HEAD is
> never able to catch up with RING_TAIL and the GPU spins endlessly. If
> the ring contains a couple of breadcrumbs, even our hangcheck is unable
> to catch the busy-looping as the ACTHD and seqno continually advance.
>
> v2: Move the wrap into a common intel_ring_wrap().
>
> Fixes: a3aabe86a340 ("drm/i915/execlists: Reinitialise context image after GPU hang")
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Mika Kuoppala <mika.kuoppala@intel.com>
> Cc: <stable@vger.kernel.org> # v4.10+
Reviewed-by: Mika Kuoppala <mika.kuoppala@intel.com>
> ---
> drivers/gpu/drm/i915/intel_lrc.c | 4 +++-
> drivers/gpu/drm/i915/intel_ringbuffer.h | 10 ++++++++--
> 2 files changed, 11 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c
> index b75df70e8e0e..32fb8ad3fd36 100644
> --- a/drivers/gpu/drm/i915/intel_lrc.c
> +++ b/drivers/gpu/drm/i915/intel_lrc.c
> @@ -1278,7 +1278,9 @@ static void reset_common_ring(struct intel_engine_cs *engine,
> GEM_BUG_ON(request->ctx != port[0].request->ctx);
>
> /* Reset WaIdleLiteRestore:bdw,skl as well */
> - request->tail = request->wa_tail - WA_TAIL_DWORDS * sizeof(u32);
> + request->tail =
> + intel_ring_wrap(request->ring,
> + request->wa_tail - WA_TAIL_DWORDS*sizeof(u32));
> GEM_BUG_ON(!IS_ALIGNED(request->tail, 8));
> }
>
> diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.h b/drivers/gpu/drm/i915/intel_ringbuffer.h
> index 166aa1ae65cf..17ac44980d84 100644
> --- a/drivers/gpu/drm/i915/intel_ringbuffer.h
> +++ b/drivers/gpu/drm/i915/intel_ringbuffer.h
> @@ -515,12 +515,18 @@ intel_ring_advance(struct drm_i915_gem_request *req, u32 *cs)
> }
>
> static inline u32
> -intel_ring_offset(struct drm_i915_gem_request *req, void *addr)
> +intel_ring_wrap(const struct intel_ring *ring, u32 pos)
> +{
> + return pos & (ring->size - 1);
> +}
> +
> +static inline u32
> +intel_ring_offset(const struct drm_i915_gem_request *req, void *addr)
> {
> /* Don't write ring->size (equivalent to 0) as that hangs some GPUs. */
> u32 offset = addr - req->ring->vaddr;
> GEM_BUG_ON(offset > req->ring->size);
> - return offset & (req->ring->size - 1);
> + return intel_ring_wrap(req->ring, offset);
> }
>
> void intel_ring_update_space(struct intel_ring *ring);
> --
> 2.11.0
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
WARNING: multiple messages have this Message-ID (diff)
From: Mika Kuoppala <mika.kuoppala@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, intel-gfx@lists.freedesktop.org
Cc: tvrtko.ursulin@intel.com, Chris Wilson <chris@chris-wilson.co.uk>,
"# v4 . 10+" <stable@vger.kernel.org>
Subject: Re: [PATCH v2 1/3] drm/i915/execlists: Wrap tail pointer after reset tweaking
Date: Mon, 27 Mar 2017 16:05:04 +0300 [thread overview]
Message-ID: <8737dyyinz.fsf@gaia.fi.intel.com> (raw)
In-Reply-To: <20170327130009.4678-1-chris@chris-wilson.co.uk>
Chris Wilson <chris@chris-wilson.co.uk> writes:
> If the request->wa_tail is 0 (because it landed exactly on the end of
> the ringbuffer), when we reconstruct request->tail following a reset we
> fill in an illegal value (-8 or 0x001ffff8). As a result, RING_HEAD is
> never able to catch up with RING_TAIL and the GPU spins endlessly. If
> the ring contains a couple of breadcrumbs, even our hangcheck is unable
> to catch the busy-looping as the ACTHD and seqno continually advance.
>
> v2: Move the wrap into a common intel_ring_wrap().
>
> Fixes: a3aabe86a340 ("drm/i915/execlists: Reinitialise context image after GPU hang")
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Mika Kuoppala <mika.kuoppala@intel.com>
> Cc: <stable@vger.kernel.org> # v4.10+
Reviewed-by: Mika Kuoppala <mika.kuoppala@intel.com>
> ---
> drivers/gpu/drm/i915/intel_lrc.c | 4 +++-
> drivers/gpu/drm/i915/intel_ringbuffer.h | 10 ++++++++--
> 2 files changed, 11 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c
> index b75df70e8e0e..32fb8ad3fd36 100644
> --- a/drivers/gpu/drm/i915/intel_lrc.c
> +++ b/drivers/gpu/drm/i915/intel_lrc.c
> @@ -1278,7 +1278,9 @@ static void reset_common_ring(struct intel_engine_cs *engine,
> GEM_BUG_ON(request->ctx != port[0].request->ctx);
>
> /* Reset WaIdleLiteRestore:bdw,skl as well */
> - request->tail = request->wa_tail - WA_TAIL_DWORDS * sizeof(u32);
> + request->tail =
> + intel_ring_wrap(request->ring,
> + request->wa_tail - WA_TAIL_DWORDS*sizeof(u32));
> GEM_BUG_ON(!IS_ALIGNED(request->tail, 8));
> }
>
> diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.h b/drivers/gpu/drm/i915/intel_ringbuffer.h
> index 166aa1ae65cf..17ac44980d84 100644
> --- a/drivers/gpu/drm/i915/intel_ringbuffer.h
> +++ b/drivers/gpu/drm/i915/intel_ringbuffer.h
> @@ -515,12 +515,18 @@ intel_ring_advance(struct drm_i915_gem_request *req, u32 *cs)
> }
>
> static inline u32
> -intel_ring_offset(struct drm_i915_gem_request *req, void *addr)
> +intel_ring_wrap(const struct intel_ring *ring, u32 pos)
> +{
> + return pos & (ring->size - 1);
> +}
> +
> +static inline u32
> +intel_ring_offset(const struct drm_i915_gem_request *req, void *addr)
> {
> /* Don't write ring->size (equivalent to 0) as that hangs some GPUs. */
> u32 offset = addr - req->ring->vaddr;
> GEM_BUG_ON(offset > req->ring->size);
> - return offset & (req->ring->size - 1);
> + return intel_ring_wrap(req->ring, offset);
> }
>
> void intel_ring_update_space(struct intel_ring *ring);
> --
> 2.11.0
next prev parent reply other threads:[~2017-03-27 13:05 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-27 13:00 [PATCH v2 1/3] drm/i915/execlists: Wrap tail pointer after reset tweaking Chris Wilson
2017-03-27 13:00 ` [PATCH v2 2/3] drm/i915: Assert that the request->tail fits within the ring Chris Wilson
2017-03-27 13:57 ` Mika Kuoppala
2017-03-27 13:00 ` [PATCH v2 3/3] drm/i915: Refactor tests for validity of RING_TAIL Chris Wilson
2017-03-27 13:14 ` [PATCH v3] " Chris Wilson
2017-03-27 13:57 ` Mika Kuoppala
2017-03-27 13:05 ` Mika Kuoppala [this message]
2017-03-27 13:05 ` [PATCH v2 1/3] drm/i915/execlists: Wrap tail pointer after reset tweaking Mika Kuoppala
2017-03-27 14:11 ` ✓ Fi.CI.BAT: success for series starting with [v2,1/3] drm/i915/execlists: Wrap tail pointer after reset tweaking (rev2) Patchwork
2017-03-27 14:20 ` 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=8737dyyinz.fsf@gaia.fi.intel.com \
--to=mika.kuoppala@linux.intel.com \
--cc=chris@chris-wilson.co.uk \
--cc=intel-gfx@lists.freedesktop.org \
--cc=stable@vger.kernel.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.