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
..
2023-05-17 10:24:42 +08:00
2022-08-02 21:04:19 +08:00
2023-12-30 08:48:43 -08:00
2023-09-08 00:59:31 +03:00
2023-10-19 21:38:45 +08:00
2023-10-19 21:38:45 +08:00
2023-07-13 10:11:58 +08:00
2023-10-30 18:20:22 +08:00
2023-07-11 23:32:17 +08:00
2023-07-28 20:56:22 -07:00
2022-12-10 02:36:24 +08:00
2023-05-19 02:40:38 +08:00
2022-03-17 09:37:15 +02:00
2024-02-21 13:29:36 -03:00
2023-07-11 23:32:17 +08:00
2023-11-29 02:13:19 -08:00
2023-07-29 07:28:23 -07:00
2023-05-05 18:36:36 +08:00
2024-02-02 09:03:18 -08:00
2024-02-21 13:29:36 -03:00