Skip to content

drm/xe/vm: Fix SVM leak and clean up xe_vm_create()

Shuicheng Lin intel-xe 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 4 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3drm/xe/vm: Fix SVM leak on resv obj alloc failure in xe_vm_create()drivers/gpu/drm/xe/xe_vm.c+4 -41 reply
2/3drm/xe/vm: Remove redundant INIT_WORK() for rebind_work in xe_vm_create()drivers/gpu/drm/xe/xe_vm.c+1 -31 reply
3/3drm/xe/vm: Use regular comment for GSC VM lockdep note in xe_vm_create()drivers/gpu/drm/xe/xe_vm.c+1 -11 reply

Reviews trailers per patch

All 3 patches have a Reviewed-by or Acked-by.

PatchMatthew Brost
1/3R-b
2/3R-b
3/3R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/3] drm/xe/vm: Fix SVM leak and clean up xe_vm_create()

This series contains one bug fix and two related cleanups in xe_vm_create() found while reviewing the function.

Patch 1 fixes resource leaks on the drm_gpuvm_resv_object_alloc() failure path. After commit 9e9787414882 ("drm/xe/userptr: replace xe_hmm with gpusvm") made xe_svm_init() unconditional and extended it to initialize a "simple" gpusvm state for non-fault-mode VMs, the error unwind path was not updated to match. As a result:

- Non-fault-mode VMs leak the resources allocated by drm_gpusvm_init(), because xe_svm_fini() is only called under XE_VM_FLAG_FAULT_MODE.

- Fault-mode VMs additionally leak the pagemap owner acquired by drm_pagemap_acquire_owner() and the pagemaps acquired by xe_svm_get_pagemaps(), because xe_svm_close() (which releases them) is not called on this error path either.

Patches 2 and 3 are pure cleanups with no functional change:

- Patch 2 removes a duplicate INIT_WORK() call for vm->preempt.rebind_work in the LR-mode setup that was introduced by the conversion to xe_validation_guard() and makes lifetime and ordering harder to reason about.

- Patch 3 replaces a kernel-doc opening marker (/**) on an in-function implementation note with a regular block comment (/*), since /** is reserved for API documentation per Documentation/doc-guide/kernel-doc.rst.

Shuicheng Lin (3):
drm/xe/vm: Fix SVM leak on resv obj alloc failure in xe_vm_create() drm/xe/vm: Remove redundant INIT_WORK() for rebind_work in

    xe_vm_create()
  drm/xe/vm: Use regular comment for GSC VM lockdep note in
    xe_vm_create()
 drivers/gpu/drm/xe/xe_vm.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)
Signature · 1 line
2.43.0