Linux kernel -stable discussions
 help / color / mirror / Atom feed
From: "Thomas Hellström" <thomas.hellstrom@linux.intel.com>
To: intel-xe@lists.freedesktop.org
Cc: "Thomas Hellström" <thomas.hellstrom@linux.intel.com>,
	"Tejas Upadhyay" <tejas.upadhyay@intel.com>,
	"Matthew Auld" <matthew.auld@intel.com>,
	"Matthew Brost" <matthew.brost@intel.com>,
	stable@vger.kernel.org
Subject: [PATCH] drm/xe: Don't zap imported bo page-tables on L2 flush optimized hw
Date: Wed, 18 Nov 2026 13:20:11 +0100	[thread overview]
Message-ID: <20261118122011.487537-1-thomas.hellstrom@linux.intel.com> (raw)

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


             reply	other threads:[~2026-11-18 12:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-18 12:20 Thomas Hellström [this message]
2026-11-18 12:28 ` [PATCH] drm/xe: Don't zap imported bo page-tables on L2 flush optimized hw Matthew Auld

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=20261118122011.487537-1-thomas.hellstrom@linux.intel.com \
    --to=thomas.hellstrom@linux.intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=matthew.auld@intel.com \
    --cc=matthew.brost@intel.com \
    --cc=stable@vger.kernel.org \
    --cc=tejas.upadhyay@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