drm/gem: Document locking rule of vmap and evict callbacks
authorDmitry Osipenko <dmitry.osipenko@collabora.com>
Sat, 22 Mar 2025 21:26:01 +0000 (00:26 +0300)
committerDmitry Osipenko <dmitry.osipenko@collabora.com>
Wed, 26 Mar 2025 20:00:06 +0000 (23:00 +0300)
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>
Reviewed-by: Christian König <christian.koenig@amd.com>
Acked-by: Thomas Zimmermann <tzimmermann@suse.d>
Signed-off-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20250322212608.40511-4-dmitry.osipenko@collabora.com
include/drm/drm_gem.h

index 43cf3c2c7ca093b89162ff2ecd8ec5a30aee21f1..9b71f7a9f3f8a01ec1612abb067eb7b39fda355f 100644 (file)
@@ -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.
         */