From mboxrd@z Thu Jan 1 00:00:00 1970 From: Daniel Vetter Subject: [PATCH] drm: Drop modeset locking from crtc init function Date: Mon, 8 Sep 2014 09:03:21 +0200 Message-ID: <1410159801-28400-1-git-send-email-daniel.vetter@ffwll.ch> References: <1409920466-20837-1-git-send-email-daniel.vetter@ffwll.ch> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail-wg0-f50.google.com (mail-wg0-f50.google.com [74.125.82.50]) by gabe.freedesktop.org (Postfix) with ESMTP id 1454489BD4 for ; Mon, 8 Sep 2014 00:02:59 -0700 (PDT) Received: by mail-wg0-f50.google.com with SMTP id x13so2728599wgg.9 for ; Mon, 08 Sep 2014 00:02:59 -0700 (PDT) In-Reply-To: <1409920466-20837-1-git-send-email-daniel.vetter@ffwll.ch> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" To: DRI Development Cc: thellstrom@vmware.com, Daniel Vetter , stable@vger.kernel.org, Daniel Vetter List-Id: dri-devel@lists.freedesktop.org At driver init no one can access modeset objects and we're single-threaded. So locking is just cargo-culting here. Worse, with the new ww mutexes and ww mutex slowpath debugging the mutex_lock might actually fail, and we don't have the full-blown ww recovery dance. Which then leads to fireworks when we try to unlock the not-locked crtc lock. An audit of all the functions called from here shows that none of them contain locking checks, so there's also no reason to keep the locking around just for consistency of caller contexts. Besides that I have the rule (at least in i915) that such places where we take locks just to simplify locking checks and not for correctness always require a comment. This regression was introduced in commit 51fd371bbaf94018a1223b4e2cf20b9880fd92d4 Author: Rob Clark Date: Tue Nov 19 12:10:12 2013 -0500 drm: convert crtc and connection_mutex to ww_mutex (v5) v2: Don't drop the lock_init call, spotted by the 0day builder. Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=83341 Cc: Rob Clark Cc: thellstrom@vmware.com Cc: maarten.lankhorst@canonical.com Cc: stable@vger.kernel.org Signed-off-by: Daniel Vetter --- drivers/gpu/drm/drm_crtc.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c index e2f4b8c21440..b1271a8d8ce7 100644 --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c @@ -679,11 +679,7 @@ int drm_crtc_init_with_planes(struct drm_device *dev, struct drm_crtc *crtc, crtc->funcs = funcs; crtc->invert_dimensions = false; - drm_modeset_lock_all(dev); drm_modeset_lock_init(&crtc->mutex); - /* dropped by _unlock_all(): */ - drm_modeset_lock(&crtc->mutex, config->acquire_ctx); - ret = drm_mode_object_get(dev, &crtc->base, DRM_MODE_OBJECT_CRTC); if (ret) goto out; @@ -701,7 +697,6 @@ int drm_crtc_init_with_planes(struct drm_device *dev, struct drm_crtc *crtc, cursor->possible_crtcs = 1 << drm_crtc_index(crtc); out: - drm_modeset_unlock_all(dev); return ret; } -- 2.0.1