drm/panfrost: Use mutex_trylock in panfrost_gem_purge
authorRob Herring <robh@kernel.org>
Fri, 23 Aug 2019 02:12:14 +0000 (21:12 -0500)
committerRob Herring <robh@kernel.org>
Fri, 23 Aug 2019 16:54:49 +0000 (11:54 -0500)
commitce49324261956f4bdec633280f30bf0697dafaef
tree5f685067158af28e39ddf3c91fd834a4f7a1ad73
parentdfbc7a46b940b5d5ef8c3db3b7c3b51e6ec8fec4
drm/panfrost: Use mutex_trylock in panfrost_gem_purge

Lockdep reports a circular locking dependency with pages_lock taken in
the shrinker callback. The deadlock can't actually happen with current
users at least as a BO will never be purgeable when pages_lock is held.
To be safe, let's use mutex_trylock() instead and bail if a BO is locked
already.

Cc: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
Signed-off-by: Rob Herring <robh@kernel.org>
Reviewed-by: Steven Price <steven.price@arm.com>
Acked-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190823021216.5862-7-robh@kernel.org
drivers/gpu/drm/panfrost/panfrost_gem_shrinker.c