CV-Bowen opened a new pull request, #22235:
URL: https://github.com/apache/nuttx/pull/22235
## Summary
Part 3 of 3 of the rpmsg character device changes, stacked on part 2
(see apache/nuttx#22142 for the overview):
1. blocking server reads: apache/nuttx#22142
2. split reads, request buffers: apache/nuttx#P2
3. this PR: preallocated opens, more forwarded ioctls
Depends on apache/nuttx#P2
- `!preallocate the per-open state`, `!default DEV_RPMSG_OPEN_MAX to 2`:
`CONFIG_DEV_RPMSG_OPEN_MAX` per-open slots are embedded in the client
device and in the server endpoint, so open/close no longer touch the
heap; a further `open()` fails with -ENOMEM.
- `keep a copy of the remote cpu and path`: the device no longer points
at the caller's strings.
- `forward the configdata ioctls` (the `config_data_s` data pointer is
copied inline), `read the configdata length unaligned` (server),
`forward BATIOC_ONLINE`.
- `run the client endpoint at RPMSG_PRIO_RT`.
- `name the endpoint callback after its side` (server, rename only).
## BREAKING CHANGE
| What | Quick fix |
|---|---|
| New `DEV_RPMSG_OPEN_MAX` (default 2): a device can be open at most that
many times at once, a further `open()` fails with -ENOMEM | raise
`CONFIG_DEV_RPMSG_OPEN_MAX` |
## Impact
- New Kconfig `DEV_RPMSG_OPEN_MAX`; see the table above.
- Only `drivers/misc/rpmsgdev*` and `drivers/misc/Kconfig` are touched.
## 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
Every commit of the three parts builds sim:rpserver, sim:rpproxy (with
`RPMSGDEV_TEST` from the commit that drops the `flags` argument),
qemu-armv8a:rpserver (+ `DEV_RPMSG_SERVER`) and qemu-armv8a:rpproxy
(+ `DEV_RPMSG`) with 0 warnings.
Runtime setup (test-only board changes, not part of this PR): the
server creates three FIFOs `/dev/p126fifo0..2` and keeps a writer open
on each, so a reader blocks until data is written; the proxy registers
them as `/dev/server-fifo0..2`, plus `/dev/zero` as `/dev/server-zero`.
Both sides use `CONFIG_RPMSG_POOL_COUNT=4`; sim also has `MM_KASAN`.
qemu-armv8a runs
rpserver + rpproxy as two QEMU instances over ivshmem.
The same cases run on the head of each part, on both targets:
| Case | part 1 | part 2 | part 3 |
|---|---|---|---|
| `dd if=/dev/server-zero bs=8192 count=4` (sim time) | 32768 bytes, 239967
usec | 32768 bytes, 70225 usec | 32768 bytes, 40294 usec |
| blocking read of `/dev/server-fifo0`, then `echo p126blk > /dev/p126fifo0`
on the server | waits, gets the data | same | same |
| three idle blocking readers, then more rpmsgdev I/O and `rpmsg ping` | all
wait, I/O and ping work | same | same |
| server `rptun stop` while the proxy has a blocking read pending | server
alive, the proxy's read returns -ENOTCONN (107) | same | same |
(The test harness flags the proxy's `nsh: cat: read failed: 107` line
as an error; it is the expected -ENOTCONN. Part 1 reads at most one
rpmsg buffer per call, hence the slower `dd`.)
Without the fixes (on earlier splits of this series that did not have
the fix yet):
- `rptun stop` with a read pending: qemu server crashes in
`rpmsgdev_read_work()`, sim: KASAN read error in `work_dispatch()`.
- three idle readers with the pool (before `keep request messages on
the stack again`): the qemu proxy crashes in `rpmsgdev_open()` on the
NULL pool block, the sim proxy hangs.
No regression in rpmsg: on the head of this PR sim:rpserver/rpproxy and
qemu-armv8a:rpserver/rpproxy pass the fixed rpmsg cases (dump, ping, rpmsgfs)
plus the rpmsgdev cases on the unchanged sim configs (console, null, a 16 KB
write in 4 KB blocks, small reads), 21/21. qemu-armv8a was built with
LIBC_ENVPATH and BINFMT_CHECKEXEC disabled, which current master needs for
nxinit to start nsh there; unrelated to this change.
--
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]