From patchwork Fri Nov 16 18:42:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Paul X-Patchwork-Id: 10686849 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 943FF17DE for ; Fri, 16 Nov 2018 18:44:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8551A2895F for ; Fri, 16 Nov 2018 18:44:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 78FFA28E12; Fri, 16 Nov 2018 18:44:16 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 207612895F for ; Fri, 16 Nov 2018 18:44:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729475AbeKQE5r (ORCPT ); Fri, 16 Nov 2018 23:57:47 -0500 Received: from mail-yb1-f195.google.com ([209.85.219.195]:39241 "EHLO mail-yb1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729377AbeKQE5r (ORCPT ); Fri, 16 Nov 2018 23:57:47 -0500 Received: by mail-yb1-f195.google.com with SMTP id w17-v6so10137654ybl.6 for ; Fri, 16 Nov 2018 10:44:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=poorly.run; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=MUUa3AydlXU+B9rr74wq6YK8dHrKp0TWGNSslOWvGqM=; b=Km/vK3gBoJF/LfzSXITj1ASEjCzMyfSJV3ZtBHA0c68TcyJaiIanRvHuVuWQxuXqK/ GTIaV3nXDTvF5UwqopSLomXiBzQRC5wgaD9/JEaXKqtyJQhFPuV9IOCSN1eu232XvO/S NAQ6W8teqR1bDQMCPgPbkvkbU7brmSVImDBVmgZDfCSBkPLGC+33yhiKvQMejVuDSclD 3mta8mMAWXZe3QY4i3Yqmi4E0z9yCUpMRbWyoxGq9h8wH0deMOmj54agflBMGJZEz/3H TfARGZpm1r70M0v8YsRDbJmgGK8JFDKHjQYoGFkDevuC3ei38casYMmuswzWcXnIrM/1 AG3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=MUUa3AydlXU+B9rr74wq6YK8dHrKp0TWGNSslOWvGqM=; b=SNUChLWIgJAfFRdbzH7RVP9S7H8CnHv5437s3TcKoJM8ObzYuXmzJQ8UwHXLnP6UFf V3U8//4Vla/tr40NmZv/lbNOQy+/sMvZ6LdqFoiOAJJvGafq4WtGGX6oLjf89RguPnV5 18y9ZXKFfbcz3+NU2KlYzeMywM11W/uKhaFIhogQN57Sr0JwSWfaLbC/NC/1Rsi3HgAB XaArmcvwV5GK33ipoJaXTBp/pQsKV2EUg/cKdO7301DFTr7xhWHJLeD7GaceVNGVtzSv cghIne7vXQO/ZXBtxk+eKv2k3Nl2sX1UqHx72cuC8ecXslaFmI02RaK+v81TP4UP/fLc 5NSA== X-Gm-Message-State: AGRZ1gI3VCOKhDWAriwNSO/nhcnR7RsCaMhEpC9xVtM57EIs/6bOmFvM EafeuqknjsxS5A0NsCB+CNvSwU5l34OIig== X-Google-Smtp-Source: AJdET5ey41H4GlFGLdoLGdyxvt6YjhekV7z5yJxRMYqsz4ROSgJ7mCIhumwYV7Rcq56VghGGm0o7Xg== X-Received: by 2002:a5b:291:: with SMTP id x17-v6mr11266974ybl.258.1542393854494; Fri, 16 Nov 2018 10:44:14 -0800 (PST) Received: from rosewood.cam.corp.google.com ([2620:0:1013:11:ad55:b1db:adfe:3b9f]) by smtp.gmail.com with ESMTPSA id b144sm5359134ywa.33.2018.11.16.10.44.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 16 Nov 2018 10:44:14 -0800 (PST) From: Sean Paul To: dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-arm-msm@vger.kernel.org Cc: robdclark@gmail.com, jsanka@codeaurora.org, Sean Paul Subject: [PATCH v2 18/24] drm/msm: dpu: Remove crtc_lock from setup_mixers Date: Fri, 16 Nov 2018 13:42:28 -0500 Message-Id: <20181116184238.170034-19-sean@poorly.run> X-Mailer: git-send-email 2.19.1.1215.g8438c0b245-goog In-Reply-To: <20181116184238.170034-1-sean@poorly.run> References: <20181116184238.170034-1-sean@poorly.run> MIME-Version: 1.0 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Sean Paul I think the intention here was to protect the enc->crtc access, but that's insufficient to avoid enc->crtc changing. Fortunately we're already holding the modeset lock when this is called (from atomic_check), so remove the crtc_lock and add a modeset lock check. While we're at it, use the encoder mask from crtc state instead of legacy pointer. Changes in v2: - None Signed-off-by: Sean Paul Reviewed-by: Jeykumar Sankaran --- drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c index c49aaf412b6e..141ed1b0e90a 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c @@ -474,19 +474,13 @@ static void _dpu_crtc_setup_mixer_for_encoder( static void _dpu_crtc_setup_mixers(struct drm_crtc *crtc) { - struct dpu_crtc *dpu_crtc = to_dpu_crtc(crtc); struct drm_encoder *enc; - mutex_lock(&dpu_crtc->crtc_lock); - /* Check for mixers on all encoders attached to this crtc */ - list_for_each_entry(enc, &crtc->dev->mode_config.encoder_list, head) { - if (enc->crtc != crtc) - continue; + WARN_ON(!drm_modeset_is_locked(&crtc->mutex)); + /* Check for mixers on all encoders attached to this crtc */ + drm_for_each_encoder_mask(enc, crtc->dev, crtc->state->encoder_mask) _dpu_crtc_setup_mixer_for_encoder(crtc, enc); - } - - mutex_unlock(&dpu_crtc->crtc_lock); } static void _dpu_crtc_setup_lm_bounds(struct drm_crtc *crtc,