From: Matthew Brost <matthew.brost@intel.com>
To: Arvind Yadav <arvind.yadav@intel.com>
Cc: <intel-xe@lists.freedesktop.org>,
<dri-devel@lists.freedesktop.org>, <rodrigo.vivi@intel.com>,
<himal.prasad.ghimiray@intel.com>,
<thomas.hellstrom@linux.intel.com>,
<sanjay.kumar.yadav@intel.com>, <tejas.upadhyay@intel.com>,
<daniel.charles@intel.com>
Subject: Re: [PATCH v3 0/3] drm/xe: Fix VM teardown and migration queue recovery
Date: Tue, 24 Nov 2026 14:29:34 -0800 [thread overview]
Message-ID: <awYPzpyv1A7siSAD@gsse-cloud1.jf.intel.com> (raw)
In-Reply-To: <20261116062804.1242511-1-arvind.yadav@intel.com>
On Mon, Nov 16, 2026 at 11:58:01AM +0530, Arvind Yadav wrote:
> Exec queue destruction is asynchronous, and user queues can outlive
> the VM handle. Closing the VM before those queues finish cleanup can
> remove mappings that are still in use.
>
> This series marks the VM as closing to reject new work, then keeps
> its mappings until the tracked queues are freed. It also holds a
> device reference across final VM destruction.
>
> File close keeps the existing synchronous scheduling-disable wait.
> There is no additional wait for the queue count to reach zero.
> If tracked queues remain, VM close is deferred until their cleanup
> completes.
>
> User bind jobs are allowed to drain during file close and queue
> destroy. The VM-owned bind queue is not counted and remains alive
> until xe_vm_close() has waited for pending BOOKKEEP fences.
>
> This series is based on the FD close cleanup changes in [1].
>
> [1] https://patchwork.freedesktop.org/series/175996/
>
> Changes in v2:
Why is this series needed after [1]?
Sure a user can close a VM while queues are active but that is largely a
user space bug that I don't think we really need to worry about.
[1] is a FD close (ctrl-c, segfault, i.e., somewhat normal flows).
Matt
> - Reduce the series to four patches following review.
> - Run deferred VM close and final VM destruction on the
> module-lifetime destroy workqueue.
> - Use a shared queue-wait budget during file close and defer teardown
> when queues remain.
>
> Changes in v3:
> - Rebase on the "FD close cleanup for XE" series and reduce this series
> to three patches.
> - Move the module-lifetime workqueue change into patch 1 to avoid
> self-deadlock when the worker drops the last device reference.
> - Check VM state before acknowledging cached faults and hold vm->lock
> through successful reply submission.
> - Preserve the original fault details for errors detected before
> acknowledgment and report failed prefetches.
> - Reject exec requests on closing VMs before userptr pinning,
> out-sync signaling and rebind.
> - Use zero wait on file close and document that internal bind queue
> cleanup can also defer VM teardown.
> - Let user bind jobs drain in the exec queue destroy ioctl.
> - Count user bind queues under vm->lock before VM close can proceed.
> - Track whether a user bind queue owns a close count and balance it
> during final queue destruction.
> - Make xe_vm_kill_bind_queues() static and remove the unused wait header.
>
> Arvind Yadav (3):
> drm/xe: Hold a device reference across deferred VM destruction
> drm/xe: Mark VMs as closing before queue cleanup
> drm/xe: Defer VM teardown until exec queue cleanup completes
>
> drivers/gpu/drm/xe/xe_device.c | 26 ++-
> drivers/gpu/drm/xe/xe_exec.c | 9 ++
> drivers/gpu/drm/xe/xe_exec_queue.c | 39 ++++-
> drivers/gpu/drm/xe/xe_exec_queue_types.h | 11 ++
> drivers/gpu/drm/xe/xe_pagefault.c | 87 +++++++++--
> drivers/gpu/drm/xe/xe_svm.c | 3 +-
> drivers/gpu/drm/xe/xe_vm.c | 191 ++++++++++++++++++++---
> drivers/gpu/drm/xe/xe_vm.h | 13 +-
> drivers/gpu/drm/xe/xe_vm_types.h | 17 ++
> drivers/gpu/drm/xe/xe_wait_user_fence.c | 5 +
> 10 files changed, 355 insertions(+), 46 deletions(-)
>
> --
> 2.43.0
>
prev parent reply other threads:[~2026-11-24 22:30 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-16 6:28 [PATCH v3 0/3] drm/xe: Fix VM teardown and migration queue recovery Arvind Yadav
2026-11-16 6:28 ` [PATCH v3 1/3] drm/xe: Hold a device reference across deferred VM destruction Arvind Yadav
2026-11-17 14:16 ` Upadhyay, Tejas
2026-11-16 6:28 ` [PATCH v3 2/3] drm/xe: Mark VMs as closing before queue cleanup Arvind Yadav
2026-11-17 14:46 ` Upadhyay, Tejas
2026-11-24 22:33 ` Matthew Brost
2026-11-16 6:28 ` [PATCH v3 3/3] drm/xe: Defer VM teardown until exec queue cleanup completes Arvind Yadav
2026-11-18 8:13 ` Upadhyay, Tejas
2026-11-24 22:29 ` Matthew Brost [this message]
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=awYPzpyv1A7siSAD@gsse-cloud1.jf.intel.com \
--to=matthew.brost@intel.com \
--cc=arvind.yadav@intel.com \
--cc=daniel.charles@intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=himal.prasad.ghimiray@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=rodrigo.vivi@intel.com \
--cc=sanjay.kumar.yadav@intel.com \
--cc=tejas.upadhyay@intel.com \
--cc=thomas.hellstrom@linux.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