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 B174E606A31A for ; Tue, 1 Dec 2026 20:52:30 +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=Mo2FQoWx Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4C26710E447; Tue, 1 Dec 2026 20:52:25 +0000 (UTC) Received: from tor.source.kernel.org (tor.source.kernel.org [172.105.4.254]) by gabe.freedesktop.org (Postfix) with ESMTPS id CB68310E29C for ; Tue, 1 Dec 2026 20:52:18 +0000 (UTC) Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with ESMTP id 369446175B; Tue, 1 Dec 2026 20:52:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CDFD01F000C1; Tue, 1 Dec 2026 20:52:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796158337; bh=YOX0v8KN/S6b7DazjtfngVFZOVwGhL1GrYyD7YGOygg=; h=From:Subject:Reply-To:To:In-Reply-To:References:Date; b=Mo2FQoWxvIFmygNjHW731+PjjxdPLN7CDYpW73EANfX9+us7r1Q/BdZiOF3TL9nqS jiziI6M0BKcuMeP5Nx7nODR9KYJlHX82at1fRCFydKWEqsvkAI9J3WEXDIKal8p0FP gNJo7rskNyRhbgoha6Fy6IjVQ+M0DuTFd2xR7CLlEQ0JKwxGcsMiwwUJqwsg63d8rv BCDxAF8Hh4eVN+qyo1Sa3ayZN6wj4kkc1YJAYyyH7OcAuR2sZdnOV73TCiMiqJ95A5 oks7o2YkuFw93SQA0z4vA+WMcbteSWjZUyrHJ7XLeVsukq9bkH2PHVYXKlGen5W82n G/aUphXVa867A== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v2 29/30] drm/amd/display: Allow disabling CRC capture when the stream is gone To: "George Zhang" , amd-gfx@lists.freedesktop.org In-Reply-To: <20261201202451.463794-31-george.zhang@amd.com> References: <20261201202451.463794-2-george.zhang@amd.com> <20261201202451.463794-31-george.zhang@amd.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Tue, 01 Dec 2026 20:52:17 +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 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 > 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 >=3D 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 !=3D 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 > Signed-off-by: George Zhang [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 valu= e? Fixes: bbc49fc0326b ("drm/amd/display: Avoid get/put vblank when stream d= isabled") 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/driv= ers/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 *c= rtc, const char *src_name) > ret =3D -ETIMEDOUT; > goto cleanup; > } > + > + /* Wait succeeded; don't leak the remaining jiffies. */ > + if (ret > 0) > + ret =3D 0; > } > =20 > enable =3D 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 !=3D -ERESTARTSYS, a signal interruption falls through with ret =3D=3D -ERESTART= SYS. Any path that does not overwrite ret via drm_crtc_vblank_get() (such as disabling CRC capture or switching between active sources) completes the st= ate update and then returns -ERESTARTSYS. Falling through before commit->hw_do= ne completes also races with amdgpu_dm_atomic_commit_tail() reading acrtc->dm_irq_params.crc_src and calling amdgpu_dm_crtc_configure_crc_source(). --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261201202451.4637= 94-2-george.zhang@amd.com?part=3D29