]> www.infradead.org Git - users/jedix/linux-maple.git/commit
drm/panthor: Avoid sleep locking in the internal BO size path
authorAdrián Larumbe <adrian.larumbe@collabora.com>
Mon, 3 Mar 2025 19:08:46 +0000 (19:08 +0000)
committerSteven Price <steven.price@arm.com>
Wed, 5 Mar 2025 14:14:52 +0000 (14:14 +0000)
commitc63c3bfdde2656a3ead50ac3ce4a51a634e22dab
tree5c15d58dd29fef6c89fc655cef0d8c09e550864a
parente379856b428acafb8ed689f31d65814da6447b2e
drm/panthor: Avoid sleep locking in the internal BO size path

Commit 434e5ca5b5d7 ("drm/panthor: Expose size of driver internal BO's over
fdinfo") locks the VMS xarray, to avoid UAF errors when the same VM is
being concurrently destroyed by another thread. However, that puts the
current thread in atomic context, which means taking the VMS' heap locks
will trigger a warning as the thread is no longer allowed to sleep.

Because in this case replacing the heap mutex with a spinlock isn't
feasible, the fdinfo handler no longer traverses the list of heaps for
every single VM associated with an open DRM file. Instead, when a new heap
chunk is allocated, its size is accumulated into a pool-wide tally, which
also makes the atomic context code path somewhat faster.

Signed-off-by: Adrián Larumbe <adrian.larumbe@collabora.com>
Fixes: 434e5ca5b5d7 ("drm/panthor: Expose size of driver internal BO's over fdinfo")
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Steven Price <steven.price@arm.com>
Signed-off-by: Steven Price <steven.price@arm.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20250303190923.1639985-2-adrian.larumbe@collabora.com
drivers/gpu/drm/panthor/panthor_heap.c
drivers/gpu/drm/panthor/panthor_mmu.c