kernel/sched/walt: test is walt is enabled

Pause will not be invoked through core control until after
walt has been initialized. However, the walt_pause apis are
made available to other vendor modules, and if those modules
attempt to invoke pause prior to walt being initialized, an
invalid reference to walt_drain_thread will be made.

Prevent the walt_pause and walt_resume apis from being used
until after walt has been properly initialized, walt_halt_init
has been called, and walt_drain_thread properly created.

Change-Id: Iadd764ebfb7402529b49de6ef121d23dfcdc5649
Signed-off-by: Stephen Dickey <quic_dickey@quicinc.com>
This commit is contained in:
Stephen Dickey 2022-09-16 15:15:33 -07:00 committed by Sai Harshini Nimmala
parent 1a0cf49aa3
commit 902848221f

View File

@ -306,8 +306,7 @@ static int halt_cpus(struct cpumask *cpus)
cpumask_or(&drain_data.cpus_to_drain, &drain_data.cpus_to_drain, cpus);
raw_spin_unlock_irqrestore(&walt_drain_pending_lock, flags);
if (!IS_ERR(walt_drain_thread))
wake_up_process(walt_drain_thread);
wake_up_process(walt_drain_thread);
out:
trace_halt_cpus(cpus, start_time, 1, ret);
@ -409,6 +408,8 @@ int walt_halt_cpus(struct cpumask *cpus, enum pause_reason reason)
int walt_pause_cpus(struct cpumask *cpus, enum pause_reason reason)
{
if (walt_disabled)
return -EAGAIN;
return walt_halt_cpus(cpus, reason);
}
EXPORT_SYMBOL(walt_pause_cpus);
@ -443,6 +444,8 @@ int walt_start_cpus(struct cpumask *cpus, enum pause_reason reason)
int walt_resume_cpus(struct cpumask *cpus, enum pause_reason reason)
{
if (walt_disabled)
return -EAGAIN;
return walt_start_cpus(cpus, reason);
}
EXPORT_SYMBOL(walt_resume_cpus);