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 29/30] drm/amd/display: Allow disabling CRC capture when the stream is gone
Date: Tue, 01 Dec 2026 20:52:17 +0000	[thread overview]
Message-ID: <sashiko-outbox-244251@kernel.org> (raw)
In-Reply-To: <20261201202451.463794-31-george.zhang@amd.com>

Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Medium] drm/amd/display: -ERESTARTSYS leak in
  amdgpu_dm_crtc_set_crc_source()
- [Low] drm/amd/display: missing Fixes trailers for CRC disable and wait
  fixes
--

commit 2f86e15468fe1d63c83a78c1c2e170de1de07582
Author: James Lin <pinglei.lin@amd.com>

> drm/amd/display: Allow disabling CRC capture when the stream is gone
>
> [Why]
> Stopping CRC capture while the CRTC has no stream (e.g. after DPMS off)
> makes amdgpu_dm_crtc_configure_crc_source() return -EINVAL. That aborts
> amdgpu_dm_crtc_set_crc_source() before it clears crc_src and resets
> crc_skip_count. The stale crc_src makes the CRC handler capture again as
> soon as the next stream is enabled, and with crc_skip_count still >= 2 the
> first (all-zero) CRC of the fresh CRC engine is reported to userspace.
> This shows up as intermittent failures of
> igt@kms_pipe_crc_basic@disable-crc-after-crtc
> (CRC mismatch, 0x59b7 != 0x0).
>
> [How]
> Only return -EINVAL for a missing stream when enabling, where programming
> is deferred to stream enable. When disabling there is nothing to program,
> so return success and let the caller drop its vblank reference, clear
> crc_src and reset the skip count. Also clear the positive
> remaining-jiffies value returned by
> wait_for_completion_interruptible_timeout() so a successful wait for a
> pending commit isn't returned to the caller as a non-zero result.
>
> Signed-off-by: James Lin <pinglei.lin@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
-EINVAL return on disable without a stream and the unreset wait return value?

  Fixes: bbc49fc0326b ("drm/amd/display: Avoid get/put vblank when stream disabled")
  Fixes: 5eb2fdafeb6f ("drm/amd/display: Fix CRC open failure during active rendering")

> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crc.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crc.c
> index db546dd44b913..07b3bc45ac86e 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crc.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crc.c

[ ... ]

> @@ -696,6 +700,10 @@ int amdgpu_dm_crtc_set_crc_source(struct drm_crtc *crtc, const char *src_name)
>  			ret = -ETIMEDOUT;
>  			goto cleanup;
>  		}
> +
> +		/* Wait succeeded; don't leak the remaining jiffies. */
> +		if (ret > 0)
> +			ret = 0;
>  	}
>  
>  	enable = amdgpu_dm_is_valid_crc_source(source);

[Severity: Medium]
Does amdgpu_dm_crtc_set_crc_source() still leak -ERESTARTSYS in ret when
wait_for_completion_interruptible_timeout() is interrupted by a signal?

Because the check above only jumps to cleanup when ret < 0 && ret !=
-ERESTARTSYS, a signal interruption falls through with ret == -ERESTARTSYS.
Any path that does not overwrite ret via drm_crtc_vblank_get() (such as
disabling CRC capture or switching between active sources) completes the state
update and then returns -ERESTARTSYS.  Falling through before commit->hw_done
completes also races with amdgpu_dm_atomic_commit_tail() reading
acrtc->dm_irq_params.crc_src and calling
amdgpu_dm_crtc_configure_crc_source().

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

  reply	other threads:[~2026-12-01 20:52 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
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 [this message]
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-244251@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