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 <[email protected]> > drm/nouveau/dispnv50: skip vblank and timestamp constants when dotclock is 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 == 0, triggering: > > [drm] *ERROR* crtc 62: Can't calculate constants, dotclock = 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 != 0. > > Signed-off-by: Munique Feitoza <[email protected]> [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/nouveau/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_commit > *state) > > 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=0, a DPMS off then DPMS on cycle on a firmware-inherited 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 run. 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. -- Sashiko AI review ยท https://sashiko.dev/#/patchset/[email protected]?part=1
