sched: walt: crash system if UTRA is called without runqueue lock

"update_task_ravg" is expected to be called with runqueue lock held by
the caller, induce a panic if UTRA is called for a runqueue without it
being locked.

Also, add an early runqueue lock check in "__walt_irq_work_locked" to
dump debug data and induce system crash.

Change-Id: Ie7bb29a7845004b3c64541b32295bb61bbe32aba
Signed-off-by: Ashay Jaiswal <quic_ashayj@quicinc.com>
Signed-off-by: Shaleen Agrawal <quic_shalagra@quicinc.com>
This commit is contained in:
Ashay Jaiswal 2023-11-17 10:41:28 +05:30 committed by Shaleen Agrawal
parent 3132a5d1e2
commit 3da009b250

View file

@ -2359,6 +2359,14 @@ static void walt_update_task_ravg(struct task_struct *p, struct rq *rq, int even
if (!wrq->window_start || wts->mark_start == wallclock)
return;
if (unlikely(!raw_spin_is_locked(&rq->__lock))) {
printk_deferred("WALT-BUG CPU%d: %s task %s(%d) unlocked access for cpu=%d suspende=%d last_clk=%llu stack[%pS <== %pS <== %pS]\n",
raw_smp_processor_id(), __func__, p->comm, p->pid, rq->cpu,
walt_clock_suspended, sched_clock_last,
(void *)CALLER_ADDR0, (void *)CALLER_ADDR1, (void *)CALLER_ADDR2);
WALT_PANIC(1);
}
walt_lockdep_assert_rq(rq, p);
old_window_start = update_window_start(rq, wallclock, event);
@ -4270,6 +4278,15 @@ static inline void __walt_irq_work_locked(bool is_migration, bool is_asym_migrat
if (rq->curr) {
/* only update ravg for locked cpus */
if (cpumask_intersects(lock_cpus, &cluster->cpus)) {
if (unlikely(!raw_spin_is_locked(&rq->__lock))) {
printk_deferred("WALT-BUG %s unlocked cpu=%d is_migration=%d is_asym_migration=%d is_shared_rail_migration=%d lock_cpus=%*pbl suspended=%d last_clk=%llu stack[%pS <= %pS <= %pS]\n",
__func__, rq->cpu, is_migration, is_asym_migration,
is_shared_rail_migration,
cpumask_pr_args(lock_cpus), walt_clock_suspended,
sched_clock_last, (void *)CALLER_ADDR0,
(void *)CALLER_ADDR1, (void *)CALLER_ADDR2);
WALT_PANIC(1);
}
walt_update_task_ravg(rq->curr, rq,
TASK_UPDATE, wc, 0);
account_load_subtractions(rq);