kernel/idle: Replace stolen IRQ lock

The removal of the abort handling also absconded with an IRQ lock that
is required for reliable operation in the idle loop.  Put it back.

Once the idle loop has made a decision to enter idle, any interrupt
that arrives needs to be masked and delivered AFTER the system enters
idle.  Otherwise we run the risk of races where the system accepts and
processes an interrupt that should have prevented idle, but then goes
to sleep anyway having already made the decision.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
This commit is contained in:
Andy Ross 2021-03-03 12:16:35 -08:00 committed by Anas Nashif
parent 098fce351f
commit 39a8f3b4f9

View file

@ -135,6 +135,8 @@ void idle(void *p1, void *unused2, void *unused3)
k_yield(); k_yield();
#else #else
(void) arch_irq_lock();
#ifdef CONFIG_SYS_CLOCK_EXISTS #ifdef CONFIG_SYS_CLOCK_EXISTS
int32_t ticks = z_get_next_timeout_expiry(); int32_t ticks = z_get_next_timeout_expiry();