From: "Dixit, Ashutosh" <ashutosh.dixit@intel.com>
To: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [Intel-gfx] [PATCH v2 1/4] drm/i915/mtl: Resize noa_wait BO size to save restore GPR regs
Date: Wed, 30 Nov 2022 18:18:13 -0800 [thread overview]
Message-ID: <87tu2f3lzu.wl-ashutosh.dixit@intel.com> (raw)
In-Reply-To: <20221201010535.1097741-2-umesh.nerlige.ramappa@intel.com>
On Wed, 30 Nov 2022 17:05:32 -0800, Umesh Nerlige Ramappa wrote:
>
> On MTL, gt->scratch was using stolen lmem. An MI_SRM to stolen lmem
> caused a hang that was attributed to saving and restoring the GPR
> registers used for noa_wait.
>
> Add an additional page in noa_wait BO to save/restore GPR registers for
> the noa_wait logic.
Mostly copying R-b's from https://patchwork.freedesktop.org/series/111411/ here.
Reviewed-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
>
> Signed-off-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
> ---
> drivers/gpu/drm/i915/gt/intel_gt_types.h | 6 ------
> drivers/gpu/drm/i915/i915_perf.c | 25 ++++++++++++++++--------
> 2 files changed, 17 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/gt/intel_gt_types.h b/drivers/gpu/drm/i915/gt/intel_gt_types.h
> index c1d9cd255e06..13dffe0a3d20 100644
> --- a/drivers/gpu/drm/i915/gt/intel_gt_types.h
> +++ b/drivers/gpu/drm/i915/gt/intel_gt_types.h
> @@ -296,12 +296,6 @@ enum intel_gt_scratch_field {
>
> /* 8 bytes */
> INTEL_GT_SCRATCH_FIELD_COHERENTL3_WA = 256,
> -
> - /* 6 * 8 bytes */
> - INTEL_GT_SCRATCH_FIELD_PERF_CS_GPR = 2048,
> -
> - /* 4 bytes */
> - INTEL_GT_SCRATCH_FIELD_PERF_PREDICATE_RESULT_1 = 2096,
> };
>
> #endif /* __INTEL_GT_TYPES_H__ */
> diff --git a/drivers/gpu/drm/i915/i915_perf.c b/drivers/gpu/drm/i915/i915_perf.c
> index 00e09bb18b13..7790a88f10d8 100644
> --- a/drivers/gpu/drm/i915/i915_perf.c
> +++ b/drivers/gpu/drm/i915/i915_perf.c
> @@ -1842,8 +1842,7 @@ static u32 *save_restore_register(struct i915_perf_stream *stream, u32 *cs,
> for (d = 0; d < dword_count; d++) {
> *cs++ = cmd;
> *cs++ = i915_mmio_reg_offset(reg) + 4 * d;
> - *cs++ = intel_gt_scratch_offset(stream->engine->gt,
> - offset) + 4 * d;
> + *cs++ = i915_ggtt_offset(stream->noa_wait) + offset + 4 * d;
> *cs++ = 0;
> }
>
> @@ -1876,7 +1875,13 @@ static int alloc_noa_wait(struct i915_perf_stream *stream)
> MI_PREDICATE_RESULT_2_ENGINE(base) :
> MI_PREDICATE_RESULT_1(RENDER_RING_BASE);
>
> - bo = i915_gem_object_create_internal(i915, 4096);
> + /*
> + * gt->scratch was being used to save/restore the GPR registers, but on
> + * MTL the scratch uses stolen lmem. An MI_SRM to this memory region
> + * causes an engine hang. Instead allocate an additional page here to
> + * save/restore GPR registers
> + */
> + bo = i915_gem_object_create_internal(i915, 8192);
> if (IS_ERR(bo)) {
> drm_err(&i915->drm,
> "Failed to allocate NOA wait batchbuffer\n");
> @@ -1910,14 +1915,19 @@ static int alloc_noa_wait(struct i915_perf_stream *stream)
> goto err_unpin;
> }
>
> + stream->noa_wait = vma;
> +
> +#define GPR_SAVE_OFFSET 4096
> +#define PREDICATE_SAVE_OFFSET 4160
> +
> /* Save registers. */
> for (i = 0; i < N_CS_GPR; i++)
> cs = save_restore_register(
> stream, cs, true /* save */, CS_GPR(i),
> - INTEL_GT_SCRATCH_FIELD_PERF_CS_GPR + 8 * i, 2);
> + GPR_SAVE_OFFSET + 8 * i, 2);
> cs = save_restore_register(
> stream, cs, true /* save */, mi_predicate_result,
> - INTEL_GT_SCRATCH_FIELD_PERF_PREDICATE_RESULT_1, 1);
> + PREDICATE_SAVE_OFFSET, 1);
>
> /* First timestamp snapshot location. */
> ts0 = cs;
> @@ -2033,10 +2043,10 @@ static int alloc_noa_wait(struct i915_perf_stream *stream)
> for (i = 0; i < N_CS_GPR; i++)
> cs = save_restore_register(
> stream, cs, false /* restore */, CS_GPR(i),
> - INTEL_GT_SCRATCH_FIELD_PERF_CS_GPR + 8 * i, 2);
> + GPR_SAVE_OFFSET + 8 * i, 2);
> cs = save_restore_register(
> stream, cs, false /* restore */, mi_predicate_result,
> - INTEL_GT_SCRATCH_FIELD_PERF_PREDICATE_RESULT_1, 1);
> + PREDICATE_SAVE_OFFSET, 1);
>
> /* And return to the ring. */
> *cs++ = MI_BATCH_BUFFER_END;
> @@ -2046,7 +2056,6 @@ static int alloc_noa_wait(struct i915_perf_stream *stream)
> i915_gem_object_flush_map(bo);
> __i915_gem_object_release_map(bo);
>
> - stream->noa_wait = vma;
> goto out_ww;
>
> err_unpin:
> --
> 2.36.1
>
next prev parent reply other threads:[~2022-12-01 2:18 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-01 1:05 [Intel-gfx] [PATCH v2 0/4] drm/i915/mtl: Add OAG 32 bit format support for MTL Umesh Nerlige Ramappa
2022-12-01 1:05 ` [Intel-gfx] [PATCH v2 1/4] drm/i915/mtl: Resize noa_wait BO size to save restore GPR regs Umesh Nerlige Ramappa
2022-12-01 2:18 ` Dixit, Ashutosh [this message]
2022-12-01 1:05 ` [Intel-gfx] [PATCH v2 2/4] drm/i915/mtl: Add Wa_14015846243 to fix OA vs CS timestamp mismatch Umesh Nerlige Ramappa
2022-12-01 2:16 ` Dixit, Ashutosh
2022-12-01 1:05 ` [Intel-gfx] [PATCH v2 3/4] drm/i915/mtl: Update OA mux whitelist for MTL Umesh Nerlige Ramappa
2022-12-01 3:17 ` Dixit, Ashutosh
2022-12-01 1:05 ` [Intel-gfx] [PATCH v2 4/4] drm/i915/mtl: Add OA support by enabling 32 bit OAG formats " Umesh Nerlige Ramappa
2022-12-01 2:14 ` Dixit, Ashutosh
2022-12-08 17:08 ` Umesh Nerlige Ramappa
2022-12-12 10:48 ` Joonas Lahtinen
2022-12-01 1:07 ` [Intel-gfx] [PATCH v2 0/4] drm/i915/mtl: Add OAG 32 bit format support " Umesh Nerlige Ramappa
2022-12-01 1:31 ` [Intel-gfx] ✗ Fi.CI.SPARSE: warning for drm/i915/mtl: Add OAG 32 bit format support for MTL (rev2) Patchwork
2022-12-01 1:46 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2022-12-01 14:08 ` [Intel-gfx] ✗ Fi.CI.IGT: failure " Patchwork
2022-12-01 18:43 ` Umesh Nerlige Ramappa
-- strict thread matches above, loose matches on Subject: below --
2022-12-01 0:59 [Intel-gfx] [PATCH v2 0/4] drm/i915/mtl: Add OAG 32 bit format support for MTL Umesh Nerlige Ramappa
2022-12-01 0:59 ` [Intel-gfx] [PATCH v2 1/4] drm/i915/mtl: Resize noa_wait BO size to save restore GPR regs Umesh Nerlige Ramappa
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=87tu2f3lzu.wl-ashutosh.dixit@intel.com \
--to=ashutosh.dixit@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=umesh.nerlige.ramappa@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.