drm/xe: Decrement fault mode counts in xe_vm_close_and_put
Subsystems (2)
Matthew Brost
maintainerPATCH 1/1 drm/xe: Decrement fault mode counts in xe_vm_close_and_put
Rather waiting for the VM to be destroyed (all refs to VM go to zero), drop the fault mode counts when the VM is closed in xe_vm_close_and_put. This avoids a window where user space can create a faulting VM, close it, and a subsequent creation of a non-faulting VM fails.
VLK-45296
--- drivers/gpu/drm/xe/xe_vm.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-)
drivers/gpu/drm/xe/xe_vm.c +7 -8
@@ -1349,6 +1349,13 @@ void xe_vm_close_and_put(struct xe_vm *vm)XE_WARN_ON (!list_empty (&vm->extobj.list));up_write (&vm->lock); +mutex_lock (&xe->usm.lock); +if (vm->flags &XE_VM_FLAG_FAULT_MODE ) + xe->usm.num_vm_in_fault_mode--; +else if (!(vm->flags &XE_VM_FLAG_MIGRATION )) + xe->usm.num_vm_in_non_fault_mode--; +mutex_unlock (&xe->usm.lock); +xe_vm_put (vm); }
@@ -1393,18 +1400,10 @@ static void vm_destroy_work_func(struct work_struct *w)drm_gpuva_manager_destroy (&vm->mgr); -mutex_lock (&xe->usm.lock); -if (vm->flags &XE_VM_FLAG_FAULT_MODE ) - xe->usm.num_vm_in_fault_mode--; -else if (!(vm->flags &XE_VM_FLAG_MIGRATION )) - xe->usm.num_vm_in_non_fault_mode--; -mutex_unlock (&xe->usm.lock); -trace_xe_vm_free (vm);dma_fence_put (vm->rebind_fence);dma_resv_fini (&vm->resv);kfree (vm); - }void xe_vm_free (struct kref *ref)
Signature · 1 line
2.34.1
[Intel-xe] ✗ CI.Patch_applied: failure for drm/xe: Decrement fault mode counts in xe_vm_close_and_put
== Series Details ==
== Series Details ==
Series: drm/xe: Decrement fault mode counts in xe_vm_close_and_put
URL : https://patchwork.freedesktop.org/series/115303/
State : failure
== Summary ==
=== Applying kernel patches on branch 'drm-xe-next' with base: === commit 68c0f7421b74cf51fe442bed6d4395d28ded5d7d
Author: Thomas Hellström <[email protected]> AuthorDate: Tue Mar 14 15:56:44 2023 +0100 Commit: Thomas Hellström <[email protected]> CommitDate: Thu Mar 16 15:16:00 2023 +0100
drm/xe/vm: Defer vm rebind until next exec if nothing to execute
If all compute engines of a vm in compute mode are idle, defer a rebind to the next exec to avoid the VM unnecessarily trying to make memory resident and compete with other VMs for available memory space.
=== git am output follows ===
error: patch failed: drivers/gpu/drm/xe/xe_vm.c:1393
error: drivers/gpu/drm/xe/xe_vm.c: patch does not apply
hint: Use 'git am --show-current-patch' to see the failed patch
Applying: drm/xe: Decrement fault mode counts in xe_vm_close_and_put Patch failed at 0001 drm/xe: Decrement fault mode counts in xe_vm_close_and_put When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
Quoted 6 lines · Matthew Brost
Rather waiting for the VM to be destroyed (all refs to VM go to zero), drop the fault mode counts when the VM is closed in
xe_vm_close_and_put. This avoids a window where user space can create a faulting VM, close it, and a subsequent creation of a non-faulting VM fails.VLK-45296
you have garbage leftover here. Please open an issue in gitlab to be able to reference it.
Lucas De Marchi
Matthew Brost
maintainerQuoted 11 lines · Lucas De Marchi
Quoted 6 lines · Matthew Brost
Rather waiting for the VM to be destroyed (all refs to VM go to zero), drop the fault mode counts when the VM is closed in
xe_vm_close_and_put. This avoids a window where user space can create a faulting VM, close it, and a subsequent creation of a non-faulting VM fails.VLK-45296
you have garbage leftover here. Please open an issue in gitlab to be able to reference it.
So no referencing internal Jiras? I thought iy fine to do so.
Matt
Quoted 1 line
Lucas De Marchi
Quoted 7 lines · Matthew Brost
Quoted 6 lines · Lucas De Marchi
Quoted 5 lines · Matthew Brost
Rather waiting for the VM to be destroyed (all refs to VM go to zero), drop the fault mode counts when the VM is closed in
xe_vm_close_and_put. This avoids a window where user space can create a faulting VM, close it, and a subsequent creation of a non-faulting VM fails.
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
VLK-45296
you have garbage leftover here. Please open an issue in gitlab to be able to reference it.
So no referencing internal Jiras? I thought iy fine to do so.
no, it's not. It means nothing externally. The only acceptable number is a bspec reference, probably for historic reasons.
in upstream we should be using
"References: <issue in a public location that has more details/discussion around what's being fixed>"
Lucas De Marchi
Quoted 4 lines
Matt
Quoted 1 line
Lucas De Marchi