sched: walt: fix updating stale window_start for walt load
With commit '45121eb2cdb ("sched/walt: Fix stale window start marker
passed to the schedutil")', sched reports 'walt_irq_work_lastq_ws'
time as window start for schedutil. With that there is a possiblilty
of sending staled value as window start, as it is not protect by common
lock but only atomically updated by any cpu.
Here is one possible scenario, CPU1 reporting the load at the window
boundary and preempted by secure world and on window rollover other cpu
reports load with new window_start.
CPU1 CPU2
try_to_wake_up()
update_task_ravg()
wallclock=779987000
rq_lock(cpu1)
cpufreq_update_util() try_to_wake_up()
cpu_util_freq() update_task_ravg()
walt_irq_work_lastq_ws=760000000 wallclock=780080182
curr_ws = 760000000 run_walt_irq_work()
<preempted by secure world> walt_irq_work_lastq_ws=780000000
rq_lock(cpu2)
cpufreq_update_util()
cpu_util_freq()
curr_ws = 780000000
< return back > lock(sg_policy->update_lock)
< waiting update_lock > sg_policy->last_ws= 780000000
unlock(sg_policy->update_lock)
lock(sg_policy->update_lock)
BUG(curr_ws < last_ws)
760000000 < 780000000
Fix this by updating the load reporting window start variable when all rq
locks held at walt irq work.
Change-Id: Id8c767420845ce003bee96d006bd2551321a9923
Signed-off-by:
Lingutla Chandrasekhar <clingutla@codeaurora.org>
Loading
Please register or sign in to comment