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 D55B9606A31F for ; Sat, 5 Dec 2026 17:50:16 +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=hjBqZr8C Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 469E110E277; Sat, 5 Dec 2026 17:50:11 +0000 (UTC) Received: from sea.source.kernel.org (sea.source.kernel.org [172.234.252.31]) by gabe.freedesktop.org (Postfix) with ESMTPS id E89E910E277 for ; Sat, 5 Dec 2026 17:50:04 +0000 (UTC) Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id A610540DFB; Sat, 5 Dec 2026 17:50:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 77A261F0092B; Sat, 5 Dec 2026 17:50:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796493004; bh=RyzQic6R1ARcyPo3IwS0krMraPBWz1U3OOBKIJnNmvw=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=hjBqZr8C/VyEAeH5yYkM4LkH+IzZMnr7DY/xJMFKGcQ91ChlLDSOFa7wd8nJq37ke wr7IpNcHiVFx6taHRe45W3q9Q2eCpA8W+Tb5g5irNPchlpwicWtZ/FKSgfhNMy/wXq Ko8Qpc24NJD9Z4NysMh1l0DGMg2lhh7zqm46zcoJ/5gTWlIusUYaIF1mT6mON9NMLn YmeAe0N41jBsDlgHMTKn/30yKNtEOAa/IoSkt0eFzfhjqXnDD7IdytJMROMgSfjRK8 fNDb8kGTDBRkWyxurznEp5CFc1sBk5yK9HDq3NNMsDw3+mfXY1fIoz3kQhpdUbKI5c tvor8KfO348gQ== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH] drm/nouveau/dispnv50: skip vblank and timestamp constants when dotclock is 0 To: "Munique Feitoza" Cc: dri-devel@lists.freedesktop.org In-Reply-To: <20261205172532.6461-1-muniquefeitoz4@gmail.com> References: <20261205172532.6461-1-muniquefeitoz4@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Sat, 05 Dec 2026 17:50:04 +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=-16.1 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: - [High] drm/nouveau: vblank refcount underflow from guarded drm_crtc_vblank_on() - [Low] drm/nouveau/dispnv50: missing Fixes trailer for commit 1b477f42285e -- commit 5f217a383db7345707a800ea837434136494b11f Author: Munique Feitoza > drm/nouveau/dispnv50: skip vblank and timestamp constants when dotclock i= s 0 > > During probe, nv50_display_read_hw_or_state() marks firmware-inherited > active heads as active and enabled without populating mode timings, > leaving adjusted_mode.crtc_clock at 0 until the first modeset. > > If a non-modeset atomic commit such as drm_mode_gamma_set_ioctl() from > plymouthd runs before the first modeset, nv50_disp_atomic_commit_tail() > calls drm_atomic_helper_calc_timestamping_constants() and vblank helpers > with crtc_clock =3D=3D 0, triggering: > > [drm] *ERROR* crtc 62: Can't calculate constants, dotclock =3D 0! > WARNING: drivers/gpu/drm/drm_vblank.c:756 > > Guard drm_calc_timestamping_constants() and the symmetric vblank > on/get/accurate_count/put calls in nv50_disp_atomic_commit_tail() on > adjusted_mode.crtc_clock !=3D 0. > > Signed-off-by: Munique Feitoza [Severity: Low] This looks like a bug fix for firmware-inherited heads left without mode timings by nv50_display_read_hw_or_state(). Should this include: Fixes: 1b477f42285e ("drm/nouveau/kms: Add INHERIT ioctl to nvkm/nvif for= reading IOR state") > diff --git a/drivers/gpu/drm/nouveau/dispnv50/disp.c b/drivers/gpu/drm/no= uveau/dispnv50/disp.c > index 98a5188f65234..9f8f234f58e8b 100644 > --- a/drivers/gpu/drm/nouveau/dispnv50/disp.c > +++ b/drivers/gpu/drm/nouveau/dispnv50/disp.c [ ... ] > @@ -2301,10 +2305,11 @@ nv50_disp_atomic_commit_tail(struct drm_atomic_co= mmit *state) > =20 > if (new_crtc_state->active) { > if (!old_crtc_state->active) { > - drm_crtc_vblank_on(crtc); > + if (new_crtc_state->adjusted_mode.crtc_clock) > + drm_crtc_vblank_on(crtc); > pm_runtime_get_noresume(dev->dev); > } > - if (new_crtc_state->event) > + if (new_crtc_state->event && new_crtc_state->adjusted_mode.crtc_clock) > drm_crtc_vblank_get(crtc); > } > } [Severity: High] Can skipping drm_crtc_vblank_on() here cause vblank->refcount to underflow? Earlier in nv50_disp_atomic_commit_tail(), disabling a CRTC calls drm_crtc_vblank_off() even when adjusted_mode.crtc_clock is 0, leaving vblank->inmodeset and vblank->refcount at 1. With nouveau.atomic=3D0, a DPMS off then DPMS on cycle on a firmware-inheri= ted head before the first modeset re-enables active while crtc_clock is still 0. This guard then skips drm_crtc_vblank_on(), leaving vblank->inmodeset set. When the first real modeset sets a non-zero crtc_clock on that active CRTC, !old_crtc_state->active is false, so drm_crtc_vblank_on() still does not ru= n. drm_crtc_vblank_get() returns -EINVAL without taking a reference, yet the later drm_crtc_vblank_put() still drops the inmodeset reference to 0. On the next disable/enable cycle, drm_crtc_vblank_on_config() decrements vblank->refcount from 0 to -1, triggering drm_WARN_ON splats and pinning vblank IRQs enabled. Pairing drm_crtc_vblank_on() with the 0-to-non-zero crtc_clock transition and checking drm_crtc_vblank_get() would prevent this. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261205172532.6461= -1-muniquefeitoz4@gmail.com?part=3D1