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: Wed, 26 Aug 2026 17:32:35 -0700 [thread overview]
Message-ID: <ao+Fo7E9c81pJtKT@gsse-cloud1.jf.intel.com> (raw)
In-Reply-To: <20260826112533.3289978-4-tilak.tirumalesh.tangudu@intel.com>
On Wed, Aug 26, 2026 at 04:55:33PM +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 address nits (Niranjana)
> v3:
> - Invalidate both the primary and media GTs, similar to
> xe_ggtt_invalidate() (Matt Brost)
>
> Assisted-by: Claude:claude-opus-4-8
> Signed-off-by: Tangudu Tilak Tirumalesh <tilak.tirumalesh.tangudu@intel.com>
Reviewed-by: Matthew Brost <matthew.brost@intel.com>
> ---
> drivers/gpu/drm/xe/xe_ggtt.c | 29 ++++++++++++++++++++++++++++-
> 1 file changed, 28 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/xe/xe_ggtt.c b/drivers/gpu/drm/xe/xe_ggtt.c
> index bd65100283e3..cc43089de34d 100644
> --- a/drivers/gpu/drm/xe/xe_ggtt.c
> +++ b/drivers/gpu/drm/xe/xe_ggtt.c
> @@ -451,6 +451,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)
> {
> @@ -482,8 +483,11 @@ static void ggtt_node_remove(struct xe_ggtt_node *node)
> xe_ggtt_clear(ggtt, xe_ggtt_node_addr(node), xe_ggtt_node_size(node));
> 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);
> @@ -600,6 +604,29 @@ static void xe_ggtt_invalidate(struct xe_ggtt *ggtt)
> ggtt_invalidate_gt_tlb(ggtt->tile->media_gt);
> }
>
> +static void ggtt_invalidate_gt_engine_tlb(struct xe_gt *gt)
> +{
> + int err;
> +
> + if (!xe_gt_has_multi_queue(gt))
> + return;
> +
> + err = xe_tlb_inval_ggtt_full(>->tlb_inval);
> + xe_gt_WARN(gt, err, "Failed to invalidate engine GGTT TLBs (%pe)",
> + ERR_PTR(err));
> +}
> +
> +/*
> + * 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)
> +{
> + /* Each GT in a tile has its own engine TLBs to drain */
> + ggtt_invalidate_gt_engine_tlb(ggtt->tile->primary_gt);
> + ggtt_invalidate_gt_engine_tlb(ggtt->tile->media_gt);
> +}
> +
> /**
> * 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-27 0:32 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
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 1/3] drm/xe/ggtt: fault on unmapped GGTT for multi-queue platforms tilak.tirumalesh.tangudu
2026-08-26 19:15 ` Niranjana Vishwanathapura
2026-08-26 20:10 ` Matt Roper
2026-08-26 20:23 ` Matthew Brost
2026-08-27 4:18 ` Tangudu, Tilak Tirumalesh
2026-08-26 11:25 ` [PATCH 2/3] drm/xe/tlb_inval: add xe_tlb_inval_ggtt_full() GGTT invalidation helper tilak.tirumalesh.tangudu
2026-08-26 19:30 ` Niranjana Vishwanathapura
2026-08-26 19:48 ` Matthew Brost
2026-08-26 19:50 ` Matthew Brost
2026-08-27 6:30 ` Tangudu, Tilak Tirumalesh
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 [this message]
2026-08-26 11:35 ` ✓ CI.KUnit: success for drm/xe/ggtt: fix stale GGTT mappings on unmap (rev4) Patchwork
2026-08-26 12:19 ` ✓ Xe.CI.BAT: " Patchwork
2026-08-26 14:40 ` ✗ Xe.CI.FULL: failure " 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 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-24 16:34 [PATCH 0/3] drm/xe/ggtt: fix stale GGTT mappings on unmap tilak.tirumalesh.tangudu
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
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=ao+Fo7E9c81pJtKT@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