From: Matthew Brost <matthew.brost@intel.com>
To: <tilak.tirumalesh.tangudu@intel.com>
Cc: <niranjana.vishwanathapura@intel.com>, <intel-xe@lists.freedesktop.org>
Subject: Re: [PATCH 3/3] drm/xe/ggtt: invalidate engine GGTT TLBs for multi-queue GTs
Date: Tue, 25 Aug 2026 11:21:50 -0700 [thread overview]
Message-ID: <ao3dPhsS0j20XIDL@gsse-cloud1.jf.intel.com> (raw)
In-Reply-To: <20260824163458.3129935-4-tilak.tirumalesh.tangudu@intel.com>
On Mon, Aug 24, 2026 at 10:04:58PM +0530, tilak.tirumalesh.tangudu@intel.com wrote:
> From: Tangudu Tilak Tirumalesh <tilak.tirumalesh.tangudu@intel.com>
>
> Engines cache GGTT translations in their own TLBs, which the
> xe_tlb_inval_ggtt() does not touch.
> After a GGTT unmap the engines can still hit the stale translation and
> read the old page.
>
> Issue an INVAL_FULL (intra vf) invalidation on GGTT unmap, gated on the
> GT having any multi-queue engine class.
>
> v2: Use xe_gt_has_multi_queue() helper and other knits. - Niranjana
>
> Assisted-by: Claude:claude-opus-4-8
> Signed-off-by: Tangudu Tilak Tirumalesh <tilak.tirumalesh.tangudu@intel.com>
> ---
> drivers/gpu/drm/xe/xe_ggtt.c | 23 ++++++++++++++++++++++-
> 1 file changed, 22 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/xe/xe_ggtt.c b/drivers/gpu/drm/xe/xe_ggtt.c
> index 4cddd69f0e99..0f8946fddbaa 100644
> --- a/drivers/gpu/drm/xe/xe_ggtt.c
> +++ b/drivers/gpu/drm/xe/xe_ggtt.c
> @@ -464,6 +464,7 @@ int xe_ggtt_init_early(struct xe_ggtt *ggtt)
> ALLOW_ERROR_INJECTION(xe_ggtt_init_early, ERRNO); /* See xe_pci_probe() */
>
> static void xe_ggtt_invalidate(struct xe_ggtt *ggtt);
> +static void xe_ggtt_invalidate_engine(struct xe_ggtt *ggtt);
>
> static void xe_ggtt_initial_clear(struct xe_ggtt *ggtt)
> {
> @@ -502,8 +503,11 @@ static void ggtt_node_remove(struct xe_ggtt_node *node)
> xe_ggtt_node_size(node), use_scratch);
> drm_mm_remove_node(&node->base);
> node->base.size = 0;
> - if (bound && node->invalidate_on_remove)
> + if (bound && node->invalidate_on_remove) {
> xe_ggtt_invalidate(ggtt);
> + /* Drain engine TLBs so a recycled range can't hit a stale entry. */
> + xe_ggtt_invalidate_engine(ggtt);
> + }
> mutex_unlock(&ggtt->lock);
>
> ggtt_node_fini(node);
> @@ -612,6 +616,23 @@ static void xe_ggtt_invalidate(struct xe_ggtt *ggtt)
> ggtt_invalidate_gt_tlb(ggtt->tile->media_gt);
> }
>
> +/*
> + * Drain engine-side GGTT TLBs on teardown so a recycled range's next
> + * occupant can't hit a predecessor's cached translation.
> + */
> +static void xe_ggtt_invalidate_engine(struct xe_ggtt *ggtt)
> +{
> + struct xe_gt *gt = ggtt->tile->primary_gt;
> + int err;
> +
> + if (!xe_gt_has_multi_queue(gt))
> + return;
For future-proofing, look similar too xe_ggtt_invalidate():
It should attempt to invalidate both the primary and media GTs. The
media GT will either be NULL or have xe_gt_has_multi_queue() == false,
in which case xe_tlb_inval_ggtt_full() will be skipped for that GT.
Sashiko also flagged this as a potential issue, not functional thing but
good feedback.
Matt
> +
> + err = xe_tlb_inval_ggtt_full(>->tlb_inval);
> + xe_gt_WARN(gt, err, "Failed to invalidate engine GGTT TLBs (%pe)",
> + ERR_PTR(err));
> +}
> +
> /**
> * xe_ggtt_shift_nodes() - Shift GGTT nodes to adjust for a change in usable address range.
> * @ggtt: the &xe_ggtt struct instance
> --
> 2.46.0
>
next prev parent reply other threads:[~2026-08-25 18:22 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-24 16:34 [PATCH 0/3] drm/xe/ggtt: fix stale GGTT mappings on unmap tilak.tirumalesh.tangudu
2026-08-24 16:34 ` [PATCH 1/3] drm/xe/ggtt: stop mapping unmapped GGTT pages to scratch tilak.tirumalesh.tangudu
2026-08-24 16:46 ` sashiko-bot
2026-08-24 18:17 ` Niranjana Vishwanathapura
2026-08-25 17:53 ` Matthew Brost
2026-08-24 16:34 ` [PATCH 2/3] drm/xe/tlb_inval: add xe_tlb_inval_ggtt_full() GGTT invalidation helper tilak.tirumalesh.tangudu
2026-08-24 18:20 ` Niranjana Vishwanathapura
2026-08-25 18:08 ` Matthew Brost
2026-08-24 16:34 ` [PATCH 3/3] drm/xe/ggtt: invalidate engine GGTT TLBs for multi-queue GTs tilak.tirumalesh.tangudu
2026-08-24 16:48 ` sashiko-bot
2026-08-24 18:25 ` Niranjana Vishwanathapura
2026-08-25 18:21 ` Matthew Brost [this message]
2026-08-24 20:44 ` ✓ CI.KUnit: success for drm/xe/ggtt: fix stale GGTT mappings on unmap (rev2) Patchwork
2026-08-24 21:24 ` ✓ Xe.CI.BAT: " Patchwork
-- strict thread matches above, loose matches on Subject: below --
2026-08-27 8:20 [PATCH 0/3] drm/xe/ggtt: fix stale GGTT mappings on unmap tilak.tirumalesh.tangudu
2026-08-27 8:20 ` [PATCH 3/3] drm/xe/ggtt: invalidate engine GGTT TLBs for multi-queue GTs tilak.tirumalesh.tangudu
2026-08-26 11:25 [PATCH 0/3] drm/xe/ggtt: fix stale GGTT mappings on unmap tilak.tirumalesh.tangudu
2026-08-26 11:25 ` [PATCH 3/3] drm/xe/ggtt: invalidate engine GGTT TLBs for multi-queue GTs tilak.tirumalesh.tangudu
2026-08-26 19:45 ` Niranjana Vishwanathapura
2026-08-27 0:32 ` Matthew Brost
2026-08-26 10:31 [PATCH 0/3] drm/xe/ggtt: fix stale GGTT mappings on unmap tilak.tirumalesh.tangudu
2026-08-26 10:31 ` [PATCH 3/3] drm/xe/ggtt: invalidate engine GGTT TLBs for multi-queue GTs tilak.tirumalesh.tangudu
2026-08-21 7:42 [PATCH 0/3] drm/xe/ggtt: fix stale GGTT mappings on unmap tilak.tirumalesh.tangudu
2026-08-21 7:42 ` [PATCH 3/3] drm/xe/ggtt: invalidate engine GGTT TLBs for multi-queue GTs tilak.tirumalesh.tangudu
2026-08-21 7:56 ` sashiko-bot
2026-08-24 0:56 ` Niranjana Vishwanathapura
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=ao3dPhsS0j20XIDL@gsse-cloud1.jf.intel.com \
--to=matthew.brost@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=niranjana.vishwanathapura@intel.com \
--cc=tilak.tirumalesh.tangudu@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox