• Mukesh Ojha's avatar
    PM / devfreq: Synchronize devfreq_monitor_[start/stop] · aed5ed59
    Mukesh Ojha authored
    There is a chance if a frequent switch of the governor
    done in a loop result in timer list corruption where
    timer cancel being done from two place one from
    cancel_delayed_work_sync() and followed by expire_timers()
    can be seen from the traces[1].
    
    while true
    do
            echo "simple_ondemand" > /sys/class/devfreq/1d84000.ufshc/governor
            echo "performance" > /sys/class/devfreq/1d84000.ufshc/governor
    done
    
    It looks to be issue with devfreq driver where
    device_monitor_[start/stop] need to synchronized so that
    delayed work should get corrupted while it is either
    being queued or running or being cancelled.
    
    Let's use polling flag and devfreq lock to synchronize the
    queueing the timer instance twice and work data being
    corrupted.
    
    [1]
    ...
    ..
    <idle>-0    [003]   9436.209662:  timer_cancel   timer=0xffffff80444f0428
    <idle>-0    [003]   9436.209664:  timer_expire_entry   timer=0xffffff80444f0428  now=0x10022da1c  function=__typeid__ZTSFvP10timer_listE_gl...
    aed5ed59
devfreq.c 57.6 KB