Skip to content

Commit 59b0002

Browse files
committed
Merge tag 'drm-xe-fixes-2025-08-27' of https://gitlab.freedesktop.org/drm/xe/kernel into drm-fixes
- Fix user-fence race issue (Zbigniew) - Couple xe_vm fixes (Thomas) - Don't trigger rebind on initial dma-buf validation (Brost) - Fix a build issue related to basename() posix vs gnu discrepancy (Carlos) Signed-off-by: Dave Airlie <airlied@redhat.com> From: Rodrigo Vivi <rodrigo.vivi@intel.com> Link: https://lore.kernel.org/r/aK8oalcIU-zQOfws@intel.com
2 parents 1b237f1 + 75671d9 commit 59b0002

5 files changed

Lines changed: 22 additions & 21 deletions

File tree

drivers/gpu/drm/xe/xe_bo.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -812,7 +812,8 @@ static int xe_bo_move(struct ttm_buffer_object *ttm_bo, bool evict,
812812
}
813813

814814
if (ttm_bo->type == ttm_bo_type_sg) {
815-
ret = xe_bo_move_notify(bo, ctx);
815+
if (new_mem->mem_type == XE_PL_SYSTEM)
816+
ret = xe_bo_move_notify(bo, ctx);
816817
if (!ret)
817818
ret = xe_bo_move_dmabuf(ttm_bo, new_mem);
818819
return ret;
@@ -2438,7 +2439,6 @@ int xe_bo_validate(struct xe_bo *bo, struct xe_vm *vm, bool allow_res_evict)
24382439
.no_wait_gpu = false,
24392440
.gfp_retry_mayfail = true,
24402441
};
2441-
struct pin_cookie cookie;
24422442
int ret;
24432443

24442444
if (vm) {
@@ -2449,10 +2449,10 @@ int xe_bo_validate(struct xe_bo *bo, struct xe_vm *vm, bool allow_res_evict)
24492449
ctx.resv = xe_vm_resv(vm);
24502450
}
24512451

2452-
cookie = xe_vm_set_validating(vm, allow_res_evict);
2452+
xe_vm_set_validating(vm, allow_res_evict);
24532453
trace_xe_bo_validate(bo);
24542454
ret = ttm_bo_validate(&bo->ttm, &bo->placement, &ctx);
2455-
xe_vm_clear_validating(vm, allow_res_evict, cookie);
2455+
xe_vm_clear_validating(vm, allow_res_evict);
24562456

24572457
return ret;
24582458
}

drivers/gpu/drm/xe/xe_gen_wa_oob.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,11 +123,19 @@ static int parse(FILE *input, FILE *csource, FILE *cheader, char *prefix)
123123
return 0;
124124
}
125125

126+
/* Avoid GNU vs POSIX basename() discrepancy, just use our own */
127+
static const char *xbasename(const char *s)
128+
{
129+
const char *p = strrchr(s, '/');
130+
131+
return p ? p + 1 : s;
132+
}
133+
126134
static int fn_to_prefix(const char *fn, char *prefix, size_t size)
127135
{
128136
size_t len;
129137

130-
fn = basename(fn);
138+
fn = xbasename(fn);
131139
len = strlen(fn);
132140

133141
if (len > size - 1)

drivers/gpu/drm/xe/xe_sync.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ static void user_fence_worker(struct work_struct *w)
7777
{
7878
struct xe_user_fence *ufence = container_of(w, struct xe_user_fence, worker);
7979

80+
WRITE_ONCE(ufence->signalled, 1);
8081
if (mmget_not_zero(ufence->mm)) {
8182
kthread_use_mm(ufence->mm);
8283
if (copy_to_user(ufence->addr, &ufence->value, sizeof(ufence->value)))
@@ -91,7 +92,6 @@ static void user_fence_worker(struct work_struct *w)
9192
* Wake up waiters only after updating the ufence state, allowing the UMD
9293
* to safely reuse the same ufence without encountering -EBUSY errors.
9394
*/
94-
WRITE_ONCE(ufence->signalled, 1);
9595
wake_up_all(&ufence->xe->ufence_wq);
9696
user_fence_put(ufence);
9797
}

drivers/gpu/drm/xe/xe_vm.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1610,8 +1610,12 @@ static int xe_vm_create_scratch(struct xe_device *xe, struct xe_tile *tile,
16101610

16111611
for (i = MAX_HUGEPTE_LEVEL; i < vm->pt_root[id]->level; i++) {
16121612
vm->scratch_pt[id][i] = xe_pt_create(vm, tile, i);
1613-
if (IS_ERR(vm->scratch_pt[id][i]))
1614-
return PTR_ERR(vm->scratch_pt[id][i]);
1613+
if (IS_ERR(vm->scratch_pt[id][i])) {
1614+
int err = PTR_ERR(vm->scratch_pt[id][i]);
1615+
1616+
vm->scratch_pt[id][i] = NULL;
1617+
return err;
1618+
}
16151619

16161620
xe_pt_populate_empty(tile, vm, vm->scratch_pt[id][i]);
16171621
}

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)