Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp3412732rwa; Tue, 23 Aug 2022 04:28:59 -0700 (PDT) X-Google-Smtp-Source: AA6agR6nIfIQ/aZ5meLusUJ8XOG/TDvIt8AoRzo//8zIKA6tFiLWCGLqR5Df5L0LXcVfhAGR5jYs X-Received: by 2002:a17:907:7e8a:b0:732:ff29:d1d6 with SMTP id qb10-20020a1709077e8a00b00732ff29d1d6mr16606803ejc.175.1661254138895; Tue, 23 Aug 2022 04:28:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661254138; cv=none; d=google.com; s=arc-20160816; b=CrNs3S3RBfUU+eujo/b+4njXs79fzuOtIDPnGZNmnNqyN9/XL6zFmVfI4yI/w77RGq n+4z7Lu2BYbe+jjqy+frgZITDmR3+VjRnbTDwHZhdtLGQN+TArLAPN6MCrUgTWfhcLg9 GeuDw0O2IiIsPoJYKOtNI8/ZBvQaDmH9ot6sBvwE9JXsXepE/bLa7S3ZzFacCWCUZ32C xe280ZthNylBMDYuFz8/bZFCE+QMdHG0UKwHSXz0dRdeoZE/p256CtKnBNY1sFtP/5mg e+D7R3KTMcy7Obuo2ckV1ii9rJJtrDhZXJUHqp08Ku7iV8TNhA4fgESypOYHYWQDzNWd NU3g== 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=jHDkQ4ILYQ3ryfqBlvm6at7MSwefxlksvax1+cNbE6A=; b=gwAwCCL2H2u03eqHsrlphm/tUJ70/THw7GIsl0g1Aigcio1eAvUPq/Dt3e2lFFExGE Sy76K3eJxWtgDulboCrA9ooVS+BBRpKK6IuCW93pJ/GLzSC6bJ/WP3+zw9YiwOBp4DFR +87cGRQzKmyT8RoxdnUzIOlGfiIRwLYom2J8guXrZF675yDXPNeTBbbPK5n8Jn2o6AJW ZSYQGpsGGzWNTyYVrG6wRLvtBCdBdQFBFQGP0wvVswjhc2RVtw1eusrWOJk8jbtN25zX GRDf5M2lcc5MdhN/fGx7v1CBxoDYBlxMDIf0ojx2UtlgekF/WKvEWn6X1Mmq5cNLuRQ7 tuGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=RwaFwPK1; 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 v20-20020a50a454000000b0044622fc1d8dsi1966218edb.183.2022.08.23.04.28.33; Tue, 23 Aug 2022 04:28:58 -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=RwaFwPK1; 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 S1355182AbiHWKiB (ORCPT + 99 others); Tue, 23 Aug 2022 06:38:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44164 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355127AbiHWKW5 (ORCPT ); Tue, 23 Aug 2022 06:22:57 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C2EAC83052; Tue, 23 Aug 2022 02:04:09 -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 D816D6157B; Tue, 23 Aug 2022 09:04:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7BB28C433C1; Tue, 23 Aug 2022 09:04:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661245448; bh=xkG7HBVSpzEct9/zDdbjFzkOFGecZni2qgP8RFOi378=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RwaFwPK1HLZn9pBxaWcGnwopX5OHqk+4+VenFpK2ZcPO9AfLYHZ8JJk0U929jzFC1 NyvtF+KTxQ66H9UFpubVBX8wMWsdCnzoUJ+1l4yBaVgbCUouvSbSoP3XIrGrvMJ1i3 1aEOr1PfJUD1/GqXVYEaWDVWv9fwk9sQe+ktEbJU= 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 4.19 082/287] drm/msm/mdp5: Fix global state lock backoff Date: Tue, 23 Aug 2022 10:24:11 +0200 Message-Id: <20220823080103.031636281@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080100.268827165@linuxfoundation.org> References: <20220823080100.268827165@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 88de12225582..69fe09b41087 100644 --- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_pipe.c +++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_pipe.c @@ -134,12 +134,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