From: Ankit Soni <Ankit.Soni@amd.com>
To: Jason Gunthorpe <jgg@ziepe.ca>
Cc: Kevin Tian <kevin.tian@intel.com>, Joerg Roedel <joro@8bytes.org>,
"Will Deacon" <will@kernel.org>,
Robin Murphy <robin.murphy@arm.com>,
Sumit Semwal <sumit.semwal@linaro.org>,
Christian König <christian.koenig@amd.com>,
Leon Romanovsky <leon@kernel.org>,
Vasant Hegde <vasant.hegde@amd.com>, <iommu@lists.linux.dev>,
<dri-devel@lists.freedesktop.org>,
<linaro-mm-sig@lists.linaro.org>, <linux-media@vger.kernel.org>,
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] iommufd: take dma_resv lock before dma_buf_unpin() in release path
Date: Tue, 26 May 2026 15:34:40 +0000 [thread overview]
Message-ID: <uwnw7ybrgdobizf6do3ugrxshqhlzsusi34w3aky5hlp3y7wa2@hxmgp5tbpzzc> (raw)
In-Reply-To: <20260526122656.GE2487554@ziepe.ca>
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
next prev parent reply other threads:[~2026-05-26 15:35 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-26 11:10 [PATCH] iommufd: take dma_resv lock before dma_buf_unpin() in release path Ankit Soni
2026-05-26 12:26 ` Jason Gunthorpe
2026-05-26 15:34 ` Ankit Soni [this message]
2026-05-27 4:56 ` Claude review: " Claude Code Review Bot
2026-05-27 4:56 ` Claude Code Review Bot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=uwnw7ybrgdobizf6do3ugrxshqhlzsusi34w3aky5hlp3y7wa2@hxmgp5tbpzzc \
--to=ankit.soni@amd.com \
--cc=christian.koenig@amd.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=iommu@lists.linux.dev \
--cc=jgg@ziepe.ca \
--cc=joro@8bytes.org \
--cc=kevin.tian@intel.com \
--cc=leon@kernel.org \
--cc=linaro-mm-sig@lists.linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=robin.murphy@arm.com \
--cc=sumit.semwal@linaro.org \
--cc=vasant.hegde@amd.com \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox