Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit d60cdac2 authored by Lingutla Chandrasekhar's avatar Lingutla Chandrasekhar
Browse files

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: default avatarLingutla Chandrasekhar <clingutla@codeaurora.org>
parent 3c599c7a
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment