From: Matthew Brost <matthew.brost@intel.com>
To: Zongyao Bai <zongyao.bai@intel.com>
Cc: <intel-xe@lists.freedesktop.org>, <Bai@freedesktop.org>
Subject: Re: [PATCH] drm/xe/pt: Reset prepare state in xe_pt_update_ops_init()
Date: Mon, 13 Jul 2026 23:31:32 -0700 [thread overview]
Message-ID: <alXXxHTxeVqUYgo2@gsse-cloud1.jf.intel.com> (raw)
In-Reply-To: <20260713230830.2662760-1-zongyao.bai@intel.com>
On Mon, Jul 13, 2026 at 11:08:30PM +0000, Zongyao Bai wrote:
> 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.
>
I'm not opposed to this patch as it makes retires with the same set ops
possible, perhaps makes the code safer but to be clear this isn't a
problem in the code base is it?
Assuming this isn't a problem what is the motivation here - future
proofing?
Matt
> 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
>
next prev parent reply other threads:[~2026-07-14 6:31 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
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 ` Matthew Brost [this message]
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
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=alXXxHTxeVqUYgo2@gsse-cloud1.jf.intel.com \
--to=matthew.brost@intel.com \
--cc=Bai@freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=zongyao.bai@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