2
0
mirror of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git synced 2025-09-04 20:19:47 +08:00

- 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)
 -----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCgAdFiEEbSBwaO7dZQkcLOKj+mJfZA7rE8oFAmivKCAACgkQ+mJfZA7r
 E8qCxggAo9VwMViUfTKLr+Nh5HME5RRelmbCkO8XNyRc+g6zJtKYjzZwg7DnEnRB
 FUl/wRlg9+Ac4yHha61sCpr6Yr0qLatx1VwwM+fv/rFadlRwi1DRzCidoCDNOzCl
 acyFsrpH4YhxGwzwkK75aoxmAybXEKLFCJ/8rn1wTQZ6ajcIRXd57frgL6OUEJ59
 +wSiicLLvYl09b2t/oAVTXo6mmSNxstklxT+FKQWZYT+ARQ5bgu5UzXAwp9aGtZX
 hYIFVsLs1DvQcBahlaJdsMinZ9RDSc2IticZuz4W+LhR/08b2hGOvoqoJHd58Z0k
 KlrepEyNkGdwaRxzxHMzSYv7Fk7E9w==
 =8avh
 -----END PGP SIGNATURE-----

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
This commit is contained in:
Dave Airlie 2025-08-29 07:06:31 +10:00
commit 59b00024ce
5 changed files with 22 additions and 21 deletions

View File

@ -812,7 +812,8 @@ static int xe_bo_move(struct ttm_buffer_object *ttm_bo, bool evict,
}
if (ttm_bo->type == ttm_bo_type_sg) {
ret = xe_bo_move_notify(bo, ctx);
if (new_mem->mem_type == XE_PL_SYSTEM)
ret = xe_bo_move_notify(bo, ctx);
if (!ret)
ret = xe_bo_move_dmabuf(ttm_bo, new_mem);
return ret;
@ -2438,7 +2439,6 @@ int xe_bo_validate(struct xe_bo *bo, struct xe_vm *vm, bool allow_res_evict)
.no_wait_gpu = false,
.gfp_retry_mayfail = true,
};
struct pin_cookie cookie;
int ret;
if (vm) {
@ -2449,10 +2449,10 @@ int xe_bo_validate(struct xe_bo *bo, struct xe_vm *vm, bool allow_res_evict)
ctx.resv = xe_vm_resv(vm);
}
cookie = xe_vm_set_validating(vm, allow_res_evict);
xe_vm_set_validating(vm, allow_res_evict);
trace_xe_bo_validate(bo);
ret = ttm_bo_validate(&bo->ttm, &bo->placement, &ctx);
xe_vm_clear_validating(vm, allow_res_evict, cookie);
xe_vm_clear_validating(vm, allow_res_evict);
return ret;
}

View File

@ -123,11 +123,19 @@ static int parse(FILE *input, FILE *csource, FILE *cheader, char *prefix)
return 0;
}
/* Avoid GNU vs POSIX basename() discrepancy, just use our own */
static const char *xbasename(const char *s)
{
const char *p = strrchr(s, '/');
return p ? p + 1 : s;
}
static int fn_to_prefix(const char *fn, char *prefix, size_t size)
{
size_t len;
fn = basename(fn);
fn = xbasename(fn);
len = strlen(fn);
if (len > size - 1)

View File

@ -77,6 +77,7 @@ static void user_fence_worker(struct work_struct *w)
{
struct xe_user_fence *ufence = container_of(w, struct xe_user_fence, worker);
WRITE_ONCE(ufence->signalled, 1);
if (mmget_not_zero(ufence->mm)) {
kthread_use_mm(ufence->mm);
if (copy_to_user(ufence->addr, &ufence->value, sizeof(ufence->value)))
@ -91,7 +92,6 @@ static void user_fence_worker(struct work_struct *w)
* Wake up waiters only after updating the ufence state, allowing the UMD
* to safely reuse the same ufence without encountering -EBUSY errors.
*/
WRITE_ONCE(ufence->signalled, 1);
wake_up_all(&ufence->xe->ufence_wq);
user_fence_put(ufence);
}

View File

@ -1610,8 +1610,12 @@ static int xe_vm_create_scratch(struct xe_device *xe, struct xe_tile *tile,
for (i = MAX_HUGEPTE_LEVEL; i < vm->pt_root[id]->level; i++) {
vm->scratch_pt[id][i] = xe_pt_create(vm, tile, i);
if (IS_ERR(vm->scratch_pt[id][i]))
return PTR_ERR(vm->scratch_pt[id][i]);
if (IS_ERR(vm->scratch_pt[id][i])) {
int err = PTR_ERR(vm->scratch_pt[id][i]);
vm->scratch_pt[id][i] = NULL;
return err;
}
xe_pt_populate_empty(tile, vm, vm->scratch_pt[id][i]);
}

View File

@ -315,22 +315,14 @@ void xe_vm_snapshot_free(struct xe_vm_snapshot *snap);
* Register this task as currently making bos resident for the vm. Intended
* to avoid eviction by the same task of shared bos bound to the vm.
* Call with the vm's resv lock held.
*
* Return: A pin cookie that should be used for xe_vm_clear_validating().
*/
static inline struct pin_cookie xe_vm_set_validating(struct xe_vm *vm,
bool allow_res_evict)
static inline void xe_vm_set_validating(struct xe_vm *vm, bool allow_res_evict)
{
struct pin_cookie cookie = {};
if (vm && !allow_res_evict) {
xe_vm_assert_held(vm);
cookie = lockdep_pin_lock(&xe_vm_resv(vm)->lock.base);
/* Pairs with READ_ONCE in xe_vm_is_validating() */
WRITE_ONCE(vm->validating, current);
}
return cookie;
}
/**
@ -338,17 +330,14 @@ static inline struct pin_cookie xe_vm_set_validating(struct xe_vm *vm,
* @vm: Pointer to the vm or NULL
* @allow_res_evict: Eviction from @vm was allowed. Must be set to the same
* value as for xe_vm_set_validation().
* @cookie: Cookie obtained from xe_vm_set_validating().
*
* Register this task as currently making bos resident for the vm. Intended
* to avoid eviction by the same task of shared bos bound to the vm.
* Call with the vm's resv lock held.
*/
static inline void xe_vm_clear_validating(struct xe_vm *vm, bool allow_res_evict,
struct pin_cookie cookie)
static inline void xe_vm_clear_validating(struct xe_vm *vm, bool allow_res_evict)
{
if (vm && !allow_res_evict) {
lockdep_unpin_lock(&xe_vm_resv(vm)->lock.base, cookie);
/* Pairs with READ_ONCE in xe_vm_is_validating() */
WRITE_ONCE(vm->validating, NULL);
}