All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tom Chung <chiahsuan.chung@amd.com>
To: <amd-gfx@lists.freedesktop.org>
Cc: stylon.wang@amd.com, Josip Pavic <Josip.Pavic@amd.com>,
	Tom Chung <chiahsuan.chung@amd.com>,
	Sunpeng.Li@amd.com, Harry.Wentland@amd.com,
	qingqing.zhuo@amd.com, Rodrigo.Siqueira@amd.com,
	roman.li@amd.com, solomon.chiu@amd.com, Aurabindo.Pillai@amd.com,
	wayne.lin@amd.com, Jun Lei <Jun.Lei@amd.com>,
	Bhawanpreet.Lakha@amd.com, agustin.gutierrez@amd.com,
	pavle.kotarac@amd.com
Subject: [PATCH 12/32] drm/amd/display: Avoid MPC infinite loop
Date: Sat, 6 Aug 2022 01:58:06 +0800	[thread overview]
Message-ID: <20220805175826.2992171-13-chiahsuan.chung@amd.com> (raw)
In-Reply-To: <20220805175826.2992171-1-chiahsuan.chung@amd.com>

From: Josip Pavic <Josip.Pavic@amd.com>

[Why]
In some cases MPC tree bottom pipe ends up point to itself.  This causes
iterating from top to bottom to hang the system in an infinite loop.

[How]
When looping to next MPC bottom pipe, check that the pointer is not same
as current to avoid infinite loop.

Reviewed-by: Jun Lei <Jun.Lei@amd.com>
Acked-by: Tom Chung <chiahsuan.chung@amd.com>
Signed-off-by: Josip Pavic <Josip.Pavic@amd.com>
---
 drivers/gpu/drm/amd/display/dc/dcn10/dcn10_mpc.c | 6 ++++++
 drivers/gpu/drm/amd/display/dc/dcn20/dcn20_mpc.c | 6 ++++++
 2 files changed, 12 insertions(+)

diff --git a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_mpc.c b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_mpc.c
index 769974375b4b..8e9384094f6d 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_mpc.c
+++ b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_mpc.c
@@ -131,6 +131,12 @@ struct mpcc *mpc1_get_mpcc_for_dpp(struct mpc_tree *tree, int dpp_id)
 	while (tmp_mpcc != NULL) {
 		if (tmp_mpcc->dpp_id == dpp_id)
 			return tmp_mpcc;
+
+		/* avoid circular linked list */
+		ASSERT(tmp_mpcc != tmp_mpcc->mpcc_bot);
+		if (tmp_mpcc == tmp_mpcc->mpcc_bot)
+			break;
+
 		tmp_mpcc = tmp_mpcc->mpcc_bot;
 	}
 	return NULL;
diff --git a/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_mpc.c b/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_mpc.c
index 3d307dd58e9a..116f67a0b989 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_mpc.c
+++ b/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_mpc.c
@@ -531,6 +531,12 @@ static struct mpcc *mpc2_get_mpcc_for_dpp(struct mpc_tree *tree, int dpp_id)
 	while (tmp_mpcc != NULL) {
 		if (tmp_mpcc->dpp_id == 0xf || tmp_mpcc->dpp_id == dpp_id)
 			return tmp_mpcc;
+
+		/* avoid circular linked list */
+		ASSERT(tmp_mpcc != tmp_mpcc->mpcc_bot);
+		if (tmp_mpcc == tmp_mpcc->mpcc_bot)
+			break;
+
 		tmp_mpcc = tmp_mpcc->mpcc_bot;
 	}
 	return NULL;
