]> www.infradead.org Git - users/dwmw2/linux.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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 21 Aug 2022 13:15:23 +0000 (15:15 +0200)
commit 2939deac1fa220bc82b89235f146df1d9b52e876 upstream.

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: 7edc3e3b975b5 ("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
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/gpu/drm/drm_gem.c

index 69c2c079d8036bcde1d17b717c50ea5168cea2a1..5979af230eda0833105bdba2b26c2da1860de6df 100644 (file)
@@ -1277,7 +1277,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;
                }
        }
@@ -1302,7 +1302,7 @@ retry:
                                goto retry;
                        }
 
-                       ww_acquire_done(acquire_ctx);
+                       ww_acquire_fini(acquire_ctx);
                        return ret;
                }
        }