CV-Bowen opened a new pull request, #21082:
URL: https://github.com/apache/nuttx/pull/21082
## Summary
Two fixes in the rpmsg_virtio PM path:
- `pm_wakelock_stay()`/`pm_wakelock_relax()` can switch context, which must
not happen while `priv->lock` is held with only interrupts disabled. Take
the lock with `spin_lock_irqsave_nopreempt()`, and also in
`rpmsg_virtio_pm_callback()`, so the PM state cannot race with the TX path
on SMP.
- `rpmsg_virtio_probe()` initializes `priv->wakelock` under
`CONFIG_RPMSG_VIRTIO_PM`, but remove freed `priv` without
`pm_wakelock_uninit()`, leaving it registered with the PM framework.
## Impact
`drivers/rpmsg/rpmsg_virtio.c` with `CONFIG_RPMSG_VIRTIO_PM` only. No API
or Kconfig change.
## Testing
Host: Ubuntu 22.04.5 LTS x86_64, QEMU version 10.2.1, sim: cc (Ubuntu
13.1.0-8ubuntu1~22.04) 13.1.0, qemu-armv8a: aarch64-none-elf-gcc (Arm GNU
Toolchain 12.2.Rel1 (Build arm-12.24)) 12.2.1 20221205
The changed code is only built with `CONFIG_RPMSG_VIRTIO_PM`, which the
stock configurations leave off. With `CONFIG_PM=y` and
`CONFIG_RPMSG_VIRTIO_PM=y` (`_AUTORELAX` defaults to y) added to
`sim:rpserver` and `sim:rpproxy`, the baseline passes with this change,
exercising `rpmsg_virtio_pm_action()` on every TX and the autorelax
callback. The same run on master passes too: the race needs SMP and the
context switch a PM driver that sleeps, neither of which sim has, so this
shows the PM path still works rather than reproducing the bug. The stock
baseline is below.
Baseline (`test.sh`, cases: baseline.yaml):
- host: Ubuntu 22.04.5 LTS x86_64, QEMU version 10.2.1, sim: cc (Ubuntu
13.1.0-8ubuntu1~22.04) 13.1.0, qemu-armv8a: aarch64-none-elf-gcc (Arm GNU
Toolchain 12.2.Rel1 (Build arm-12.24)) 12.2.1 20221205
- tested: nuttx 02b3c72737b apps 5f1100d02
- qemu-armv8a built with test-only overlay: disabled LIBC_ENVPATH
BINFMT_CHECKEXEC
- sim:rpserver + sim:rpproxy: PASS
- [x] `uname -a` (server)
- [x] `rpmsg dump all` (server)
- [x] `rpmsg ping all 10 1024 3 0` (server)
- [x] `uname -a` (proxy)
- [x] `rpmsg ping all 10 1024 3 0` (proxy)
- [x] `mount -t rpmsgfs -o cpu=server,fs=/proc /sp` (proxy)
- [x] `cat /sp/version` (proxy)
- [x] `rpmsg dump all` (proxy)
- qemu-armv8a:rpserver + qemu-armv8a:rpproxy: PASS
- [x] `uname -a` (server)
- [x] `uname -a` (proxy)
- [x] `rpmsg dump all` (server)
- [x] `rpmsg ping all 10 1024 3 0` (server)
- [x] `rpmsg ping all 10 1024 3 0` (proxy)
- [x] `mount -t rpmsgfs -o cpu=server,fs=/proc /sp` (proxy)
- [x] `cat /sp/version` (proxy)
--
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]