Skip to content

Commit 7551865

Browse files
Thomas Hellströmrodrigovivi
authored andcommitted
drm/xe/vm: Don't pin the vm_resv during validation
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>
1 parent 04e1f68 commit 7551865

2 files changed

Lines changed: 4 additions & 16 deletions

File tree

drivers/gpu/drm/xe/xe_bo.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2438,7 +2438,6 @@ int xe_bo_validate(struct xe_bo *bo, struct xe_vm *vm, bool allow_res_evict)
24382438
.no_wait_gpu = false,
24392439
.gfp_retry_mayfail = true,
24402440
};
2441-
struct pin_cookie cookie;
24422441
int ret;
24432442

24442443
if (vm) {
@@ -2449,10 +2448,10 @@ int xe_bo_validate(struct xe_bo *bo, struct xe_vm *vm, bool allow_res_evict)
24492448
ctx.resv = xe_vm_resv(vm);
24502449
}
24512450

2452-
cookie = xe_vm_set_validating(vm, allow_res_evict);
2451+
xe_vm_set_validating(vm, allow_res_evict);
24532452
trace_xe_bo_validate(bo);
24542453
ret = ttm_bo_validate(&bo->ttm, &bo->placement, &ctx);
2455-
xe_vm_clear_validating(vm, allow_res_evict, cookie);
2454+
xe_vm_clear_validating(vm, allow_res_evict);
24562455

24572456
return ret;
24582457
}

drivers/gpu/drm/xe/xe_vm.h

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -315,40 +315,29 @@ void xe_vm_snapshot_free(struct xe_vm_snapshot *snap);
315315
* Register this task as currently making bos resident for the vm. Intended
316316
* to avoid eviction by the same task of shared bos bound to the vm.
317317
* Call with the vm's resv lock held.
318-
*
319-
* Return: A pin cookie that should be used for xe_vm_clear_validating().
320318
*/
321-
static inline struct pin_cookie xe_vm_set_validating(struct xe_vm *vm,
322-
bool allow_res_evict)
319+
static inline void xe_vm_set_validating(struct xe_vm *vm, bool allow_res_evict)
323320
{
324-
struct pin_cookie cookie = {};
325-
326321
if (vm && !allow_res_evict) {
327322
xe_vm_assert_held(vm);
328-
cookie = lockdep_pin_lock(&xe_vm_resv(vm)->lock.base);
329323
/* Pairs with READ_ONCE in xe_vm_is_validating() */
330324
WRITE_ONCE(vm->validating, current);
331325
}
332-
333-
return cookie;
334326
}
335327

336328
/**
337329
* xe_vm_clear_validating() - Unregister this task as currently making bos resident
338330
* @vm: Pointer to the vm or NULL
339331
* @allow_res_evict: Eviction from @vm was allowed. Must be set to the same
340332
* value as for xe_vm_set_validation().
341-
* @cookie: Cookie obtained from xe_vm_set_validating().
342333
*
343334
* Register this task as currently making bos resident for the vm. Intended
344335
* to avoid eviction by the same task of shared bos bound to the vm.
345336
* Call with the vm's resv lock held.
346337
*/
347-
static inline void xe_vm_clear_validating(struct xe_vm *vm, bool allow_res_evict,
348-
struct pin_cookie cookie)
338+
static inline void xe_vm_clear_validating(struct xe_vm *vm, bool allow_res_evict)
349339
{
350340
if (vm && !allow_res_evict) {
351-
lockdep_unpin_lock(&xe_vm_resv(vm)->lock.base, cookie);
352341
/* Pairs with READ_ONCE in xe_vm_is_validating() */
353342
WRITE_ONCE(vm->validating, NULL);
354343
}

0 commit comments

Comments
 (0)