1. 27 Jun, 2019 1 commit
    • Daniel Vetter's avatar
      drm/vkms: Fix crc worker races · 18d0952a
      Daniel Vetter authored
      The issue we have is that the crc worker might fall behind. We've
      tried to handle this by tracking both the earliest frame for which it
      still needs to compute a crc, and the last one. Plus when the
      crtc_state changes, we have a new work item, which are all run in
      order due to the ordered workqueue we allocate for each vkms crtc.
      
      Trouble is there's been a few small issues in the current code:
      - we need to capture frame_end in the vblank hrtimer, not in the
        worker. The worker might run much later, and then we generate a lot
        of crc for which there's already a different worker queued up.
      - frame number might be 0, so create a new crc_pending boolean to
        track this without confusion.
      - we need to atomically grab frame_start/end and clear it, so do that
        all in one go. This is not going to create a new race, because if we
        race with the hrtimer then our work will be re-run.
      - only race that can happen is the following:
        1. worker starts
        2. hrtimer runs and updates frame_end
        3. worker grabs frame_start/end, already reading the new frame_end,
        and clears crc_pending
        4. hrtimer calls queue_work()
        5. worker completes
        6. worker gets  re-run, crc_pending is false
        Explain this case a bit better by rewording the comment.
      
      v2: Demote warning level output to debug when we fail to requeue, this
      is expected under high load when the crc worker can't quite keep up.
      
      Cc: Shayenne Moura <shayenneluzmoura@gmail.com>
      Cc: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
      Cc: Haneen Mohammed <hamohammed.sa@gmail.com>
      Cc: Daniel Vetter <daniel@ffwll.ch>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@intel.com>
      Reviewed-by: default avatarRodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
      Tested-by: default avatarRodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
      Signed-off-by: default avatarRodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20190606222751.32567-2-daniel.vetter@ffwll.ch
      18d0952a
  2. 26 Jun, 2019 34 commits
  3. 25 Jun, 2019 5 commits