Shuicheng Lin
d2c6800ad1
drm/xe/vm: Fix SVM leak on resv obj alloc failure in xe_vm_create()
...
Commit 9e97874148 ("drm/xe/userptr: replace xe_hmm with gpusvm") made
xe_svm_init() unconditional in xe_vm_create() and extended it to also
initialize a "simple" gpusvm state for non-fault-mode VMs. The matching
xe_svm_fini() call in xe_vm_close_and_put() was updated to run
unconditionally, but the error unwind path in xe_vm_create() was not.
On the drm_gpuvm_resv_object_alloc() failure path, xe_svm_init() has
already succeeded but xe_svm_fini() is only called when
XE_VM_FLAG_FAULT_MODE is set. For non-fault-mode VMs this leaves
vm->svm.gpusvm partially initialized and leaks the resources allocated
by drm_gpusvm_init().
For fault-mode VMs, xe_svm_init() additionally acquires the pagemap
owner via drm_pagemap_acquire_owner() and the pagemaps via
xe_svm_get_pagemaps(). Those resources are released by xe_svm_close(),
not xe_svm_fini(). On the same error path, xe_svm_close() is not
called either, so fault-mode VMs leak the pagemap owner and pagemaps.
Fix both leaks:
- Call xe_svm_fini() unconditionally on the err_svm_fini path, matching
the unconditional xe_svm_init() call. Move the vm->size = 0
assignment out of the conditional so the xe_vm_is_closed() assert in
xe_svm_fini() (and xe_svm_close()) holds for both modes.
- Call xe_svm_close() for fault-mode VMs before xe_svm_fini(), matching
the ordering used in xe_vm_close_and_put().
Fixes: 9e97874148 ("drm/xe/userptr: replace xe_hmm with gpusvm")
Cc: Matthew Auld <matthew.auld@intel.com >
Assisted-by: Claude:claude-opus-4.7
Reviewed-by: Matthew Brost <matthew.brost@intel.com >
Link: https://patch.msgid.link/20260721205516.4058959-2-shuicheng.lin@intel.com
Signed-off-by: Shuicheng Lin <shuicheng.lin@intel.com >
(cherry picked from commit ca2a3587d5 )
Signed-off-by: Thomas Hellström <thomas.hellstrom@linux.intel.com >
2026-07-23 09:19:08 +02:00
..
2026-05-27 21:28:01 +02:00
2026-04-16 19:24:22 +03:00
2026-07-02 12:29:43 +02:00
2026-05-13 12:21:12 +05:30
2026-06-16 10:18:52 -07:00
2026-07-09 12:09:31 +02:00
2026-01-22 11:27:25 +01:00
2026-06-16 10:18:43 -07:00
2026-03-03 10:37:29 +10:00
2026-02-20 10:54:03 -08:00
2026-07-16 16:32:19 +02:00
2026-07-16 16:32:45 +02:00
2026-07-16 16:32:19 +02:00
2026-03-03 10:37:29 +10:00
2026-02-17 19:38:57 -05:00
2026-05-04 18:22:33 +10:00
2026-02-26 13:44:55 +01:00
2026-04-17 14:43:29 +02:00
2026-04-06 08:52:53 -07:00
2026-04-28 16:20:33 -04:00
2026-07-16 16:33:08 +02:00
2026-05-12 14:34:48 -07:00
2026-07-16 16:53:38 +02:00
2026-05-27 12:51:27 +02:00
2026-07-16 16:32:19 +02:00
2026-07-02 12:29:43 +02:00
2026-03-05 19:38:56 -05:00
2026-06-16 10:18:29 -07:00
2026-04-06 08:52:53 -07:00
2026-05-08 13:38:39 -07:00
2026-04-06 08:52:53 -07:00
2026-04-16 08:31:59 -07:00
2026-05-08 13:48:42 -07:00
2026-06-16 10:18:18 -07:00
2026-07-09 12:09:24 +02:00
2026-05-06 10:12:25 +10:00
2026-02-05 14:33:44 -08:00
2026-02-05 14:33:44 -08:00
2026-03-19 17:13:54 +01:00
2026-04-21 10:20:17 -07:00
2026-02-16 14:20:24 +01:00
2026-01-10 13:38:47 -08:00
2026-04-17 14:43:29 +02:00
2026-01-10 13:39:50 -08:00
2026-01-15 07:05:04 -08:00
2026-03-04 08:54:18 -05:00
2026-01-15 07:05:04 -08:00
2026-03-04 08:54:18 -05:00
2026-05-14 08:24:03 -07:00
2026-03-19 18:05:04 +01:00
2026-01-15 07:05:04 -08:00
2026-07-02 12:29:42 +02:00
2026-03-26 14:21:12 -07:00
2026-05-14 08:24:28 -07:00
2026-05-15 18:05:14 -03:00
2026-05-15 18:05:14 -03:00
2026-04-17 08:06:36 +02:00
2026-04-12 10:32:58 +02:00
2026-03-24 10:47:52 +01:00
2026-03-24 10:47:52 +01:00
2026-03-24 10:47:52 +01:00
2026-02-21 17:09:51 -08:00
2026-04-30 08:16:35 -07:00
2026-05-15 21:10:16 +02:00
2026-05-15 21:10:16 +02:00
2026-04-12 10:32:53 +02:00
2026-04-12 10:32:53 +02:00
2026-02-12 11:01:41 -08:00
2026-04-16 08:31:59 -07:00
2026-04-12 10:32:48 +02:00
2026-02-27 18:02:07 +01:00
2026-05-15 21:03:43 +02:00
2026-05-15 21:03:43 +02:00
2026-03-30 11:00:45 +02:00
2026-03-30 11:00:45 +02:00
2026-02-17 18:12:10 -08:00
2026-02-21 17:09:51 -08:00
2026-01-15 07:05:04 -08:00
2026-02-06 09:49:20 -08:00
2026-05-08 09:48:10 -07:00
2026-05-15 18:05:14 -03:00
2026-05-08 13:48:41 -07:00
2026-05-27 19:11:24 +05:30
2026-01-21 15:43:39 +01:00
2026-01-15 07:05:04 -08:00
2026-04-16 08:32:00 -07:00
2026-06-16 10:18:49 -07:00
2026-04-06 08:52:53 -07:00
2026-04-16 08:31:59 -07:00
2026-04-11 17:06:07 +02:00
2026-01-15 07:05:04 -08:00
2026-07-16 16:33:02 +02:00
2026-04-06 08:52:53 -07:00
2026-01-15 07:05:04 -08:00
2026-02-21 01:02:28 -08:00
2026-02-20 13:11:09 +01:00
2026-02-23 12:31:32 -08:00
2026-04-27 18:13:16 -04:00
2026-04-27 18:13:16 -04:00
2026-02-23 15:43:35 -08:00
2026-02-23 15:43:35 -08:00
2026-04-16 08:32:00 -07:00
2026-07-02 12:29:43 +02:00
2026-04-16 08:31:59 -07:00
2026-07-16 16:33:08 +02:00
2026-06-16 10:18:35 -07:00
2026-07-16 16:33:08 +02:00
2026-05-18 18:25:40 -03:00
2026-03-19 14:22:28 +01:00
2026-02-21 17:09:51 -08:00
2026-03-26 14:21:12 -07:00
2026-01-15 07:05:04 -08:00
2026-01-15 07:05:04 -08:00
2026-02-21 17:09:51 -08:00
2026-03-26 14:21:12 -07:00
2026-06-16 10:18:18 -07:00
2026-07-02 12:29:42 +02:00
2026-07-02 12:29:43 +02:00
2026-05-15 18:05:13 -03:00
2026-06-16 10:18:32 -07:00
2026-04-06 08:52:53 -07:00
2026-02-23 16:14:19 +01:00
2026-01-10 13:39:50 -08:00
2026-05-04 18:22:33 +10:00
2026-07-23 09:19:03 +02:00
2026-04-30 11:31:45 +05:30
2026-05-27 21:28:01 +02:00
2026-03-03 10:37:29 +10:00
2026-02-20 15:49:58 +01:00
2026-05-08 13:48:44 -07:00
2026-05-08 13:48:48 -07:00
2026-05-08 13:48:44 -07:00
2026-04-29 12:51:19 -04:00
2026-04-29 12:51:19 -04:00
2026-04-29 12:51:19 -04:00
2026-05-19 10:50:32 +02:00
2026-05-19 10:50:32 +02:00
2026-01-14 16:02:50 +01:00
2026-01-12 14:38:44 +01:00
2026-07-22 08:59:26 +02:00
2026-07-22 08:59:26 +02:00
2026-02-21 17:09:51 -08:00
2026-02-05 21:14:23 +01:00
2026-02-25 13:23:04 +02:00
2026-03-17 15:44:26 +10:00
2026-02-10 10:09:21 -03:00
2026-07-16 16:33:08 +02:00
2026-07-16 16:33:08 +02:00
2026-07-16 16:32:40 +02:00
2026-04-06 08:52:53 -07:00
2026-07-02 12:29:43 +02:00
2026-07-02 12:29:43 +02:00
2026-03-16 09:42:41 -07:00
2026-03-16 09:42:41 -07:00
2026-04-16 08:32:00 -07:00
2026-04-15 08:45:00 -07:00
2026-04-21 10:20:17 -07:00
2026-04-21 10:20:17 -07:00
2026-04-12 10:32:54 +02:00
2026-04-17 08:05:54 -07:00
2026-07-16 16:53:38 +02:00
2026-04-17 11:38:47 -04:00
2026-01-27 16:45:53 +02:00
2026-01-27 16:45:53 +02:00
2026-03-26 14:21:12 -07:00
2026-05-27 12:51:30 +02:00
2026-05-27 12:51:28 +02:00
2026-02-21 17:09:51 -08:00
2026-02-21 17:09:51 -08:00
2026-01-15 07:05:04 -08:00
2026-04-16 08:31:59 -07:00
2026-04-16 08:32:00 -07:00
2026-07-16 16:32:56 +02:00
2026-01-15 07:05:04 -08:00
2026-04-06 08:52:53 -07:00
2026-04-06 08:52:53 -07:00
2026-04-06 08:52:53 -07:00
2026-04-15 14:34:09 -07:00
2026-04-06 08:52:53 -07:00
2026-04-14 12:38:14 +02:00
2026-06-16 10:18:37 -07:00
2026-04-30 11:31:45 +05:30
2026-04-30 11:31:45 +05:30
2026-04-30 11:31:45 +05:30
2026-04-06 08:52:53 -07:00
2026-05-15 18:05:14 -03:00
2026-04-06 08:52:53 -07:00
2026-07-02 12:29:44 +02:00
2026-07-02 12:29:43 +02:00
2026-05-08 10:39:59 -04:00
2026-03-24 09:29:11 -04:00
2026-05-08 13:49:36 -07:00
2026-04-06 08:52:53 -07:00
2026-07-01 21:48:36 +02:00
2026-07-01 21:48:36 +02:00
2026-07-02 12:28:02 +02:00
2026-02-20 10:54:05 -08:00
2026-02-20 10:54:03 -08:00
2026-03-23 10:38:14 +01:00
2026-02-23 16:14:19 +01:00
2026-02-21 17:09:51 -08:00
2026-02-02 22:35:42 +01:00
2026-02-05 21:08:28 +01:00
2026-03-23 10:10:50 -04:00
2026-03-24 10:47:52 +01:00
2026-03-24 10:47:52 +01:00
2026-01-15 07:05:04 -08:00
2026-04-14 12:38:16 +02:00
2026-04-30 08:16:15 -07:00
2026-04-12 10:32:58 +02:00
2026-04-12 10:32:54 +02:00
2026-03-03 10:37:29 +10:00
2026-04-14 12:38:16 +02:00
2026-04-14 12:38:16 +02:00
2026-04-29 12:51:19 -04:00
2026-07-22 08:59:26 +02:00
2026-07-16 16:32:45 +02:00
2026-01-15 07:05:04 -08:00
2026-03-24 10:47:52 +01:00
2026-02-02 19:18:09 -05:00
2026-02-02 22:22:57 +01:00
2026-04-09 10:10:00 +03:00
2026-04-09 10:10:00 +03:00
2026-04-09 10:10:00 +03:00
2026-05-05 15:01:43 -04:00
2026-05-05 15:01:43 -04:00
2026-07-02 12:29:43 +02:00
2026-07-02 12:29:43 +02:00
2026-05-04 16:28:14 +02:00
2026-04-30 11:31:45 +05:30
2026-04-30 11:31:45 +05:30
2026-04-30 11:31:45 +05:30
2026-03-30 10:06:55 -07:00
2026-04-09 12:37:06 -07:00
2026-04-30 11:31:45 +05:30
2026-04-30 11:31:45 +05:30
2026-04-30 11:31:45 +05:30
2026-03-26 14:21:12 -07:00
2026-02-16 14:20:24 +01:00
2026-02-16 14:20:24 +01:00
2026-03-03 10:37:29 +10:00
2026-05-13 13:49:34 +02:00
2026-01-15 07:05:04 -08:00
2026-02-05 21:16:20 +01:00
2026-02-21 17:09:51 -08:00
2026-03-11 09:32:59 +01:00
2026-04-08 09:15:29 -07:00
2026-03-11 09:32:59 +01:00
2026-05-08 13:48:48 -07:00
2026-01-10 13:39:52 -08:00
2026-05-08 10:39:59 -04:00
2026-05-08 10:39:59 -04:00
2026-02-21 17:09:51 -08:00
2026-02-06 11:38:35 +10:00
2026-05-15 13:58:13 +10:00
2026-07-01 21:48:36 +02:00
2026-04-06 08:52:53 -07:00
2026-01-15 07:05:04 -08:00
2026-06-16 10:18:15 -07:00
2026-05-27 21:28:01 +02:00
2026-03-13 18:04:15 -07:00
2026-02-05 14:17:30 -08:00
2026-07-02 12:29:43 +02:00
2026-03-11 09:33:01 +01:00
2026-05-25 10:45:38 +02:00
2026-05-25 10:45:38 +02:00
2026-07-20 18:18:41 +02:00
2026-05-08 16:12:06 +05:30
2026-04-16 08:31:59 -07:00
2026-07-23 09:19:08 +02:00
2026-03-25 18:05:59 -07:00
2026-02-05 21:16:20 +01:00
2026-04-08 21:34:00 +05:30
2026-04-08 21:34:00 +05:30
2026-03-17 18:51:15 +02:00
2026-03-17 18:51:15 +02:00
2026-04-03 12:56:18 -07:00
2026-07-01 21:48:36 +02:00
2026-04-06 08:52:53 -07:00
2026-01-15 07:05:04 -08:00
2026-07-16 16:32:51 +02:00