nuttx/sched
Masayuki Ishikawa 35c8da34a8 sched: task: Fix nxtask_exit() for SMP
Summary:
- During Wi-Fi audio streaming test, I found a deadlock in nxtask_exit()
- Actually, nxtask_exit() was called and tried to enter critical section
- In enter_critical_section(), there is a deadlock avoidance logic
- However, if switched to a new rtcb with irqcount=0, the logic did not work
- Because the 2nd critical section was treated as if it were the 1st one
- Actually, it tried to run the deadlock avoidance logic
- But nxtask_exit() was called with critical section (i.e. IRQ already disabled)
- So the logic did not work as expected because up_irq_restore() did not enable the IRQ.
- This commit fixes this issue by incrementing irqcount before calling nxtask_terminate()
- Also it adjusts g_cpu_irqlock and g_cpu_lockset

Impact:
- Affects SMP only

Testing:
- Tested with spresense:wifi_smp (smp, ostest, nxplayer, telnetd)
- Tested with sabre-6quad:smp with QEMU (smp, ostest)
- Tested with maix-bit:smp with QEMU (smp, ostest)
- Tested with esp32-core:smp with QEMU (smp, ostest)

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2020-10-10 13:01:01 -06:00
..
clock Rename clock_systime[r|spec] to clock_systime_[ticks|timespec] 2020-05-10 14:35:50 -06:00
environ global change: repace sched_xfree() to kxmm_free() 2020-04-09 10:29:28 -06:00
group libc/stdio: Allocate file_struct dynamically 2020-09-11 17:58:17 +08:00
init init: Move file system initialization before clock/irq 2020-09-17 15:51:03 +09:00
irq arch, include, sched : Refactor ARCH_GLOBAL_IRQDISABLE related code 2020-09-03 10:20:20 +08:00
module modsym: Fix a printf format for berr 2020-04-13 16:20:09 +01:00
mqueue sched/wdog: Remove MAX_WDOGPARMS and related stuff 2020-08-14 08:19:50 -06:00
paging Rename clock_systime[r|spec] to clock_systime_[ticks|timespec] 2020-05-10 14:35:50 -06:00
pthread sched/pthread: Implement pthread_attr_[get|set]detachstate 2020-08-20 10:46:14 +01:00
sched Add on-boot instrumentation support for note filter 2020-10-06 03:26:46 +08:00
semaphore sched/wdog: Remove MAX_WDOGPARMS and related stuff 2020-08-14 08:19:50 -06:00
signal sched/signal: Cosmetic changes 2020-10-05 01:05:45 +08:00
task sched: task: Fix nxtask_exit() for SMP 2020-10-10 13:01:01 -06:00
timer Fix nxstyle warning 2020-08-22 17:37:21 -06:00
wdog sched/wdog: Remove MAX_WDOGPARMS and related stuff 2020-08-14 08:19:50 -06:00
wqueue sched/: Make more naming consistent 2020-05-16 13:39:03 -03:00
Kconfig Add on-boot instrumentation support for note filter 2020-10-06 03:26:46 +08:00
Makefile Makefile: Fix Make.dep not updated by config changes 2020-07-28 03:59:45 -05:00