From: sashiko-bot@kernel.org
To: "Matthew Brost" <matthew.brost@intel.com>
Cc: intel-xe@lists.freedesktop.org
Subject: Re: [PATCH v4 13/25] drm/xe: Enable CPU binds for jobs
Date: Fri, 04 Sep 2026 00:31:44 +0000 [thread overview]
Message-ID: <20260904003144.6DA551F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260903235842.3401722-14-matthew.brost@intel.com>
Thank you for your contribution! Sashiko AI review found 4 potential issue(s) to consider:
- [Critical] A Use-After-Free of `xe_vm` occurs because CPU-based PT updates execute asynchronously on the device-global bind queue without holding a reference to the VM.
- [High] execlist backend ignores is_pt_job and submits PT jobs to hardware, skipping CPU updates.
- [High] The `xe_pt_job_ops` reference is leaked when a PT job is aborted or destroyed without running.
- [Medium] xe_sched_job_snapshot_capture reads from the wrong union member for PT jobs.
--
commit 1bc0a17fc99eb78f42df916d66ac3038c0338a83
Author: Matthew Brost <matthew.brost@intel.com>
Subject: drm/xe: Enable CPU binds for jobs
This commit updates the migration layer to formulate a PT job which will issue
CPU binds in the submission backend. All code related to GPU-based binding has
been removed.
Link: https://patch.msgid.link/20260228013501.106680-14-matthew.brost@intel.com
> diff --git a/drivers/gpu/drm/xe/xe_migrate.c b/drivers/gpu/drm/xe/xe_migrate.c
> index 100e84b7b81df..62ae0e2e85be5 100644
> --- a/drivers/gpu/drm/xe/xe_migrate.c
> +++ b/drivers/gpu/drm/xe/xe_migrate.c
> @@ -1938,162 +1867,18 @@ __xe_migrate_update_pgtables(struct xe_migrate *m,
> {
[ ... ]
> int err;
>
> - job = xe_bb_create_migration_job(pt_update_ops->q, bb,
> - xe_migrate_batch_base(m, usm),
> - update_idx);
> + job = xe_sched_job_create(pt_update_ops->q, NULL);
> if (IS_ERR(job)) {
> err = PTR_ERR(job);
> - goto err_sa;
> + goto err_out;
> }
>
> - xe_sched_job_add_migrate_flush(job, MI_INVALIDATE_TLB);
> + xe_tile_assert(tile, job->is_pt_job);
[Severity: High]
If the platform uses the execlist backend (e.g., GuC disabled), does
execlist_run_job() properly handle CPU-only PT jobs?
Looking at the execlist backend, execlist_run_job() appears to unconditionally
call q->ring_ops->emit_job(job) without checking job->is_pt_job. Because
job->ptrs and job->pt_update share a union, the ring ops might read a garbage
value (like the ops kernel pointer) as batch_addr and emit a hardware migration
job instead.
Could this regression cause an immediate GPU fault or hang from executing an
invalid address, while completely skipping the actual page table update on the
CPU?
>
> if (ops->pre_commit) {
> pt_update->job = job;
> @@ -2104,6 +1889,12 @@ __xe_migrate_update_pgtables(struct xe_migrate *m,
> if (is_migrate)
> mutex_lock(&m->job_mutex);
>
> + job->pt_update[0].vm = pt_update->vops->vm;
[Severity: Critical]
Is it possible for the xe_vm pointer assigned here to be used after it is freed?
PT jobs are assigned a raw VM pointer without taking an xe_vm_get() reference.
CPU binds are queued and executed on a device-global queue (xe->cpu_bind->q).
If the user closes the VM, xe_vm_close_and_put() kills the VM's specific
queues and frees the struct xe_vm, but it does not appear to wait for jobs
pending on the global cpu_bind->q.
When the DRM scheduler later executes the pending PT job on the cpu_bind->q,
could it access the now-freed vm pointer during CPU execution, resulting in a
use-after-free regression?
[Severity: Medium]
When xe_sched_job_snapshot_capture() iterates over q->width, will it safely
handle PT jobs?
It appears that xe_sched_job_snapshot_capture() accesses job->ptrs[i].batch_addr
unconditionally. For PT jobs, job->ptrs aliases with job->pt_update via a union.
This causes batch_addr to overlap with the ops kernel pointer (or similar
members) from xe_pt_update_args. Could this mangled pointer then be
uncanonicalized and included in GPU devcoredumps, leading to corrupted state
data and a potential kernel pointer information leak?
> + job->pt_update[0].tile = tile;
> + job->pt_update[0].ops = ops;
> + job->pt_update[0].pt_job_ops =
> + xe_pt_job_ops_get(pt_update_ops->pt_job_ops);
[Severity: High]
What happens to the pt_job_ops reference if the PT job is aborted or destroyed
without running?
The job destruction path in xe_sched_job_destroy() does not seem to check for
is_pt_job, and thus skips calling xe_pt_job_ops_put(). If the job is canceled,
aborted, or its execution queue is destroyed before it runs, the DRM scheduler
bypasses the normal execution path and directly calls the free_job callback.
Would this permanently leak the pt_job_ops structure on those failure paths?
> +
> xe_sched_job_arm(job);
> fence = dma_fence_get(&job->drm.s_fence->finished);
> xe_sched_job_push(job);
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260903235842.3401722-1-matthew.brost@intel.com?part=13
next prev parent reply other threads:[~2026-09-04 0:31 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-03 23:58 [PATCH v4 00/25] CPU binds and ULLS on migration queue Matthew Brost
2026-09-03 23:58 ` [PATCH v4 01/25] drm/xe: Drop struct xe_migrate_pt_update argument from populate/clear vfuns Matthew Brost
2026-09-03 23:58 ` [PATCH v4 02/25] drm/xe: Add xe_migrate_update_pgtables_cpu_execute helper Matthew Brost
2026-09-04 0:15 ` sashiko-bot
2026-09-03 23:58 ` [PATCH v4 03/25] drm/xe: Decouple exec queue idle check from LRC Matthew Brost
2026-09-03 23:58 ` [PATCH v4 04/25] drm/xe: Add job count to GuC exec queue snapshot Matthew Brost
2026-09-03 23:58 ` [PATCH v4 05/25] drm/xe: Update xe_bo_put_deferred arguments to include writeback flag Matthew Brost
2026-09-03 23:58 ` [PATCH v4 06/25] drm/xe: Add XE_BO_FLAG_PUT_VM_ASYNC Matthew Brost
2026-09-04 0:18 ` sashiko-bot
2026-09-04 0:41 ` Matthew Brost
2026-09-03 23:58 ` [PATCH v4 07/25] drm/xe: Update scheduler job layer to support PT jobs Matthew Brost
2026-09-04 0:25 ` sashiko-bot
2026-09-03 23:58 ` [PATCH v4 08/25] drm/xe: Add helpers to access PT ops Matthew Brost
2026-09-03 23:58 ` [PATCH v4 09/25] drm/xe: Add struct xe_pt_job_ops Matthew Brost
2026-09-03 23:58 ` [PATCH v4 10/25] drm/xe: Update GuC submission backend to run PT jobs Matthew Brost
2026-09-04 0:36 ` sashiko-bot
2026-09-04 0:57 ` Matthew Brost
2026-09-03 23:58 ` [PATCH v4 11/25] drm/xe: Store level in struct xe_vm_pgtable_update Matthew Brost
2026-09-04 0:19 ` sashiko-bot
2026-09-03 23:58 ` [PATCH v4 12/25] drm/xe: Don't use migrate exec queue for page fault binds Matthew Brost
2026-09-03 23:58 ` [PATCH v4 13/25] drm/xe: Enable CPU binds for jobs Matthew Brost
2026-09-04 0:31 ` sashiko-bot [this message]
2026-09-04 1:04 ` Matthew Brost
2026-09-03 23:58 ` [PATCH v4 14/25] drm/xe: Remove unused arguments from xe_migrate_pt_update_ops Matthew Brost
2026-09-03 23:58 ` [PATCH v4 15/25] drm/xe: Make bind queues operate cross-tile Matthew Brost
2026-09-03 23:58 ` [PATCH v4 16/25] drm/xe: Add CPU bind layer Matthew Brost
2026-09-04 0:31 ` sashiko-bot
2026-09-04 1:18 ` Matthew Brost
2026-09-03 23:58 ` [PATCH v4 17/25] drm/xe: Add device flag to enable PT mirroring across tiles Matthew Brost
2026-09-04 0:29 ` sashiko-bot
2026-09-04 1:33 ` Matthew Brost
2026-09-03 23:58 ` [PATCH v4 18/25] drm/xe: Add xe_hw_engine_write_ring_tail Matthew Brost
2026-09-03 23:58 ` [PATCH v4 19/25] drm/xe: Add ULLS support to LRC Matthew Brost
2026-09-03 23:58 ` [PATCH v4 20/25] drm/xe: Add ULLS migration job support to migration layer Matthew Brost
2026-09-04 0:27 ` sashiko-bot
2026-09-04 1:35 ` Matthew Brost
2026-09-03 23:58 ` [PATCH v4 21/25] drm/xe: Add ULLS migration job support to ring ops Matthew Brost
2026-09-03 23:58 ` [PATCH v4 22/25] drm/xe: Add ULLS migration job support to GuC submission Matthew Brost
2026-09-04 0:38 ` sashiko-bot
2026-09-04 1:41 ` Matthew Brost
2026-09-03 23:58 ` [PATCH v4 23/25] drm/xe: Enter ULLS for migration jobs upon page fault or SVM prefetch Matthew Brost
2026-09-04 0:28 ` sashiko-bot
2026-09-04 1:32 ` Matthew Brost
2026-09-03 23:58 ` [PATCH v4 24/25] drm/xe: Add modparam to enable / disable ULLS on migrate queue Matthew Brost
2026-09-03 23:58 ` [PATCH v4 25/25] drm/xe: Document ULLS for migration jobs Matthew Brost
2026-09-04 0:47 ` ✗ CI.checkpatch: warning for CPU binds and ULLS on migration queue (rev6) Patchwork
2026-09-04 0:49 ` ✓ CI.KUnit: success " Patchwork
2026-09-04 1:33 ` ✓ Xe.CI.BAT: " 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=20260904003144.6DA551F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=matthew.brost@intel.com \
--cc=sashiko-reviews@lists.linux.dev \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.