[bug report] drm/panthor: Expose size of driver internal BO's over fdinfo
Adrián Larumbe
adrian.larumbe at collabora.com
Mon Feb 17 08:35:16 UTC 2025
Hi Dan, thanks for the bug report.
A fix is already being discussed at https://lore.kernel.org/dri-devel/20250215102807.7502e7ba@collabora.com/
On 17.02.2025 00:36, Dan Carpenter wrote:
> Hello Adrián Larumbe,
>
> Commit 434e5ca5b5d7 ("drm/panthor: Expose size of driver internal
> BO's over fdinfo") from Jan 30, 2025 (linux-next), leads to the
> following Smatch static checker warning:
>
> drivers/gpu/drm/panthor/panthor_mmu.c:1968 panthor_vm_heaps_sizes()
> warn: sleeping in atomic context
>
> drivers/gpu/drm/panthor/panthor_mmu.c
> 1956 void panthor_vm_heaps_sizes(struct panthor_file *pfile, struct drm_memory_stats *stats)
> 1957 {
> 1958 struct panthor_vm *vm;
> 1959 unsigned long i;
> 1960
> 1961 if (!pfile->vms)
> 1962 return;
> 1963
> 1964 xa_lock(&pfile->vms->xa);
> ^^^^^^^
> This is a spinlock.
>
> 1965 xa_for_each(&pfile->vms->xa, i, vm) {
> 1966 size_t size = 0;
> 1967
> --> 1968 mutex_lock(&vm->heaps.lock);
> ^^^^^^^^^^
> So we can't take a mutex if we're holding a spinlock.
>
> 1969 if (vm->heaps.pool)
> 1970 size = panthor_heap_pool_size(vm->heaps.pool);
> 1971 mutex_unlock(&vm->heaps.lock);
> 1972
> 1973 stats->resident += size;
> 1974 if (vm->as.id >= 0)
> 1975 stats->active += size;
> 1976 }
> 1977 xa_unlock(&pfile->vms->xa);
> 1978 }
>
> regards,
> dan carpenter
Kind Regards,
Adrian Larumbe
More information about the dri-devel
mailing list