From: Jeff Hugo <jeff.hugo@oss.qualcomm.com>
To: Wang Haoran <wanghr2026@mail.zgclab.edu.cn>,
carl.vanderlip@oss.qualcomm.com
Cc: ogabbay@kernel.org, sumit.semwal@linaro.org,
christian.koenig@amd.com, phasta@kernel.org,
linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org,
linux-media@vger.kernel.org, linaro-mm-sig@lists.linaro.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] accel/qaic: hold the dma_resv lock when mapping imported buffers
Date: Mon, 30 Nov 2026 19:10:55 -0700 [thread overview]
Message-ID: <3c308428-58e9-46a0-9cc5-6d99870accbb@oss.qualcomm.com> (raw)
In-Reply-To: <1795076088845-1-b103cfa7@mail.zgclab.edu.cn>
On 11/19/2026 1:14 AM, Wang Haoran wrote:
> qaic_prepare_import_bo() maps an imported dma-buf with
> dma_buf_map_attachment() and qaic_unprepare_import_bo() unmaps it with
> dma_buf_unmap_attachment(). Those are the locked variants: the dma-buf
> locking convention requires importers to hold the buffer's reservation
> lock when calling them, and both assert it via dma_resv_assert_held(),
> i.e. lockdep_assert_held() on attach->dmabuf->resv.
>
> qaic calls both without holding the reservation lock, so on a
> lockdep-enabled kernel every slice attach/detach against an imported
> buffer trips the lockdep assertion (a WARNING with a backtrace). The
> reservation lock also serializes the importer against the exporter
> moving or invalidating the buffer's backing storage for a dynamic
> attachment, so an unlocked map can race that move and use a stale
> sg_table.
>
> Hold the reservation lock around the map and unmap calls, which is
> equivalent to the dedicated dma_buf_map_attachment_unlocked() and
> dma_buf_unmap_attachment_unlocked() helpers.
Why not use the unlocked() helpers in this instance? Your proposal
grabs the lock to call the function, and then immediately unlocks it.
Seems like less effort to just use the helpers that you point out are
equivalent to what you are doing.
-Jeff
prev parent reply other threads:[~2026-12-01 2:10 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-19 8:14 Wang Haoran
2026-12-01 2:10 ` Jeff Hugo [this message]
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=3c308428-58e9-46a0-9cc5-6d99870accbb@oss.qualcomm.com \
--to=jeff.hugo@oss.qualcomm.com \
--cc=carl.vanderlip@oss.qualcomm.com \
--cc=christian.koenig@amd.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=linaro-mm-sig@lists.linaro.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=ogabbay@kernel.org \
--cc=phasta@kernel.org \
--cc=sumit.semwal@linaro.org \
--cc=wanghr2026@mail.zgclab.edu.cn \
/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
all inboxes | Powered by JetHome®