]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/gem: Properly annotate WW context on drm_gem_lock_reservations() error
authorDmitry Osipenko <dmitry.osipenko@collabora.com>
Thu, 30 Jun 2022 20:04:04 +0000 (23:04 +0300)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Tue, 9 Aug 2022 16:43:28 +0000 (18:43 +0200)
Use ww_acquire_fini() in the error code paths. Otherwise lockdep
thinks that lock is held when lock's memory is freed after the
drm_gem_lock_reservations() error. The ww_acquire_context needs to be
annotated as "released", which fixes the noisy "WARNING: held lock freed!"
splat of VirtIO-GPU driver with CONFIG_DEBUG_MUTEXES=y and enabled lockdep.

Cc: stable@vger.kernel.org
Fixes: 26b8a18e3cc11 ("drm: Add helpers for locking an array of BO reservations.")
Reviewed-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20220630200405.1883897-2-dmitry.osipenko@collabora.com
drivers/gpu/drm/drm_gem.c

index eb0c2d041f1380521924d579a14bfafd4d4d4f24..86d670c712867163d8329c19c93ca8d7e1a64a92 100644 (file)
@@ -1226,7 +1226,7 @@ retry:
                ret = dma_resv_lock_slow_interruptible(obj->resv,
                                                                 acquire_ctx);
                if (ret) {
-                       ww_acquire_done(acquire_ctx);
+                       ww_acquire_fini(acquire_ctx);
                        return ret;
                }
        }
@@ -1251,7 +1251,7 @@ retry:
                                goto retry;
                        }
 
-                       ww_acquire_done(acquire_ctx);
+                       ww_acquire_fini(acquire_ctx);
                        return ret;
                }
        }