incubator-nuttx/sched/irq
ligd 2241969e5a SMP: fix crash when switch to new task which is still running
cpu0 thread0:                        cpu1:
sched_yield()
nxsched_set_priority()
nxsched_running_setpriority()
nxsched_reprioritize_rtr()
nxsched_add_readytorun()
up_cpu_pause()
                                     IRQ enter
                                     arm64_pause_handler()
                                     enter_critical_section() begin
                                     up_cpu_paused() pick thread0
                                     arm64_restorestate() set thread0 tcb->xcp.regs to CURRENT_REGS
up_switch_context()
  thread0 -> thread1
arm64_syscall()
    case SYS_switch_context
     change thread0 tcb->xcp.regs
    restore_critical_section()
                                     enter_critical_section() done
                                     leave_critical_section()
                                     IRQ leave with restore CURRENT_REGS
                                     ERROR !!!

Reason:
As descript above, cpu0 swith task: thread0 -> thread1, and the
syscall() execute slowly, this time cpu1 pick thread0 to run at
up_cpu_paused(). Then cpu0 syscall execute, cpu1 IRQ leave error.

Resolve:
Move arm64_restorestate() after enter_critical_section() done

This is a continued fix with:
https://github.com/apache/nuttx/pull/6833

Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-03-01 21:05:00 +09:00
..
CMakeLists.txt cmake:complete missing changes during cmake reforming for sched 2023-09-08 21:20:16 +03:00
Make.defs
irq.h clock: replace all up_perf_xx with perf_xx 2023-10-02 16:11:43 +02:00
irq_attach.c clock: replace all up_perf_xx with perf_xx 2023-10-02 16:11:43 +02:00
irq_chain.c
irq_csection.c SMP: fix crash when switch to new task which is still running 2024-03-01 21:05:00 +09:00
irq_dispatch.c clock: replace all up_perf_xx with perf_xx 2023-10-02 16:11:43 +02:00
irq_foreach.c
irq_initialize.c add the startup process tracepoint 2023-08-19 21:50:08 +08:00
irq_procfs.c fs: procfs add poll support 2023-12-26 19:23:13 -08:00
irq_spinlock.c spinlock: implement read writer spinlock 2023-10-16 08:55:01 +08:00
irq_unexpectedisr.c