esp_hw_support: Fix esp_light_sleep_start() deadlock

esp_light_sleep_start() will stall the other CPU via esp_ipc_isr_stall_other_cpu(). After stalling the other CPU,
will call esp_clk_... API which themselves take locks. If the other stalled CPU is holding those locks, this will
result in a deadlock.

This commit adds a workaround calling esp_clk_private_lock() to take the lock before stalling the other CPU.
This commit is contained in:
Darian Leung
2022-07-28 14:20:16 +08:00
parent 2a6c6c18f7
commit a73dd07d12
5 changed files with 44 additions and 2 deletions

View File

@@ -51,11 +51,11 @@ void esp_timer_private_set(uint64_t new_us);
void esp_timer_private_advance(int64_t time_diff_us);
/**
* @brief obtain internal critical section used esp_timer implementation
* @brief obtain internal critical section used in the esp_timer implementation
* This can be used when a sequence of calls to esp_timer has to be made,
* and it is necessary that the state of the timer is consistent between
* the calls. Should be treated in the same way as a spinlock.
* Call esp_timer_unlock to release the lock
* Call esp_timer_private_unlock to release the lock
*/
void esp_timer_private_lock(void);