public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: Thomas Zimmermann <tzimmermann@suse.de>
To: jfalempe@redhat.com, javierm@redhat.com, mripard@kernel.org,
	maarten.lankhorst@linux.intel.com
Cc: dri-devel@lists.freedesktop.org,
	linux-arm-kernel@lists.infradead.org,
	linux-samsung-soc@vger.kernel.org,
	intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org,
	linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org,
	amd-gfx@lists.freedesktop.org, linux-tegra@vger.kernel.org,
	Thomas Zimmermann <tzimmermann@suse.de>
Subject: [PATCH 2/4] drm/log: Do not hold lock across drm_client_release()
Date: Thu,  9 Oct 2025 15:16:29 +0200	[thread overview]
Message-ID: <20251009132006.45834-3-tzimmermann@suse.de> (raw)
In-Reply-To: <20251009132006.45834-1-tzimmermann@suse.de>

When calling drm_client_release(), the client is already quiescent.
Internal locks should therefore be dropped before the caller releases
the client.

In the case of the DRM log, concurrency originates from the console or
from client events. The console has been unregistered in the previous
line. The caller of the unregister callback, drm_log_client_unregister(),
holds clientlist_mutex from struct drm_device to protect against concurrent
client events. It is therefore safe to release the client without holding
locks.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/clients/drm_log.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/clients/drm_log.c b/drivers/gpu/drm/clients/drm_log.c
index d239f1e3c456..116e0ef9ae5d 100644
--- a/drivers/gpu/drm/clients/drm_log.c
+++ b/drivers/gpu/drm/clients/drm_log.c
@@ -302,8 +302,8 @@ static void drm_log_client_unregister(struct drm_client_dev *client)
 
 	mutex_lock(&dlog->lock);
 	drm_log_free_scanout(client);
-	drm_client_release(client);
 	mutex_unlock(&dlog->lock);
+	drm_client_release(client);
 	kfree(dlog);
 	drm_dbg(dev, "Unregistered with drm log\n");
 }
-- 
2.51.0



  parent reply	other threads:[~2025-10-09 13:23 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-09 13:16 [PATCH 0/4] drm/client: Implement free callback for fbdev and log Thomas Zimmermann
2025-10-09 13:16 ` [PATCH 1/4] drm/client: Add client free callback to unprepare fb_helper Thomas Zimmermann
2025-10-09 13:32   ` Dmitry Baryshkov
2025-10-21 13:29   ` Tomi Valkeinen
2025-10-21 13:54   ` Patrik Jakobsson
2025-10-23 13:13   ` Thomas Zimmermann
2025-10-23 15:39   ` Thomas Zimmermann
2025-10-09 13:16 ` Thomas Zimmermann [this message]
2025-10-15  7:52   ` [PATCH 2/4] drm/log: Do not hold lock across drm_client_release() Jocelyn Falempe
2025-10-09 13:16 ` [PATCH 3/4] drm/log: Add free callback Thomas Zimmermann
2025-10-15  7:53   ` Jocelyn Falempe
2025-10-09 13:16 ` [PATCH 4/4] drm/client: Do not free client memory by default Thomas Zimmermann
2025-10-15  8:20   ` Jocelyn Falempe

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=20251009132006.45834-3-tzimmermann@suse.de \
    --to=tzimmermann@suse.de \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=freedreno@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=javierm@redhat.com \
    --cc=jfalempe@redhat.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    /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