From: sashiko-bot@kernel.org
To: "George Zhang" <george.zhang@amd.com>, amd-gfx@lists.freedesktop.org
Subject: Re: [PATCH v2 27/30] drm/amd/display: Sync OTG timing in the DC2 non-seamless commit
Date: Tue, 01 Dec 2026 20:57:09 +0000 [thread overview]
Message-ID: <sashiko-outbox-244259@kernel.org> (raw)
In-Reply-To: <20261201202451.463794-29-george.zhang@amd.com>
Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Medium] drm/amd/display: missed OTG sync in
dcn401_timing_sync_source()
- [Medium] drm/amd/display: data race on static buffers in
wa_dpg_height_apply()
--
commit 38a0b1198247f1d2010554b1b7b6370ab3f8b13a
Author: Tony Cheng <tony.cheng@amd.com>
drm/amd/display: Sync OTG timing in the DC2 non-seamless commit
This commit adds OTG timing synchronization steps to the DCN401 DC2
non-seamless commit builder and registers a workaround to raise the DPG
height around the OTG reset trigger steps.
> diff --git a/drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_seamless_builder.c b/drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_seamless_builder.c
> index 6ee61bea0c0bc..9ad9081b1b9ae 100644
> --- a/drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_seamless_builder.c
> +++ b/drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_seamless_builder.c
[ ... ]
> @@ -2853,6 +2871,42 @@ static bool dcn401_walks_stream(const struct dcn401_commit_step_args *args,
> args->new_state, stream);
> }
>
> +/*
> + * The OTG master that pipe resets to, chosen as program_timing_sync does:
> + * the first OTG master with the same timing that shows a plane, else the
> + * first one. NULL when that is pipe.
> + */
> +static const struct pipe_ctx *dcn401_timing_sync_source(
> + const struct dcn401_commit_step_args *args,
> + const struct pipe_ctx *pipe)
> +{
> + const struct dc_state_update_flags *flags = args->update_flags;
> + const struct pipe_ctx *source = NULL;
> + const struct pipe_ctx *member;
> + unsigned int i;
> +
> + if (args->dc->debug.disable_timing_sync)
> + return NULL;
> + for (i = 0; i < args->dc->res_pool->pipe_count; i++) {
> + member = &args->new_state->res_ctx.pipe_ctx[i];
> + if (!member->stream || member->top_pipe ||
> + member->prev_odm_pipe ||
> + !resource_are_streams_timing_synchronizable(
> + member->stream, pipe->stream))
> + continue;
> + if (flags->cur_pipes[i].has_plane &&
> + flags->new_pipes[i].has_plane) {
> + source = member;
> + break;
> + }
> + if (!source)
> + source = member;
> + }
> + if (!source || source->pipe_idx == pipe->pipe_idx)
> + return NULL;
> + return source;
> +}
[Severity: Medium]
Can dcn401_timing_sync_source() skip OTG timing synchronization when a kept
stream had no plane in current_state?
Because dcn401_timing_sync_source() only prioritizes an OTG master when
both flags->cur_pipes[i].has_plane and flags->new_pipes[i].has_plane are
set, it falls back to the lowest matching pipe_idx when a kept stream had
no plane in current_state. If a newly enabled stream with the same timing
is allocated on a lower pipe_idx (e.g. pipe 0) than the kept stream (e.g.
pipe 1), dcn401_timing_sync_source() picks pipe 0 as source and returns
NULL for pipe 0 because source->pipe_idx == pipe->pipe_idx. Meanwhile,
when bls_sync is expanded, dcn401_walks_stream() skips all kept streams
(!dcn401_stream_kept()), so neither stream emits TG_ENABLE_RESET_TRIGGER
and the two OTGs remain out of phase.
In addition, if that kept stream gains a plane during the commit,
dcn401_add_stream_update() enables its plane and unblanks its OPP before
bls_postamble, yet the second bls_sync pass still checks
flags->cur_pipes[i].has_plane && flags->new_pipes[i].has_plane and fails to
select the newly unblanked kept stream as the timing sync source.
> diff --git a/drivers/gpu/drm/amd/display/dc/workaround_manager/workaround_manager.c b/drivers/gpu/drm/amd/display/dc/workaround_manager/workaround_manager.c
> index 067a7069186bb..7e7e29d2530ad 100644
> --- a/drivers/gpu/drm/amd/display/dc/workaround_manager/workaround_manager.c
> +++ b/drivers/gpu/drm/amd/display/dc/workaround_manager/workaround_manager.c
> @@ -4,19 +4,129 @@
> */
>
> #include "dm_services.h"
> +#include "core_types.h"
> #include "workaround_manager/workaround_manager.h"
>
> -static const struct workaround_manager dc2_wam_empty = {
> - .registry = NULL,
> - .count = 0,
> -};
> -
> /* BSS, not the stack: 64 block_sequence entries exceed the kernel frame limit. */
> static struct block_sequence dc2_wam_saved_steps[DC2_BLS_MAX_STEPS];
> +static struct block_sequence dc2_wam_input_steps[DC2_BLS_MAX_STEPS];
[ ... ]
> +static enum workaround_manager_result wa_dpg_height_apply(
> + struct block_sequence_state *bls,
> + const struct workaround_context *ctx)
> +{
> + struct block_sequence *in = dc2_wam_input_steps;
> + unsigned int num = *bls->num_steps;
> + unsigned int n = 0;
> + unsigned int i = 0;
> + unsigned int j = 0;
> +
> + memmove(in, bls->steps, num * sizeof(in[0]));
> + for (i = 0; i < num; i = j) {
> + for (j = i + 1; j < num && in[j].func == in[i].func; j++)
> + ;
> + if (in[i].func == TG_ENABLE_RESET_TRIGGER &&
> + !wa_dpg_height_add(bls->steps, &n, ctx->target,
> + &in[i], j - i, true))
> + return WAM_SIZE_EXCEEDED;
> + if (n + j - i > DC2_BLS_MAX_STEPS)
> + return WAM_SIZE_EXCEEDED;
> + memmove(&bls->steps[n], &in[i], (j - i) * sizeof(in[0]));
> + n += j - i;
> + if (in[i].func == TG_DISABLE_RESET_TRIGGER &&
> + !wa_dpg_height_add(bls->steps, &n, ctx->target,
> + &in[i], j - i, false))
> + return WAM_SIZE_EXCEEDED;
> + }
> + *bls->num_steps = n;
> + return WAM_OK;
> +}
[Severity: Medium]
Can concurrent calls to workaround_manager_apply() race on the static
dc2_wam_input_steps and dc2_wam_saved_steps arrays?
dc2_wam_input_steps and dc2_wam_saved_steps are file-scope static buffers
shared across all struct dc instances without a lock. If two threads run
core2_run_sequence() concurrently (for example, modesets on two AMD GPUs,
each serialized only by its own per-device adev->dm.dc_lock), they will
overwrite dc2_wam_input_steps and dc2_wam_saved_steps while rebuilding or
restoring bls->steps, corrupting the block_sequence array passed to
dc2_bls_execute().
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261201202451.463794-2-george.zhang@amd.com?part=27
next prev parent reply other threads:[~2026-12-01 20:57 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
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 [this message]
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-244259@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 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.