All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Munique Feitoza" <muniquefeitoz4@gmail.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] drm/nouveau/dispnv50: skip vblank and timestamp constants when dotclock is 0
Date: Sat, 05 Dec 2026 17:50:04 +0000	[thread overview]
Message-ID: <sashiko-outbox-251781@kernel.org> (raw)
In-Reply-To: <20261205172532.6461-1-muniquefeitoz4@gmail.com>

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 <muniquefeitoz4@gmail.com>

> 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 <muniquefeitoz4@gmail.com>

[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/20261205172532.6461-1-muniquefeitoz4@gmail.com?part=1

      reply	other threads:[~2026-12-05 17:50 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-05 17:25 [PATCH] drm/nouveau/dispnv50: skip vblank and timestamp constants when dotclock is 0 Munique Feitoza
2026-12-05 17:25 ` Munique Feitoza
2026-12-05 17:50 ` sashiko-bot [this message]

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-251781@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=muniquefeitoz4@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.