Skip to content

Commit

Permalink
drm/gem: Properly annotate WW context on drm_gem_lock_reservations() …
Browse files Browse the repository at this point in the history
…error

commit 2939dea 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: 7edc3e3 ("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>
  • Loading branch information
digetx authored and gregkh committed Aug 17, 2022
1 parent 3ef9485 commit da2a1aa
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/gpu/drm/drm_gem.c
Original file line number Diff line number Diff line change
Expand Up @@ -1224,7 +1224,7 @@ drm_gem_lock_reservations(struct drm_gem_object **objs, int count,
ret = dma_resv_lock_slow_interruptible(obj->resv,
acquire_ctx);
if (ret) {
ww_acquire_done(acquire_ctx);
ww_acquire_fini(acquire_ctx);
return ret;
}
}
Expand All @@ -1249,7 +1249,7 @@ drm_gem_lock_reservations(struct drm_gem_object **objs, int count,
goto retry;
}

ww_acquire_done(acquire_ctx);
ww_acquire_fini(acquire_ctx);
return ret;
}
}
Expand Down

0 comments on commit da2a1aa

Please sign in to comment.