Skip to content

Commit 70f7b37

Browse files
Thomas Hellströmgregkh
authored andcommitted
drm/xe/vm: Don't pin the vm_resv during validation
[ Upstream commit 7551865 ] The pinning has the odd side-effect that unlocking *any* resv during validation triggers an "unlocking pinned lock" warning. Cc: Matthew Brost <matthew.brost@intel.com> Fixes: 5cc3325 ("drm/xe: Rework eviction rejection of bound external bos") Signed-off-by: Thomas Hellström <thomas.hellstrom@linux.intel.com> Reviewed-by: Matthew Brost <matthew.brost@intel.com> Link: https://lore.kernel.org/r/20250821143045.106005-2-thomas.hellstrom@linux.intel.com (cherry picked from commit 0a51bf3) Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent dc023a2 commit 70f7b37

File tree

2 files changed

+4
-16
lines changed

2 files changed

+4
-16
lines changed

drivers/gpu/drm/xe/xe_bo.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2435,7 +2435,6 @@ int xe_bo_validate(struct xe_bo *bo, struct xe_vm *vm, bool allow_res_evict)
24352435
.no_wait_gpu = false,
24362436
.gfp_retry_mayfail = true,
24372437
};
2438-
struct pin_cookie cookie;
24392438
int ret;
24402439

24412440
if (vm) {
@@ -2446,10 +2445,10 @@ int xe_bo_validate(struct xe_bo *bo, struct xe_vm *vm, bool allow_res_evict)
24462445
ctx.resv = xe_vm_resv(vm);
24472446
}
24482447

2449-
cookie = xe_vm_set_validating(vm, allow_res_evict);
2448+
xe_vm_set_validating(vm, allow_res_evict);
24502449
trace_xe_bo_validate(bo);
24512450
ret = ttm_bo_validate(&bo->ttm, &bo->placement, &ctx);
2452-
xe_vm_clear_validating(vm, allow_res_evict, cookie);
2451+
xe_vm_clear_validating(vm, allow_res_evict);
24532452

24542453
return ret;
24552454
}

drivers/gpu/drm/xe/xe_vm.h

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -310,40 +310,29 @@ void xe_vm_snapshot_free(struct xe_vm_snapshot *snap);
310310
* Register this task as currently making bos resident for the vm. Intended
311311
* to avoid eviction by the same task of shared bos bound to the vm.
312312
* Call with the vm's resv lock held.
313-
*
314-
* Return: A pin cookie that should be used for xe_vm_clear_validating().
315313
*/
316-
static inline struct pin_cookie xe_vm_set_validating(struct xe_vm *vm,
317-
bool allow_res_evict)
314+
static inline void xe_vm_set_validating(struct xe_vm *vm, bool allow_res_evict)
318315
{
319-
struct pin_cookie cookie = {};
320-
321316
if (vm && !allow_res_evict) {
322317
xe_vm_assert_held(vm);
323-
cookie = lockdep_pin_lock(&xe_vm_resv(vm)->lock.base);
324318
/* Pairs with READ_ONCE in xe_vm_is_validating() */
325319
WRITE_ONCE(vm->validating, current);
326320
}
327-
328-
return cookie;
329321
}
330322

331323
/**
332324
* xe_vm_clear_validating() - Unregister this task as currently making bos resident
333325
* @vm: Pointer to the vm or NULL
334326
* @allow_res_evict: Eviction from @vm was allowed. Must be set to the same
335327
* value as for xe_vm_set_validation().
336-
* @cookie: Cookie obtained from xe_vm_set_validating().
337328
*
338329
* Register this task as currently making bos resident for the vm. Intended
339330
* to avoid eviction by the same task of shared bos bound to the vm.
340331
* Call with the vm's resv lock held.
341332
*/
342-
static inline void xe_vm_clear_validating(struct xe_vm *vm, bool allow_res_evict,
343-
struct pin_cookie cookie)
333+
static inline void xe_vm_clear_validating(struct xe_vm *vm, bool allow_res_evict)
344334
{
345335
if (vm && !allow_res_evict) {
346-
lockdep_unpin_lock(&xe_vm_resv(vm)->lock.base, cookie);
347336
/* Pairs with READ_ONCE in xe_vm_is_validating() */
348337
WRITE_ONCE(vm->validating, NULL);
349338
}

0 commit comments

Comments
 (0)