Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/xe/pt: Reset prepare state in xe_pt_update_ops_init()
@ 2026-07-13 23:08 Zongyao Bai
  2026-07-13 23:15 ` ✗ CI.checkpatch: warning for " Patchwork
                   ` (8 more replies)
  0 siblings, 9 replies; 11+ messages in thread
From: Zongyao Bai @ 2026-07-13 23:08 UTC (permalink / raw)
  To: intel-xe; +Cc: Zongyao Bai, Bai

xe_pt_update_ops_init() resets the per-prepare address range and
deferred state, but current_op was left unchanged. If the same
xe_vm_pgtable_update_ops is prepared again, new operations are appended
after the stale current_op value instead of starting from ops[0]. This
can make current_op exceed the number of operations allocated by
xe_vma_ops_alloc(), leading to out-of-bounds access to pt_update_ops->ops.
So, reset current_op when initializing the PT update ops.

Also reset needs_svm_lock and needs_invalidation. These flags are derived
during the same prepare pass as current_op and are consumed by
xe_pt_update_ops_run(); leaving them stale can select the SVM migrate ops
or request TLB invalidation even when the current prepared operations do
not require it.

Assisted-by: GitHub-Copilot:claude-sonnet-4.6
Signed-off-by: Bai, Zongyao <zongyao.bai@intel.com>
---
 drivers/gpu/drm/xe/xe_pt.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/xe/xe_pt.c b/drivers/gpu/drm/xe/xe_pt.c
index e466f714bf86..598c6b2571e7 100644
--- a/drivers/gpu/drm/xe/xe_pt.c
+++ b/drivers/gpu/drm/xe/xe_pt.c
@@ -2371,8 +2371,11 @@ static void
 xe_pt_update_ops_init(struct xe_vm_pgtable_update_ops *pt_update_ops)
 {
 	init_llist_head(&pt_update_ops->deferred);
+	pt_update_ops->current_op = 0;
 	pt_update_ops->start = ~0x0ull;
 	pt_update_ops->last = 0x0ull;
+	pt_update_ops->needs_svm_lock = false;
+	pt_update_ops->needs_invalidation = false;
 	xe_page_reclaim_list_init(&pt_update_ops->prl);
 }
 
-- 
2.43.0


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

end of thread, other threads:[~2026-07-15  4:59 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-13 23:08 [PATCH] drm/xe/pt: Reset prepare state in xe_pt_update_ops_init() Zongyao Bai
2026-07-13 23:15 ` ✗ CI.checkpatch: warning for " Patchwork
2026-07-13 23:16 ` ✓ CI.KUnit: success " Patchwork
2026-07-13 23:51 ` ✓ Xe.CI.BAT: " Patchwork
2026-07-14  4:33 ` ✓ Xe.CI.FULL: " Patchwork
2026-07-14  6:31 ` [PATCH] " Matthew Brost
2026-07-14 23:24 ` [PATCH v2] drm/xe/pt: Reset current_op " Zongyao Bai
2026-07-15  1:46   ` Matthew Brost
2026-07-14 23:31 ` ✓ CI.KUnit: success for drm/xe/pt: Reset prepare state in xe_pt_update_ops_init() (rev2) Patchwork
2026-07-15  0:15 ` ✓ Xe.CI.BAT: " Patchwork
2026-07-15  4:59 ` ✗ Xe.CI.FULL: failure " Patchwork

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