From patchwork Thu Jul 9 21:44:31 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 6760301 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id B7B6DC05AD for ; Thu, 9 Jul 2015 21:42:12 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D0CF2207A5 for ; Thu, 9 Jul 2015 21:42:11 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id E8C3920792 for ; Thu, 9 Jul 2015 21:42:10 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BF48F6EBFF; Thu, 9 Jul 2015 14:42:09 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wi0-f175.google.com (mail-wi0-f175.google.com [209.85.212.175]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1B7A86E69E for ; Thu, 9 Jul 2015 14:42:08 -0700 (PDT) Received: by wifm2 with SMTP id m2so30322969wif.1 for ; Thu, 09 Jul 2015 14:42:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=vsOEzlsEy8061lSvS8zo+JR2iv5SpM8A4Gl/Qo4o0Y4=; b=ia0GPzy9L+IrxTE6vTrAhAJrAMQRiuV7RFM21rrVL0QlGXfan+5sS0/n645YjoQmdg gTmSmo8zXXRTlucdylGhAq4csj9gvUdaRxiYsvis/TAgDaaL3VD6wLg3RmEryP+yva8i G/taKKDHF20MfwmBUppiS4TTVQ5TpBM/flG5k= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=vsOEzlsEy8061lSvS8zo+JR2iv5SpM8A4Gl/Qo4o0Y4=; b=EAZwsqofcwUas67ssFEKMPLzpiGXtBbiXjZT5Zb4DzRRhhMh/QIZMUR/fiTmL9dPGS Icy/AII8WW/G4QmVPJiH4IodnfjVdCSc73secLoMAT3gry8BqQCq8UUYo0Yn5IBAT0fO xOdOhoWQtO/EXxmhd6+at2opwyC140jPtPs1Zd0p+SZLjcnC9jQUY2jxogxhrh0NDWGQ taNaPtcIhAoJLTB0L5FoOS/b5FJBWJZWI8Lz0X/lm0bA90ZlxXq6uLNhg78VT8ai99lY QcWaKw2uzj9jEntUYSWeXKa5G55fpG38lvY/NKEuGnRTBFAb+cFEzgx59F4dFSclR7xK cj5w== X-Gm-Message-State: ALoCoQm2560friRnwNdEEimg2HOD+g4zyGdn6cRqdB7tBeoUK5ZYm/Lb+nermg/8kS5EpSsZ7U68 X-Received: by 10.194.201.71 with SMTP id jy7mr35459839wjc.93.1436478126859; Thu, 09 Jul 2015 14:42:06 -0700 (PDT) Received: from phenom.ffwll.local (212-51-149-109.fiber7.init7.net. [212.51.149.109]) by smtp.gmail.com with ESMTPSA id fb3sm10110697wib.21.2015.07.09.14.42.06 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 09 Jul 2015 14:42:06 -0700 (PDT) From: Daniel Vetter To: DRI Development Subject: [PATCH 08/14] drm/i915: Take all modeset locks for DP MST hotplug Date: Thu, 9 Jul 2015 23:44:31 +0200 Message-Id: <1436478277-10861-9-git-send-email-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1436478277-10861-1-git-send-email-daniel.vetter@ffwll.ch> References: <1436478277-10861-1-git-send-email-daniel.vetter@ffwll.ch> Cc: Daniel Vetter , Intel Graphics Development , Daniel Vetter X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP While auditing various users of the connector/encoder lists I realized that the atomic code is a very prolific user of them. And it only ever grabs the mode_config->connection_mutex, but not the mode_config->mutex like all the other code walking encoder/connector lists. The problem is that we can't grab the mode_config.mutex late in atomic code since that would lead to locking inversions. And we don't want to grab it unconditionally like the legacy set_config modeset path since that would render all the fine-grained locking moot. Instead just grab more locks in the dp mst hotplug code. Note that drm_connector_init (which is the one adding the connector to these lists) already uses drm_modeset_lock_all. The other reason for grabbing all locks is that the dpms off in the unplug function amounts to a modeset, so better to take all required locks for that. Signed-off-by: Daniel Vetter --- drivers/gpu/drm/i915/intel_dp_mst.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_dp_mst.c b/drivers/gpu/drm/i915/intel_dp_mst.c index 6e4cc5334f47..d0b2569c6241 100644 --- a/drivers/gpu/drm/i915/intel_dp_mst.c +++ b/drivers/gpu/drm/i915/intel_dp_mst.c @@ -442,9 +442,9 @@ static struct drm_connector *intel_dp_add_mst_connector(struct drm_dp_mst_topolo drm_mode_connector_set_path_property(connector, pathprop); drm_reinit_primary_mode_group(dev); - mutex_lock(&dev->mode_config.mutex); + drm_modeset_lock_all(dev); intel_connector_add_to_fbdev(intel_connector); - mutex_unlock(&dev->mode_config.mutex); + drm_modeset_unlock_all(dev); drm_connector_register(&intel_connector->base); return connector; } @@ -455,16 +455,16 @@ static void intel_dp_destroy_mst_connector(struct drm_dp_mst_topology_mgr *mgr, struct intel_connector *intel_connector = to_intel_connector(connector); struct drm_device *dev = connector->dev; /* need to nuke the connector */ - mutex_lock(&dev->mode_config.mutex); + drm_modeset_lock_all(dev); intel_connector_dpms(connector, DRM_MODE_DPMS_OFF); - mutex_unlock(&dev->mode_config.mutex); + drm_modeset_unlock_all(dev); intel_connector->unregister(intel_connector); - mutex_lock(&dev->mode_config.mutex); + drm_modeset_lock_all(dev); intel_connector_remove_from_fbdev(intel_connector); drm_connector_cleanup(connector); - mutex_unlock(&dev->mode_config.mutex); + drm_modeset_unlock_all(dev); drm_reinit_primary_mode_group(dev);