esp_system: Workaround esp_ipc_isr_stall_other_cpu() deadlock with SMP FreeRTOS

SMP FreeRTOS uses a single kernel lock for all critical sections. There is a known
issue with esp_ipc_isr_stall_other_cpu() that can cause dead if the other CPU is
already in a critical section.

This commit adds a temporary workaround to reduce the chance of deadlock by taking
the SMP FreeRTOS kernel lock first before stalling the other CPU.

See IDF-5257 for more details.
pull/9328/head
Darian Leung 2022-06-17 15:37:07 +08:00
rodzic da54350570
commit 95955ed170
1 zmienionych plików z 14 dodań i 0 usunięć

Wyświetl plik

@ -105,6 +105,13 @@ void esp_ipc_isr_waiting_for_finish_cmd(void* finish_cmd);
*/
void IRAM_ATTR esp_ipc_isr_stall_other_cpu(void)
{
#if CONFIG_FREERTOS_SMP
/*
Temporary workaround to prevent deadlocking on the SMP FreeRTOS kernel lock after stalling the other CPU.
See IDF-5257
*/
taskENTER_CRITICAL();
#endif
if (s_stall_state == STALL_STATE_RUNNING) {
#if CONFIG_FREERTOS_SMP
BaseType_t intLvl = portDISABLE_INTERRUPTS();
@ -145,6 +152,13 @@ void IRAM_ATTR esp_ipc_isr_release_other_cpu(void)
assert(0);
}
}
#if CONFIG_FREERTOS_SMP
/*
Temporary workaround to prevent deadlocking on the SMP FreeRTOS kernel lock after stalling the other CPU.
See IDF-5257
*/
taskEXIT_CRITICAL();
#endif
}
void IRAM_ATTR esp_ipc_isr_stall_pause(void)