Re: [Nouveau] [PATCH drm-misc-next 0/5] Nouveau VM_BIND uAPI Fixes
For the series: Reviewed-by: Dave Airlie On Tue, 8 Aug 2023 at 02:32, Danilo Krummrich wrote: > > The patch series provides a few fixes for the recently merged VM_BIND uAPI > mostly addressing a couple of warnings. > > It also contains one patch to slightly reduce the memory footprint of > struct nouveau_uvma. > > Danilo Krummrich (5): > nouveau/dmem: fix copy-paste error in nouveau_dmem_migrate_chunk() > drm/nouveau: nvkm: vmm: silence warning from cast > drm/nouveau: remove incorrect __user annotations > drm/nouveau: uvmm: remove incorrect calls to mas_unlock() > drm/nouveau: uvmm: remove dedicated VM pointer from VMAs > > drivers/gpu/drm/nouveau/nouveau_dmem.c| 2 +- > drivers/gpu/drm/nouveau/nouveau_exec.c| 6 ++--- > drivers/gpu/drm/nouveau/nouveau_exec.h| 2 +- > drivers/gpu/drm/nouveau/nouveau_uvmm.c| 23 --- > drivers/gpu/drm/nouveau/nouveau_uvmm.h| 14 +-- > .../gpu/drm/nouveau/nvkm/subdev/mmu/uvmm.c| 5 ++-- > 6 files changed, 24 insertions(+), 28 deletions(-) > > > base-commit: 82d750e9d2f5d0594c8f7057ce59127e701af781 > -- > 2.41.0 >
Re: [Nouveau] [PATCH] drm/nouveau/sched: Don't pass user flags to drm_syncobj_find_fence()
On Mon, Aug 07, 2023 at 06:41:44PM -0500, Faith Ekstrand wrote: > The flags field in drm_syncobj_find_fence() takes SYNCOBJ_WAIT flags > from the syncobj UAPI whereas sync->flags is from the nouveau UAPI. What > we actually want is 0 flags which tells it to just try to find the > fence and then return without waiting. Good catch! Reviewed-by: Danilo Krummrich > > Signed-off-by: Faith Ekstrand > Fixes: b88baab82871 ("drm/nouveau: implement new VM_BIND uAPI") > Cc: Danilo Krummrich > Cc: Dave Airlie > --- > drivers/gpu/drm/nouveau/nouveau_sched.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/nouveau/nouveau_sched.c > b/drivers/gpu/drm/nouveau/nouveau_sched.c > index b3b59fbec291..3424a1bf6af3 100644 > --- a/drivers/gpu/drm/nouveau/nouveau_sched.c > +++ b/drivers/gpu/drm/nouveau/nouveau_sched.c > @@ -142,7 +142,7 @@ sync_find_fence(struct nouveau_job *job, > > ret = drm_syncobj_find_fence(job->file_priv, >sync->handle, point, > - sync->flags, fence); > + 0 /* flags */, fence); > if (ret) > return ret; > > -- > 2.41.0 >
[Nouveau] [PATCH] drm/nouveau/sched: Don't pass user flags to drm_syncobj_find_fence()
The flags field in drm_syncobj_find_fence() takes SYNCOBJ_WAIT flags from the syncobj UAPI whereas sync->flags is from the nouveau UAPI. What we actually want is 0 flags which tells it to just try to find the fence and then return without waiting. Signed-off-by: Faith Ekstrand Fixes: b88baab82871 ("drm/nouveau: implement new VM_BIND uAPI") Cc: Danilo Krummrich Cc: Dave Airlie --- drivers/gpu/drm/nouveau/nouveau_sched.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/nouveau/nouveau_sched.c b/drivers/gpu/drm/nouveau/nouveau_sched.c index b3b59fbec291..3424a1bf6af3 100644 --- a/drivers/gpu/drm/nouveau/nouveau_sched.c +++ b/drivers/gpu/drm/nouveau/nouveau_sched.c @@ -142,7 +142,7 @@ sync_find_fence(struct nouveau_job *job, ret = drm_syncobj_find_fence(job->file_priv, sync->handle, point, -sync->flags, fence); +0 /* flags */, fence); if (ret) return ret; -- 2.41.0
Re: [Nouveau] [PATCH] drm/nouveau/disp: Revert a NULL check inside nouveau_connector_get_modes
Ugh, thanks for catching this! Reviewed-by: Lyude Paul On Sat, 2023-08-05 at 12:18 +0200, Karol Herbst wrote: > The original commit adding that check tried to protect the kenrel against > a potential invalid NULL pointer access. > > However we call nouveau_connector_detect_depth once without a native_mode > set on purpose for non LVDS connectors and this broke DP support in a few > cases. > > Cc: Olaf Skibbe > Cc: Lyude Paul > Closes: https://gitlab.freedesktop.org/drm/nouveau/-/issues/238 > Closes: https://gitlab.freedesktop.org/drm/nouveau/-/issues/245 > Fixes: 20a2ce87fbaf8 ("drm/nouveau/dp: check for NULL > nv_connector->native_mode") > Signed-off-by: Karol Herbst > --- > drivers/gpu/drm/nouveau/nouveau_connector.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/nouveau/nouveau_connector.c > b/drivers/gpu/drm/nouveau/nouveau_connector.c > index f75c6f09dd2af..a2e0033e8a260 100644 > --- a/drivers/gpu/drm/nouveau/nouveau_connector.c > +++ b/drivers/gpu/drm/nouveau/nouveau_connector.c > @@ -967,7 +967,7 @@ nouveau_connector_get_modes(struct drm_connector > *connector) > /* Determine display colour depth for everything except LVDS now, >* DP requires this before mode_valid() is called. >*/ > - if (connector->connector_type != DRM_MODE_CONNECTOR_LVDS && > nv_connector->native_mode) > + if (connector->connector_type != DRM_MODE_CONNECTOR_LVDS) > nouveau_connector_detect_depth(connector); > > /* Find the native mode if this is a digital panel, if we didn't -- Cheers, Lyude Paul (she/her) Software Engineer at Red Hat
Re: [Nouveau] [PATCH drm-misc-next v9 06/11] drm/nouveau: fence: separate fence alloc and emit
Hi Christian, On 8/7/23 20:07, Christian König wrote: Am 03.08.23 um 18:52 schrieb Danilo Krummrich: The new (VM_BIND) UAPI exports DMA fences through DRM syncobjs. Hence, in order to emit fences within DMA fence signalling critical sections (e.g. as typically done in the DRM GPU schedulers run_job() callback) we need to separate fence allocation and fence emitting. At least from the description that sounds like it might be illegal. Daniel can you take a look as well. What exactly are you doing here? I'm basically doing exactly the same as amdgpu_fence_emit() does in amdgpu_ib_schedule() called by amdgpu_job_run(). The difference - and this is what this patch is for - is that I separate the fence allocation from emitting the fence, such that the fence structure is allocated before the job is submitted to the GPU scheduler. amdgpu solves this with GFP_ATOMIC within amdgpu_fence_emit() to allocate the fence structure in this case. - Danilo Regards, Christian. Signed-off-by: Danilo Krummrich --- drivers/gpu/drm/nouveau/dispnv04/crtc.c | 9 - drivers/gpu/drm/nouveau/nouveau_bo.c | 52 +++-- drivers/gpu/drm/nouveau/nouveau_chan.c | 6 ++- drivers/gpu/drm/nouveau/nouveau_dmem.c | 9 +++-- drivers/gpu/drm/nouveau/nouveau_fence.c | 16 +++- drivers/gpu/drm/nouveau/nouveau_fence.h | 3 +- drivers/gpu/drm/nouveau/nouveau_gem.c | 5 ++- 7 files changed, 59 insertions(+), 41 deletions(-) diff --git a/drivers/gpu/drm/nouveau/dispnv04/crtc.c b/drivers/gpu/drm/nouveau/dispnv04/crtc.c index a6f2e681bde9..a34924523133 100644 --- a/drivers/gpu/drm/nouveau/dispnv04/crtc.c +++ b/drivers/gpu/drm/nouveau/dispnv04/crtc.c @@ -1122,11 +1122,18 @@ nv04_page_flip_emit(struct nouveau_channel *chan, PUSH_NVSQ(push, NV_SW, NV_SW_PAGE_FLIP, 0x); PUSH_KICK(push); - ret = nouveau_fence_new(chan, false, pfence); + ret = nouveau_fence_new(pfence); if (ret) goto fail; + ret = nouveau_fence_emit(*pfence, chan); + if (ret) + goto fail_fence_unref; + return 0; + +fail_fence_unref: + nouveau_fence_unref(pfence); fail: spin_lock_irqsave(>event_lock, flags); list_del(>head); diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c index 057bc995f19b..e9cbbf594e6f 100644 --- a/drivers/gpu/drm/nouveau/nouveau_bo.c +++ b/drivers/gpu/drm/nouveau/nouveau_bo.c @@ -820,29 +820,39 @@ nouveau_bo_move_m2mf(struct ttm_buffer_object *bo, int evict, mutex_lock(>mutex); else mutex_lock_nested(>mutex, SINGLE_DEPTH_NESTING); + ret = nouveau_fence_sync(nouveau_bo(bo), chan, true, ctx->interruptible); - if (ret == 0) { - ret = drm->ttm.move(chan, bo, bo->resource, new_reg); - if (ret == 0) { - ret = nouveau_fence_new(chan, false, ); - if (ret == 0) { - /* TODO: figure out a better solution here - * - * wait on the fence here explicitly as going through - * ttm_bo_move_accel_cleanup somehow doesn't seem to do it. - * - * Without this the operation can timeout and we'll fallback to a - * software copy, which might take several minutes to finish. - */ - nouveau_fence_wait(fence, false, false); - ret = ttm_bo_move_accel_cleanup(bo, - >base, - evict, false, - new_reg); - nouveau_fence_unref(); - } - } + if (ret) + goto out_unlock; + + ret = drm->ttm.move(chan, bo, bo->resource, new_reg); + if (ret) + goto out_unlock; + + ret = nouveau_fence_new(); + if (ret) + goto out_unlock; + + ret = nouveau_fence_emit(fence, chan); + if (ret) { + nouveau_fence_unref(); + goto out_unlock; } + + /* TODO: figure out a better solution here + * + * wait on the fence here explicitly as going through + * ttm_bo_move_accel_cleanup somehow doesn't seem to do it. + * + * Without this the operation can timeout and we'll fallback to a + * software copy, which might take several minutes to finish. + */ + nouveau_fence_wait(fence, false, false); + ret = ttm_bo_move_accel_cleanup(bo, >base, evict, false, + new_reg); + nouveau_fence_unref(); + +out_unlock: mutex_unlock(>mutex); return ret; } diff --git a/drivers/gpu/drm/nouveau/nouveau_chan.c b/drivers/gpu/drm/nouveau/nouveau_chan.c index 6d639314250a..f69be4c8f9f2 100644 --- a/drivers/gpu/drm/nouveau/nouveau_chan.c +++ b/drivers/gpu/drm/nouveau/nouveau_chan.c @@ -62,9 +62,11 @@ nouveau_channel_idle(struct nouveau_channel *chan) struct nouveau_fence *fence = NULL; int ret; - ret = nouveau_fence_new(chan, false, ); + ret =
Re: [Nouveau] [PATCH drm-misc-next v9 06/11] drm/nouveau: fence: separate fence alloc and emit
Am 03.08.23 um 18:52 schrieb Danilo Krummrich: The new (VM_BIND) UAPI exports DMA fences through DRM syncobjs. Hence, in order to emit fences within DMA fence signalling critical sections (e.g. as typically done in the DRM GPU schedulers run_job() callback) we need to separate fence allocation and fence emitting. At least from the description that sounds like it might be illegal. Daniel can you take a look as well. What exactly are you doing here? Regards, Christian. Signed-off-by: Danilo Krummrich --- drivers/gpu/drm/nouveau/dispnv04/crtc.c | 9 - drivers/gpu/drm/nouveau/nouveau_bo.c| 52 +++-- drivers/gpu/drm/nouveau/nouveau_chan.c | 6 ++- drivers/gpu/drm/nouveau/nouveau_dmem.c | 9 +++-- drivers/gpu/drm/nouveau/nouveau_fence.c | 16 +++- drivers/gpu/drm/nouveau/nouveau_fence.h | 3 +- drivers/gpu/drm/nouveau/nouveau_gem.c | 5 ++- 7 files changed, 59 insertions(+), 41 deletions(-) diff --git a/drivers/gpu/drm/nouveau/dispnv04/crtc.c b/drivers/gpu/drm/nouveau/dispnv04/crtc.c index a6f2e681bde9..a34924523133 100644 --- a/drivers/gpu/drm/nouveau/dispnv04/crtc.c +++ b/drivers/gpu/drm/nouveau/dispnv04/crtc.c @@ -1122,11 +1122,18 @@ nv04_page_flip_emit(struct nouveau_channel *chan, PUSH_NVSQ(push, NV_SW, NV_SW_PAGE_FLIP, 0x); PUSH_KICK(push); - ret = nouveau_fence_new(chan, false, pfence); + ret = nouveau_fence_new(pfence); if (ret) goto fail; + ret = nouveau_fence_emit(*pfence, chan); + if (ret) + goto fail_fence_unref; + return 0; + +fail_fence_unref: + nouveau_fence_unref(pfence); fail: spin_lock_irqsave(>event_lock, flags); list_del(>head); diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c index 057bc995f19b..e9cbbf594e6f 100644 --- a/drivers/gpu/drm/nouveau/nouveau_bo.c +++ b/drivers/gpu/drm/nouveau/nouveau_bo.c @@ -820,29 +820,39 @@ nouveau_bo_move_m2mf(struct ttm_buffer_object *bo, int evict, mutex_lock(>mutex); else mutex_lock_nested(>mutex, SINGLE_DEPTH_NESTING); + ret = nouveau_fence_sync(nouveau_bo(bo), chan, true, ctx->interruptible); - if (ret == 0) { - ret = drm->ttm.move(chan, bo, bo->resource, new_reg); - if (ret == 0) { - ret = nouveau_fence_new(chan, false, ); - if (ret == 0) { - /* TODO: figure out a better solution here -* -* wait on the fence here explicitly as going through -* ttm_bo_move_accel_cleanup somehow doesn't seem to do it. -* -* Without this the operation can timeout and we'll fallback to a -* software copy, which might take several minutes to finish. -*/ - nouveau_fence_wait(fence, false, false); - ret = ttm_bo_move_accel_cleanup(bo, - >base, - evict, false, - new_reg); - nouveau_fence_unref(); - } - } + if (ret) + goto out_unlock; + + ret = drm->ttm.move(chan, bo, bo->resource, new_reg); + if (ret) + goto out_unlock; + + ret = nouveau_fence_new(); + if (ret) + goto out_unlock; + + ret = nouveau_fence_emit(fence, chan); + if (ret) { + nouveau_fence_unref(); + goto out_unlock; } + + /* TODO: figure out a better solution here +* +* wait on the fence here explicitly as going through +* ttm_bo_move_accel_cleanup somehow doesn't seem to do it. +* +* Without this the operation can timeout and we'll fallback to a +* software copy, which might take several minutes to finish. +*/ + nouveau_fence_wait(fence, false, false); + ret = ttm_bo_move_accel_cleanup(bo, >base, evict, false, + new_reg); + nouveau_fence_unref(); + +out_unlock: mutex_unlock(>mutex); return ret; } diff --git a/drivers/gpu/drm/nouveau/nouveau_chan.c b/drivers/gpu/drm/nouveau/nouveau_chan.c index 6d639314250a..f69be4c8f9f2 100644 --- a/drivers/gpu/drm/nouveau/nouveau_chan.c +++ b/drivers/gpu/drm/nouveau/nouveau_chan.c @@ -62,9 +62,11 @@ nouveau_channel_idle(struct nouveau_channel *chan) struct nouveau_fence *fence = NULL; int ret; - ret = nouveau_fence_new(chan, false, ); + ret = nouveau_fence_new();
[Nouveau] [PATCH drm-misc-next 5/5] drm/nouveau: uvmm: remove dedicated VM pointer from VMAs
VMAs can find their corresponding VM through their embedded struct drm_gpuva which already carries a pointer to a struct drm_gpuva_manager which the VM is based on. Hence, remove the struct nouveau_uvmm pointer from struct nouveau_uvma to save a couple of bytes per mapping. Signed-off-by: Danilo Krummrich --- drivers/gpu/drm/nouveau/nouveau_uvmm.c | 9 - drivers/gpu/drm/nouveau/nouveau_uvmm.h | 10 +- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/nouveau/nouveau_uvmm.c b/drivers/gpu/drm/nouveau/nouveau_uvmm.c index 91b964ef98b1..3a1e8538f205 100644 --- a/drivers/gpu/drm/nouveau/nouveau_uvmm.c +++ b/drivers/gpu/drm/nouveau/nouveau_uvmm.c @@ -181,7 +181,7 @@ nouveau_uvma_vmm_put(struct nouveau_uvma *uvma) u64 addr = uvma->va.va.addr; u64 range = uvma->va.va.range; - return nouveau_uvmm_vmm_put(uvma->uvmm, addr, range); + return nouveau_uvmm_vmm_put(to_uvmm(uvma), addr, range); } static int @@ -192,7 +192,7 @@ nouveau_uvma_map(struct nouveau_uvma *uvma, u64 offset = uvma->va.gem.offset; u64 range = uvma->va.va.range; - return nouveau_uvmm_vmm_map(uvma->uvmm, addr, range, + return nouveau_uvmm_vmm_map(to_uvmm(uvma), addr, range, offset, uvma->kind, mem); } @@ -206,7 +206,7 @@ nouveau_uvma_unmap(struct nouveau_uvma *uvma) if (drm_gpuva_invalidated(>va)) return 0; - return nouveau_uvmm_vmm_unmap(uvma->uvmm, addr, range, sparse); + return nouveau_uvmm_vmm_unmap(to_uvmm(uvma), addr, range, sparse); } static int @@ -586,7 +586,6 @@ op_map_prepare(struct nouveau_uvmm *uvmm, if (ret) return ret; - uvma->uvmm = uvmm; uvma->region = args->region; uvma->kind = args->kind; @@ -794,7 +793,7 @@ op_unmap_range(struct drm_gpuva_op_unmap *u, bool sparse = !!uvma->region; if (!drm_gpuva_invalidated(u->va)) - nouveau_uvmm_vmm_unmap(uvma->uvmm, addr, range, sparse); + nouveau_uvmm_vmm_unmap(to_uvmm(uvma), addr, range, sparse); } static void diff --git a/drivers/gpu/drm/nouveau/nouveau_uvmm.h b/drivers/gpu/drm/nouveau/nouveau_uvmm.h index 534baadc3bf7..fc7f6fd2a4e1 100644 --- a/drivers/gpu/drm/nouveau/nouveau_uvmm.h +++ b/drivers/gpu/drm/nouveau/nouveau_uvmm.h @@ -37,12 +37,15 @@ struct nouveau_uvma_region { struct nouveau_uvma { struct drm_gpuva va; - struct nouveau_uvmm *uvmm; struct nouveau_uvma_region *region; - u8 kind; }; +#define uvmm_from_mgr(x) container_of((x), struct nouveau_uvmm, umgr) +#define uvma_from_va(x) container_of((x), struct nouveau_uvma, va) + +#define to_uvmm(x) uvmm_from_mgr((x)->va.mgr) + struct nouveau_uvmm_bind_job { struct nouveau_job base; @@ -79,9 +82,6 @@ struct nouveau_uvmm_bind_job_args { #define to_uvmm_bind_job(job) container_of((job), struct nouveau_uvmm_bind_job, base) -#define uvmm_from_mgr(x) container_of((x), struct nouveau_uvmm, umgr) -#define uvma_from_va(x) container_of((x), struct nouveau_uvma, va) - int nouveau_uvmm_init(struct nouveau_uvmm *uvmm, struct nouveau_cli *cli, u64 kernel_managed_addr, u64 kernel_managed_size); void nouveau_uvmm_fini(struct nouveau_uvmm *uvmm); -- 2.41.0
[Nouveau] [PATCH drm-misc-next 3/5] drm/nouveau: remove incorrect __user annotations
Fix copy-paste error causing EXEC and VM_BIND syscalls data pointers to carry incorrect __user annotations. Fixes: b88baab82871 ("drm/nouveau: implement new VM_BIND uAPI") Reported-by: kernel test robot Signed-off-by: Danilo Krummrich --- drivers/gpu/drm/nouveau/nouveau_exec.c | 6 +++--- drivers/gpu/drm/nouveau/nouveau_exec.h | 2 +- drivers/gpu/drm/nouveau/nouveau_uvmm.c | 6 +++--- drivers/gpu/drm/nouveau/nouveau_uvmm.h | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/nouveau/nouveau_exec.c b/drivers/gpu/drm/nouveau/nouveau_exec.c index 42d9dd43ea02..0f927adda4ed 100644 --- a/drivers/gpu/drm/nouveau/nouveau_exec.c +++ b/drivers/gpu/drm/nouveau/nouveau_exec.c @@ -293,7 +293,7 @@ nouveau_exec(struct nouveau_exec_job_args *args) static int nouveau_exec_ucopy(struct nouveau_exec_job_args *args, - struct drm_nouveau_exec __user *req) + struct drm_nouveau_exec *req) { struct drm_nouveau_sync **s; u32 inc = req->wait_count; @@ -352,7 +352,7 @@ nouveau_exec_ufree(struct nouveau_exec_job_args *args) int nouveau_exec_ioctl_exec(struct drm_device *dev, - void __user *data, + void *data, struct drm_file *file_priv) { struct nouveau_abi16 *abi16 = nouveau_abi16_get(file_priv); @@ -360,7 +360,7 @@ nouveau_exec_ioctl_exec(struct drm_device *dev, struct nouveau_abi16_chan *chan16; struct nouveau_channel *chan = NULL; struct nouveau_exec_job_args args = {}; - struct drm_nouveau_exec __user *req = data; + struct drm_nouveau_exec *req = data; int ret = 0; if (unlikely(!abi16)) diff --git a/drivers/gpu/drm/nouveau/nouveau_exec.h b/drivers/gpu/drm/nouveau/nouveau_exec.h index 3032db27b8d7..778cacd90f65 100644 --- a/drivers/gpu/drm/nouveau/nouveau_exec.h +++ b/drivers/gpu/drm/nouveau/nouveau_exec.h @@ -48,7 +48,7 @@ struct nouveau_exec_job { int nouveau_exec_job_init(struct nouveau_exec_job **job, struct nouveau_exec_job_args *args); -int nouveau_exec_ioctl_exec(struct drm_device *dev, void __user *data, +int nouveau_exec_ioctl_exec(struct drm_device *dev, void *data, struct drm_file *file_priv); #endif diff --git a/drivers/gpu/drm/nouveau/nouveau_uvmm.c b/drivers/gpu/drm/nouveau/nouveau_uvmm.c index b515a21aa08e..2acbac73e57a 100644 --- a/drivers/gpu/drm/nouveau/nouveau_uvmm.c +++ b/drivers/gpu/drm/nouveau/nouveau_uvmm.c @@ -1687,7 +1687,7 @@ nouveau_uvmm_vm_bind(struct nouveau_uvmm_bind_job_args *args) static int nouveau_uvmm_vm_bind_ucopy(struct nouveau_uvmm_bind_job_args *args, - struct drm_nouveau_vm_bind __user *req) + struct drm_nouveau_vm_bind *req) { struct drm_nouveau_sync **s; u32 inc = req->wait_count; @@ -1749,12 +1749,12 @@ nouveau_uvmm_vm_bind_ufree(struct nouveau_uvmm_bind_job_args *args) int nouveau_uvmm_ioctl_vm_bind(struct drm_device *dev, - void __user *data, + void *data, struct drm_file *file_priv) { struct nouveau_cli *cli = nouveau_cli(file_priv); struct nouveau_uvmm_bind_job_args args = {}; - struct drm_nouveau_vm_bind __user *req = data; + struct drm_nouveau_vm_bind *req = data; int ret = 0; if (unlikely(!nouveau_cli_uvmm_locked(cli))) diff --git a/drivers/gpu/drm/nouveau/nouveau_uvmm.h b/drivers/gpu/drm/nouveau/nouveau_uvmm.h index 3923c03012f9..534baadc3bf7 100644 --- a/drivers/gpu/drm/nouveau/nouveau_uvmm.h +++ b/drivers/gpu/drm/nouveau/nouveau_uvmm.h @@ -89,10 +89,10 @@ void nouveau_uvmm_fini(struct nouveau_uvmm *uvmm); void nouveau_uvmm_bo_map_all(struct nouveau_bo *nvbov, struct nouveau_mem *mem); void nouveau_uvmm_bo_unmap_all(struct nouveau_bo *nvbo); -int nouveau_uvmm_ioctl_vm_init(struct drm_device *dev, void __user *data, +int nouveau_uvmm_ioctl_vm_init(struct drm_device *dev, void *data, struct drm_file *file_priv); -int nouveau_uvmm_ioctl_vm_bind(struct drm_device *dev, void __user *data, +int nouveau_uvmm_ioctl_vm_bind(struct drm_device *dev, void *data, struct drm_file *file_priv); static inline void nouveau_uvmm_lock(struct nouveau_uvmm *uvmm) -- 2.41.0
[Nouveau] [PATCH drm-misc-next 4/5] drm/nouveau: uvmm: remove incorrect calls to mas_unlock()
Remove incorrect calls to mas_unlock() in the unwind path of __nouveau_uvma_region_insert(). The region maple tree uses an external lock instead, namely the global uvmm lock. Fixes: b88baab82871 ("drm/nouveau: implement new VM_BIND uAPI") Reported-by: kernel test robot Signed-off-by: Danilo Krummrich --- drivers/gpu/drm/nouveau/nouveau_uvmm.c | 8 ++-- 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/nouveau/nouveau_uvmm.c b/drivers/gpu/drm/nouveau/nouveau_uvmm.c index 2acbac73e57a..91b964ef98b1 100644 --- a/drivers/gpu/drm/nouveau/nouveau_uvmm.c +++ b/drivers/gpu/drm/nouveau/nouveau_uvmm.c @@ -279,15 +279,11 @@ __nouveau_uvma_region_insert(struct nouveau_uvmm *uvmm, u64 last = addr + range - 1; MA_STATE(mas, >region_mt, addr, addr); - if (unlikely(mas_walk())) { - mas_unlock(); + if (unlikely(mas_walk())) return -EEXIST; - } - if (unlikely(mas.last < last)) { - mas_unlock(); + if (unlikely(mas.last < last)) return -EEXIST; - } mas.index = addr; mas.last = last; -- 2.41.0
[Nouveau] [PATCH drm-misc-next 2/5] drm/nouveau: nvkm: vmm: silence warning from cast
Cast the integer to a pointer-sized type first to keep the compiler happy. Fixes: 6b252cf42281 ("drm/nouveau: nvkm/vmm: implement raw ops to manage uvmm") Reported-by: kernel test robot Reported-by: Stephen Rothwell Signed-off-by: Danilo Krummrich --- drivers/gpu/drm/nouveau/nvkm/subdev/mmu/uvmm.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/uvmm.c b/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/uvmm.c index 38b7ced934b1..46cbd4cedb78 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/uvmm.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/uvmm.c @@ -399,6 +399,8 @@ nvkm_uvmm_mthd_raw_map(struct nvkm_uvmm *uvmm, struct nvif_vmm_raw_v0 *args) .no_comp = true, }; struct nvkm_memory *memory; + void *argv = (void *)(uintptr_t)args->argv; + int argc = args->argc; u64 handle = args->memory; u8 refd; int ret; @@ -418,8 +420,7 @@ nvkm_uvmm_mthd_raw_map(struct nvkm_uvmm *uvmm, struct nvif_vmm_raw_v0 *args) return PTR_ERR(memory); } - ret = nvkm_memory_map(memory, args->offset, vmm, , - (void *)args->argv, args->argc); + ret = nvkm_memory_map(memory, args->offset, vmm, , argv, argc); nvkm_memory_unref(); nvkm_memory_unref(); -- 2.41.0
[Nouveau] [PATCH drm-misc-next 1/5] nouveau/dmem: fix copy-paste error in nouveau_dmem_migrate_chunk()
Fix call to nouveau_fence_emit() with wrong channel parameter. Fixes: 7f2a0b50b2b2 ("drm/nouveau: fence: separate fence alloc and emit") Reported-by: kernel test robot Reported-by: Stephen Rothwell Reviewed-by: Karol Herbst Signed-off-by: Danilo Krummrich --- drivers/gpu/drm/nouveau/nouveau_dmem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/nouveau/nouveau_dmem.c b/drivers/gpu/drm/nouveau/nouveau_dmem.c index 4ad40e42cae1..61e84562094a 100644 --- a/drivers/gpu/drm/nouveau/nouveau_dmem.c +++ b/drivers/gpu/drm/nouveau/nouveau_dmem.c @@ -678,7 +678,7 @@ static void nouveau_dmem_migrate_chunk(struct nouveau_drm *drm, } if (!nouveau_fence_new()) - nouveau_fence_emit(fence, chunk->drm->dmem->migrate.chan); + nouveau_fence_emit(fence, drm->dmem->migrate.chan); migrate_vma_pages(args); nouveau_dmem_fence_done(); nouveau_pfns_map(svmm, args->vma->vm_mm, args->start, pfns, i); -- 2.41.0
[Nouveau] [PATCH drm-misc-next 0/5] Nouveau VM_BIND uAPI Fixes
The patch series provides a few fixes for the recently merged VM_BIND uAPI mostly addressing a couple of warnings. It also contains one patch to slightly reduce the memory footprint of struct nouveau_uvma. Danilo Krummrich (5): nouveau/dmem: fix copy-paste error in nouveau_dmem_migrate_chunk() drm/nouveau: nvkm: vmm: silence warning from cast drm/nouveau: remove incorrect __user annotations drm/nouveau: uvmm: remove incorrect calls to mas_unlock() drm/nouveau: uvmm: remove dedicated VM pointer from VMAs drivers/gpu/drm/nouveau/nouveau_dmem.c| 2 +- drivers/gpu/drm/nouveau/nouveau_exec.c| 6 ++--- drivers/gpu/drm/nouveau/nouveau_exec.h| 2 +- drivers/gpu/drm/nouveau/nouveau_uvmm.c| 23 --- drivers/gpu/drm/nouveau/nouveau_uvmm.h| 14 +-- .../gpu/drm/nouveau/nvkm/subdev/mmu/uvmm.c| 5 ++-- 6 files changed, 24 insertions(+), 28 deletions(-) base-commit: 82d750e9d2f5d0594c8f7057ce59127e701af781 -- 2.41.0
[Nouveau] [PATCH drm-misc-next 0/5] Nouveau VM_BIND uAPI Fixes
The patch series provides a few fixes for the recently merged VM_BIND uAPI mostly addressing a couple of warnings. It also contains one patch to slightly reduce the memory footprint of struct nouveau_uvma. Danilo Krummrich (5): nouveau/dmem: fix copy-paste error in nouveau_dmem_migrate_chunk() drm/nouveau: nvkm: vmm: silence warning from cast drm/nouveau: remove incorrect __user annotations drm/nouveau: uvmm: remove incorrect calls to mas_unlock() drm/nouveau: uvmm: remove dedicated VM pointer from VMAs drivers/gpu/drm/nouveau/nouveau_dmem.c| 2 +- drivers/gpu/drm/nouveau/nouveau_exec.c| 6 ++--- drivers/gpu/drm/nouveau/nouveau_exec.h| 2 +- drivers/gpu/drm/nouveau/nouveau_uvmm.c| 23 --- drivers/gpu/drm/nouveau/nouveau_uvmm.h| 14 +-- .../gpu/drm/nouveau/nvkm/subdev/mmu/uvmm.c| 5 ++-- 6 files changed, 24 insertions(+), 28 deletions(-) base-commit: 82d750e9d2f5d0594c8f7057ce59127e701af781 -- 2.41.0
Re: [Nouveau] 2b5d1c29f6c4 ("drm/nouveau/disp: PIOR DP uses GPIO for HPD, not PMGR AUX interrupts")
On Mon, Aug 07, 2023 at 01:49:42PM +0200, Karol Herbst wrote: > in what way does it stop? Just not progressing? That would be kinda > concerning. Mind tracing with what arguments `nvkm_uevent_add` is > called with and without that patch? Well, me dumping those args I guess made the box not freeze before catching a #PF over serial. Does that help? [3.410135] Unpacking initramfs... [3.416319] software IO TLB: mapped [mem 0xa877d000-0xac77d000] (64MB) [3.418227] Initialise system trusted keyrings [3.432273] workingset: timestamp_bits=56 max_order=22 bucket_order=0 [3.439006] ntfs: driver 2.1.32 [Flags: R/W]. [3.443368] fuse: init (API version 7.38) [3.447601] 9p: Installing v9fs 9p2000 file system support [3.453223] Key type asymmetric registered [3.457332] Asymmetric key parser 'x509' registered [3.462236] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 250) [3.475865] efifb: probing for efifb [3.479458] efifb: framebuffer at 0xf900, using 1920k, total 1920k [3.485969] efifb: mode is 800x600x32, linelength=3200, pages=1 [3.491872] efifb: scrolling: redraw [3.495438] efifb: Truecolor: size=8:8:8:8, shift=24:16:8:0 [3.502349] Console: switching to colour frame buffer device 100x37 [3.509564] fb0: EFI VGA frame buffer device [3.514013] ACPI: \_PR_.CP00: Found 4 idle states [3.518850] ACPI: \_PR_.CP01: Found 4 idle states [3.523687] ACPI: \_PR_.CP02: Found 4 idle states [3.528515] ACPI: \_PR_.CP03: Found 4 idle states [3.533346] ACPI: \_PR_.CP04: Found 4 idle states [3.538173] ACPI: \_PR_.CP05: Found 4 idle states [3.543003] ACPI: \_PR_.CP06: Found 4 idle states [3.544219] Freeing initrd memory: 8196K [3.547844] ACPI: \_PR_.CP07: Found 4 idle states [3.609542] Serial: 8250/16550 driver, 4 ports, IRQ sharing enabled [3.616224] 00:05: ttyS0 at I/O 0x3f8 (irq = 4, base_baud = 115200) is a 16550A [3.625552] serial :00:16.3: enabling device ( -> 0003) [3.633034] :00:16.3: ttyS1 at I/O 0xf0a0 (irq = 17, base_baud = 115200) is a 16550A [3.642451] Linux agpgart interface v0.103 [3.647141] ACPI: bus type drm_connector registered [3.653261] Console: switching to colour dummy device 80x25 [3.659092] nouveau :03:00.0: vgaarb: deactivate vga console [3.665174] nouveau :03:00.0: NVIDIA GT218 (0a8c00b1) [3.784585] nouveau :03:00.0: bios: version 70.18.83.00.08 [3.792244] nouveau :03:00.0: fb: 512 MiB DDR3 [3.948786] nouveau :03:00.0: DRM: VRAM: 512 MiB [3.953755] nouveau :03:00.0: DRM: GART: 1048576 MiB [3.959073] nouveau :03:00.0: DRM: TMDS table version 2.0 [3.964808] nouveau :03:00.0: DRM: DCB version 4.0 [3.969938] nouveau :03:00.0: DRM: DCB outp 00: 02000360 [3.976367] nouveau :03:00.0: DRM: DCB outp 01: 02000362 00020010 [3.982792] nouveau :03:00.0: DRM: DCB outp 02: 028003a6 0f220010 [3.989223] nouveau :03:00.0: DRM: DCB outp 03: 01011380 [3.995647] nouveau :03:00.0: DRM: DCB outp 04: 08011382 00020010 [4.002076] nouveau :03:00.0: DRM: DCB outp 05: 088113c6 0f220010 [4.008511] nouveau :03:00.0: DRM: DCB conn 00: 00101064 [4.014151] nouveau :03:00.0: DRM: DCB conn 01: 00202165 [4.021710] nvkm_uevent_add: uevent: 0x888100242100, event: 0x8881022de1a0, id: 0x0, bits: 0x1, func: 0x [4.033680] nvkm_uevent_add: uevent: 0x888100242300, event: 0x8881022de1a0, id: 0x0, bits: 0x1, func: 0x [4.045429] nouveau :03:00.0: DRM: MM: using COPY for buffer copies [4.052059] stackdepot: allocating hash table of 1048576 entries via kvcalloc [4.067191] nvkm_uevent_add: uevent: 0x888100242800, event: 0x888104b3e260, id: 0x0, bits: 0x1, func: 0x [4.078936] nvkm_uevent_add: uevent: 0x888100242900, event: 0x888104b3e260, id: 0x1, bits: 0x1, func: 0x [4.090514] nvkm_uevent_add: uevent: 0x888100242a00, event: 0x888102091f28, id: 0x1, bits: 0x3, func: 0x8177b700 [4.102118] tsc: Refined TSC clocksource calibration: 3591.345 MHz [4.108342] clocksource: tsc: mask: 0x max_cycles: 0x33c4635c383, max_idle_ns: 440795314831 ns [4.108401] nvkm_uevent_add: uevent: 0x8881020b6000, event: 0x888102091f28, id: 0xf, bits: 0x3, func: 0x8177b700 [4.129864] clocksource: Switched to clocksource tsc [4.131478] [drm] Initialized nouveau 1.3.1 20120801 for :03:00.0 on minor 0 [4.143806] BUG: kernel NULL pointer dereference, address: 0020 [4.144676] #PF: supervisor read access in kernel mode [4.144676] #PF: error_code(0x) - not-present page [4.144676] PGD 0 P4D 0 [4.144676] Oops: [#1] PREEMPT SMP PTI [4.144676] CPU: 2 PID: 1 Comm: swapper/0 Not tainted 6.5.0-rc5-dirty #1 [4.144676]
Re: [Nouveau] 2b5d1c29f6c4 ("drm/nouveau/disp: PIOR DP uses GPIO for HPD, not PMGR AUX interrupts")
On Sun, Aug 6, 2023 at 11:40 PM Borislav Petkov wrote: > > Hi folks, > > the patch in $Subject breaks booting here on one of my test boxes, see > below. > > Reverting it ontop of -rc4 fixes the issue. > > Thx. > > [3.580535] ACPI: \_PR_.CP04: Found 4 idle states > [3.585694] ACPI: \_PR_.CP05: Found 4 idle states > [3.590852] ACPI: \_PR_.CP06: Found 4 idle states > [3.596037] ACPI: \_PR_.CP07: Found 4 idle states > [3.644065] Freeing initrd memory: 6740K > [3.742932] Serial: 8250/16550 driver, 4 ports, IRQ sharing enabled > [3.750409] 00:05: ttyS0 at I/O 0x3f8 (irq = 4, base_baud = 115200) is a > 16550A > [3.762111] serial :00:16.3: enabling device ( -> 0003) > [3.771589] :00:16.3: ttyS1 at I/O 0xf0a0 (irq = 17, base_baud = > 115200) is a 16550A > [3.782503] Linux agpgart interface v0.103 > [3.787805] ACPI: bus type drm_connector registered > > <--- boot stops here. > in what way does it stop? Just not progressing? That would be kinda concerning. Mind tracing with what arguments `nvkm_uevent_add` is called with and without that patch? Also a boot log with `nouveau.debug=trace` might be helpful here. > It should continue with this: > > [3.795491] Console: switching to colour dummy device 80x25 > [3.801933] nouveau :03:00.0: vgaarb: deactivate vga console > [3.808303] nouveau :03:00.0: NVIDIA GT218 (0a8c00b1) > [3.931002] nouveau :03:00.0: bios: version 70.18.83.00.08 > [3.941731] nouveau :03:00.0: fb: 512 MiB DDR3 > [4.110348] tsc: Refined TSC clocksource calibration: 3591.349 MHz > [4.116627] clocksource: tsc: mask: 0x max_cycles: > 0x33c466a1ab5, max_idle_ns: 440795209767 ns > [4.126871] clocksource: Switched to clocksource tsc > [4.252013] nouveau :03:00.0: DRM: VRAM: 512 MiB > [4.257088] nouveau :03:00.0: DRM: GART: 1048576 MiB > [4.262501] nouveau :03:00.0: DRM: TMDS table version 2.0 > [4.268333] nouveau :03:00.0: DRM: DCB version 4.0 > [4.273561] nouveau :03:00.0: DRM: DCB outp 00: 02000360 > [4.280104] nouveau :03:00.0: DRM: DCB outp 01: 02000362 00020010 > [4.286630] nouveau :03:00.0: DRM: DCB outp 02: 028003a6 0f220010 > [4.293176] nouveau :03:00.0: DRM: DCB outp 03: 01011380 > [4.299711] nouveau :03:00.0: DRM: DCB outp 04: 08011382 00020010 > [4.306243] nouveau :03:00.0: DRM: DCB outp 05: 088113c6 0f220010 > [4.312772] nouveau :03:00.0: DRM: DCB conn 00: 00101064 > [4.318520] nouveau :03:00.0: DRM: DCB conn 01: 00202165 > [4.329488] nouveau :03:00.0: DRM: MM: using COPY for buffer copies > [4.336261] stackdepot: allocating hash table of 1048576 entries via > kvcalloc > ... > > > -- > Regards/Gruss, > Boris. > > https://people.kernel.org/tglx/notes-about-netiquette >
Re: [Nouveau] 2b5d1c29f6c4 ("drm/nouveau/disp: PIOR DP uses GPIO for HPD, not PMGR AUX interrupts")
[CCing the regression list, as it should be in the loop for regressions: https://docs.kernel.org/admin-guide/reporting-regressions.html] [TLDR: I'm adding this report to the list of tracked Linux kernel regressions; the text you find below is based on a few templates paragraphs you might have encountered already in similar form. See link in footer if these mails annoy you.] On 06.08.23 23:31, Borislav Petkov wrote: > > the patch in $Subject Side note, in case anyone cares: it was also included in 6.4.7. > breaks booting here on one of my test boxes, see > below. > > Reverting it ontop of -rc4 fixes the issue. > > Thx. Thanks for the report. To be sure the issue doesn't fall through the cracks unnoticed, I'm adding it to regzbot, the Linux kernel regression tracking bot: #regzbot ^introduced 2b5d1c29f6c4 #regzbot title drm/nouveau: stopped booting #regzbot ignore-activity This isn't a regression? This issue or a fix for it are already discussed somewhere else? It was fixed already? You want to clarify when the regression started to happen? Or point out I got the title or something else totally wrong? Then just reply and tell me -- ideally while also telling regzbot about it, as explained by the page listed in the footer of this mail. Developers: When fixing the issue, remember to add 'Link:' tags pointing to the report (the parent of this mail). See page linked in footer for details. Ciao, Thorsten (wearing his 'the Linux kernel's regression tracker' hat) -- Everything you wanna know about Linux kernel regression tracking: https://linux-regtracking.leemhuis.info/about/#tldr That page also explains what to do if mails like this annoy you. > [3.580535] ACPI: \_PR_.CP04: Found 4 idle states > [3.585694] ACPI: \_PR_.CP05: Found 4 idle states > [3.590852] ACPI: \_PR_.CP06: Found 4 idle states > [3.596037] ACPI: \_PR_.CP07: Found 4 idle states > [3.644065] Freeing initrd memory: 6740K > [3.742932] Serial: 8250/16550 driver, 4 ports, IRQ sharing enabled > [3.750409] 00:05: ttyS0 at I/O 0x3f8 (irq = 4, base_baud = 115200) is a > 16550A > [3.762111] serial :00:16.3: enabling device ( -> 0003) > [3.771589] :00:16.3: ttyS1 at I/O 0xf0a0 (irq = 17, base_baud = > 115200) is a 16550A > [3.782503] Linux agpgart interface v0.103 > [3.787805] ACPI: bus type drm_connector registered > > <--- boot stops here. > > It should continue with this: > > [3.795491] Console: switching to colour dummy device 80x25 > [3.801933] nouveau :03:00.0: vgaarb: deactivate vga console > [3.808303] nouveau :03:00.0: NVIDIA GT218 (0a8c00b1) > [3.931002] nouveau :03:00.0: bios: version 70.18.83.00.08 > [3.941731] nouveau :03:00.0: fb: 512 MiB DDR3 > [4.110348] tsc: Refined TSC clocksource calibration: 3591.349 MHz > [4.116627] clocksource: tsc: mask: 0x max_cycles: > 0x33c466a1ab5, max_idle_ns: 440795209767 ns > [4.126871] clocksource: Switched to clocksource tsc > [4.252013] nouveau :03:00.0: DRM: VRAM: 512 MiB > [4.257088] nouveau :03:00.0: DRM: GART: 1048576 MiB > [4.262501] nouveau :03:00.0: DRM: TMDS table version 2.0 > [4.268333] nouveau :03:00.0: DRM: DCB version 4.0 > [4.273561] nouveau :03:00.0: DRM: DCB outp 00: 02000360 > [4.280104] nouveau :03:00.0: DRM: DCB outp 01: 02000362 00020010 > [4.286630] nouveau :03:00.0: DRM: DCB outp 02: 028003a6 0f220010 > [4.293176] nouveau :03:00.0: DRM: DCB outp 03: 01011380 > [4.299711] nouveau :03:00.0: DRM: DCB outp 04: 08011382 00020010 > [4.306243] nouveau :03:00.0: DRM: DCB outp 05: 088113c6 0f220010 > [4.312772] nouveau :03:00.0: DRM: DCB conn 00: 00101064 > [4.318520] nouveau :03:00.0: DRM: DCB conn 01: 00202165 > [4.329488] nouveau :03:00.0: DRM: MM: using COPY for buffer copies > [4.336261] stackdepot: allocating hash table of 1048576 entries via > kvcalloc > ... > >