From: Mika Kuoppala <mika.kuoppala@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, intel-gfx@lists.freedesktop.org
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Subject: Re: [Intel-gfx] [PATCH 4/4] drm/i915/gt: Use a mmio read of the CSB in case of failure
Date: Tue, 15 Sep 2020 16:39:50 +0300 [thread overview]
Message-ID: <87ft7jyx95.fsf@gaia.fi.intel.com> (raw)
In-Reply-To: <20200915124150.12045-4-chris@chris-wilson.co.uk>
Chris Wilson <chris@chris-wilson.co.uk> writes:
> If we find the GPU didn't update the CSB within 50us, we currently fail
> and eventually reset the GPU. Lets report the value from the mmio space
> as a last resort, it may just stave off an unnecessary GPU reset.
>
> Suggested-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>
I am more of a messenger. This can be replaced by
References: HSDES#22011327657
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
> ---
> drivers/gpu/drm/i915/gt/intel_lrc.c | 26 +++++++++++++++++++------
> drivers/gpu/drm/i915/gt/intel_lrc_reg.h | 3 +++
> 2 files changed, 23 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/gt/intel_lrc.c b/drivers/gpu/drm/i915/gt/intel_lrc.c
> index fcb6ec3d55f4..7cf208311539 100644
> --- a/drivers/gpu/drm/i915/gt/intel_lrc.c
> +++ b/drivers/gpu/drm/i915/gt/intel_lrc.c
> @@ -2528,19 +2528,33 @@ static inline bool gen8_csb_parse(const u64 csb)
> return csb & (GEN8_CTX_STATUS_IDLE_ACTIVE | GEN8_CTX_STATUS_PREEMPTED);
> }
>
> -static noinline u64 wa_csb_read(u64 * const csb)
> +static noinline u64
> +wa_csb_read(const struct intel_engine_cs *engine, u64 * const csb)
> {
> u64 entry;
>
> preempt_disable();
> - if (wait_for_atomic_us((entry = READ_ONCE(*csb)) != -1, 50))
> - GEM_WARN_ON("50us CSB timeout");
> + if (wait_for_atomic_us((entry = READ_ONCE(*csb)) != -1, 50)) {
The hsdes says 30us delay between head and csb fetch. But well we
want to sort it out as quickly as possible.
hsdes also states that status buf read delay OR mmio read.
I think that our AND variation surpasses the recommendations.
Reviewed-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>
> + int idx = csb - engine->execlists.csb_status;
> + int status;
> +
> + status = GEN8_EXECLISTS_STATUS_BUF;
> + if (idx >= 6) {
> + status = GEN11_EXECLISTS_STATUS_BUF2;
> + idx -= 6;
> + }
> + status += sizeof(u64) * idx;
> +
> + entry = intel_uncore_read64(engine->uncore,
> + _MMIO(engine->mmio_base + status));
> + }
> preempt_enable();
>
> return entry;
> }
>
> -static inline u64 csb_read(u64 * const csb)
> +static inline u64
> +csb_read(const struct intel_engine_cs *engine, u64 * const csb)
> {
> u64 entry = READ_ONCE(*csb);
>
> @@ -2556,7 +2570,7 @@ static inline u64 csb_read(u64 * const csb)
> * tgl:HSDES#22011248461
> */
> if (unlikely(entry == -1))
> - entry = wa_csb_read(csb);
> + entry = wa_csb_read(engine, csb);
>
> /* Consume this entry so that we can spot its future reuse. */
> WRITE_ONCE(*csb, -1);
> @@ -2649,7 +2663,7 @@ static void process_csb(struct intel_engine_cs *engine)
> * status notifier.
> */
>
> - csb = csb_read(buf + head);
> + csb = csb_read(engine, buf + head);
> ENGINE_TRACE(engine, "csb[%d]: status=0x%08x:0x%08x\n",
> head, upper_32_bits(csb), lower_32_bits(csb));
>
> diff --git a/drivers/gpu/drm/i915/gt/intel_lrc_reg.h b/drivers/gpu/drm/i915/gt/intel_lrc_reg.h
> index 93cb6c460508..1b51f7b9a5c3 100644
> --- a/drivers/gpu/drm/i915/gt/intel_lrc_reg.h
> +++ b/drivers/gpu/drm/i915/gt/intel_lrc_reg.h
> @@ -49,4 +49,7 @@
> #define GEN11_CTX_RCS_INDIRECT_CTX_OFFSET_DEFAULT 0x1A
> #define GEN12_CTX_RCS_INDIRECT_CTX_OFFSET_DEFAULT 0xD
>
> +#define GEN8_EXECLISTS_STATUS_BUF 0x370
> +#define GEN11_EXECLISTS_STATUS_BUF2 0x3c0
> +
> #endif /* _INTEL_LRC_REG_H_ */
> --
> 2.20.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2020-09-15 13:41 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-15 12:41 [Intel-gfx] [PATCH 1/4] drm/i915/gt: Widen CSB pointer to u64 for the parsers Chris Wilson
2020-09-15 12:41 ` [Intel-gfx] [PATCH 2/4] drm/i915/gt: Wait for CSB entries on Tigerlake Chris Wilson
2020-09-15 13:19 ` Mika Kuoppala
2020-09-16 6:33 ` Greg KH
2020-09-16 8:26 ` Chris Wilson
2020-09-16 8:35 ` Greg KH
2020-09-15 12:41 ` [Intel-gfx] [PATCH 3/4] drm/i915/gt: Apply the CSB w/a for all Chris Wilson
2020-09-15 13:29 ` Mika Kuoppala
2020-09-15 12:41 ` [Intel-gfx] [PATCH 4/4] drm/i915/gt: Use a mmio read of the CSB in case of failure Chris Wilson
2020-09-15 13:39 ` Mika Kuoppala [this message]
2020-09-15 13:56 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for series starting with [1/4] drm/i915/gt: Widen CSB pointer to u64 for the parsers Patchwork
2020-09-15 13:57 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2020-09-15 14:21 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2020-09-15 17:26 ` [Intel-gfx] ✗ Fi.CI.IGT: failure " 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=87ft7jyx95.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox