nuttx/sched
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
..
addrenv cmake:complete missing changes during cmake reforming for sched 2023-09-08 21:20:16 +03:00
clock adjtime: Rewrite implementation to work for RTC and tickless kernel 2023-11-14 19:47:40 -08:00
environ env_dup: fix issue about USE_AFTER_FREE 2023-10-26 00:11:14 +08:00
group sched/taskfiles: skip unnecessary file open/close operations to improve performance 2023-11-16 07:30:36 -08:00
init Revert "fix variable set but not used" 2024-02-21 21:29:48 -08:00
instrument sched/procfs:use instrument to statistics run time max stack 2023-12-11 02:06:51 -08:00
irq SMP: fix crash when switch to new task which is still running 2024-03-01 21:05:00 +09:00
misc assert: fix flags type, should be irqstate_t 2024-01-04 22:16:54 -08:00
module fs: procfs add poll support 2023-12-26 19:23:13 -08:00
mqueue mm/alloc: remove all unnecessary cast for alloc 2023-08-30 14:34:20 +08:00
paging build: add initial cmake build system 2023-07-08 13:50:48 +08:00
pthread task/pthread_cancelpt: Move cancel point handling to libc, data to TLS 2023-11-15 08:52:04 -08:00
sched Revert "fix variable set but not used" 2024-02-21 21:29:48 -08:00
semaphore misc/rwlock:Implementing read/write locks. 2023-12-02 19:43:19 -08:00
signal sigaction: Expand si_user for non-kernel signals 2023-11-22 08:00:43 -08:00
task sched/logging: add task activation/exit logs 2024-01-14 23:04:42 -08:00
timer Replace enter_critical_section with spin_irqsave 2023-10-21 11:00:07 +08:00
tls sched/tls: inline group info in flat mode to improve performance 2024-03-01 17:27:26 +08:00
wdog clock: replace all up_perf_xx with perf_xx 2023-10-02 16:11:43 +02:00
wqueue clock: replace all up_perf_xx with perf_xx 2023-10-02 16:11:43 +02:00
CMakeLists.txt build: add initial cmake build system 2023-07-08 13:50:48 +08:00
Kconfig sched: move etc romfs mount from nsh to sched/init 2024-01-09 21:29:46 -03:00
Makefile sched/procfs:use instrument to statistics run time max stack 2023-12-11 02:06:51 -08:00