CV-Bowen opened a new pull request, #22192:
URL: https://github.com/apache/nuttx/pull/22192
## Summary
Three rptun core changes, in the order they were made:
- `add rptun_dump_resource()`: print every vdev (id, features, status,
vrings, config space) and carveout (name, da, pa, length, flags) entry
of a resource table. Bringing up a new rptun transport usually starts
with checking that both sides agree on the table; a transport driver
can call this while it is being brought up.
- `dump the peer's syslog buffer on halt`: when the peer keeps its rpmsg
syslog buffer in shared memory and publishes it as the `RSC_TRACE`
entry of the resource table, map that region when the peer starts, add
`RPTUNIOC_DUMP` to print it with `syslog_rpmsg_dump()`, and dump every
peer from the reboot notifier on `SYS_HALT`, right after the peers are
told to panic. This shows the peer's log lines that had not reached
this side yet, e.g. its own crash output. Built only with
`CONFIG_SYSLOG_RPMSG_SERVER`.
- `poll for the peer's devices every millisecond`: `rptun_start_thread()`
retries `rptun_create_devices()` until the peer has filled the resource
table, sleeping 1 s between tries; a peer that is ready a few
milliseconds later cost a whole second of boot time. Sleep 1 ms.
## Impact
- New API `rptun_dump_resource()` (no in-tree caller; for transport
bring-up) and new ioctl `RPTUNIOC_DUMP` (`_RPTUNIOC(4)`).
- With `CONFIG_SYSLOG_RPMSG_SERVER`, a kernel panic additionally prints
the syslog buffer of every peer that has an `RSC_TRACE` entry. No
in-tree resource table has one yet, so nothing changes for the
existing boards.
- rptun polls for the peer's devices every 1 ms instead of every 1 s
during start-up.
## 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 builds sim:rpserver, sim:rpproxy, qemu-armv8a:rpserver and
qemu-armv8a:rpproxy with 0 warnings.
**Resource table and peer syslog dump (sim:rpserver + sim:rpproxy).** No
in-tree table has an `RSC_TRACE` entry and nothing calls
`rptun_dump_resource()`, so a test-only patch (not in this PR) to
`arch/sim/src/sim/sim_rptun.c` adds a 4 KB `RSC_TRACE` region to the sim
resource table, points the proxy's rpmsg syslog buffer at it
(`CONFIG_SYSLOG_RPMSG_BUFSIZE=0`), and calls `rptun_dump_resource()` on
the server once the table is built. The proxy is also built with
`CONFIG_SYSLOG_RPMSG_WORK_DELAY=60000` so that its log stays in the buffer
instead of being forwarded right away, standing in for a peer that died
before it could forward it. A test-only app issues
`ioctl(fd, RPTUNIOC_DUMP, 0)` on `/dev/rptun/proxy`, or triggers an
assertion.
Steps: proxy `echo P131MARK > /dev/logrpmsg`, proxy asserts, then server
`RPTUNIOC_DUMP` on `/dev/rptun/proxy`.
| | master | this PR |
|---|---|---|
| server boot log | no table dump | every vdev and carveout of the table |
| `RPTUNIOC_DUMP` (2 runs) | not defined | prints the proxy's buffer:
`P131MARK` and the proxy's assertion |
<details><summary>this PR</summary>
```
[server] [vdev] VirtIO Entropy
[server] [carveout] Rsc 1 0xea54b07c
[server] [carveout] Carveout vdev0buffer
[server] [carveout] da 0x000000b4 pa 0xffffffff len 65536 flags 0x0 reserved 0
...
[server] syslog_rpmsg_dump: Dump syslog rpmsg header:0xf08e72d0 head:382
tail:0 size:4080
[server] syslog_rpmsg_dump: [ 0.080161] [proxy] rpmsg_rtc_ept_cb: rpmsg
rtc client sync time:1795277942
[ 7.120238] [proxy] P131MARK
[ 8.600299] [proxy] dump_assert_info: Current Version: NuttX proxy ...
[ 8.600332] [proxy] dump_assert_info: Assertion failed : at file:
.../p131dump_main.c:25 task: p131dump ...
p131dump: ioctl ret 0
```
</details>
Not tested: the `SYS_HALT` path end to end. On sim, a kernel panic on the
server resets the proxy first (`RPTUNIOC_RESET`), and the sim reset of the
peer ends the server process before the dump runs; the dump itself is
the same `RPTUNIOC_DUMP` handler exercised above.
**Retry period (qemu-armv8a:rpserver + rpproxy over ivshmem).** 20 boots
each, `rpmsg ping all 1 64 1 0` from both nodes after boot:
| | master | this PR |
|---|---|---|
| boots that pass both pings | 20/20 | 20/20 |
| wall time for 20 boot+ping runs | 131 s | 132 s |
This shows the shorter period does not break start-up (an earlier attempt
saw a fault in the rx callback with it, fixed since by the rpmsg_virtio
rx callback change). In these configs the peer's table is ready on the
first try, so the shorter wait itself is not visible in the timing.
No regression in rpmsg: sim:rpserver/rpproxy and
qemu-armv8a:rpserver/rpproxy boot and pass the fixed rpmsg cases (dump, ping,
rpmsgfs; 15/15). 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]