461911662 opened a new issue, #16868:
URL: https://github.com/apache/nuttx/issues/16868
### Description / Steps to reproduce the issue
详细步骤如下:
./tools/configure.sh -a ./vendor/boss/app/boss1-app qemu-armv7a:smp
make menuconfig
qemu-system-arm -cpu cortex-a7 -smp 4 -nographic -machine
virt,virtualization=off,gic-version=2 -net none -chardev stdio,id=con,mux=on
-serial chardev:con -mon chardev=con,mode=readline -kernel ./nuttx
发现系统不能启动,错误信息如下:
[CPU0] psci_detect: Detected PSCI v0.2
[CPU0] nx_start: Entry
[CPU0] uart_register: Registering /dev/console
[CPU0] uart_register: Registering /dev/ttyS1
[CPU0] work_start_highpri: Starting high-priority kernel worker thread(s)
[CPU0] nxtask_activate: hpwork pid=4,TCB=0x40130318
[CPU0] nxtask_activate: AppBringUp pid=5,TCB=0x401313f0
[CPU3] nx_idle_trampoline: CPU3: Beginning Idle Loop
[CPU2] nx_idle_trampoline: CPU2: Beginning Idle Loop
[CPU1] nx_idle_trampoline: CPU1: Beginning Idle Loop
[CPU0] nx_start_application: Starting init thread
[CPU0] task_spawn: name=nsh_main entry=0x4010cfec file_actions=0
attr=0x4013248c argv=0x40132488
[CPU0] nxtask_activate: nsh_main pid=6,TCB=0x401324f0
[CPU1] qemu-system-arm: terminating on signal 2
添加的配置如下:
make savedefconfig
make -f tools/Makefile.host
./tools/cmpconfig defconfig
./boards/arm/qemu/qemu-armv7a/configs/smp/defconfig
file1: CONFIG_BOARD_LATE_INITIALIZE=y
file2:
file1: CONFIG_DEBUG_SCHED=y
file2:
file1: CONFIG_DEBUG_SCHED_INFO=y
file2:
file1:
file2: CONFIG_EXAMPLES_HELLO=y
file1:
file2: CONFIG_TESTING_GETPRIME=y
file1:
file2: CONFIG_TESTING_OSTEST=y
另外我想让syslog打印信息完成,添加了新的patch,patch如下:
git diff
diff --git a/libs/libc/syslog/lib_syslog.c b/libs/libc/syslog/lib_syslog.c
index 5cdb73c145..0cc1667ede 100644
--- a/libs/libc/syslog/lib_syslog.c
+++ b/libs/libc/syslog/lib_syslog.c
@@ -91,14 +91,21 @@ void vsyslog(int priority, FAR const IPTR char *fmt,
va_list ap)
* None.
*
****************************************************************************/
-
+#include <nuttx/spinlock.h>
+static volatile spinlock_t g_syslog_lock = SP_UNLOCKED;
void syslog(int priority, FAR const IPTR char *fmt, ...)
{
va_list ap;
+#ifdef CONFIG_SPINLOCK
+ spin_lock(&g_syslog_lock);
+#endif
/* Let vsyslog do the work */
va_start(ap, fmt);
vsyslog(priority, fmt, ap);
va_end(ap);
+#ifdef CONFIG_SPINLOCK
+ spin_unlock(&g_syslog_lock);
+#endif
}
========================================================================
切换到非smp配置后,执行如下命令不会出现卡死现象:
make menuconfig
make savedefconfig
./tools/cmpconfig defconfig
./boards/arm/qemu/qemu-armv7a/configs/smp/defconfig
file1: CONFIG_BOARD_LATE_INITIALIZE=y
file2:
file1: CONFIG_DEBUG_SCHED=y
file2:
file1: CONFIG_DEBUG_SCHED_INFO=y
file2:
file1:
file2: CONFIG_EXAMPLES_HELLO=y
file1:
file2: CONFIG_SMP=y
file1: CONFIG_SPINLOCK=y
file2:
file1:
file2: CONFIG_TESTING_GETPRIME=y
file1:
file2: CONFIG_TESTING_OSTEST=y
make nuttx -j4
执行qemu
qemu-system-arm -cpu cortex-a7 -nographic -machine
virt,virtualization=off,gic-version=2 -net none -chardev stdio,id=con,mux=on
-serial chardev:con -mon chardev=con,mode=readline -kernel ./nuttx
正常回显:
psci_detect: Detected PSCI v0.2
nx_start: Entry
uart_register: Registering /dev/console
uart_register: Registering /dev/ttyS1
work_start_highpri: Starting high-priority kernel worker thread(s)
nxtask_activate: hpwork pid=1,TCB=0x40129310
nxtask_activate: AppBringUp pid=2,TCB=0x4012a3e0
nx_start_application: Starting init thread
task_spawn: name=nsh_main entry=0x4010adc4 file_actions=0 attr=0x4012b474
argv=0x4012b470
nxtask_activate: nsh_main pid=3,TCB=0x4012b4d8
nxtask_exit: AppBringUp pid=2,TCB=0x4012a3e0
lib_cxx_initialize: _sinit: 0x40121000 _einit: 0x40121000
NuttShell (NSH)
nsh> nx_start: CPU0: Beginning Idle Loop
nsh>
nsh>
nsh> qemu-system-arm: terminating on signal 2
### On which OS does this issue occur?
[OS: Linux]
### What is the version of your OS?
Linux DESKTOP-BNU9SN9 6.6.87.2-microsoft-standard-WSL2 #1 SMP
PREEMPT_DYNAMIC Thu Jun 5 18:30:46 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
### NuttX Version
master, ba3a55b445cd61c25e47bc92addfbbada33336c5
### Issue Architecture
[Arch: arm]
### Issue Area
[Area: Kernel]
### Host information
no
### Verification
- [x] I have verified before submitting the report.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]