Linux kernel -stable discussions
 help / color / mirror / Atom feed
* [PATCH] drm/xe: Don't zap imported bo page-tables on L2 flush optimized hw
@ 2026-11-18 12:20 Thomas Hellström
  2026-11-18 12:28 ` Matthew Auld
  0 siblings, 1 reply; 2+ messages in thread
From: Thomas Hellström @ 2026-11-18 12:20 UTC (permalink / raw)
  To: intel-xe
  Cc: Thomas Hellström, Tejas Upadhyay, Matthew Auld,
	Matthew Brost, stable

Invalidations of imported buffer objects originating from the dma-buf
invalidate_mappings() callback may run without a runtime pm reference,
and obtaining one from that context may not be possible. However, on
L2 flush optimized hardware, xe_bo_trigger_rebind() would, also for
non-fault-mode VMs, wait for idle and zap the page-tables and flush
the TLB using xe_vm_invalidate_vma() in order to ensure the L2 cache
is flushed.

For imported buffer objects this is not needed, since the vm_bind
ioctl already restricts them to PAT indices that either ensure no
data for their pages is kept cached in L2, or that are 2-way
coherent, making a flush unnecessary. So, for non-fault-mode VMs,
skip the invalidation for imported bos and rely on rebind on next
exec, as is done on hardware that isn't L2 flush optimized.

The patch and changelog were prepared with the help of an LLM.

Fixes: 4e7ebff69aed ("drm/xe/xe3p_lpg: flush shrinker bo cachelines manually")
Cc: Tejas Upadhyay <tejas.upadhyay@intel.com>
Cc: Matthew Auld <matthew.auld@intel.com>
Cc: Matthew Brost <matthew.brost@intel.com>
Cc: <stable@vger.kernel.org> # v7.1+
Signed-off-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
---
 drivers/gpu/drm/xe/xe_bo.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_bo.c b/drivers/gpu/drm/xe/xe_bo.c
index 42a6aa1a2e4a..fd7833e598b3 100644
--- a/drivers/gpu/drm/xe/xe_bo.c
+++ b/drivers/gpu/drm/xe/xe_bo.c
@@ -805,9 +805,12 @@ static int xe_bo_trigger_rebind(struct xe_device *xe, struct xe_bo *bo,
 			drm_gpuvm_bo_evict(vm_bo, true);
 			/*
 			 * L2 cache may not be flushed, so ensure that is done in
-			 * xe_vm_invalidate_vma() below
+			 * xe_vm_invalidate_vma() below. For imported bos, the
+			 * PAT setting ensures either no cached L2 data or
+			 * 2-way coherency, making a flush unnecessary.
 			 */
-			if (!xe_device_is_l2_flush_optimized(xe))
+			if (!xe_device_is_l2_flush_optimized(xe) ||
+			    bo->ttm.base.import_attach)
 				continue;
 		}
 
-- 
2.56.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-18 12:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-18 12:20 [PATCH] drm/xe: Don't zap imported bo page-tables on L2 flush optimized hw Thomas Hellström
2026-11-18 12:28 ` Matthew Auld

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox