sched:walt: register restricted tracehooks for race with pause

The current code in force_compatible_cpus_allowed_ptr() holds just
the cpus_read_lock, i.e. serializes with the second  step of pause.
However it doesn't serialize with the first step. IOW, a CPUX chosen
in __set_cpus_allowed_ptr_locked() may end up getting deactivated in
the pause first and stopper ends up returning early in __migrate_tasks()
leaving the 32bit task on an invalid CPU.

A simple fix is to serialize force_compatible_cpus_allowed_ptr() with
pause first step. Add a cpu_maps_update_begin/done() in
force_compatible_cpus_allowed_ptr().

Change-Id: I24e7838ee9813b4336bfcebc823e498c3606c793
Signed-off-by: Shaleen Agrawal <shalagra@codeaurora.org>
This commit is contained in:
Shaleen Agrawal 2021-06-03 10:11:03 -07:00 committed by Rishabh Bhatnagar
parent 5c3c385a68
commit 6c47bb351e

View File

@ -4115,6 +4115,20 @@ static void android_rvh_build_perf_domains(void *unused, bool *eas_check)
*eas_check = true;
}
static void android_rvh_force_compatible_pre(void *unused, void *unused2)
{
if (unlikely(walt_disabled))
return;
cpu_maps_update_begin();
}
static void android_rvh_force_compatible_post(void *unused, void *unused2)
{
if (unlikely(walt_disabled))
return;
cpu_maps_update_done();
}
static void register_walt_hooks(void)
{
register_trace_android_rvh_wake_up_new_task(android_rvh_wake_up_new_task, NULL);
@ -4144,6 +4158,8 @@ static void register_walt_hooks(void)
register_trace_android_rvh_sched_exec(android_rvh_sched_exec, NULL);
register_trace_android_rvh_build_perf_domains(android_rvh_build_perf_domains, NULL);
register_trace_cpu_frequency_limits(walt_cpu_frequency_limits, NULL);
register_trace_android_rvh_force_compatible_pre(android_rvh_force_compatible_pre, NULL);
register_trace_android_rvh_force_compatible_post(android_rvh_force_compatible_post, NULL);
}
atomic64_t walt_irq_work_lastq_ws;