Received: by 2002:a05:6359:322:b0:b3:69d0:12d8 with SMTP id ef34csp177856rwb; Wed, 10 Aug 2022 17:18:43 -0700 (PDT) X-Google-Smtp-Source: AA6agR5GxhP1VwykbtYZ76qHgA1S4w32VZxbPWRlwAF9XN3uHNkTD2KGpg/2y7TBwfIYof4bJL3h X-Received: by 2002:a17:90b:3a81:b0:1f7:2103:a8d6 with SMTP id om1-20020a17090b3a8100b001f72103a8d6mr5994285pjb.105.1660177122995; Wed, 10 Aug 2022 17:18:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660177122; cv=none; d=google.com; s=arc-20160816; b=caOHeMZxptjkqUWQsvOxj0QTuCTwFEq2QrUDosMJ6MOXvq+f3BIsjEJGkTPEXkalX2 34O1pZ5MenuDYrsg9f3yYKZga3kWXAsEENzefo1GJKkswdr/vypiN3HhFyZcgYI8ybWS 6e+F7/d6I/YN4DtGMesOL/c/8CuCiskL+C4271nrF7JzoK9mqH1HwAOJmIAEXuyX7WaH BYDQPIHZ8JwQg7BmP6fVsPLC70OkL+6ZXY4STqpdbvjqUDRFV8UcDYP560K4tHiHvZSr /LRNVsf6b7hTfbvFbnWz4VVTjqxVreUcL/uLbWS+adWNxMZzJO9cAkFHgbX1icYqvtkp Yh6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:user-agent:from :references:in-reply-to:mime-version:dkim-signature; bh=C16lQ11m+Fol+4L80u44mbuXPnmczf0UX1lY5QRXlHs=; b=vkEZBSBQF3oGxtnycv3W0TXjXbLPNyTeG75d/wQkpAq8rvdOwhYSeMWJCvaRRIHesV I1lamZCxbLED6lNyI2kGLEPbQSE95op8m7YbrBKkC74ajPwR6Kt1du+QR2kVB5NurLb3 Q47wxKQ1zI1iUpC/UFpAGOu3znnBHTiT07PDjzWqGbUBrNxxpp2AiISnp7BHqmLb9Tek rFP1wkyck2MOBhV+nkghlcqq1++IBxVdo9gQEjKG27v0WT862xj5WEnpj+VklzOy5xFX HAw34m6ZO3ED8/rdo5R2jzLQfit6I9v4FBduuUU0dk0IOmv8JMJuFj+y7XIDSnxdjRSx xZmQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=lnof+J9e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a184-20020a6390c1000000b00408add1cf0bsi4409595pge.43.2022.08.10.17.18.30; Wed, 10 Aug 2022 17:18:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=lnof+J9e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232749AbiHKAJF (ORCPT + 99 others); Wed, 10 Aug 2022 20:09:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58602 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232515AbiHKAJE (ORCPT ); Wed, 10 Aug 2022 20:09:04 -0400 Received: from mail-oi1-x22f.google.com (mail-oi1-x22f.google.com [IPv6:2607:f8b0:4864:20::22f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7752E7FE75 for ; Wed, 10 Aug 2022 17:09:03 -0700 (PDT) Received: by mail-oi1-x22f.google.com with SMTP id p132so19582551oif.9 for ; Wed, 10 Aug 2022 17:09:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=cc:to:subject:message-id:date:user-agent:from:references :in-reply-to:mime-version:from:to:cc; bh=C16lQ11m+Fol+4L80u44mbuXPnmczf0UX1lY5QRXlHs=; b=lnof+J9e73sWWV2P76DkdnT/flxhdLwzk6IjqWOzztc2OWwFBmRuRmO2scHgZk3CBq GRV169KOmILKU6IlpvWyXSKDwR7qOjbfJwa2NoYWM/DdvVcl/tQTqR2YaOqa4BF3SFQ9 7NAdg4han2f2MPvoMjGoseen/7yjFmViBjY5U= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:user-agent:from:references :in-reply-to:mime-version:x-gm-message-state:from:to:cc; bh=C16lQ11m+Fol+4L80u44mbuXPnmczf0UX1lY5QRXlHs=; b=BO/RLV0eNcDcv28AcEGzszZoZm3i/V1zog2N0QsVuk38p8RienI5Miaykh3HjdRVA7 rA0lhBSzWhIcZgDkOFzomcsgBopshI8C48cukaKb2BlFInu42ksxNCpd7vW0ibdmPpeo CjPF4febbbs6JkmnrIPgRF0fBknHJYcJKbCi+8xXzi6USrq3WoqiD2791+3VmzCM1mGB CO2BD8Pw3ap39Vjr2Bgsip6sZ/ui1qTDjIPSFgYB+IALw4kDATmyyzyKm6GTtnv9izaC iuVWudwin+EiY6QKMWXQH4aC8KRKIVMFazlUBP2LDeaAhF+5fE6Mz1/KjikwYbUni7x7 EeAQ== X-Gm-Message-State: ACgBeo3zAMWe3tBxi9On+RH9txHj5o2SwIQcBvo1NdAjQN2PT/O5u3vP sSgXorMHu9NVSNnibbgyjI6U12k9KPMeNkUt/SyTEA== X-Received: by 2002:a05:6808:1389:b0:33a:bd16:c4e4 with SMTP id c9-20020a056808138900b0033abd16c4e4mr2311696oiw.0.1660176542614; Wed, 10 Aug 2022 17:09:02 -0700 (PDT) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Wed, 10 Aug 2022 19:09:02 -0500 MIME-Version: 1.0 In-Reply-To: References: <1660159551-13828-1-git-send-email-quic_khsieh@quicinc.com> From: Stephen Boyd User-Agent: alot/0.10 Date: Wed, 10 Aug 2022 19:09:02 -0500 Message-ID: Subject: Re: [PATCH v3] drm/msm/dp: check hpd_state before push idle pattern at dp_bridge_disable() To: Kuogee Hsieh , agross@kernel.org, airlied@linux.ie, bjorn.andersson@linaro.org, daniel@ffwll.ch, dianders@chromium.org, dmitry.baryshkov@linaro.org, robdclark@gmail.com, sean@poorly.run, vkoul@kernel.org Cc: quic_abhinavk@quicinc.com, quic_aravindh@quicinc.com, quic_sbillaka@quicinc.com, freedreno@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Quoting Kuogee Hsieh (2022-08-10 16:57:51) > > On 8/10/2022 3:22 PM, Stephen Boyd wrote: > > Quoting Kuogee Hsieh (2022-08-10 12:25:51) > >> diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c > >> index b36f8b6..678289a 100644 > >> --- a/drivers/gpu/drm/msm/dp/dp_display.c > >> +++ b/drivers/gpu/drm/msm/dp/dp_display.c > >> @@ -1729,10 +1729,20 @@ void dp_bridge_disable(struct drm_bridge *drm_bridge) > >> struct msm_dp_bridge *dp_bridge = to_dp_bridge(drm_bridge); > >> struct msm_dp *dp = dp_bridge->dp_display; > >> struct dp_display_private *dp_display; > >> + u32 state; > >> > >> dp_display = container_of(dp, struct dp_display_private, dp_display); > >> > >> + mutex_lock(&dp_display->event_mutex); > >> + > >> + state = dp_display->hpd_state; > >> + if (state != ST_DISCONNECT_PENDING && state != ST_CONNECTED) { > > It's concerning that we have to check this at all. Are we still > > interjecting into the disable path when the cable is disconnected? > > yes, > > The problem is not from cable disconnected. > > There is a corner case that this function is called at drm shutdown > (drm_release). > > At that time, mainlink is not enabled, hence dp_ctrl_push_idle() will > cause system crash. The mainlink is only disabled when the cable is disconnected though? Let me put it this way, if we have to check that the state is "connected" or "disconnected pending" in the disable path then there's an issue where this driver is being called in unexpected ways. This driver is fighting the drm core each time there's a state check. We really need to get rid of the state tracking entirely, and make sure that the drm core is calling into the driver at the right time, i.e. bridge disable is only called when the mainlink is enabled, etc.