commit | 2241969e5ada2eaafee38ab6de6457aa15c8402c | [log] [tgz] |
---|---|---|
author | ligd <liguiding1@xiaomi.com> | Thu Feb 22 10:44:56 2024 +0800 |
committer | Masayuki Ishikawa <masayuki.ishikawa@gmail.com> | Fri Mar 01 21:05:00 2024 +0900 |
tree | 65250b86e324edc6d4c6d8959ca9c021f225c3ba | |
parent | 27ef7576ff87ea0b80fc532f61c13138a4ca24e8 [diff] |
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>
Apache NuttX is a real-time operating system (RTOS) with an emphasis on standards compliance and small footprint. Scalable from 8-bit to 64-bit microcontroller environments, the primary governing standards in NuttX are POSIX and ANSI standards. Additional standard APIs from Unix and other common RTOSs (such as VxWorks) are adopted for functionality not available under these standards, or for functionality that is not appropriate for deeply-embedded environments (such as fork()).
For brevity, many parts of the documentation will refer to Apache NuttX as simply NuttX.
First time on NuttX? Read the Getting Started guide! If you don't have a board available, NuttX has its own simulator that you can run on terminal.
You can find the current NuttX documentation on the Documentation Page.
Alternatively, you can build the documentation yourself by following the Documentation Build Instructions.
The old NuttX documentation is still available in the Apache wiki.
NuttX supports a wide variety of platforms. See the full list on the Supported Platforms page.
If you wish to contribute to the NuttX project, read the Contributing guidelines for information on Git usage, coding standard, workflow and the NuttX principles.
The code in this repository is under either the Apache 2 license, or a license compatible with the Apache 2 license. See the License Page for more information.