-- 
2.25.1


  parent reply	other threads:[~2022-08-05 18:00 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-05 17:57 [PATCH 00/32] DC Patches July 29 2022 Tom Chung
2022-08-05 17:57 ` [PATCH 01/32] drm/amd/display: Use pixels per container logic for DCN314 DCCG dividers Tom Chung
2022-08-05 17:57 ` [PATCH 02/32] drm/amd/display: Create FPU files for DCN314 Tom Chung
2022-08-05 17:57 ` [PATCH 03/32] drm/amd/display: Move populate dml pipes from DCN314 to dml Tom Chung
2022-08-05 17:57 ` [PATCH 04/32] drm/amd/display: Drop FPU flags from Makefile Tom Chung
2022-08-05 17:57 ` [PATCH 05/32] drm/amd/display: fix CAB allocation for multiple displays Tom Chung
2022-08-05 17:58 ` [PATCH 06/32] drm/amd/display: Revert "fix 32 bit compilation errors in dc_dmub_srv.c" Tom Chung
2022-08-05 17:58 ` [PATCH 07/32] drm/amd/display: Add a variable to update FCLK latency Tom Chung
2022-08-05 17:58 ` [PATCH 08/32] drm/amd/display: Refactor SubVP calculation to remove FPU Tom Chung
2022-08-05 17:58 ` [PATCH 09/32] drm/amd/display: Fix TMDS 4K@60Hz YCbCr420 corruption issue Tom Chung
2022-08-05 17:58 ` [PATCH 10/32] drm/amd/display: Device flash garbage before get in OS Tom Chung
2022-08-05 17:58 ` [PATCH 11/32] drm/amd/display: Add 16 lines margin for SubVP Tom Chung
2022-08-05 17:58 ` Tom Chung [this message]
2022-08-05 17:58 ` [PATCH 13/32] drm/amd/display: Fix subvp calculations Tom Chung
2022-08-05 17:58 ` [PATCH 14/32] drm/amd/display: Fix HDMI VSIF V3 incorrect issue Tom Chung
2022-08-05 17:58 ` [PATCH 15/32] drm/amd/display: Add documentation to some of the cursor struct Tom Chung
2022-08-05 17:58 ` [PATCH 16/32] drm/amd/display: Add basic kernel doc to CRC code under DC Tom Chung
2022-08-05 17:58 ` [PATCH 17/32] drm/amd/display: Add some extra kernel doc to amdgpu_dm Tom Chung
2022-08-05 17:58 ` [PATCH 18/32] drm/amd/display: Document pipe split policy Tom Chung
2022-08-05 17:58 ` [PATCH 19/32] drm/amd/display: Expand documentation for timing Tom Chung
2022-08-05 17:58 ` [PATCH 20/32] drm/amd/display: Document some of the DML structs Tom Chung
2022-08-05 17:58 ` [PATCH 21/32] drm/amd/display: Allow alternate prefetch modes in DML for DCN32 Tom Chung
2022-08-05 17:58 ` [PATCH 22/32] drm/amd/display: Fix Compile-time Warning Tom Chung
2022-08-05 17:58 ` [PATCH 23/32] drm/amd/display: Fix VPG instancing for dcn314 HPO Tom Chung
2022-08-05 17:58 ` [PATCH 24/32] drm/amd/display: Check correct bounds for stream encoder instances for DCN303 Tom Chung
2022-08-05 17:58   ` Tom Chung
2022-08-05 17:58 ` [PATCH 25/32] drm/amd/display: Enable SubVP by default on DCN32 & DCN321 Tom Chung
2022-08-05 17:58 ` [PATCH 26/32] drm/amd/display: Correct DTBCLK for dcn314 Tom Chung
2022-08-05 17:58 ` [PATCH 27/32] drm/amd/display: Revert "attempt to fix the logic in commit_planes_for_stream()" Tom Chung
2022-08-05 17:58 ` [PATCH 28/32] drm/amd/display: For stereo keep "FLIP_ANY_FRAME" Tom Chung
2022-08-05 17:58 ` [PATCH 29/32] drm/amd/display: Don't try to enter MALL SS if stereo3d Tom Chung
2022-08-05 17:58 ` [PATCH 30/32] drm/amd/display: clear optc underflow before turn off odm clock Tom Chung
2022-08-05 17:58 ` [PATCH 31/32] drm/amd/display: Fix TDR eDP and USB4 display light up issue Tom Chung
2022-08-05 17:58 ` [PATCH 32/32] drm/amd/display: 3.2.197 Tom Chung
2022-08-08 15:38 ` [PATCH 00/32] DC Patches July 29 2022 Wheeler, Daniel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220805175826.2992171-13-chiahsuan.chung@amd.com \
    --to=chiahsuan.chung@amd.com \
    --cc=Aurabindo.Pillai@amd.com \
    --cc=Bhawanpreet.Lakha@amd.com \
    --cc=Harry.Wentland@amd.com \
    --cc=Josip.Pavic@amd.com \
    --cc=Jun.Lei@amd.com \
    --cc=Rodrigo.Siqueira@amd.com \
    --cc=Sunpeng.Li@amd.com \
    --cc=agustin.gutierrez@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=pavle.kotarac@amd.com \
    --cc=qingqing.zhuo@amd.com \
    --cc=roman.li@amd.com \
    --cc=solomon.chiu@amd.com \
    --cc=stylon.wang@amd.com \
    --cc=wayne.lin@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.