ANDROID: cpuidle: Update cpuidle_uninstall_idle_handler() to wakeup all online CPUs

wake_up_all_idle_cpus() will not wakeup paused CPUs since they are removed
from cpu_active_mask but paused CPUs can be in deep cpu idle and hence must
wakeup when uninstalling idle handler.

This change fixes this by introducing wake_up_all_online_idle_cpus() to
unconditionally wakeup all online idle CPUs and invoking same when uninstalling
cpu idle handler.

Bug: 192436062
Fixes: 683010f555 ("ANDROID: cpu/hotplug: add pause/resume_cpus interface")
Change-Id: I4afd4b7a17b87f9cc495e7009c9537888387f9ef
Signed-off-by: Maulik Shah <mkshah@codeaurora.org>
This commit is contained in:
Maulik Shah 2021-06-30 16:40:22 +05:30 committed by Todd Kjos
parent 14dd90ab37
commit f0b280c395
3 changed files with 24 additions and 1 deletions

View File

@ -428,7 +428,7 @@ void cpuidle_uninstall_idle_handler(void)
{
if (enabled_devices) {
initialized = 0;
wake_up_all_idle_cpus();
wake_up_all_online_idle_cpus();
}
/*

View File

@ -127,6 +127,7 @@ int smp_call_function_any(const struct cpumask *mask,
void kick_all_cpus_sync(void);
void wake_up_all_idle_cpus(void);
void wake_up_all_online_idle_cpus(void);
/*
* Generic and arch helpers
@ -182,6 +183,7 @@ smp_call_function_any(const struct cpumask *mask, smp_call_func_t func,
static inline void kick_all_cpus_sync(void) { }
static inline void wake_up_all_idle_cpus(void) { }
static inline void wake_up_all_online_idle_cpus(void) { }
#ifdef CONFIG_UP_LATE_INIT
extern void __init up_late_init(void);

View File

@ -967,6 +967,27 @@ void wake_up_all_idle_cpus(void)
}
EXPORT_SYMBOL_GPL(wake_up_all_idle_cpus);
/**
* wake_up_all_online_idle_cpus - break all online cpus out of idle
* wake_up_all_online_idle_cpus try to break all online cpus which is in idle
* state even including idle polling cpus, for non-idle cpus, we will do nothing
* for them.
*/
void wake_up_all_online_idle_cpus(void)
{
int cpu;
preempt_disable();
for_each_online_cpu(cpu) {
if (cpu == smp_processor_id())
continue;
wake_up_if_idle(cpu);
}
preempt_enable();
}
EXPORT_SYMBOL_GPL(wake_up_all_online_idle_cpus);
/**
* smp_call_on_cpu - Call a function on a specific cpu
*