Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2819414rwb; Mon, 15 Aug 2022 12:00:40 -0700 (PDT) X-Google-Smtp-Source: AA6agR72e8Syw8mcr5jE/SeguicbMx17EF0daUycT273VeSW6vNNFt6yyBsYWzmuxRMiLIpnt2r8 X-Received: by 2002:a17:907:97d5:b0:730:9eac:d965 with SMTP id js21-20020a17090797d500b007309eacd965mr10986667ejc.353.1660590029639; Mon, 15 Aug 2022 12:00:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660590029; cv=none; d=google.com; s=arc-20160816; b=WE1QYTW1HGnf+sKneQB2Ttnk8QD87dLSNG7TVHhSB0QSfPohn24MMy1cDr3d3i50/q rdTJVerUec+FPY7yTIVhm1O+5zxajCnlrmlruvOu43E+StUDyINdihOWZSkjGQ+t4IO7 0yKhvuEwJ2d+uRopjcguj4B3O6KFdPHk8pr5jcWQLxlLb0eO2wljg617zyJ+QL31WB0I uZPdUfeO6dbOkQxUNOB/of+DelPekHAWEtPRjJ4cxK1qbWbIw5Y6FTEEhUCe+wcthpL7 wqQc6CotzMincxgnj2FhQUfL6MTMORIYYb0Urbj99r84nh0ySaCtC9BNhtx/AAVq3nZ7 BE1Q== 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=HsY4Nv9zTUG9eqowHZNKn/WLmkMQHb8/47Y6d82ZS58hb2D1IFS4vs+HKBA1IIlX2K y4/kEomzzfpfhGukjtx9DkBL2vcQoC2+eU/1MLjfre+Jz5nBlOHwK75/p4yTzvkw0sbN jvLHKXTMep2K7CPm82oBqGmWH38bg2iuGmaSmE2T5yYj0FkIZFgMWYZlgkjqPkrUaugg Obh7w/qjET16nj4IwkTnSBh1VxpcdtebiS7djUz4+m8LvcVrgSJiBSYOuvaZmuvNdufC PdxNpeG06AjA3Jb8M/VJCSL/nWltfEVSc7NKW05v59mCUQ6gj7PBjxJn9YvjfLXkD9ar Wllw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vzmaZtt5; 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 q8-20020a056402518800b0043a64ab539bsi9493197edd.60.2022.08.15.11.59.48; Mon, 15 Aug 2022 12:00:29 -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=vzmaZtt5; 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 S244678AbiHOSzk (ORCPT + 99 others); Mon, 15 Aug 2022 14:55:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33816 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244786AbiHOSv5 (ORCPT ); Mon, 15 Aug 2022 14:51:57 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5B51E47B8F; Mon, 15 Aug 2022 11:29:46 -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 9C67061043; Mon, 15 Aug 2022 18:29:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 25006C43142; Mon, 15 Aug 2022 18:29:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588185; bh=qthlUxLyneTrQoXxQBbYo31Gy/R5BpXEYmeBs7zGNCU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vzmaZtt5B23gWGESEJQEwvJEO6LCTck2mzOgN4ii8WcCUi/oQPC0JFRffHUX6WqxH UGcTlNDRlj7ftN4IrMUG6VOHzw8ayXIhteWNA/GboyRrUJ7KFSpVz5vgu/RFeyUemh zpwgI3k6/MomQy142l5CAkeioCTi0XL09u/H398A= 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.15 320/779] drm/msm/mdp5: Fix global state lock backoff Date: Mon, 15 Aug 2022 19:59:24 +0200 Message-Id: <20220815180350.955357281@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@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