• Lyude Paul's avatar
    drm/nouveau/dispnv50: Fix runtime PM ref tracking for non-blocking modesets · ed22eb56
    Lyude Paul authored
    This is something that got noticed a while ago back when I was fixing a
    large number of runtime PM related issues in nouveau, but never got
    fixed:
    
    https://patchwork.freedesktop.org/series/46815/#rev7
    
    It's not safe to iterate the entire list of CRTCs in
    nv50_disp_atomic_commit(), as we could be doing a non-blocking modeset
    on one CRTC in parallel with one or more other CRTCs. Likewise, this
    means it's also not safe to do so in order to track runtime PM state.
    While this code is certainly wrong, so far the only issues I've seen
    this cause in the wild is the occasional PM ref unbalance after an
    atomic check failure + module reloading (since the PCI device will
    outlive nouveau in such scenarios).
    
    So, do this far more elegantly: grab a runtime PM ref across the modeset
    and commit tail, then grab/put references for each CRTC enable/disable.
    This also ends up being much simpler then the previous broken solution
    we had.
    
    Finally, since we've removed all it's users: get rid of
    nouveau_drm->have_disp_power_ref.
    Signed-off-by: default avatarLyude Paul <lyude@redhat.com>
    Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
    ed22eb56
nouveau_drv.h 6.7 KB