drm: Assert that BO is locked in drm_gem_vram_{pin, unpin}_locked()
authorThomas Zimmermann <tzimmermann@suse.de>
Tue, 21 May 2019 11:08:31 +0000 (13:08 +0200)
committerGerd Hoffmann <kraxel@redhat.com>
Wed, 22 May 2019 10:43:30 +0000 (12:43 +0200)
We may not call drm_gem_vram_{pin,unpin}_locked() with an unlocked
BO. Now test for this.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20190521110831.20200-4-tzimmermann@suse.de
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
drivers/gpu/drm/drm_gem_vram_helper.c

index aefb0c361486b4c51dc52e680a06e329d21df7da..7380a06a582c163467a56f24cb4468ab60fa27a2 100644 (file)
@@ -284,6 +284,8 @@ int drm_gem_vram_pin_locked(struct drm_gem_vram_object *gbo,
        int i, ret;
        struct ttm_operation_ctx ctx = { false, false };
 
+       lockdep_assert_held(&gbo->bo.resv->lock.base);
+
        if (gbo->pin_count) {
                ++gbo->pin_count;
                return 0;
@@ -361,6 +363,8 @@ int drm_gem_vram_unpin_locked(struct drm_gem_vram_object *gbo)
        int i, ret;
        struct ttm_operation_ctx ctx = { false, false };
 
+       lockdep_assert_held(&gbo->bo.resv->lock.base);
+
        if (WARN_ON_ONCE(!gbo->pin_count))
                return 0;