nuttx/drivers
wangshaoxin 43d26e2890 drivers/rptun: solve the poweroff stuck problem
The rpmsg_ioctl() function will first obtain the read lock before
traversing g_rpmsg, then the rpmsg_dev_destory function will try
to obtain the write lock.

At this time, rpmsg_ioctl does not release the read lock, resulting
in a deadlock.

To solve this problem, add a standardalone list for the rptun instance
to avoid hold the rpmsg lock when execute rptun_poweroff()

Backtrace:
Thread 14 nsh_main
0  0x4412b9da in up_switch_context (tcb=0xeac03380, rtcb=0xe7f02480) at sim/sim_switchcontext.c:95
1  0x43fbe5e4 in nxsem_wait_slow (sem=0x5179d570 <g_rpmsg_lock+16>) at semaphore/sem_wait.c:170
2  0x43fbeacf in nxsem_wait (sem=0x5179d570 <g_rpmsg_lock+16>) at semaphore/sem_wait.c:272
3  0x44671a26 in down_write (rwsem=0x5179d560 <g_rpmsg_lock>) at semaphore/sem_rw.c:248
4  0x4401e255 in rpmsg_device_destory (rpmsg=0xe7b03280) at rpmsg/rpmsg.c:469
5  0x4402f5fe in rptun_dev_stop (rproc=0xe7b033e4, stop_ns=true) at rptun/rptun.c:973
6  0x4402aa28 in rptun_ioctl (rpmsg=0xe7b03280, cmd=11109, arg=0) at rptun/rptun.c:661
7  0x4401ba1e in rpmsg_dev_ioctl_ (rpmsg=0xe7b03280, cmd=11109, arg=0) at rpmsg/rpmsg.c:137
8  0x4401ee88 in rpmsg_ioctl (cpuname=0x0, cmd=11109, arg=0) at rpmsg/rpmsg.c:562
9  0x44030cb0 in rptun_poweroff (cpuname=0x0) at rptun/rptun.c:1183
10 0x43f27be2 in board_power_off (status=0) at sim/sim_head.c:211
11 0x446fd933 in boardctl (cmd=65283, arg=0) at boardctl.c:401
12 0x44313b95 in cmd_poweroff (vtbl=0xe7600e80, argc=1, argv=0xe7824350) at nsh_syscmds.c:368
13 0x442d148c in nsh_command (vtbl=0xe7600e80, argc=1, argv=0xe7824350) at nsh_command.c:1275
14 0x442f65f5 in nsh_execute (vtbl=0xe7600e80, argc=1, argv=0xe7824350, param=0xe78242b0) at nsh_parse.c:716
15 0x44304fb4 in nsh_parse_command (vtbl=0xe7600e80, cmdline=0xe7601338 "poweroff") at nsh_parse.c:2809
16 0x44305a50 in nsh_parse (vtbl=0xe7600e80, cmdline=0xe7601338 "poweroff") at nsh_parse.c:2919
17 0x442bdc91 in nsh_session (pstate=0xe7600e80, login=1, argc=1, argv=0xe7814870) at nsh_session.c:246
18 0x442bbbe5 in nsh_consolemain (argc=1, argv=0xe7814870) at nsh_consolemain.c:75
19 0x4422b4bb in nsh_main (argc=1, argv=0xe7814870) at nsh_main.c:74
20 0x440ee098 in nxtask_startup (entrypt=0x4422b39a <nsh_main>, argc=1, argv=0xe7814870) at sched/task_startup.c:72
21 0x43fa1d6e in nxtask_start () at task/task_start.c:116
22 0x4412982c in pre_start () at sim/sim_initialstate.c:53
23 0x00000000 in ?? ()

