Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp1866433rwb; Fri, 19 Aug 2022 10:41:34 -0700 (PDT) X-Google-Smtp-Source: AA6agR7r946Umyc8IDokcjumnVLAgAewar9gjBSdhKWGEXMpx+3VVLU4fHi4QNAAB8nq/LZlVMLk X-Received: by 2002:a17:903:190:b0:16f:642:1a72 with SMTP id z16-20020a170903019000b0016f06421a72mr8939472plg.113.1660930894233; Fri, 19 Aug 2022 10:41:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660930894; cv=none; d=google.com; s=arc-20160816; b=SMqjwDKfnw84wRSG4Y08FWPF/dOZWHccQV2wqpRZevoJkPH0miHmGUVq4x1CQjHBJk +XAdTTkbG45481KLUP6QCM5KPePE3cd0IU2fyynWPa/CBhb0J2huhhDx4FtQjON2ZZ+P fe6D1qu49agEuM5AGCqcq1OAxikKCp8RDNfSNH6ohLBHlVI/ISoclKLhmfrjJOTypfTn QDXzTzs9qLBuajunnCoIdo8/ilaji+mQIs6t0tBHb22wyB26LC5JrzS5N3lC4k9KLFo9 WVh/nmf4QuvyAU4U6kgk7GLesCSo7i+IZZsUqy4Sno2ePMWlaMdYYGJDdnTv6tNL6XCP s4ng== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=MDIkczmEWIpI6t5iWA0ZKFm07xedoiDaEH0sp0TkODU=; b=NmDJ2UQB2X+d2weaFATpCUlyY/hkLfi7UDhR1QhSby+Z37BMEO3tdI4tO2YGGGhEpI nHEHG2/lTEDu3RU6fHje7OIcFf57XrRbpCamMTf2ZRi2l8WbDahzC+UVsWkgLs7VwKzK Ty884Ula3uDSXjDjUi6WLfaQ95oCtQqWSsioYnZPyPIxp4rRaO8SXxlzJkQf6wEweGXg 2wkBF0Gdk9pcW7S3fD+kEHeiY5IO6mjw0v8ZOt/B69L7h+zfpY/bjf6YUCUNY8EWGhjY Aj0MKuJr5+e7D+7OGLh2M4MfUNYXdlp5kegT2IRlxY6MM0zkhxLPhO7/U1iRyXSxub2S EX5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=PaRHqHUm; 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=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jc11-20020a17090325cb00b001708d35847bsi4330127plb.278.2022.08.19.10.41.21; Fri, 19 Aug 2022 10:41:34 -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=@linuxfoundation.org header.s=korg header.b=PaRHqHUm; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352028AbiHSQP2 (ORCPT + 99 others); Fri, 19 Aug 2022 12:15:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37078 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351834AbiHSQO1 (ORCPT ); Fri, 19 Aug 2022 12:14:27 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3DD9C1758F; Fri, 19 Aug 2022 08:58:10 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5DC18612E6; Fri, 19 Aug 2022 15:57:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 60617C433C1; Fri, 19 Aug 2022 15:57:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660924674; bh=qthlUxLyneTrQoXxQBbYo31Gy/R5BpXEYmeBs7zGNCU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PaRHqHUmG0E/aPVypK1aZbHPDALWRA8eY/3vHqw1K11acPiFR01rfMLjHi5SjhZQW opwZG/ASZfGIg17nccGtwHj/6dQ05uPUiwB6vnNJqcKTtrPPCcou8LoCywZJsVx81h PxXnEPKO122iAraGlMSdkwidUQPSy8ApkZ9DEsQQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Rob Clark , Abhinav Kumar , Sasha Levin Subject: [PATCH 5.10 217/545] drm/msm/mdp5: Fix global state lock backoff Date: Fri, 19 Aug 2022 17:39:47 +0200 Message-Id: <20220819153839.072427077@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220819153829.135562864@linuxfoundation.org> References: <20220819153829.135562864@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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 [ Upstream commit 92ef86ab513593c6329d04146e61f9a670e72fc5 ] 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 Patchwork: https://patchwork.freedesktop.org/patch/492701/ Link: https://lore.kernel.org/r/20220707162040.1594855-1-robdclark@gmail.com Signed-off-by: Sasha Levin --- 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.35.1