Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp1676426rdb; Mon, 2 Oct 2023 18:33:22 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHLHEurYG89Amv9EZZWOuR+KICmJaHJWKyt/ra3/kLQeSSrQ3eZ5T56/Ixm9V6M/3xp6kVQ X-Received: by 2002:a05:6870:1707:b0:1d0:e371:e95c with SMTP id h7-20020a056870170700b001d0e371e95cmr15785779oae.40.1696296801816; Mon, 02 Oct 2023 18:33:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696296801; cv=none; d=google.com; s=arc-20160816; b=WtFBOk6/W4e8J8qv+lY7sd+iFpNCCy71eHT9c7EdD93b+MqKYXWnnt3SJe2c+ZYb63 Q4IhleSou30sZjVXGBcOeyS3jqEk/+KxXd31xMksityo6xEknQIxeo9Nzxw9nnPtltjo HEoozys3lfTIMDHJ8e+uaE8YuM1PnVXLUDewDKoZ+AW3glXVVb2ZuDRc1cfbcIy01OS+ 6DjrUrW8/tUQFR2R1TvyzJ83u4GTy+pbNv8hjtc4VODTOZ0G61qWrbmkMFjwXgFiolJk 8Vu4SOR90vA2/UFz8PL/BTOYYPuTQT5/6QTmaczRKwLV5oYM1cCH26KCbTo+L+YFyjoO M/RA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=eQzTMLkI/SRnx3s8MUN9c1/X05zKDhSPiiowucxwbdc=; fh=h7qU5fspdOU2y40hULAa6AL6l1E80wvlvBv2V+GJu6E=; b=VHz7dkAnBru5/FaMmYhOksNNf1xioGvLZd4qxK8XIui7xxFCdIs3tfqba6tDj0Ud00 EtHzuRrkgPUq9h8TFaLj9c9ILy+MNDWiHDu0kFn2TaY45GLfZNsRctOTClraJGGx6tYb A6fXvwqfB90abG6QyvGBM5tIxGQorbHH+JGtEiDp61ac3O0sflXMDcm4356490IIs2Ez AFCVLIoYGf6xR2VpK/lq/EPIyuw6ixi5ojCIFkPOb2REEDffnysuY5TsIDe/ir5Rmw3w vzJc9kpkGc57wteYWZjc6jGznMo1bednaFtS/yUlosNxDbDaFXrXuKXrDO+bRoMkrxRV pyww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b="njecMQ/j"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id v3-20020a655c43000000b0056c297d1644si273665pgr.510.2023.10.02.18.33.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Oct 2023 18:33:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b="njecMQ/j"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id BA3828227786; Mon, 2 Oct 2023 18:33:20 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238922AbjJCBdU (ORCPT + 99 others); Mon, 2 Oct 2023 21:33:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59910 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229875AbjJCBdT (ORCPT ); Mon, 2 Oct 2023 21:33:19 -0400 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D405A9E; Mon, 2 Oct 2023 18:33:15 -0700 (PDT) Received: from pps.filterd (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3930kbZF031647; Tue, 3 Oct 2023 01:32:53 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=message-id : date : mime-version : subject : to : cc : references : from : in-reply-to : content-type : content-transfer-encoding; s=qcppdkim1; bh=eQzTMLkI/SRnx3s8MUN9c1/X05zKDhSPiiowucxwbdc=; b=njecMQ/jKOtuFgJ/7DfaiOJvutb63oEelRpFLy4ORPirH8Z8N4YQTmMZQJEyuyy3cwAJ 0wpBCvqm6mrNtlPCOXGavPoD5iTCKrSqziOTxChaMwEgD7bSFk2Ol1luOpmxCRghC7xI 0g8dsM3fWCJnJ1V64Du9VgzzAqrPNuHaap+njjeT2cVhbvBcmXtkP1zoVqhP3XaGeqpO oo9N7CaJiGRZGsmxAkdjW+treslP57HQTybG8EdArpTCH5/aX8KW0EtGCQ5lX3ZJO6UA PxXzRw907iHEOLS3PmaR93pn6ohErQKa/hHGxA8xsL5KyhiTosV1B5ln4xNiqQWabLNy SQ== Received: from nalasppmta04.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3tg1v38yea-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 03 Oct 2023 01:32:53 +0000 Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA04.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 3931WqWG008541 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 3 Oct 2023 01:32:52 GMT Received: from [10.110.1.90] (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.36; Mon, 2 Oct 2023 18:32:49 -0700 Message-ID: Date: Mon, 2 Oct 2023 18:32:47 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Subject: Re: [PATCH v3 6/7] drm/msm/dp: add pm_runtime_force_suspend()/resume() Content-Language: en-US To: Stephen Boyd , Dmitry Baryshkov , Kuogee Hsieh CC: , , , , , , , , , , , , , , References: <1694813901-26952-1-git-send-email-quic_khsieh@quicinc.com> <1694813901-26952-7-git-send-email-quic_khsieh@quicinc.com> <2f98d5f1-57c1-d9fe-cb1c-b975db057287@quicinc.com> <65566a68-3510-2e5f-7d57-e4dba08c008c@quicinc.com> <1d9bf80d-0267-937b-4dd9-c57db7a89cb4@quicinc.com> <58701008-bb93-e5c6-9ca0-5bc43f9a46f0@quicinc.com> From: Abhinav Kumar In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: FEktAmGvqznxNRqtU58vxTDLwBAln3xk X-Proofpoint-ORIG-GUID: FEktAmGvqznxNRqtU58vxTDLwBAln3xk X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.980,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-10-02_16,2023-10-02_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 phishscore=0 mlxscore=0 mlxlogscore=999 suspectscore=0 bulkscore=0 clxscore=1015 spamscore=0 impostorscore=0 priorityscore=1501 adultscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2309180000 definitions=main-2310030011 X-Spam-Status: No, score=-5.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_PASS 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Mon, 02 Oct 2023 18:33:20 -0700 (PDT) On 10/2/2023 3:58 PM, Stephen Boyd wrote: > Quoting Abhinav Kumar (2023-09-28 17:46:11) >> On 9/27/2023 3:01 PM, Stephen Boyd wrote: >>> Quoting Kuogee Hsieh (2023-09-25 09:07:18) >>>> >>>> However for external DP case, link training can not be guarantee always >>>> success without link rate or lane being reduced as Abhinav mentioned. >>>> >>>> In addition,  CTS (compliance test) it required to complete link >>>> training within 10ms after hpd asserted. >>> >>> Is it possible to change that timeout? I have to look around for the CTS >>> parameters because I'm pretty confused how it can work. What do we do if >>> DP wakes the system from suspend and asserts HPD? We need resume time to >>> be < 10ms? That's not realistic. >>> >> >> No, the CTS doesnt say we need to finish link training within 10ms after >> HPD is asserted. It says it must be completed in 10ms after >> TRAINING_PATTERN_SET dpcd write. >> >> "Wait until the Source DUT writes 00h to the TRAINING_PATTERN_SET byte >> of Reference Sink DPCD Link Configuration Field to indicate the end of >> the link training. Stop the link training timer. Verify that link >> training completed in 10ms or less" >> >> That needs to be done independent of HPD so we can ignore the CTS point. > > Great! > >> >>>> >>>> I am not sure do link training at atomic_enable() can meet this timing >>>> requirement. > > Why? It's putting some time bound on link training in general to only > take 10ms, right? > Like I said, CTS is mentioning 10ms to finish link training after the DUT writes 00h to the TRAINING_PATTERN_SET byte. So for this discussion lets leave out CTS for now. >>>> >>> >>> At least in the DP spec itself it doesn't require the link to be trained >>> within 10ms of HPD being asserted. Instead it simply recommends that the >>> OS start configuring the display promptly after HPD is asserted, e.g. >>> within 100ms. There's some strict timing on IRQ_HPD, so the driver must >>> read DPCD registers within 100ms of IRQ_HPD rising edge; maybe that is >>> what CTS is checking for? >>> >>> TL;DR: I don't see why CTS should stop us from link training in >>> atomic_enable(). It would be beneficial to do so to make eDP and DP the >>> same. It would also help to report a drm connector being connected >>> _before_ link training so that userspace knows the link itself is the >>> bad part of the equation (and not that the DP connector looks >>> disconnected to userspace when in fact it really is connected and the >>> monitor is asserting HPD, just the link training failed). >> >> Its the corrective action of the userspace when it finds link is bad is >> the concern as I highlighted in the other response. Just reading and >> resetting link_status is not enough to recover. > > What needs to be done to recover? Userspace will try to set a mode on > the connector again if the link status is bad and there were some modes > available. If there are zero modes and the link is bad, then it ignores > the connector. I'm not sure what else could be done to recover besides > try again and stop trying if no modes exist. > Let me re-explain if I didnt make this clear last time. You are right. Thats all the "userspace" can do which is basically retry the mode. And like I said, its again only going to fail. All the corrective actions you mentioned below like ignoring the connector entirely or consider that the display has link training problems are not something we decided to go with on a commercial device where we expect things to be more reliable. Let me re-explain what I explained in the prev response. If driver issues hot-plug after link-training: It would have implemented all the link training mechanisms such as trying lower rates/number of lanes and made sure that when the usermode queries the list of modes, only the modes which fit into the link rate which was link trained successfully will be exposed and the chances of a user ending up with a blank screen on connection are pretty high. This reduces the dependency on usermodes to be smart enough to implement such policies and we would rather not depend on those unless we have some reference to a compositor which is more sturdy. I do not think the CrOS code you have pointed to is more sturdy than the driver mechanism explained above. As opposed to this, if we just issue hotplug without any of this, usermode does not know which mode to retry as we do not remove or edit the mode list once link training fails. > Acting like the connector isn't connected makes the situation worse for > ChromeOS because userspace thinks there's nothing there so it can't try > to retrain the link again. Instead, userspace has to rely on the kernel > driver to train the link again. The kernel should just tell userspace > the link is bad so userspace can implement the policy to either ignore > the connector entirely or to consider it a display that is having link > training problems. > What gain will it give if it retries the same mode blindly as opposed to the safer option I have explained above. None of the policies you have highlighted seem like something an end user will be satisfied with. > So again, I see no reason why the kernel driver thinks it can implement > a policy to train the link before indicating the drm connector is > connected. It should stop doing that. Instead it should tell userspace > that the connector is connected and then train the link when there's a > modeset. If the modeset fails then userspace can take action to either > figure out that the link is bad, or notify the user that the cable is > bad, or to try replugging or power cycle the monitor, etc. None of that > can be done if the kernel lies about the state of the connector because > the link training failed. Usermode is unable to take the corrective action without proper support from the kernel like removing unsupported modes etc and I dont see other drivers taking an action like that. Kernel is not lying. Its delaying the status to a point where usermode can safely handle. Please explain to me how any of the policies you have explained usermode can take are safer and have more chance of success than what we have now.