]> granicus.if.org Git - esp-idf/commit
spi_flash: fix race condition when doing operations in unpinned tasks
authorIvan Grokhotkov <ivan@espressif.com>
Wed, 18 Jan 2017 07:07:27 +0000 (15:07 +0800)
committerIvan Grokhotkov <ivan@espressif.com>
Wed, 18 Jan 2017 07:07:27 +0000 (15:07 +0800)
commit4676d159adc6e92ab90546a618c340b9a5814459
treed8f2e0977787b1c07371a482b354ce77d39ea996
parent0b2962f41ebda2cf1935faf2a31c31f6a0f849bc
spi_flash: fix race condition when doing operations in unpinned tasks

spi_flash_enable_interrupts_caches_and_other_cpu function used to enable
non-IRAM interrupts after giving up flash operation lock, which would
cause problems if another task was waiting on the lock to start a flash
operation. In fact, non-IRAM interrupts should be re-enabled before the
task scheduler is resumed. Otherwise non-pinned task can be moved to the
other CPU due to preemption, causing esp_intr_noniram_enable to be
called on the other CPU, causing an abort to be triggered.

Fixes the issue reported in
https://github.com/espressif/esp-idf/pull/258
components/spi_flash/cache_utils.c
components/spi_flash/test/test_spi_flash.c