Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp3922691imw; Thu, 7 Jul 2022 09:38:48 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vJmc/TZEtbWiAsSdic+03AM7XLPRn0Wl/CogC/xLIThqWLQqPx0vcOOVuVLvmMEJ+vS0Li X-Received: by 2002:a17:906:c14f:b0:726:a609:a369 with SMTP id dp15-20020a170906c14f00b00726a609a369mr46071734ejc.326.1657211928117; Thu, 07 Jul 2022 09:38:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657211928; cv=none; d=google.com; s=arc-20160816; b=VFsCDMvSydmB53SZXU9RbT8ls2Ws6buNg0XTs51aKxidBsNVXN1atLwh6dC+INFiPY x/u0T96d3DlLSDVbwRCgG3jsfe9gl5cX2fLEsYzK946ihe5nW/EVYfG5THK/9FF6pyBR ECVb8BVeA4NtSVulVCR3s+c+0tssUEodKsSM2vcRIes5Enfg+vPyLisKidCo3JnCCE1D XbYyW7ISuSEUsnDaX3WkQEjNOtzDtHwsLb/tSSCjwIx4QxzwauBUvC5fj3pzjLk31e2g 9BfBJvFpevVBkemQD7PS4lX24MxdDyyjKAak965W1FUm2HehoQeI8gS75VmICz5Gc5C/ J10w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=TQXT+Vn5CgtfH4Lkw1DN2mXJFuK6qLYy5tuOuFlvcck=; b=hh3L5/mq2duTJpb3AudCmvwmFhg5OqJ85DwUkRf4rLwRiKoE5TaOMo8EyRjKxJRL1y fOW66D1Ey+1WJQicRFr9Jh0Frltj9zFrZyQjiDT6LH546J4v0adHxI+vpzQZ4VpeMfF8 AF7xOjPk2afcw3QR3golA9EXAWUVZ6PQMhjPGTq+ynVYIzFtQnlOY0I/7nbzRKy8rXKI 62iVFtNl7rib/vQ18OpHZTzbFp66XL0KCVXZPNjkmfUXqOlpdhp6vBe7C8y7vp0tu0ty dbolwdXLTscxjTb3pxRP5bPkzT8FIcCJeTSgVqyxPu3fyLzHeyeYzW+3hD9kE2WWfGCe 6lDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=ep481det; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e7-20020a056402190700b0043586d19cf9si3026838edz.465.2022.07.07.09.38.22; Thu, 07 Jul 2022 09:38:48 -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=@gmail.com header.s=20210112 header.b=ep481det; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236039AbiGGQU1 (ORCPT + 99 others); Thu, 7 Jul 2022 12:20:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60098 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235967AbiGGQUY (ORCPT ); Thu, 7 Jul 2022 12:20:24 -0400 Received: from mail-pg1-x530.google.com (mail-pg1-x530.google.com [IPv6:2607:f8b0:4864:20::530]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8703A25EAF; Thu, 7 Jul 2022 09:20:23 -0700 (PDT) Received: by mail-pg1-x530.google.com with SMTP id 23so19394930pgc.8; Thu, 07 Jul 2022 09:20:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=TQXT+Vn5CgtfH4Lkw1DN2mXJFuK6qLYy5tuOuFlvcck=; b=ep481detKf6cnRtYgWwYl8Ve2Q20j9MBngIbyhXi+uUiMyNsCkJPVNnqV4+9GEhQMI 5r1BEG5VeuXECmy0qa1BEBQ6bsTHw3NZbroX0bjTLLy01n8EJ8mAk5kqew8XKjiFk3cX ppiMuPBWMYfwraZz6UOODNf3GAhRBmy/Assivb9cqXlaSodfiAa5hIapIWjlPEkelT98 zVcpWRM4+ZtOZ382zBMtZJumB5PmIIl70vSgkIem6zVa5wnPbw+b+Lqs+D7k+ZnxBRJJ RcwcxN2L9fTv0LJKfZzwj/fnvwPHkHniErWhqoAe6s1/AeXORF3nj9RWw78U2egOuoEk ODqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=TQXT+Vn5CgtfH4Lkw1DN2mXJFuK6qLYy5tuOuFlvcck=; b=Ys45EREfiu6ntmgkG4aDQQx7MljEQBYLu/wYO7+3gsyhrCIcF3Dz1DRBWD+5SF8e8V 6DJ0vkriYrUauEHFkQN924q5ri4nRpP0vtBW/niQhLo/NJRfWhZeQ3YKyk2BJq0qI211 52Y3c04jKfX7mE1wlzT8jjRPiI2xHiXvoAnT3emk+wWk16ClyKaoHRnNCngi34J82OND rPeYBUTp8luotiR7cRD5iTidm9ZInLMc/Luib5bgeFxO/BocdNcTl3JsNKRGNN//QWga Q6Tvhct9Ekb/5ynWvG/BQaW+AkAwVoXXeLLZceHWuERGTuFthPPwyUHMdGFM9Wi4qP64 CdJA== X-Gm-Message-State: AJIora+1yEsTAGjMdfX8LhZD6YkLuRhoS53/oPeVyyEIPj5iVSd1+NG9 9M459RlEso70NJaaBb7lMvk= X-Received: by 2002:a17:902:ea0e:b0:16b:f92b:a3c3 with SMTP id s14-20020a170902ea0e00b0016bf92ba3c3mr13342583plg.10.1657210822934; Thu, 07 Jul 2022 09:20:22 -0700 (PDT) Received: from localhost ([2a00:79e1:abd:4a00:2703:3c72:eb1a:cffd]) by smtp.gmail.com with ESMTPSA id ik30-20020a170902ab1e00b0016bee668a5asm7138661plb.161.2022.07.07.09.20.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Jul 2022 09:20:21 -0700 (PDT) From: Rob Clark To: dri-devel@lists.freedesktop.org Cc: freedreno@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, Rob Clark , Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Sean Paul , David Airlie , Daniel Vetter , Jessica Zhang , linux-kernel@vger.kernel.org (open list) Subject: [PATCH] drm/msm/mdp5: Fix global state lock backoff Date: Thu, 7 Jul 2022 09:20:37 -0700 Message-Id: <20220707162040.1594855-1-robdclark@gmail.com> X-Mailer: git-send-email 2.36.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, 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 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 --- 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); -- 2.36.1