From: "Bence Csókás" <bence.csokas@arm.com>
To: "Daniel Almeida" <daniel.almeida@collabora.com>,
"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
"Maxime Ripard" <mripard@kernel.org>,
"Thomas Zimmermann" <tzimmermann@suse.de>,
"David Airlie" <airlied@gmail.com>,
"Simona Vetter" <simona@ffwll.ch>,
"Miguel Ojeda" <ojeda@kernel.org>,
"Alex Gaynor" <alex.gaynor@gmail.com>,
"Boqun Feng" <boqun.feng@gmail.com>,
"Gary Guo" <gary@garyguo.net>,
"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
"Benno Lossin" <benno.lossin@proton.me>,
"Andreas Hindborg" <a.hindborg@kernel.org>,
"Alice Ryhl" <aliceryhl@google.com>,
"Trevor Gross" <tmgross@umich.edu>,
"Sumit Semwal" <sumit.semwal@linaro.org>,
"Christian König" <christian.koenig@amd.com>
Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
rust-for-linux@vger.kernel.org, linux-media@vger.kernel.org,
linaro-mm-sig@lists.linaro.org,
Danilo Krummrich <dakr@kernel.org>,
Asahi Lina <lina@asahilina.net>
Subject: Re: [PATCH 1/7] drm/shmem-helper: Add lockdep asserts to vmap/vunmap
Date: Thu, 2 Apr 2026 18:13:13 +0200 [thread overview]
Message-ID: <c8dbb9e2-f1a1-469e-a0af-ba3a5e3a651c@arm.com> (raw)
In-Reply-To: <20250318-drm-gem-shmem-v1-1-64b96511a84f@collabora.com>
Hi,
I just came across this commit while researching something else.
Original patch had too few context lines, so I here's the diff with `-U10`.
On 3/18/25 20:22, Daniel Almeida wrote:
> From: Asahi Lina <lina@asahilina.net>
>
> Since commit 21aa27ddc582 ("drm/shmem-helper: Switch to reservation
> lock"), the drm_gem_shmem_vmap and drm_gem_shmem_vunmap functions
> require that the caller holds the DMA reservation lock for the object.
> Add lockdep assertions to help validate this.
There were already lockdep assertions...
> Signed-off-by: Asahi Lina <lina@asahilina.net>
> Signed-off-by: Daniel Almeida <daniel.almeida@collabora.com>
> Reviewed-by: Christian König <christian.koenig@amd.com>
> Signed-off-by: Lyude Paul <lyude@redhat.com>
> Link: https://lore.kernel.org/r/20250318-drm-gem-shmem-v1-1-64b96511a84f@collabora.com
> ---
> drivers/gpu/drm/drm_gem_shmem_helper.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/gpu/drm/drm_gem_shmem_helper.c b/drivers/gpu/drm/drm_gem_shmem_helper.c
> index aa43265f4f4f..0b41f0346bad 100644
> --- a/drivers/gpu/drm/drm_gem_shmem_helper.c
> +++ b/drivers/gpu/drm/drm_gem_shmem_helper.c
> @@ -341,20 +341,22 @@ EXPORT_SYMBOL_GPL(drm_gem_shmem_unpin);
> *
> * Returns:
> * 0 on success or a negative error code on failure.
> */
> int drm_gem_shmem_vmap_locked(struct drm_gem_shmem_object *shmem,
> struct iosys_map *map)
> {
> struct drm_gem_object *obj = &shmem->base;
> int ret = 0;
>
> + dma_resv_assert_held(obj->resv);
> +
> if (drm_gem_is_imported(obj)) {
> ret = dma_buf_vmap(obj->dma_buf, map);
> } else {
> pgprot_t prot = PAGE_KERNEL;
>
> dma_resv_assert_held(shmem->base.resv);
... right here, and
> if (refcount_inc_not_zero(&shmem->vmap_use_count)) {
> iosys_map_set_vaddr(map, shmem->vaddr);
> return 0;
> @@ -401,20 +403,22 @@ EXPORT_SYMBOL_GPL(drm_gem_shmem_vmap_locked);
> * drops to zero.
> *
> * This function hides the differences between dma-buf imported and natively
> * allocated objects.
> */
> void drm_gem_shmem_vunmap_locked(struct drm_gem_shmem_object *shmem,
> struct iosys_map *map)
> {
> struct drm_gem_object *obj = &shmem->base;
>
> + dma_resv_assert_held(obj->resv);
> +
> if (drm_gem_is_imported(obj)) {
> dma_buf_vunmap(obj->dma_buf, map);
> } else {
> dma_resv_assert_held(shmem->base.resv);
...here.
> if (refcount_dec_and_test(&shmem->vmap_use_count)) {
> vunmap(shmem->vaddr);
> shmem->vaddr = NULL;
>
> drm_gem_shmem_unpin_locked(shmem);
Or were those insufficient for some reason? If so, should we keep both
of them, or should the older ones have been removed?
Bence
next prev parent reply other threads:[~2026-04-02 16:14 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-18 19:22 [PATCH 0/7] Rust abstractions for shmem-backed GEM objects Daniel Almeida
2025-03-18 19:22 ` [PATCH 1/7] drm/shmem-helper: Add lockdep asserts to vmap/vunmap Daniel Almeida
2025-03-19 7:49 ` Christian König
2025-05-13 19:26 ` Lyude Paul
2026-04-02 16:13 ` Bence Csókás [this message]
2026-04-02 16:46 ` Christian König
2025-03-18 19:22 ` [PATCH 2/7] drm/gem-shmem: Export VM ops functions Daniel Almeida
2025-03-19 7:55 ` Christian König
2025-03-19 7:55 ` Christian König
2025-03-18 19:22 ` [PATCH 3/7] rust: helpers: Add bindings/wrappers for dma_resv_lock Daniel Almeida
2025-03-18 19:22 ` [PATCH 4/7] rust: drm: gem: shmem: Add DRM shmem helper abstraction Daniel Almeida
2025-03-18 19:22 ` [PATCH 5/7] drm/gem: Add a flag to control whether objects can be exported Daniel Almeida
2025-03-19 8:04 ` Christian König
2025-03-18 19:22 ` [PATCH 6/7] rust: drm: gem: Add set_exportable() method Daniel Almeida
2025-03-18 19:22 ` [PATCH 7/7] rust: drm: gem: shmem: Add share_dma_resv() function Daniel Almeida
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=c8dbb9e2-f1a1-469e-a0af-ba3a5e3a651c@arm.com \
--to=bence.csokas@arm.com \
--cc=a.hindborg@kernel.org \
--cc=airlied@gmail.com \
--cc=alex.gaynor@gmail.com \
--cc=aliceryhl@google.com \
--cc=benno.lossin@proton.me \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun.feng@gmail.com \
--cc=christian.koenig@amd.com \
--cc=dakr@kernel.org \
--cc=daniel.almeida@collabora.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=gary@garyguo.net \
--cc=lina@asahilina.net \
--cc=linaro-mm-sig@lists.linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=ojeda@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=simona@ffwll.ch \
--cc=sumit.semwal@linaro.org \
--cc=tmgross@umich.edu \
--cc=tzimmermann@suse.de \
/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®