public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Rob Clark <robdclark@gmail.com>
To: dri-devel@lists.freedesktop.org
Cc: freedreno@lists.freedesktop.org, linux-arm-msm@vger.kernel.org,
	Rob Clark <robdclark@chromium.org>,
	Rob Clark <robdclark@gmail.com>,
	Abhinav Kumar <quic_abhinavk@quicinc.com>,
	Dmitry Baryshkov <dmitry.baryshkov@linaro.org>,
	Sean Paul <sean@poorly.run>, David Airlie <airlied@linux.ie>,
	Daniel Vetter <daniel@ffwll.ch>,
	linux-kernel@vger.kernel.org (open list)
Subject: [PATCH v4 15/15] drm/msm/gem: Convert to lockdep assert
Date: Tue,  2 Aug 2022 08:51:48 -0700	[thread overview]
Message-ID: <20220802155152.1727594-16-robdclark@gmail.com> (raw)
In-Reply-To: <20220802155152.1727594-1-robdclark@gmail.com>

From: Rob Clark <robdclark@chromium.org>

Signed-off-by: Rob Clark <robdclark@chromium.org>
---
 drivers/gpu/drm/msm/msm_gem.h | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/msm/msm_gem.h b/drivers/gpu/drm/msm/msm_gem.h
index 3c6add51d13b..c4844cf3a585 100644
--- a/drivers/gpu/drm/msm/msm_gem.h
+++ b/drivers/gpu/drm/msm/msm_gem.h
@@ -197,8 +197,8 @@ msm_gem_unlock(struct drm_gem_object *obj)
 	dma_resv_unlock(obj->resv);
 }
 
-static inline bool
-msm_gem_is_locked(struct drm_gem_object *obj)
+static inline void
+msm_gem_assert_locked(struct drm_gem_object *obj)
 {
 	/*
 	 * Destroying the object is a special case.. msm_gem_free_object()
@@ -212,13 +212,10 @@ msm_gem_is_locked(struct drm_gem_object *obj)
 	 * Unfortunately lockdep is not aware of this detail.  So when the
 	 * refcount drops to zero, we pretend it is already locked.
 	 */
-	return dma_resv_is_locked(obj->resv) || (kref_read(&obj->refcount) == 0);
-}
-
-static inline void
-msm_gem_assert_locked(struct drm_gem_object *obj)
-{
-	GEM_WARN_ON(!msm_gem_is_locked(obj));
+	lockdep_assert_once(
+		(kref_read(&obj->refcount) == 0) ||
+		(lockdep_is_held(&obj->resv->lock.base) != LOCK_STATE_NOT_HELD)
+	);
 }
 
 /* imported/exported objects are not purgeable: */
-- 
2.36.1


      parent reply	other threads:[~2022-08-02 15:52 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-02 15:51 [PATCH v4 00/15] drm+msm: Shrinker and LRU rework Rob Clark
2022-08-02 15:51 ` [PATCH v4 01/15] drm/msm: Reorder lock vs submit alloc Rob Clark
2022-08-02 15:51 ` [PATCH v4 02/15] drm/msm: Small submit cleanup Rob Clark
2022-08-02 15:51 ` [PATCH v4 03/15] drm/msm: Split out idr_lock Rob Clark
2022-08-02 15:51 ` [PATCH v4 04/15] drm/msm/gem: Check for active in shrinker path Rob Clark
2022-08-02 15:51 ` [PATCH v4 05/15] drm/msm/gem: Rename update_inactive Rob Clark
2022-08-02 15:51 ` [PATCH v4 06/15] drm/msm/gem: Rename to pin/unpin_pages Rob Clark
2022-08-02 15:51 ` [PATCH v4 07/15] drm/msm/gem: Consolidate pin/unpin paths Rob Clark
2022-08-02 15:51 ` [PATCH v4 08/15] drm/msm/gem: Remove active refcnt Rob Clark
2022-08-02 15:51 ` [PATCH v4 09/15] drm/gem: Add LRU/shrinker helper Rob Clark
2022-08-02 15:51 ` [PATCH v4 10/15] drm/msm/gem: Convert to using drm_gem_lru Rob Clark
2022-08-02 15:51 ` [PATCH v4 11/15] drm/msm/gem: Unpin buffers earlier Rob Clark
2022-08-02 15:51 ` [PATCH v4 12/15] drm/msm/gem: Consolidate shrinker trace Rob Clark
2022-08-02 15:51 ` [PATCH v4 13/15] drm/msm/gem: Evict active GEM objects when necessary Rob Clark
2022-08-02 15:51 ` [PATCH v4 14/15] drm/msm/gem: Add msm_gem_assert_locked() Rob Clark
2022-08-02 15:51 ` Rob Clark [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220802155152.1727594-16-robdclark@gmail.com \
    --to=robdclark@gmail.com \
    --cc=airlied@linux.ie \
    --cc=daniel@ffwll.ch \
    --cc=dmitry.baryshkov@linaro.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=freedreno@lists.freedesktop.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=quic_abhinavk@quicinc.com \
    --cc=robdclark@chromium.org \
    --cc=sean@poorly.run \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox