• Hans Verkuil's avatar
    media: vivid: fix (partially) timing issues · 6e8c09bb
    Hans Verkuil authored
    The vivid driver is a bit flaky w.r.t. the kthread timing, esp. when
    running inside a virtual machine.
    
    This is caused by calling schedule_timeout_uninterruptible(1) which can
    actually take more than one jiffie. A while loop with schedule() turns out
    to be a lot more precise. Also, if mutex_trylock() fails, then just call
    schedule() instead of schedule_timeout_uninterruptible(1). There is no need
    to wait until the next jiffer, just schedule(), then try to get the lock
    again.
    
    This is still not precise enough, it is still relatively easy to get missed
    frames. This really should be converted to use a proper timer, but for now
    this solves the worst problems.
    Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
    Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
    6e8c09bb
vivid-kthread-cap.c 31.7 KB