kernel: Simplified idle for SMP auxiliary CPUs
A pure timer-based idle won't work well in SMP. Without an IPI to wake up idle CPUs out of the scheduler they will sleep far too long and the main CPU will do all the scheduling of wake-up-and-sleep processes. Instead just have the auxilary CPUs do a traditional busy-wait scheduler in their idle loop. We will need to revisit an architecture that allows both wait-for-timer-interrupt idle and SMP. Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
This commit is contained in:
parent
53eceffb7f
commit
85557b011e
1 changed files with 14 additions and 0 deletions
|
@ -164,6 +164,20 @@ void idle(void *unused1, void *unused2, void *unused3)
|
|||
__idle_time_stamp = (u64_t)k_cycle_get_32();
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SMP
|
||||
/* Simplified idle for non-default SMP CPUs pending driver
|
||||
* support. The busy waiting is needed to prevent lock
|
||||
* contention. Long term we need to wake up idle CPUs with an
|
||||
* IPI.
|
||||
*/
|
||||
if (_arch_curr_cpu()->id > 0) {
|
||||
while (1) {
|
||||
k_busy_wait(100);
|
||||
k_yield();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
for (;;) {
|
||||
(void)irq_lock();
|
||||
_sys_power_save_idle(_get_next_timeout_expiry());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue