From patchwork Thu Jul 9 21:44:33 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 6760331 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 73B259F319 for ; Thu, 9 Jul 2015 21:42:15 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 933BF20763 for ; Thu, 9 Jul 2015 21:42:14 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id BD72320790 for ; Thu, 9 Jul 2015 21:42:13 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1DBE76ED49; Thu, 9 Jul 2015 14:42:12 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wi0-f174.google.com (mail-wi0-f174.google.com [209.85.212.174]) by gabe.freedesktop.org (Postfix) with ESMTPS id 48A366ED4F for ; Thu, 9 Jul 2015 14:42:10 -0700 (PDT) Received: by widjy10 with SMTP id jy10so17634wid.1 for ; Thu, 09 Jul 2015 14:42:09 -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=RrFoo28u1sAuCgoDQd6PlSxWx5cf5Fvpu9b0y+arE0o=; b=QVJuD2OK3nbNXd2Ps/IOhQ/ZBSyJn+mzYbjNgygf+0hTUVU9hHgw2+ot3r64BlYwNS 986pWrRgJCOKdxsSDgK9i062lnGfiLfg+zBNldh5DRXDVTjYwHGiW4nrcXVmcjYeK+Dp yg3xsAKXABWcIO8kuz1lZyd814HGS8GYkVPic= 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=RrFoo28u1sAuCgoDQd6PlSxWx5cf5Fvpu9b0y+arE0o=; b=Wh4x1T499nPd0nhn1j4lGtziCFNj2ikfeYQcRZ5l7TWdD515xxCIxIUl6puMtSS5px 0CK96p+6xFAYo6DQCMhig+sDAuO+QC2PDVhp4ytheL1jmL3pMl/ZGoB8Pbo5utb/HQZr UGQeH6BZafHojfuMdQ4AKAz4Z+Sncsc7iPtgo/mdicYvheMRRsP5X5wmX+4X+czxBnQK ZN9Ztb3JAdAPDSR36dDMBmSk0dCN2y57QpzwXn/7GNLaMgnTYHSevJPNXLccX/QhD9Fn mUH5xRVOr1OpmQ5lGXyJjThrORUAC17mqYJaLH1K2oNzit/KFaBOcnknSRgx8vLQy6dH ZGiA== X-Gm-Message-State: ALoCoQnVerTpZ1+ZDecgSZKc0IYVq1uUMhlohF5i1nSoz4rI7YPv7Dn6tyhY0ORt4oSBBJ5X06B6 X-Received: by 10.181.13.206 with SMTP id fa14mr1662wid.56.1436478128927; Thu, 09 Jul 2015 14:42:08 -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.07 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 09 Jul 2015 14:42:08 -0700 (PDT) From: Daniel Vetter To: DRI Development Subject: [PATCH 10/14] drm: Amend connector list locking rules Date: Thu, 9 Jul 2015 23:44:33 +0200 Message-Id: <1436478277-10861-11-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 , Daniel Vetter , Intel Graphics Development 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 Now that dp mst hotplug takes all locks we can amend the locking rules for the iterators. This is needed before we can roll these out in the atomic code to avoid getting burried in WARNINGs. v2: Rebase onto the extracted list locking assert and add a comment to explain the rules. v3: Fixup German->English translation fail in the comment. Cc: Chris Wilson Signed-off-by: Daniel Vetter --- include/drm/drm_crtc.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h index 10547be5684a..fe3100115a41 100644 --- a/include/drm/drm_crtc.h +++ b/include/drm/drm_crtc.h @@ -1592,7 +1592,15 @@ static inline struct drm_property *drm_property_find(struct drm_device *dev, static inline void assert_drm_connector_list_read_locked(struct drm_mode_config *mode_config) { - WARN_ON(!mutex_is_locked(&mode_config->mutex)); + /* + * The connector hotadd/remove code currently grabs both locks when + * updating lists. Hence readers need only hold either of them to be + * safe and the check amounts to + * + * WARN_ON(not_holding(A) && not_holding(B)). + */ + WARN_ON(!mutex_is_locked(&mode_config->mutex) && + !drm_modeset_is_locked(&mode_config->connection_mutex)); } #define drm_for_each_connector(connector, dev) \