CV-Bowen opened a new pull request, #21373:
URL: https://github.com/apache/nuttx/pull/21373
## Summary
Add a way to see what went through an rpmsg transport, for debugging a
peer that hangs or crashes:
- `rpmsg_initialize()`: a framework init hook, called from
`drivers_initialize()`.
- `CONFIG_RPMSG_TRACE`: `rpmsg_trace()` / `rpmsg_vtrace()` write a text
record and, optionally, a copy of the message to the note stream under
a new `NOTE_TAG_RPMSG` tag, so the note drivers (e.g. `/dev/note/ram`,
`trace dump`) keep the last messages. The payload goes out as
`NOTE_DUMP_BINARY` events split to fit `nc_length`. rpmsg_port records
the start and end of every endpoint callback.
`CONFIG_RPMSG_TRACE_BACKTRACE` appends a backtrace to the records that
ask for one.
- `CONFIG_RPMSG_PROCFS`: `/proc/rpmsg` lists the local and remote CPU of
every rpmsg device. Writing an `fnmatch()` pattern to it restricts the
trace to matching endpoint names; all endpoints are traced until a
pattern is written, and `*` traces all of them again.
## Impact
New options, all default off except `RPMSG_PROCFS` (`default
!DEFAULT_SMALL`, and it needs `FS_PROCFS_REGISTER`).
`include/nuttx/sched_note.h`
gains `NOTE_TAG_RPMSG`. No change when the options are off.
## 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
qemu-armv8a:rpserver/rpproxy with these test-only defconfig additions:
```
CONFIG_SCHED_INSTRUMENTATION=y
CONFIG_SCHED_INSTRUMENTATION_DUMP=y
CONFIG_SCHED_INSTRUMENTATION_FILTER=y
CONFIG_DRIVERS_NOTE=y
CONFIG_DRIVERS_NOTECTL=y
CONFIG_DRIVERS_NOTERAM=y
CONFIG_SYSTEM_TRACE=y
CONFIG_RPMSG_TRACE=y
CONFIG_FS_PROCFS_REGISTER=y
CONFIG_RPMSG_PROCFS=y
```
`/proc/rpmsg` on the server shows the virtio link and the port uart link:
```
proxy> cat /proc/rpmsg; echo __UPC_4__
Local CPU Remote CPU
server proxy
server2 proxy2
```
After `rpmsg ping all 3 64 3 0`, `trace dump` shows the port uart
endpoint callbacks and the message bytes:
```
rpmsg-uart-rx-5 [0] 384.307830448: tracing_mark_write: [Port] rx ept->cb
start ept:0x404cb0d8 name:rpmsg-ping cb:0x402d711c rdev:0x404cb158
hdr:0x404d1cc8 len:80
rpmsg-uart-rx-5 [0] 384.307950240: tracing_mark_write: I|5|01 04 00 00 01
04 00 00 00 00 01 00 40 00 00 00 20 00 00 00 40 00 00 00 d0 c0 4d 40 00 00 ...
rpmsg-uart-rx-5 [0] 384.308177616: tracing_mark_write: [Port] rx ept->cb
end ept:0x404cb0d8 name:rpmsg-ping cb:0x402d711c rdev:0x404cb158 hdr:0x404d1cc8
len:80
```
Filter: after `echo rpmsg-syslog > /proc/rpmsg` a ping leaves no
`name:rpmsg-ping` record after its `B|...|rpmsg ping` marker in the dump;
after `echo "*" > /proc/rpmsg` the same ping leaves 6.
Baseline with the options off:
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 34055e196d6 apps 54374b3b2
- 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]