From: Niranjana Vishwanathapura <niranjana.vishwanathapura@intel.com>
To: <tilak.tirumalesh.tangudu@intel.com>
Cc: <matthew.brost@intel.com>, <intel-xe@lists.freedesktop.org>
Subject: Re: [PATCH 3/3] drm/xe/ggtt: invalidate engine GGTT TLBs for multi-queue GTs
Date: Sun, 23 Aug 2026 17:56:09 -0700 [thread overview]
Message-ID: <aouWqfHYxus0OuWq@nvishwa1-desk> (raw)
In-Reply-To: <20260821074238.3000501-4-tilak.tirumalesh.tangudu@intel.com>
On Fri, Aug 21, 2026 at 01:12:38PM +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 a FULL_INTRA_VF invalidation on GGTT unmap, gated on the GT
>having any multi-queue engine class.
NIT...probably good to keep the name consistent.
"Issue a INVAL_FULL (intra vf) invalidation...."?
>
>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 3564345fd740..60eb9a3d29cc 100644
>--- a/drivers/gpu/drm/xe/xe_ggtt.c
>+++ b/drivers/gpu/drm/xe/xe_ggtt.c
>@@ -458,6 +458,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)
> {
>@@ -493,8 +494,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);
>@@ -603,6 +607,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 (!gt || !gt->info.multi_queue_engine_class_mask)
>+ return;
>+
As mentioned in other patch, probably good to abstract this into a
separate function with proper name and comment.
Niranjana
>+ 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-24 0:56 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
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 1/3] drm/xe/ggtt: stop mapping unmapped GGTT pages to scratch tilak.tirumalesh.tangudu
2026-08-24 0:32 ` Niranjana Vishwanathapura
2026-08-21 7:42 ` [PATCH 2/3] drm/xe/tlb_inval: add FULL_INTRA_VF GGTT invalidation helper tilak.tirumalesh.tangudu
2026-08-24 0:41 ` Niranjana Vishwanathapura
2026-08-24 10:03 ` Tangudu, Tilak Tirumalesh
2026-08-24 0:59 ` Niranjana Vishwanathapura
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 [this message]
2026-08-21 7:54 ` ✓ CI.KUnit: success for drm/xe/ggtt: fix stale GGTT mappings on unmap Patchwork
2026-08-21 8:49 ` ✓ Xe.CI.BAT: " Patchwork
2026-08-21 9:38 ` ✓ Xe.CI.FULL: " Patchwork
-- strict thread matches above, loose matches on Subject: below --
2026-08-24 16:34 [PATCH 0/3] " 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-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-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-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
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=aouWqfHYxus0OuWq@nvishwa1-desk \
--to=niranjana.vishwanathapura@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=matthew.brost@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