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 27E88606A32F for ; Thu, 3 Dec 2026 16:36:39 +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=X++SD8Sr Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9349A10E6BB; Thu, 3 Dec 2026 16:36:33 +0000 (UTC) Received: from tor.source.kernel.org (tor.source.kernel.org [172.105.4.254]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3368610E6BB for ; Thu, 3 Dec 2026 16:36:27 +0000 (UTC) Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with ESMTP id 590EE60DB9 for ; Thu, 3 Dec 2026 16:36:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F11B41F00893; Thu, 3 Dec 2026 16:36:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796315786; bh=64NWGDglxge0yG34VvuL9zoaElkr4vhyAhG/ag8FX0g=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=X++SD8SrD1AY6mwvpp+4fBQHVLwwskcICcI+g11d8iV9ugR/8EhcdosJ3l2MFkDMS aEnS45o8pD9R12K1jsBhdCoFghtgLiUbEgHcTYmign/bB/0PQvl4Ja4kbKbtz3Zj2T t3QljgGuHP2bu/kVwKR7SmnRAIV6QQ7CikEbFv5NXSZ/VBjcr4YVC7ppfFAjkDAw4V YLcwywnOelMv2gsh1X4gXdFftOuVofuMhvidq6t5DrIoRALVaolYxF32ayBzsjAJaU pe2wND8PBltRF1Zu+oR9w+EeXdsdNfb7JCkGXkGwjdtVK14Ihy/Z0fsQZUueXvAJej ox06fKZWgubZA== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v13 7/9] drm/msm/dpu1: Carry the mixers over to created CRTC states To: "Maxime Ripard" Cc: dri-devel@lists.freedesktop.org In-Reply-To: <20261203-drm-reset-state-flag-v13-7-b09f19f64e64@kernel.org> References: <20261203-drm-reset-state-flag-v13-0-b09f19f64e64@kernel.org> <20261203-drm-reset-state-flag-v13-7-b09f19f64e64@kernel.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Thu, 03 Dec 2026 16:36:25 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: sashiko-reviews@lists.linux.dev Sender: "dri-devel" X-Spam-Status: No, score=-10.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, 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/msm/dpu1: created CRTC states drop crc_source and leak vblank refcount - [Medium] drm/msm/dpu1: created plane states drop active bus bw vote to zero - [Low] drm/msm/dpu1: data race on mixer_op_mode in dpu_crtc_atomic_check() memcpy() -- commit 95540b7cfb31b9e4d0cbbff15e3247a5f5b7e686 Author: Maxime Ripard drm/msm/dpu1: Carry the mixers over to created CRTC states This commit copies num_mixers and mixers from the old CRTC state into newly created CRTC states in dpu_crtc_atomic_check() when the CRTC stays enabled and does not reallocate resources. > diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c b/drivers/gpu/drm/m= sm/disp/dpu1/dpu_crtc.c > index 77a2d1f6700d0..a99f6761035f8 100644 > --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c > +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c > @@ -1540,6 +1540,29 @@ static int dpu_crtc_atomic_check(struct drm_crtc *= crtc, > rc =3D dpu_crtc_assign_resources(crtc, crtc_state); > if (rc < 0) > return rc; > + } else if (crtc_state->enable && !cstate->num_mixers) { > + struct dpu_crtc_state *old_cstate =3D > + to_dpu_crtc_state(drm_atomic_get_old_crtc_state(state, > + crtc)); > + > + /* > + * A CRTC that keeps its configuration keeps its mixers. > + * A duplicated state carries them over, but a state > + * created through atomic_create_state() comes with > + * none, so copy them from the current state like a > + * duplicated state would, to make sure the checks and > + * the commit see the mixers in use. > + * > + * Only do so for a CRTC that stays enabled: > + * dpu_crtc_assign_resources() returns right after > + * dpu_rm_release() for a disabled one, leaving the mixers > + * it just released behind in the state it was given. > + */ > + if (old_cstate->num_mixers) { > + cstate->num_mixers =3D old_cstate->num_mixers; > + memcpy(cstate->mixers, old_cstate->mixers, > + sizeof(cstate->mixers)); [Severity: Low] Can this memcpy() race with _dpu_crtc_blend_setup() on old_cstate->mixers[i].mixer_op_mode? After a nonblocking commit swaps crtc->state and drops crtc->mutex, its commit_work runs msm_atomic_commit_tail() under kms->commit_lock[] while a subsequent reset commit can enter dpu_crtc_atomic_check() before waiting for hw_done: CPU0 (reset commit) CPU1 (nonblock commit_work) drm_mode_atomic_ioctl() lock(crtc->mutex) msm_atomic_commit_tail() lock(kms->commit_lock[idx]) dpu_crtc_atomic_check() ... _dpu_crtc_blend_setup() memcpy(cstate->mixers, mixer[i].mixer_op_mode =3D 0 old_cstate->mixers, ...) _dpu_crtc_blend_setup_mixer() <-- data race mixer[i].mixer_op_mode |=3D .= .. Because _dpu_crtc_blend_setup() zeroes mixer_op_mode before using it on the new state, hardware programming is not corrupted, but KCSAN will flag the data race. Copying only hw_lm, lm_ctl, and hw_dspp for i < old_cstate->num_mixers avoids reading mixer_op_mode altogether. > + } > } [Severity: Medium] Does this drop crc_source and crc_frame_skip_count on created CRTC states and leak a CRTC vblank reference? dpu_crtc_create_state() zero-initializes crc_source to DPU_CRTC_CRC_SOURCE_NONE, whereas dpu_crtc_duplicate_state() preserves it across commits. Because dpu_crtc_atomic_check() only carries over num_mixers and mixers (and only on the non-reallocation branch), a commit built via drm_atomic_commit_fill_with_defaults() while debugfs CRC capture is open resets crtc->state->crc_source to DPU_CRTC_CRC_SOURCE_NONE. Once the new state is swapped in, dpu_crtc_get_crc() returns -EINVAL and CRC capture silently stalls. When userspace later closes the CRC debugfs file, crtc_crc_release() calls dpu_crtc_set_crc_source(crtc, NULL), which sees current_source =3D=3D DPU_CRTC_CRC_SOURCE_NONE and skips drm_crtc_vblank_put(crtc), permanently leaking the vblank refcount. Carrying crc_source and crc_frame_skip_count over from old_cstate across all paths for created states (or storing them on struct dpu_crtc instead) would avoid this. [Severity: Medium] Does dpu_core_perf_crtc_check() drop the active interconnect avg_bw vote to zero when a commit uses created plane states? dpu_plane_create_state() leaves plane_fetch_bw at zero, and it is only computed later during commit in dpu_plane_sspp_atomic_update(). When dpu_crtc_atomic_check() calls dpu_core_perf_crtc_check() -> _dpu_core_perf_calc_bw(), it sums plane_fetch_bw over the newly created plane states and stores cstate->new_perf.bw_ctl =3D 0, which is never updated after dpu_plane_sspp_atomic_update() runs. At the end of the commit, dpu_crtc_complete_commit() calls dpu_core_perf_crtc_update(crtc, 0). Seeing new->bw_ctl < old->bw_ctl, it lowers the bus avg_bw vote via icc_set_bw() to zero while the CRTC and planes remain actively scanning out, risking display underruns on a static screen and under-counting this CRTC in the next commit's aggregate bandwidth check. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261203-drm-reset-= state-flag-v13-0-b09f19f64e64@kernel.org?part=3D7