AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "George Zhang" <george.zhang@amd.com>, amd-gfx@lists.freedesktop.org
Subject: Re: [PATCH v2 17/30] drm/amd/display: Revoke alternate channel P-State before pipe teardown
Date: Tue, 01 Dec 2026 21:09:41 +0000	[thread overview]
Message-ID: <sashiko-outbox-244269@kernel.org> (raw)
In-Reply-To: <20261201202451.463794-19-george.zhang@amd.com>

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 <ivan.lipski@amd.com>

> 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 <alvin.lee2@amd.com>
> Signed-off-by: Ivan Lipski <ivan.lipski@amd.com>
> Signed-off-by: George Zhang <george.zhang@amd.com>

[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 sequence")

> 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_action(
>  	bool dcfclk_dpm_enabled = dcn60_is_ppclk_dpm_enabled(clk_mgr_internal,
>  			PPCLK_DCFCLK);
>  	bool uclk_pstate_supported = new_clocks->p_state_change_support
> -			|| (total_plane_count == 0);
> +			|| (total_plane_count == 0 && safe_to_lower);
>  
>  	bool fclk_pstate_supported = new_clocks->fclk_p_state_change_support
> -			|| (total_plane_count == 0);
> +			|| (total_plane_count == 0 && safe_to_lower);

[Severity: Medium]
Can gating total_plane_count == 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 == 0, DML21 sets
all_streams_blanked = true and leaves new_clocks->p_state_change_support
and fclk_p_state_change_support as false. During prepare_bandwidth
(safe_to_lower == false), uclk_pstate_supported and fclk_pstate_supported
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_bandwidth() {
	...
	if (p_state_change_support) {
		dc->optimized_required = true;
		context->bw_ctx.bw.dcn.clk.p_state_change_support = 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 == 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_action(
>  	}
>  
>  	if (new_clocks->alt_ch_pstate_switch != clk_mgr_base->clks.alt_ch_pstate_switch) {
> -		action->alt_ch.enable = new_clocks->alt_ch_pstate_switch;
> -		action->alt_ch.disable = !new_clocks->alt_ch_pstate_switch
> +		/* PMFW hangs if alt-ch is still allowed while pipes are torn down */
> +		action->alt_ch.enable = new_clocks->alt_ch_pstate_switch
>  				&& safe_to_lower;
> +		action->alt_ch.disable = !new_clocks->alt_ch_pstate_switch;
>  		action->alt_ch.send_message = 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 = 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.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261201202451.463794-2-george.zhang@amd.com?part=17

  reply	other threads:[~2026-12-01 21:09 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-01 20:22 [PATCH v2 00/30] DC Patches for Nov 30 2026 George Zhang
2026-12-01 20:22 ` [PATCH v2 01/30] drm/amd/display: cast clamped rate conversion George Zhang
2026-12-01 20:22 ` [PATCH v2 02/30] drm/amd/display: Split HWSS_CURSOR_LOCK into flat BLS operations George Zhang
2026-12-01 20:22 ` [PATCH v2 03/30] drm/amd/display: clamp AUX reply length as unsigned George Zhang
2026-12-01 20:22 ` [PATCH v2 04/30] drm/amd/display: keep the DPCD read result signed in the MST ISR George Zhang
2026-12-01 20:22 ` [PATCH v2 05/30] drm/amd/display: copy only the status byte on a DMUB AUX write status retry George Zhang
2026-12-01 20:22 ` [PATCH v2 06/30] drm/amd/display: test the DMUB AUX write status reply copy George Zhang
2026-12-01 20:22 ` [PATCH v2 07/30] drm/amd/display: Account for downspread and DFS in clock validation George Zhang
2026-12-01 20:49   ` sashiko-bot
2026-12-01 20:22 ` [PATCH v2 08/30] drm/amd/display: Read max LSDMA BW from DMU George Zhang
2026-12-01 20:22 ` [PATCH v2 09/30] drm/amd/display: Precompute EASF lookup thresholds George Zhang
2026-12-01 20:22 ` [PATCH v2 10/30] drm/amd/display: Make DPP_SET_INPUT_TRANSFER_FUNC BLS compliant George Zhang
2026-12-01 20:22 ` [PATCH v2 11/30] drm/amd/display: Add pipe init to core2 George Zhang
2026-12-01 20:54   ` sashiko-bot
2026-12-01 20:22 ` [PATCH v2 12/30] drm/amd/display: Fix HDMI FRL no_timeout behavior George Zhang
2026-12-01 20:42   ` sashiko-bot
2026-12-01 20:22 ` [PATCH v2 13/30] drm/amd/display: Re-enable HUBP/DPP Driver PG on DCN42 George Zhang
2026-12-01 20:22 ` [PATCH v2 14/30] drm/amd/display: Program DSC on one stream in DC2 George Zhang
2026-12-01 20:55   ` sashiko-bot
2026-12-01 20:22 ` [PATCH v2 15/30] drm/amd/display: enable dcn42b hubp/dpp pg control from driver side George Zhang
2026-12-01 20:22 ` [PATCH v2 16/30] drm/amd/display: cover gamma 2.4 and 2.6 on the wide curve George Zhang
2026-12-01 20:22 ` [PATCH v2 17/30] drm/amd/display: Revoke alternate channel P-State before pipe teardown George Zhang
2026-12-01 21:09   ` sashiko-bot [this message]
2026-12-01 20:22 ` [PATCH v2 18/30] drm/amd/display: block pr in mst right George Zhang
2026-12-01 20:46   ` sashiko-bot
2026-12-01 20:22 ` [PATCH v2 19/30] drm/amd/display: Add a per-ASIC default for the DC2 selection George Zhang
2026-12-01 20:22 ` [PATCH v2 20/30] drm/amd/display: Refactor Max VStartup calculations for DCN6 George Zhang
2026-12-01 20:22 ` [PATCH v2 21/30] drm/amd/display: Improve P-state admissability logic George Zhang
2026-12-01 20:50   ` sashiko-bot
2026-12-01 20:22 ` [PATCH v2 22/30] drm/amd/display: Flip every DPP pipe of the stream in DC2 George Zhang
2026-12-01 21:00   ` sashiko-bot
2026-12-01 20:22 ` [PATCH v2 23/30] drm/amd/display: Report a DC2 BLS step overflow behind a debug option George Zhang
2026-12-01 20:22 ` [PATCH v2 24/30] drm/amd/display: VRR Support on Direct MST Sinks George Zhang
2026-12-01 20:22 ` [PATCH v2 25/30] drm/amd/display: Program YCbCr output in DC2 George Zhang
2026-12-01 20:23 ` [PATCH v2 26/30] drm/amd/display: Skip a stream with no OTG master " George Zhang
2026-12-01 20:23 ` [PATCH v2 27/30] drm/amd/display: Sync OTG timing in the DC2 non-seamless commit George Zhang
2026-12-01 20:57   ` sashiko-bot
2026-12-01 20:23 ` [PATCH v2 28/30] drm/amd/display: Move shared dcn401 builder code to its own file George Zhang
2026-12-01 20:23 ` [PATCH v2 29/30] drm/amd/display: Allow disabling CRC capture when the stream is gone George Zhang
2026-12-01 20:52   ` sashiko-bot
2026-12-01 20:23 ` [PATCH v2 30/30] drm/amd/display: Promote DC to 3.2.410 George Zhang
2026-12-01 20:45   ` sashiko-bot

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=sashiko-outbox-244269@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=george.zhang@amd.com \
    --cc=sashiko-reviews@lists.linux.dev \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox