All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel.vetter@ffwll.ch>
To: DRI Development <dri-devel@lists.freedesktop.org>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>,
	Tomi Valkeinen <tomi.valkeinen@ti.com>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Daniel Vetter <daniel.vetter@intel.com>
Subject: [PATCH] drm/omapdrm: Switch to gem_free_object_unlocked
Date: Wed, 28 Mar 2018 13:41:44 +0200	[thread overview]
Message-ID: <20180328114144.19890-1-daniel.vetter@ffwll.ch> (raw)
In-Reply-To: <20180327082356.24516-5-daniel.vetter@ffwll.ch>

The only thing that omap_gem_free_object does that might need the
magic protection of struct_mutex (of keeping all objects alive if that
lock is held, even if the last reference is gone) is the mm_list
manipulation.

But that is already protected by the separate omapdrm->list_lock,
which means struct_mutex is an entirely internal lock for omapdrm.
Everything else is just releasing resources, which is all protected
already by the various subsystems and allocators.

To make this even more obvious we could do an
s/dev->struct_mutex/omapdrm->gem_lock/ like I've done for udl. But
since omapdrm is a lot bigger and a lot more active I'll refrain from
that - this is better done by omapdrm developers at some suitable time
in the future.

v2: Just auditing the code isn't enough, I actually have to remove
the now wrong locking check in omap_gem_free_object ...

Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/gpu/drm/omapdrm/omap_drv.c | 2 +-
 drivers/gpu/drm/omapdrm/omap_gem.c | 2 --
 2 files changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c
index 5fcf9eaf3eaf..5005ecc284d2 100644
--- a/drivers/gpu/drm/omapdrm/omap_drv.c
+++ b/drivers/gpu/drm/omapdrm/omap_drv.c
@@ -493,7 +493,7 @@ static struct drm_driver omap_drm_driver = {
 	.prime_fd_to_handle = drm_gem_prime_fd_to_handle,
 	.gem_prime_export = omap_gem_prime_export,
 	.gem_prime_import = omap_gem_prime_import,
-	.gem_free_object = omap_gem_free_object,
+	.gem_free_object_unlocked = omap_gem_free_object,
 	.gem_vm_ops = &omap_gem_vm_ops,
 	.dumb_create = omap_gem_dumb_create,
 	.dumb_map_offset = omap_gem_dumb_map_offset,
diff --git a/drivers/gpu/drm/omapdrm/omap_gem.c b/drivers/gpu/drm/omapdrm/omap_gem.c
index 183447572e90..ac4175c13ecb 100644
--- a/drivers/gpu/drm/omapdrm/omap_gem.c
+++ b/drivers/gpu/drm/omapdrm/omap_gem.c
@@ -1086,8 +1086,6 @@ void omap_gem_free_object(struct drm_gem_object *obj)
 
 	evict(obj);
 
-	WARN_ON(!mutex_is_locked(&dev->struct_mutex));
-
 	mutex_lock(&priv->list_lock);
 	list_del(&omap_obj->mm_list);
 	mutex_unlock(&priv->list_lock);
-- 
2.16.2

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  parent reply	other threads:[~2018-03-28 11:41 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-27  8:23 [PATCH 1/5] staging/vboxvideo: Use gem_free_object_unlocked Daniel Vetter
2018-03-27  8:23 ` [PATCH 2/5] drm/rockchip: fixup comment for gem_free_object_unlocked Daniel Vetter
2018-03-27  8:23   ` Daniel Vetter
2018-03-28 14:02   ` Sean Paul
2018-03-28 14:02     ` Sean Paul
2018-03-27  8:23 ` [PATCH 3/5] drm/udl: Get rid of dev->struct_mutex usage Daniel Vetter
2018-03-27 16:35   ` Sean Paul
2018-03-27  8:23 ` [PATCH 4/5] drm/omapdrm: Fix mm_list locking Daniel Vetter
2018-03-29  9:40   ` Tomi Valkeinen
2018-03-27  8:23 ` [PATCH 5/5] drm/omapdrm: Switch to gem_free_object_unlocked Daniel Vetter
2018-03-28  9:52   ` Tomi Valkeinen
2018-03-28 10:12     ` Daniel Vetter
2018-03-28 11:13       ` Tomi Valkeinen
2018-03-28 11:41   ` Daniel Vetter [this message]
2018-03-29  9:41     ` [PATCH] " Tomi Valkeinen
2018-04-02 15:05       ` Laurent Pinchart
2018-04-03  9:07         ` Daniel Vetter
2018-04-03 11:23           ` Laurent Pinchart
2018-03-27  8:34 ` [PATCH 1/5] staging/vboxvideo: Use gem_free_object_unlocked Greg Kroah-Hartman
2018-03-27  9:18   ` Daniel Vetter
2018-03-27 15:25     ` Greg Kroah-Hartman
2018-03-28 15:07       ` Daniel Vetter

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=20180328114144.19890-1-daniel.vetter@ffwll.ch \
    --to=daniel.vetter@ffwll.ch \
    --cc=daniel.vetter@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=tomi.valkeinen@ti.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.