From patchwork Tue Nov 13 20:52:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Paul X-Patchwork-Id: 10681531 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 B1A9213BF for ; Tue, 13 Nov 2018 20:53:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A1F5D2B6D8 for ; Tue, 13 Nov 2018 20:53:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 961C62B537; Tue, 13 Nov 2018 20:53:06 +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=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 50B872B537 for ; Tue, 13 Nov 2018 20:53:06 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id EE8736E30C; Tue, 13 Nov 2018 20:53:04 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-yw1-xc41.google.com (mail-yw1-xc41.google.com [IPv6:2607:f8b0:4864:20::c41]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2F3676E34C for ; Tue, 13 Nov 2018 20:53:04 +0000 (UTC) Received: by mail-yw1-xc41.google.com with SMTP id v77-v6so6392195ywc.4 for ; Tue, 13 Nov 2018 12:53:04 -0800 (PST) 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=0uJlzUYoMkmz9wfHG2GzW+owDjWRrYyxWNW8o1b4XmE=; b=WK4vnnOQQIrYa9RuTqOrlZV3hEOoxCX+3Ofq4oqR6MbzsBtz3zGhUdc+vhmzG+vlQY Tl5q5/b66DyPAE4r65voIGoAciCDEG43rON+06WaCOBi/MhPv1IDH7jEiR4+ImOdV/cS 9/XTs0OmiC/yfeefSGf4MpCY0EsCHrCconHLx3RDBJDLNPQC79Ny9qoSh+1522etw6GU h6eFt89De6yb4TKqPFTC5MWQa1aFwgNf9HXlDkSPSnezIQnor4ptlwyenEFV9XQvs77P rcSPupLZLGmFV8yhYVcVkucc93AFkZYKV4FLESoQ7bGo4iQa9RcVTzxhkEf4x8l5zKIg c5Gg== X-Gm-Message-State: AGRZ1gIt+OP4r04weTkqQweueeLZ9/HhmbTnIxL3q0g97PsQWdZWtwZ7 /J9FZNaFm1y1imDJIgzVKQecGS01v76/Mg== X-Google-Smtp-Source: AJdET5e3g/BOJwzA7VaReXm7vkjU8Z1FpQ40k0EdnOEV7Xxo5HmDnEUQX96cAJD3zxj82V2a67LKrw== X-Received: by 2002:a0d:e744:: with SMTP id q65-v6mr6774291ywe.109.1542142383167; Tue, 13 Nov 2018 12:53:03 -0800 (PST) Received: from rosewood.cam.corp.google.com ([2620:0:1013:11:ad55:b1db:adfe:3b9f]) by smtp.gmail.com with ESMTPSA id u130-v6sm5441257ywa.71.2018.11.13.12.53.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Nov 2018 12:53:02 -0800 (PST) From: Sean Paul To: dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-arm-msm@vger.kernel.org Subject: [PATCH 2/8] drm/msm: dpu: Remove crtc_lock from setup_mixers Date: Tue, 13 Nov 2018 15:52:45 -0500 Message-Id: <20181113205257.170707-2-sean@poorly.run> X-Mailer: git-send-email 2.19.1.930.g4563a0d9d0-goog In-Reply-To: <20181113205257.170707-1-sean@poorly.run> References: <20181113205257.170707-1-sean@poorly.run> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sean Paul Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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. Signed-off-by: Sean Paul --- 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 aa2f20c05dd7..adda0aa0cbaa 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c @@ -470,19 +470,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,