From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C1F11606A31A for ; Tue, 1 Dec 2026 21:09:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=c05EPS0h Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6301610E43F; Tue, 1 Dec 2026 21:09:48 +0000 (UTC) Received: from sea.source.kernel.org (sea.source.kernel.org [172.234.252.31]) by gabe.freedesktop.org (Postfix) with ESMTPS id E41C910FD28 for ; Tue, 1 Dec 2026 21:09:41 +0000 (UTC) Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id A94E24061B; Tue, 1 Dec 2026 21:09:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 768401F000C1; Tue, 1 Dec 2026 21:09:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796159381; bh=IayjLxnJT/XG8sRu9Nm/3VqWQo01mgAU1snCn8AYy30=; h=From:Subject:Reply-To:To:In-Reply-To:References:Date; b=c05EPS0hYvznhAZrqXclT/Xi+nXzddIABwYUiGDgdK/jexvtq0cGngaw7r/HdA6QH ggps11QfAy4XUrBBrdHA/vw2OVD3KZp5ZrtW8NxPANFtn0PSbF4jpc7ir1qTC+xa99 ogVmIo6fEKFVn71SkVP/K6Ap5U91kb+/skQ1I1zAG6NzjV1i+UtocaOqk2ZjljDEIX PrEZ4paLO/NryjRfg2oW1Hc1WG5Q2SCEgcvCJONC/muwz4HQm56TMsGPfOYQxoXvnC J8wO5em3SLZugykIqm9Pw3j0qcAk6sJMxkuSbGK3r0iznc4kodGY8hm8Ji+Xv0VmQo v0dHoyPQCLKEA== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v2 17/30] drm/amd/display: Revoke alternate channel P-State before pipe teardown To: "George Zhang" , amd-gfx@lists.freedesktop.org In-Reply-To: <20261201202451.463794-19-george.zhang@amd.com> References: <20261201202451.463794-2-george.zhang@amd.com> <20261201202451.463794-19-george.zhang@amd.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Tue, 01 Dec 2026 21:09:41 +0000 X-BeenThere: amd-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion list for AMD gfx List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: sashiko-reviews@lists.linux.dev Sender: "amd-gfx" X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 X-Archived-By: Thank you for your contribution! Sashiko AI review found 3 potential issues to consider: - [Medium] drm/amd/display: alt_ch_pstate_switch not revoked in prepare_bandwidth() - [Medium] drm/amd/display: UCLK/FCLK P-State left disabled in dcn60_update_clocks() - [Low] drm/amd/display: missing Fixes: trailers for DCN6 P-State sequencing fix -- commit 68003479a603655940aa4cfb42034d78591d357d Author: Ivan Lipski > drm/amd/display: Revoke alternate channel P-State before pipe teardown > > [Why] > A modeset after stress testing can hang PMFW. The hang only happens > when alternate channel P-State switching is in use. > > Alternate channel P-State permission was sequenced the opposite way to > UCLK/FCLK P-State: it could be enabled during prepare_bandwidth, before > the new configuration was programmed, and was only disabled during > optimize_bandwidth, after the old configuration had been torn down. > PMFW could therefore start an alternate channel switch that depended on > a display being disabled and never complete it. > > The IndicatePstateStatus messages also did not follow the computed > action. With no active planes, prepare_bandwidth decided to revoke > UCLK/FCLK P-State but still told PMFW they were allowed, and the enable > message could briefly re-allow a state the action was revoking. > > [How] > Only allow alternate channel P-State when it is safe to lower, and > revoke it as soon as the new state does not support it. > > Only treat zero active planes as UCLK/FCLK P-State support when it is > safe to lower, so prepare_bandwidth never grants it for a config that > has not been programmed yet. > > Derive allow_uclk, allow_fclk and alt_ch_enable once from the action > and the current clocks. The IndicatePstateStatus messages no longer > recount the active planes to allow UCLK/FCLK P-State on their own; the > zero plane case is decided only by the action. > > Cc: Alvin Lee > Signed-off-by: Ivan Lipski > Signed-off-by: George Zhang [Severity: Low] Should this bug fix include Fixes: tags for the commits that introduced the DCN6 P-State sequencing and IndicatePstateStatus handling? Fixes: 7f7d7ea1fa51 ("drm/amd/display: Add new sources for DCN6") Fixes: fb48cc34206c ("drm/amd/display: Update indicate pstate enable sequ= ence") > diff --git a/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn60/dcn60_clk_mgr.c= b/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn60/dcn60_clk_mgr.c > index 9556da79cdce1..4b73dd8b5382b 100644 > --- a/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn60/dcn60_clk_mgr.c > +++ b/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn60/dcn60_clk_mgr.c > @@ -1211,10 +1211,10 @@ static void dcn60_make_bandwidth_clocks_update_ac= tion( > bool dcfclk_dpm_enabled =3D dcn60_is_ppclk_dpm_enabled(clk_mgr_internal, > PPCLK_DCFCLK); > bool uclk_pstate_supported =3D new_clocks->p_state_change_support > - || (total_plane_count =3D=3D 0); > + || (total_plane_count =3D=3D 0 && safe_to_lower); > =20 > bool fclk_pstate_supported =3D new_clocks->fclk_p_state_change_support > - || (total_plane_count =3D=3D 0); > + || (total_plane_count =3D=3D 0 && safe_to_lower); [Severity: Medium] Can gating total_plane_count =3D=3D 0 on safe_to_lower leave UCLK and FCLK P-State permanently disabled after a stream update on a stream that already has zero active planes? When stream_count > 0 and total_plane_count =3D=3D 0, DML21 sets all_streams_blanked =3D true and leaves new_clocks->p_state_change_support and fclk_p_state_change_support as false. During prepare_bandwidth (safe_to_lower =3D=3D false), uclk_pstate_supported and fclk_pstate_support= ed now evaluate to false, so should_update_pstate_support() actively revokes UCLK and FCLK P-State in PMFW. However, in dcn401_prepare_bandwidth(), dc->optimized_required is only set when context->bw_ctx.bw.dcn.clk.p_state_change_support is true or when watermarks, arbiter, or compbuf_size change: drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.c:dcn401_prepare_ba= ndwidth() { ... if (p_state_change_support) { dc->optimized_required =3D true; context->bw_ctx.bw.dcn.clk.p_state_change_support =3D false; } ... } When updating a stream that already had zero planes in dc->current_state, none of those change and dc->optimized_required stays false. dc_post_update_surfaces_to_stream() then skips optimize_bandwidth(), so update_clocks() never runs with safe_to_lower =3D=3D true to re-enable UCLK and FCLK P-State, leaving memory and fabric clocks pinned at high DPM levels. [ ... ] > @@ -1282,9 +1282,10 @@ static void dcn60_make_bandwidth_clocks_update_act= ion( > } > =20 > if (new_clocks->alt_ch_pstate_switch !=3D clk_mgr_base->clks.alt_ch_pst= ate_switch) { > - action->alt_ch.enable =3D new_clocks->alt_ch_pstate_switch; > - action->alt_ch.disable =3D !new_clocks->alt_ch_pstate_switch > + /* PMFW hangs if alt-ch is still allowed while pipes are torn down */ > + action->alt_ch.enable =3D new_clocks->alt_ch_pstate_switch > && safe_to_lower; > + action->alt_ch.disable =3D !new_clocks->alt_ch_pstate_switch; > action->alt_ch.send_message =3D action->alt_ch.enable > || action->alt_ch.disable; > } [Severity: Medium] Does alt_ch_pstate_switch remain enabled in PMFW during prepare_bandwidth when transitioning between two configurations that both use alternate channel P-State switching? dcn401_prepare_bandwidth() temporarily forces context->bw_ctx.bw.dcn.clk.p_state_change_support =3D false before calling update_clocks() and disabling FAMS2 in DMUB, but it does not clear context->bw_ctx.bw.dcn.clk.alt_ch_pstate_switch. If a modeset or full plane update tears down or reconfigures pipes while at least one plane in the new context still uses P_STATE_ALT, both clk_mgr_base->clks.alt_ch_pstate_switch and new_clocks->alt_ch_pstate_switch are true during prepare_bandwidth. action->alt_ch.disable is then not set, and alt_ch_enable remains true in the CLK_MGR60_INDICATE_PSTATE_STATUS message sent before FAMS2 is disabled and pipes are torn down. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261201202451.4637= 94-2-george.zhang@amd.com?part=3D17