first two files are: destroy eviction_lock and kfm_lock. final change is because it gets num_fences == 2, and this is a hackaround. then it crashes: [ 722.8749085] panic: kernel diagnostic assertion "START(__node) <= __start" failed: file "/usr/branches/riastradh-drm/netbsd-src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_vm.c", line 69 [ 722.8911974] cpu2: Begin traceback... [ 722.8911974] vpanic() at netbsd:vpanic+0x156 [ 722.9011972] __x86_indirect_thunk_rax() at netbsd:__x86_indirect_thunk_rax [ 722.9111971] amdgpu_vm_bo_map() at netbsd:amdgpu_vm_bo_map+0x160 [ 722.9111971] amdgpu_gem_va_ioctl() at netbsd:amdgpu_gem_va_ioctl+0x2e7 [ 722.9211970] drm_ioctl() at netbsd:drm_ioctl+0x219 which is : INTERVAL_TREE_DEFINE(struct amdgpu_bo_va_mapping, rb, uint64_t, __subtree_last, in amdgpu_vm.c. and then inside that macro: QUAL T * \ PREFIX##_iter_first(struct rb_root_cached *__root, KT __start, KT __last) \ { \ T *__node; \ \ __node = rb_tree_find_node_geq(&__root->rb_root.rbr_tree, &__start); \ if (__node == NULL) \ return NULL; \ KASSERT(START(__node) <= __start); \ diff --git a/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_vm.c b/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_vm.c index 8dda49259a85..c1a90ae8c648 100644 --- a/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_vm.c +++ b/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_vm.c @@ -3120,6 +3120,8 @@ void amdgpu_vm_fini(struct amdgpu_device *adev, struct amdgpu_vm *vm) struct amdgpu_bo *root; int i; + FINI_KFIFO(vm->faults); + amdgpu_amdkfd_gpuvm_destroy_cb(adev, vm); root = amdgpu_bo_ref(vm->root.base.bo); @@ -3172,6 +3174,7 @@ void amdgpu_vm_fini(struct amdgpu_device *adev, struct amdgpu_vm *vm) for (i = 0; i < AMDGPU_MAX_VMHUBS; i++) amdgpu_vmid_free_reserved(adev, vm, i); + mutex_destroy(&vm->eviction_lock); spin_lock_destroy(&vm->invalidated_lock); } diff --git a/sys/external/bsd/drm2/include/linux/kfifo.h b/sys/external/bsd/drm2/include/linux/kfifo.h index 8791d08f63be..5833200456a3 100644 --- a/sys/external/bsd/drm2/include/linux/kfifo.h +++ b/sys/external/bsd/drm2/include/linux/kfifo.h @@ -66,6 +66,11 @@ struct kfifo_meta { _init_kfifo(&(FIFO).kf_meta, sizeof((FIFO).kf_buf)); \ } while (0) +#define FINI_KFIFO(FIFO) do \ +{ \ + _fini_kfifo(&(FIFO).kf_meta); \ +} while (0) + static inline void _init_kfifo(struct kfifo_meta *meta, size_t nbytes) { @@ -76,6 +81,13 @@ _init_kfifo(struct kfifo_meta *meta, size_t nbytes) meta->kfm_nbytes = nbytes; } +static inline void +_fini_kfifo(struct kfifo_meta *meta) +{ + + mutex_destroy(&meta->kfm_lock); +} + _KFIFO_PTR_TYPE(kfifo, void); #define kfifo_alloc(FIFO, SIZE, GFP) \ diff --git a/sys/external/bsd/drm2/linux/linux_dma_resv.c b/sys/external/bsd/drm2/linux/linux_dma_resv.c index 95e731d26dc4..c2047abf5acf 100644 --- a/sys/external/bsd/drm2/linux/linux_dma_resv.c +++ b/sys/external/bsd/drm2/linux/linux_dma_resv.c @@ -317,7 +317,7 @@ dma_resv_reserve_shared(struct dma_resv *robj, unsigned int num_fences) uint32_t n, nalloc; KASSERT(dma_resv_held(robj)); - KASSERT(num_fences == 1); + //KASSERTMSG(num_fences <= 1, "num_fences %u", num_fences); list = robj->fence; prealloc = robj->robj_prealloc;