On Tue, May 26, 2026 at 09:26:56AM -0300, Jason Gunthorpe wrote:
On Tue, May 26, 2026 at 11:10:34AM +0000, Ankit Soni wrote:
dma_buf_unpin() requires the caller to hold the exporter's dma_resv lock:
void dma_buf_unpin(struct dma_buf_attachment *attach) { ... dma_resv_assert_held(dmabuf->resv); ... }
iopt_release_pages() calls dma_buf_unpin() without taking that lock, so every iommufd_ioas_destroy()/iommufd_ioas_unmap() that releases the last reference on a DMABUF-backed iopt_pages triggers a WARN. This was hit while running tools/testing/selftests/iommu/iommufd:
Any idea why this is comming up now? Did I run the tests without some kind of debug option to turn on that assertion maybe?
Jason
The assertion is gated by CONFIG_LOCKDEP. My config has it on via CONFIG_DEBUG_LOCK_ALLOC=y (LOCK_STAT, PROVE_LOCKING and DEBUG_WW_MUTEX_SLOWPATH each select-chain to LOCKDEP as well).
-Ankit