Hi Thomas,

On Sun, 29 Nov 2026 12:54:45 +0000, [email protected] wrote:
[...]
> > +   ret = drm_mode_config_create_initial_state(drm);
[...]
> > +   ret = drm_vblank_init(drm, drm->mode_config.num_crtc);

[...]
> [Severity: High]
> Does calling drm_mode_config_create_initial_state() before
> drm_vblank_init() leave vblank enabled on the initially disabled CRTC and
> allow spacemit_crtc_enable_vblank() to race with runtime PM?

[...]

In v2 you suggested calling drm_vblank_init() after the mode config
reset [1], and v4 still has that order.

Although the race Sashiko describes won't happen, I checked the code
and this order does skip drm_crtc_vblank_reset(): the reset runs only
if drm_dev_has_vblank(), which is false until drm_vblank_init() is
called.

So before the first modeset, a vblank wait reaches the driver's
enable_vblank(), and only a check in the driver rejects it. With
drm_vblank_init() first, the core rejects it.

I tend to agree with Sashiko and swap the two calls in v5. What do you
think?

[1] 
https://lore.kernel.org/dri-devel/[email protected]/

Cody

Reply via email to