kernel/sched/walt: rd->pd not getting updated soon enough

If the energy model is not updated by the time rebalance_domains
is called for the first time, the root domain -> perf_domain
values will get erased completely, and will be invalid. The
responsibility for this race is outside of the walt module.

walt_find_energy_efficient_cpu() relies upon rd->pd being valid
and cannot function properly without it. This is critical to
proper walt functionality and it cannot move forward without it.

Decisvely catch the failure.

Change-Id: Iee8030afd487dcee1d9cc18c2d655ecc26938279
Signed-off-by: Stephen Dickey <quic_dickey@quicinc.com>
This commit is contained in:
Stephen Dickey 2022-08-12 16:37:20 -07:00 committed by Sai Harshini Nimmala
parent 427c7e27f6
commit 5ca19b7ae1

View File

@ -4559,6 +4559,7 @@ static void walt_init(struct work_struct *work)
{
struct ctl_table_header *hdr;
static atomic_t already_inited = ATOMIC_INIT(0);
struct root_domain *rd = cpu_rq(cpumask_first(cpu_active_mask))->rd;
int i;
might_sleep();
@ -4600,6 +4601,11 @@ static void walt_init(struct work_struct *work)
}
topology_clear_scale_freq_source(SCALE_FREQ_SOURCE_ARCH, cpu_online_mask);
if (!rcu_dereference(rd->pd))
WALT_BUG(WALT_BUG_WALT, NULL,
"root domain's perf-domain values not initialized rd->pd=%d.",
rd->pd);
}
static DECLARE_WORK(walt_init_work, walt_init);