Signed-off-by: wangshaoxin <wangshaoxin@xiaomi.com>
2026-01-08 12:05:46 +08:00
..
1wire drivers/1wire/1wire_ds2xxx.h: add the driver for DS2XXX eeproms. 2025-10-10 08:55:45 +02:00
aie drivers: unify Private Types banners 2025-05-28 10:17:15 +08:00
analog drivers/adc: Use mutexlock to replace critical section protection 2026-01-05 22:03:12 +08:00
audio timers/oneshot: Remove all callback and args. 2025-11-18 13:02:29 +01:00
bch drivers/fs: Control the behavior of FTL by passing oflags during the open process. 2025-07-16 14:11:41 +08:00
can can: ctucanfd: initialize CAN message header on receive 2026-01-06 23:20:18 +08:00
clk style: fix spelling in code comments and strings 2025-05-23 10:48:41 +08:00
contactless sched/sleep: replace all Signal-based sleep implement to Scheduled sleep 2025-10-17 14:05:02 +08:00
coresight arch | boards | drivers: fix whitespace issues for switch case statements 2025-05-23 10:48:41 +08:00
crypto sched/sleep: replace all Signal-based sleep implement to Scheduled sleep 2025-10-17 14:05:02 +08:00
devicetree style: fix spelling in code comments and strings 2025-05-23 10:48:41 +08:00
dma drivers: migrate to SPDX identifier 2024-11-06 18:02:25 +08:00
dummy drivers: migrate to SPDX identifier 2024-11-06 18:02:25 +08:00
eeprom mtd/at25ee: Use eeprom/spi_xx25xx internally 2025-12-17 19:03:54 +01:00
efuse drivers: unify Private Types banners 2025-05-28 10:17:15 +08:00
i2c drivers/i2c: add ioexpander-based lower-half implementation for I2C bit-bang 2026-01-01 17:08:47 +08:00
i2s drivers/i2s/i2schar: Implement blocking read/write operations 2025-08-27 11:07:05 +08:00
i3c Revert: "drivers/i3c: remove extra i3c_dev_register, do_daa has created them" 2025-12-09 08:23:46 -03:00
input drivers/input/ff: use small lock to replace enter_critical_section 2026-01-08 11:17:17 +08:00
ioexpander ioe_dummy: fix pinval always zero issue 2026-01-05 15:10:41 -03:00
ipcc style: fix spelling in code comments and strings 2025-05-23 10:48:41 +08:00
lcd lcd/ili9341: Improve initialization 2025-12-10 23:54:44 +08:00
leds drivers/leds: remove bo_closing as lu_lock can prevent race condition occurs 2026-01-08 11:17:17 +08:00
loop drivers/iovec: revert vector io implement from loop/null/zero driver 2025-01-22 11:29:39 +08:00
math drivers/math: use small lock to replace enter_critical_section 2026-01-08 11:17:17 +08:00
misc rpmsgdev: fix export null issue when rpmsgdev init 2025-12-12 17:48:43 +08:00
mmcsd drivers/mmcsd: Aligned Cmake with Make 2025-12-09 14:25:40 -03:00
modem sched/sleep: replace all Signal-based sleep implement to Scheduled sleep 2025-10-17 14:05:02 +08:00
motor drivers/motor: use small lock to replace enter_critical_section 2026-01-08 11:17:17 +08:00
mtd driver/cfi: fix write failed issue for unalign length with bankwidth 2025-12-31 02:36:01 +08:00
net driver/net: replace net_lock with netdev_lock 2026-01-06 16:08:30 +08:00
note node/driver: make SIZEOF_NOTE_START return the right size 2025-12-23 11:26:24 -05:00
pci drivers/pci: fix arm32 build warning 2025-12-01 14:38:02 +01:00
pinctrl drivers: migrate to SPDX identifier 2024-11-06 18:02:25 +08:00
pipes fs/drivers: Avoid causing a busy loop in the program due to context switching induced by sem_post. 2025-03-17 10:44:26 +01:00
power power/battery: set interval to reduce report via ioctl 2025-12-22 09:15:56 -03:00
rc style: fix spelling in code comments and strings 2025-05-23 10:48:41 +08:00
regmap style: fix spelling in code comments and strings 2025-05-23 10:48:41 +08:00
reset style: fix spelling in code comments and strings 2025-05-23 10:48:41 +08:00
rf drivers/rf: migrate license to ASF 2024-11-06 19:46:13 +08:00
rmt drivers: migrate to SPDX identifier 2024-11-06 18:02:25 +08:00
rpmsg drivers/rptun: change the notify wait return type after upgrade OpenAMP 2026-01-08 12:05:46 +08:00
rptun drivers/rptun: solve the poweroff stuck problem 2026-01-08 12:05:46 +08:00
segger drivers/segger: Add a kconfig to override Segger SystemView target sources version 2025-07-22 23:21:31 +08:00
sensors gnss_uorb.c: update upper->parsebuffer every new line 2026-01-05 12:43:34 -03:00
serial drivers/serial/pty: fix memory leak when pty_destroy 2026-01-06 15:08:23 -03:00
spi sched/sleep: replace all Signal-based sleep implement to Scheduled sleep 2025-10-17 14:05:02 +08:00
syslog Documentation: Add description for early_syslog() 2025-10-31 08:29:17 -03:00
thermal style: fix spelling in code comments and strings 2025-05-23 10:48:41 +08:00
timers drivers/timers: use DEBUGASSERT check abnormal values 2026-01-08 11:56:18 +08:00
usbdev driver/net: replace net_lock with netdev_lock 2026-01-06 16:08:30 +08:00
usbhost driver/net: replace net_lock with netdev_lock 2026-01-06 16:08:30 +08:00
usbmisc sched/sleep: replace all Signal-based sleep implement to Scheduled sleep 2025-10-17 14:05:02 +08:00
usbmonitor sched/sleep: replace all Signal-based sleep implement to Scheduled sleep 2025-10-17 14:05:02 +08:00
usrsock usrsock_rpmsg_server.c: replace net_lock with conn_lock 2026-01-07 09:17:49 -03:00
vhost virtio/vhost: update virtqueue_get_available_buffer() api 2025-12-31 02:36:29 +08:00
video sched/sleep: replace all Signal-based sleep implement to Scheduled sleep 2025-10-17 14:05:02 +08:00
virtio virtio-gpu: support vsync and double fb. 2026-01-08 02:49:43 +08:00
wireless driver/net: replace net_lock with netdev_lock 2026-01-06 16:08:30 +08:00
.gitignore build: Remve the unnecessary .gitignore 2020-05-23 18:00:40 +01:00
CMakeLists.txt drivers: migrate to SPDX identifier 2024-11-06 18:02:25 +08:00
drivers_initialize.c sensor_monitor: add /proc/sensor_monitor 2026-01-04 09:24:30 -03:00
Kconfig AI engine driver 2024-10-16 13:57:23 +08:00
Makefile drivers: migrate to SPDX identifier 2024-11-06 18:02:25 +08:00