dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Osipenko <dmitry.osipenko@collabora.com>
To: "David Airlie" <airlied@gmail.com>,
	"Simona Vetter" <simona@ffwll.ch>,
	"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
	"Maxime Ripard" <mripard@kernel.org>,
	"Thomas Zimmermann" <tzimmermann@suse.de>,
	"Christian König" <christian.koenig@amd.com>,
	"Gerd Hoffmann" <kraxel@redhat.com>,
	"Qiang Yu" <yuq825@gmail.com>,
	"Steven Price" <steven.price@arm.com>,
	"Boris Brezillon" <boris.brezillon@collabora.com>,
	"Frank Binns" <frank.binns@imgtec.com>,
	"Matt Coster" <matt.coster@imgtec.com>
Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	kernel@collabora.com
Subject: [PATCH v20 03/10] drm/gem: Document locking rule of vmap and evict callbacks
Date: Sun, 23 Mar 2025 00:26:01 +0300	[thread overview]
Message-ID: <20250322212608.40511-4-dmitry.osipenko@collabora.com> (raw)
In-Reply-To: <20250322212608.40511-1-dmitry.osipenko@collabora.com>

The vmap/vunmap/evict GEM callbacks are always invoked with a held GEM's
reservation lock. Document this locking rule for clarity.

Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Signed-off-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
---
 include/drm/drm_gem.h | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/include/drm/drm_gem.h b/include/drm/drm_gem.h
index 43cf3c2c7ca0..9b71f7a9f3f8 100644
--- a/include/drm/drm_gem.h
+++ b/include/drm/drm_gem.h
@@ -159,7 +159,8 @@ struct drm_gem_object_funcs {
 	 * @vmap:
 	 *
 	 * Returns a virtual address for the buffer. Used by the
-	 * drm_gem_dmabuf_vmap() helper.
+	 * drm_gem_dmabuf_vmap() helper. Called with a held GEM reservation
+	 * lock.
 	 *
 	 * This callback is optional.
 	 */
@@ -169,7 +170,8 @@ struct drm_gem_object_funcs {
 	 * @vunmap:
 	 *
 	 * Releases the address previously returned by @vmap. Used by the
-	 * drm_gem_dmabuf_vunmap() helper.
+	 * drm_gem_dmabuf_vunmap() helper. Called with a held GEM reservation
+	 * lock.
 	 *
 	 * This callback is optional.
 	 */
@@ -192,7 +194,8 @@ struct drm_gem_object_funcs {
 	 * @evict:
 	 *
 	 * Evicts gem object out from memory. Used by the drm_gem_object_evict()
-	 * helper. Returns 0 on success, -errno otherwise.
+	 * helper. Returns 0 on success, -errno otherwise. Called with a held
+	 * GEM reservation lock.
 	 *
 	 * This callback is optional.
 	 */
-- 
2.49.0


  parent reply	other threads:[~2025-03-22 21:29 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-22 21:25 [PATCH v20 00/10] Add generic DRM-shmem memory shrinker (part 1) Dmitry Osipenko
2025-03-22 21:25 ` [PATCH v20 01/10] drm/gem: Change locked/unlocked postfix of drm_gem_v/unmap() function names Dmitry Osipenko
2025-03-24 13:05   ` Christian König
2025-03-25 13:15     ` Dmitry Osipenko
2025-03-22 21:26 ` [PATCH v20 02/10] drm/gem: Add _locked postfix to functions that have unlocked counterpart Dmitry Osipenko
2025-03-22 21:26 ` Dmitry Osipenko [this message]
2025-03-22 21:26 ` [PATCH v20 04/10] drm/shmem-helper: Make all exported symbols GPL Dmitry Osipenko
2025-03-22 21:26 ` [PATCH v20 05/10] drm/shmem-helper: Refactor locked/unlocked functions Dmitry Osipenko
2025-03-27 11:25   ` Jani Nikula
2025-03-27 11:27     ` Jani Nikula
2025-03-27 11:29       ` Jani Nikula
2025-03-22 21:26 ` [PATCH v20 06/10] drm/shmem-helper: Remove obsoleted is_iomem test Dmitry Osipenko
2025-03-22 21:26 ` [PATCH v20 07/10] drm/shmem-helper: Add and use pages_pin_count Dmitry Osipenko
2025-03-22 21:26 ` [PATCH v20 08/10] drm/shmem-helper: Use refcount_t for pages_use_count Dmitry Osipenko
2025-03-22 21:26 ` [PATCH v20 09/10] drm/shmem-helper: Switch drm_gem_shmem_vmap/vunmap to use pin/unpin Dmitry Osipenko
2025-04-02 12:47   ` Thomas Zimmermann
2025-04-02 12:58     ` Dmitry Osipenko
2025-04-02 13:21       ` Boris Brezillon
2025-04-03  7:20         ` Thomas Zimmermann
2025-04-03  8:50           ` Boris Brezillon
2025-04-04  8:01             ` Thomas Zimmermann
2025-04-04 14:52               ` Boris Brezillon
2025-04-04 14:58                 ` Thomas Zimmermann
2025-04-07  9:56                   ` Boris Brezillon
2025-03-22 21:26 ` [PATCH v20 10/10] drm/shmem-helper: Use refcount_t for vmap_use_count Dmitry Osipenko
2025-03-25 14:17 ` [PATCH v20 00/10] Add generic DRM-shmem memory shrinker (part 1) Thomas Zimmermann
2025-03-26 20:08   ` Dmitry Osipenko
2025-03-27 10:45     ` Boris Brezillon
2025-03-27 10:47       ` Dmitry Osipenko
2025-04-03  0:37 ` Lucas De Marchi
2025-04-03  7:03   ` Thomas Zimmermann
2025-04-03 14:10     ` Dmitry Osipenko

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=20250322212608.40511-4-dmitry.osipenko@collabora.com \
    --to=dmitry.osipenko@collabora.com \
    --cc=airlied@gmail.com \
    --cc=boris.brezillon@collabora.com \
    --cc=christian.koenig@amd.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=frank.binns@imgtec.com \
    --cc=kernel@collabora.com \
    --cc=kraxel@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=matt.coster@imgtec.com \
    --cc=mripard@kernel.org \
    --cc=simona@ffwll.ch \
    --cc=steven.price@arm.com \
    --cc=tzimmermann@suse.de \
    --cc=yuq825@gmail.com \
    /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;
as well as URLs for NNTP newsgroup(s).