Received: by 2002:ab2:710b:0:b0:1ef:a325:1205 with SMTP id z11csp1915185lql; Wed, 13 Mar 2024 11:41:55 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVFJqWjLJgY4+jJ9LU3Is5Wi9hNMsfSa80zXZ3YF3TqqOBImhyDMzYiPc8GoXUzdWEjiCHOvxvLV9FICAZjPJLMh2NCkwkvF2yUqZ2i9A== X-Google-Smtp-Source: AGHT+IGqi8CVs2z+wJXlKJ9exnCgVksjzvT/17CjqyxpNKCtvrkDmdskrt8Ftb+rERt564DhOJyZ X-Received: by 2002:a50:cc9e:0:b0:565:6e34:da30 with SMTP id q30-20020a50cc9e000000b005656e34da30mr9584786edi.21.1710355314990; Wed, 13 Mar 2024 11:41:54 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710355314; cv=pass; d=google.com; s=arc-20160816; b=cew4uv5tDBJGjhoY9Mkl1ppjCw7/geSQsUND8Ydo5aSFg8BCfZ79ZmU4AOYBM9xeQ9 tiOD7G+Qvhd9PZMvkTiBaw7/KjusPIqlugew41gBGmwekne2GiGAJybvld6owF8ns93Q HpONXEsmzDHH2YZBVx/cbKj5n+wEYpXLLPzDmItOmMzdHU/6HOJyiElYSs1gzMEqT1OG 1EthAESs1RiXgMGizRTxWYOgxNybouptsA0eUYk6a1pmazoIPmQqO8u/ueOuwfyXOWWD ovD45vHdwlX6bbc//b4Lg7WDHOztIxLVhMUbcoGqXkiHcgqtb7xRjNY6dEsPuWJRzhjL 6p0w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=HsXYLo4vxmd7FYkONEKhNYJ7yL8L99rg/zJTykm0JYo=; fh=V6V21scPBCP91L7RvKXhu0g75kYnBC6c3I6EXuyjWh4=; b=Py6iMF19QNdGO4rZOjeC4tUb56X4WO0/P7FXNvjqpWT+kptbZgxIyOrWfwEljwkIm6 QJJB5xmrX3fRe6h14tdXYKuX5rgy54m7xRRGO70+dTwNV1ZJG9X9Ugfw36giJd5lVHcW VhEau5wlpXLTiS51IFhmuofoxz6bJOivxyRQODwk6ScIADM+CrBbG2kLcJKJ8Vyq0lbx 0+PQAXQ/pmwBa6THifmMuGMw6pTpss3Cz3WdUU/yOmrya53m1n++guEOf9aIQpqvl/j2 iXhxnjtjowjYO4mCwWbH6t5PFCp/JrufeRLkAOmKLaJiY5x4u5mIp8cFQkUefkb36kYn rL3A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=HIFH71lf; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-kernel+bounces-102259-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-102259-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id eo5-20020a056402530500b005661b6a0aebsi430960edb.162.2024.03.13.11.41.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Mar 2024 11:41:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-102259-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=HIFH71lf; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-kernel+bounces-102259-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-102259-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 810EC1F29800 for ; Wed, 13 Mar 2024 18:37:58 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3374962806; Wed, 13 Mar 2024 17:24:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="HIFH71lf" Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7DF42627E5; Wed, 13 Mar 2024 17:24:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710350670; cv=none; b=lOIa8Z260Zd+U5nbnx3C4MC6yRr17mCYUng/1lzomBZ76Q4aFSxgU+cfT6/MTTYW68Ps2tYrhIuEdQUGyp7dCuKZzw8AYZn/2L5sCoIYQkJfGXuf8swMgiDUHIb93FbYu2SeZQxhujaVFXuHvabuKE57v8+T0KS83UzulxdhaYs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710350670; c=relaxed/simple; bh=ZvIharIEYk7kDgPIHx5QO4EE9939DqfNYXx3tDnTQHU=; h=Message-ID:Date:MIME-Version:Subject:To:CC:References:From: In-Reply-To:Content-Type; b=p912em/rURoeo2224frRSjgAksNm5yAvjJwS8FHuNR5ktFRsXpAATsP9LeQe1O1xp67xUmQ91ZMHjmhRi8CXneb42bxnoBpGqvknd+muYmNbLZb5Jmy1hP5M7XthpN7CT97PZX2nqBnlUEseSJ+Q+ELwccUwL9bpX3N5RrdeFbA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=HIFH71lf; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Received: from pps.filterd (m0279865.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 42D7kCjq031221; Wed, 13 Mar 2024 17:24:16 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=HsXYLo4vxmd7FYkONEKhNYJ7yL8L99rg/zJTykm0JYo=; b=HI FH71lftMUPi/6Qh8LVdfNe6y4JITb8nbq0sFS8Q05ayyHUdV8V9sC0F6OteeOyqZ qa5GkpnlNC5+JarcwCv1i8qPmMHd5r9sPumVYNTRu4gmbj30Z9TCPxMHkDn7CMRd Y5ULDX6CJfqg5JBvjp1yXLcMwSUWXpQyc26eUPO1vKjoETrIBo1Bkx+aUx043Nix E10+lIQsqaVK8D8yRqAZK6v981kz22SAAx3yL/ISvgKg8x8vfcWVYT9H/1HFrPVI AL+7EBAp+Y2oqXFt5UHFgbG+Iu7bNCm4oyB8fw7qO9isb22vG/UQFhx7EqwnzZp8 4mL7ZRIP/20fM1pPB5Sw== Received: from nalasppmta05.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3wu81m1871-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 13 Mar 2024 17:24:16 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA05.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 42DHOFml013855 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 13 Mar 2024 17:24:15 GMT Received: from [10.110.70.168] (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.40; Wed, 13 Mar 2024 10:24:10 -0700 Message-ID: Date: Wed, 13 Mar 2024 10:24:08 -0700 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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] drm/msm/dp: move link_ready out of HPD event thread Content-Language: en-US To: Johan Hovold CC: , Rob Clark , "Dmitry Baryshkov" , Sean Paul , "Marijn Suijten" , David Airlie , Daniel Vetter , Kuogee Hsieh , , , , , , Rob Clark , , References: <20240308214532.1404038-1-quic_abhinavk@quicinc.com> <8e125a99-543d-8328-a2a9-100e223e4faf@quicinc.com> From: Abhinav Kumar In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit 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-ORIG-GUID: k_KsKkFVR1NcTEJbp5-f7QVlS1rPpC3D X-Proofpoint-GUID: k_KsKkFVR1NcTEJbp5-f7QVlS1rPpC3D X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-03-13_09,2024-03-13_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 adultscore=0 malwarescore=0 lowpriorityscore=0 clxscore=1015 phishscore=0 priorityscore=1501 mlxlogscore=999 impostorscore=0 suspectscore=0 spamscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2402120000 definitions=main-2403130132 On 3/13/2024 1:18 AM, Johan Hovold wrote: > On Tue, Mar 12, 2024 at 10:39:46AM -0700, Abhinav Kumar wrote: >> On 3/12/2024 9:59 AM, Johan Hovold wrote: > >>>> Heh. This is getting ridiculous. I just tried running with this patch >>>> and it again breaks hotplug detect in a VT console and in X (where I >>>> could enable a reconnected external display by running xrandr twice >>>> before). >>>> >>>> So, please, do not apply this one. >>> >>> To make things worse, I indeed also hit the reset when disconnecting >>> after such a failed hotplug. > >> Ack, I will hold off till I analyze your issues more which you have >> listed in separate replies. Especially about the spurious connect, I >> believe you are trying to mention that, by adding logs, you are able to >> delay the processing of a connect event to *make* it like a spurious >> one? In case, I got this part wrong, can you pls explain the spurious >> connect scenario again? > > No, I only mentioned the debug printks in passing as instrumentation > like that may affect race conditions (but I'm also hitting the resets > also with no printks in place). > > The spurious connect event comes directly from the pmic firmware, and > even if we may optimise things by implementing some kind of debounce, > the hotplug implementation needs to be robust enough to not kill the > machine if such an event gets through. > > Basically what I see is that during physical disconnect there can be > multiple hpd notify events (e.g. connect, disconnect, connect): > > [ 146.910195] usb 5-1: USB disconnect, device number 4 > [ 146.931026] msm-dp-display ae98000.displayport-controller: dp_bridge_hpd_notify - link_ready = 1, status = 2 > [ 146.934785] msm-dp-display ae98000.displayport-controller: dp_hpd_unplug_handle > [ 146.938114] msm-dp-display ae98000.displayport-controller: dp_bridge_hpd_notify - link_ready = 1, status = 1 > [ 146.940245] [CONNECTOR:35:DP-2] status updated from disconnected to connected > [ 146.955193] msm-dp-display ae98000.displayport-controller: dp_bridge_hpd_notify - link_ready = 0, status = 2 > > And it is the spurious connect event while the link is being tore down > that triggers the hotplug processing that leads to the reset. > > Similarly, I've seen spurious disconnect events while the plug in being > inserted. > This is quite weird and also explains why most of the issues were seen only with sc8280xp. pmic spurious events are busting the hpd logic. Agreed, that DP driver should be robust enough to handle this but this will also bust usermode to send down unnecessary frames. Someone should address why these spurious events are coming. >> A short response on why this change was made is that commit can be >> issued by userspace or the fbdev client. So userspace involvement only >> makes commit happen from a different path. It would be incorrect to >> assume the issues from the earlier bug and the current one are different >> only because there was userspace involvement in that one and not this. >> >> Because in the end, it manifests itself in the same way that >> atomic_enable() did not go through after an atomic_disable() and the >> next atomic_disable() crashes. > > Right, but your proposed fix would not actually fix anything and judging > from the sparse commit message and diff itself it is clearly only meant > to mitigate the case where user space is involved, which is *not* the > case here. > No, I think there is some disconnect in the way you are reading that patch perhaps due to some missing details OR I am missing your point. Like I said, drm_atomic_commit() can be issued by userspace or the fbdev client in the driver. Thats the only userspace involvement. Now, why the patch was made or was expected to work. There can be a race condition between the time the DP driver gets the hpd disconnect event and when the hpd thread processes that event allowing the commit to sneak in. This is something which has always been there even without pm_runtime series and remains even today. In this race condition, the setting of "link_ready" to false can be a bit delayed if we go through the HPD event processing increasing the race condition window. If link_ready is false, atomic_check() fails, thereby failing any commits and hence not allowing the atomic_disable() / atomic_enable() cycle and hence avoiding this reset. The patch is moving the setting of link_ready to false earlier by not putting it through the HPD event thread and hence trying to reduce the window of the issue. > Johan