[PATCH 0/3] drm/xe/ggtt: fix stale GGTT mappings on unmap

[email protected]
Newsgroups org.freedesktop.lists.intel-xe
Message-ID <[email protected]>
From: Tangudu Tilak Tirumalesh <[email protected]>

This series addresses two related GGTT teardown issues on multi-
queue platforms:

First issue: the unmap path mapped freed ranges to the scratch page.
Because scratch is a valid PTE, a re-walk of a freed range never
faults, so any stale TLB translation left behind is masked - the freed
range silently reads scratch instead of surfacing the problem. On
multi-queue platforms Patch 1 writes PTE=0 on unmap instead; other
platforms keep scratch, so free-hole and init-time handling are
unchanged.

Second issue: engines cache GGTT translations in their own TLBs. The
existing GGTT invalidation (xe_tlb_inval_ggtt()) does not reach those
engine-side TLBs, so after an unmap an engine can keep hitting the
stale translation and read the old page. Patches 2 and 3 add and use a
FULL_INTRA_VF invalidation to drain the engine TLBs on unmap.

Patch 1: drm/xe/ggtt: stop mapping unmapped GGTT pages to scratch
    On multi-queue platforms write PTE=0 on unmap so a stale-TLB
    access to a freed range faults instead of silently landing on
    scratch.

Patch 2: drm/xe/tlb_inval: add FULL_INTRA_VF GGTT invalidation helper
    xe_tlb_inval_ggtt_full() + GuC backend flush engine TLBs across
    all engines in the requesting VF partition.

Patch 3: drm/xe/ggtt: invalidate engine GGTT TLBs for multi-queue GTs
    Issue the FULL_INTRA_VF invalidation on the unmap path, gated on
    the GT having any multi-queue engine class. Draining the engine
    TLB on teardown guarantees a recycled range's next occupant cannot
    hit the predecessor's cached translation.

Tangudu Tilak Tirumalesh (3):
  drm/xe/ggtt: stop mapping unmapped GGTT pages to scratch
  drm/xe/tlb_inval: add FULL_INTRA_VF GGTT invalidation helper
  drm/xe/ggtt: invalidate engine GGTT TLBs for multi-queue GTs

 drivers/gpu/drm/xe/xe_ggtt.c            | 61 +++++++++++++++++++------
 drivers/gpu/drm/xe/xe_guc_tlb_inval.c   | 21 +++++++++
 drivers/gpu/drm/xe/xe_tlb_inval.c       | 25 ++++++++++
 drivers/gpu/drm/xe/xe_tlb_inval.h       |  1 +
 drivers/gpu/drm/xe/xe_tlb_inval_types.h | 10 ++++
 5 files changed, 104 insertions(+), 14 deletions(-)

-- 
2.46.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.