Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp3968345imw; Thu, 7 Jul 2022 10:22:51 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tIKK1GeLCyBSWnSOpjo+c9Grxm0ghC3y4CF8isseadhpVMFwIwA9NtnWCHdR3edPiT64kU X-Received: by 2002:a05:6402:380a:b0:437:d11f:b8b0 with SMTP id es10-20020a056402380a00b00437d11fb8b0mr63691516edb.425.1657214571299; Thu, 07 Jul 2022 10:22:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657214571; cv=none; d=google.com; s=arc-20160816; b=qVmuY/LglOnG7g707jYiUlbaf1Qg7Dz3+17LGhWoei/dk4oQJp6yiXLQFx+9Fjt/1z 5GdaiZBg7s5ytLVS8FQILGLr2uV3nlHNYhOtu2XcQTBfMHijSR/qTYD7aHMVuHO0/8vD RJX+j3+dY3MhqMlOmVPIzvWrpH6MelhK3C4w7mrpk6V0cWvMFPXP3FQ6kiMyY2fijNXN a33K40ifA9Af6OkFTu4gJ4Aod6MRWQzOf2H9F0F0OJWUJCw8UMQSlKHwp3ypjWK5eAZk 21pZ5WZ6P2ofZLZvo3WW02YNeQTYOuTyw3Zemv2taqpxP2Es1Hm/L7J3/6t5qMEqNB8j UuXw== 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=fzvG9KcXakJp0NGkoS5P9K5pudVXmEkaIJ6d4P/hRKk=; b=Zab6gZqSlxhSscTfuOTFcfQzk1DHZQT4bw49rh3IRQ0jvC9NovmWBWmXI3B513AtTH jyIDS0fbPtYoy3EHg7ntbfMCFc0lOeJmIsxEOw18CWugPNEEtXVXNzpX8iMwliQnwXQk IsEjdmN/CcJ2GoPKJOTpwYY5vwXtgSdIRoN+Afwx9q1BaU3Zz32Fb2t+TZiXSfynjZVK nevnIHuI4gLEIw/4r695SE3ag9O4kwMv4rXsthFkearmqa72Ketv3s7TJVD6i4JvWVok bVnAEnjJ2b54stk5YW7bwpY/tKjFs7Fo4amfBv66T7CQ8nt5/y5xsGtaw6ERBaYWyhj0 glPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b="K++uit/0"; 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=quicinc.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hq33-20020a1709073f2100b00726b8501cd4si2014750ejc.91.2022.07.07.10.22.26; Thu, 07 Jul 2022 10:22:51 -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=@quicinc.com header.s=qcdkim header.b="K++uit/0"; 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=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235156AbiGGQvh (ORCPT + 99 others); Thu, 7 Jul 2022 12:51:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59784 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235158AbiGGQvg (ORCPT ); Thu, 7 Jul 2022 12:51:36 -0400 Received: from alexa-out-sd-01.qualcomm.com (alexa-out-sd-01.qualcomm.com [199.106.114.38]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3550B2E9DE; Thu, 7 Jul 2022 09:51:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1657212695; x=1688748695; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=fzvG9KcXakJp0NGkoS5P9K5pudVXmEkaIJ6d4P/hRKk=; b=K++uit/0nMjxudNkIFR9KAE+Kk+XArduHYuz65IGzhb/jip8md9nCT3u rB7gmbMTEI6TYBNc78Wgh+opUhw83BsbznjlvOs2yoHqUdiFhe9oi5avn tHOpVq1ZZ/Mu0cFAQ9VB0DuzFfRuE56Cwm1fMjhc0fWwM6ZCvdReNXQ5R E=; Received: from unknown (HELO ironmsg03-sd.qualcomm.com) ([10.53.140.143]) by alexa-out-sd-01.qualcomm.com with ESMTP; 07 Jul 2022 09:51:34 -0700 X-QCInternal: smtphost Received: from nasanex01c.na.qualcomm.com ([10.47.97.222]) by ironmsg03-sd.qualcomm.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Jul 2022 09:51:34 -0700 Received: from nalasex01a.na.qualcomm.com (10.47.209.196) by nasanex01c.na.qualcomm.com (10.47.97.222) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Thu, 7 Jul 2022 09:51:33 -0700 Received: from [10.111.163.64] (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.986.22; Thu, 7 Jul 2022 09:51:31 -0700 Message-ID: <240422bd-ba5e-d250-d8ac-ef6651a97977@quicinc.com> Date: Thu, 7 Jul 2022 09:51:29 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.6.2 Subject: Re: [PATCH] drm/msm/mdp5: Fix global state lock backoff Content-Language: en-US To: Rob Clark , CC: Rob Clark , David Airlie , , open list , Sean Paul , Dmitry Baryshkov , Jessica Zhang , References: <20220707162040.1594855-1-robdclark@gmail.com> From: Abhinav Kumar In-Reply-To: <20220707162040.1594855-1-robdclark@gmail.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01a.na.qualcomm.com (10.47.209.196) X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_MED, 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 On 7/7/2022 9:20 AM, Rob Clark wrote: > From: Rob Clark > > We need to grab the lock after the early return for !hwpipe case. > Otherwise, we could have hit contention yet still returned 0. > > Fixes an issue that the new CONFIG_DRM_DEBUG_MODESET_LOCK stuff flagged > in CI: > > WARNING: CPU: 0 PID: 282 at drivers/gpu/drm/drm_modeset_lock.c:296 drm_modeset_lock+0xf8/0x154 > Modules linked in: > CPU: 0 PID: 282 Comm: kms_cursor_lega Tainted: G W 5.19.0-rc2-15930-g875cc8bc536a #1 > Hardware name: Qualcomm Technologies, Inc. DB820c (DT) > pstate: 60000005 (nZCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--) > pc : drm_modeset_lock+0xf8/0x154 > lr : drm_atomic_get_private_obj_state+0x84/0x170 > sp : ffff80000cfab6a0 > x29: ffff80000cfab6a0 x28: 0000000000000000 x27: ffff000083bc4d00 > x26: 0000000000000038 x25: 0000000000000000 x24: ffff80000957ca58 > x23: 0000000000000000 x22: ffff000081ace080 x21: 0000000000000001 > x20: ffff000081acec18 x19: ffff80000cfabb80 x18: 0000000000000038 > x17: 0000000000000000 x16: 0000000000000000 x15: fffffffffffea0d0 > x14: 0000000000000000 x13: 284e4f5f4e524157 x12: 5f534b434f4c5f47 > x11: ffff80000a386aa8 x10: 0000000000000029 x9 : ffff80000cfab610 > x8 : 0000000000000029 x7 : 0000000000000014 x6 : 0000000000000000 > x5 : 0000000000000001 x4 : ffff8000081ad904 x3 : 0000000000000029 > x2 : ffff0000801db4c0 x1 : ffff80000cfabb80 x0 : ffff000081aceb58 > Call trace: > drm_modeset_lock+0xf8/0x154 > drm_atomic_get_private_obj_state+0x84/0x170 > mdp5_get_global_state+0x54/0x6c > mdp5_pipe_release+0x2c/0xd4 > mdp5_plane_atomic_check+0x2ec/0x414 > drm_atomic_helper_check_planes+0xd8/0x210 > drm_atomic_helper_check+0x54/0xb0 > ... > ---[ end trace 0000000000000000 ]--- > drm_modeset_lock attempting to lock a contended lock without backoff: > drm_modeset_lock+0x148/0x154 > mdp5_get_global_state+0x30/0x6c > mdp5_pipe_release+0x2c/0xd4 > mdp5_plane_atomic_check+0x290/0x414 > drm_atomic_helper_check_planes+0xd8/0x210 > drm_atomic_helper_check+0x54/0xb0 > drm_atomic_check_only+0x4b0/0x8f4 > drm_atomic_commit+0x68/0xe0 > > Fixes: d59be579fa93 ("drm/msm/mdp5: Return error code in mdp5_pipe_release when deadlock is detected") > Signed-off-by: Rob Clark Reviewed-by: Abhinav Kumar > --- > drivers/gpu/drm/msm/disp/mdp5/mdp5_pipe.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_pipe.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_pipe.c > index a4f5cb90f3e8..e4b8a789835a 100644 > --- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_pipe.c > +++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_pipe.c > @@ -123,12 +123,13 @@ int mdp5_pipe_release(struct drm_atomic_state *s, struct mdp5_hw_pipe *hwpipe) > { > struct msm_drm_private *priv = s->dev->dev_private; > struct mdp5_kms *mdp5_kms = to_mdp5_kms(to_mdp_kms(priv->kms)); > - struct mdp5_global_state *state = mdp5_get_global_state(s); > + struct mdp5_global_state *state; > struct mdp5_hw_pipe_state *new_state; > > if (!hwpipe) > return 0; > > + state = mdp5_get_global_state(s); > if (IS_ERR(state)) > return PTR_ERR(state); >