CV-Bowen opened a new pull request, #21609:
URL: https://github.com/apache/nuttx/pull/21609

   ## Summary
   
   Make the rpmsg dump useful on a crash and safe to run from the panic
   path. Companion apps PR: apache/nuttx-apps#{apps_pr}.
   
   - `rpmsg_virtio_dump()` prints the unretrieved/retrieved counts of
     both rings, not only the pending buffers.
   - `rpmsg_ops_s.dump()` and `rpmsg_port_ops_s.dump()` take a
     `verbose` flag; `RPMSGIOC_DUMP` passes its argument through. The
     endpoint list and the buffer lists are printed only when it is true,
     so a brief dump is a few lines per link. The rpmsg_port timeout dump
     stays verbose.
   - Each rpmsg device registers a panic notifier and dumps itself at
     `PANIC_KERNEL_FINAL`. `CONFIG_RPMSG_PANIC_DUMP_LEVEL`: 0 off,
     1 brief, 2 verbose (default unless `DEFAULT_SMALL`).
   - rpmsg_virtio skips the dump until the vdev is started: a panic
     between `rpmsg_register()` and the end of
     `rpmsg_init_vdev_with_config()` would otherwise walk an endpoint
     list that is not initialized yet.
   - `rpmsg_virtio_dump_buffer()` ignores ring entries whose descriptor
     index is not below `vq_nentries`; a peer that panicked mid-update
     can leave such an index, and reading `desc[]` with it faulted inside
     the panic dump.
   
   ## Impact
   
   - `rpmsg_ops_s.dump` / `rpmsg_port_ops_s.dump` signature change; all
     in-tree implementations are updated. Out-of-tree transports add the
     `bool verbose` argument.
   - `RPMSGIOC_DUMP` argument: 0 brief, non-zero verbose. nsh's
     "rpmsg dump" passes 0 today, so without the apps PR it prints the
     brief dump.
   - New Kconfig `RPMSG_PANIC_DUMP_LEVEL`; with it at 0 nothing is
     registered on the panic chain.
   
   ## 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
   
   **Panic dump**, qemu-armv8a:rpserver + rpproxy (rptun ivshmem and
   rpmsg_port uart), test-only `examples/hello` that calls `PANIC()`,
   `CONFIG_BOARD_RESET_ON_ASSERT=2` so a task assert takes the kernel
   panic path (`PANIC_KERNEL_FINAL`). On the proxy: `hello`.
   
   | tree | proxy output after the assert |
   | --- | --- |
   | master | register dump and backtrace only |
   | this PR, `RPMSG_PANIC_DUMP_LEVEL=2` | per link: header, endpoint list, 
rings, buffer lists |
   | this PR, `RPMSG_PANIC_DUMP_LEVEL=1` | per link: header and rings, no 
endpoint/buffer lists |
   
   <details><summary>master</summary>
   
   ```
   [    3.347970] [ 8] [ EMERG] [server] ping times: 3
   
   [    3.348208] [ 8] [ EMERG] [server] buffer_len: 1520, send_len: 64
   
   [    3.348594] [ 8] [ EMERG] [server] avg: 0 s, 489541 ns
   
   ```
   
   </details>
   
   <details><summary>this PR, level 2 (rpmsg_virtio link)</summary>
   
   ```
   [proxy] Local: proxy Remote: server Headrx 8 Headtx 10
   
   [proxy] Dump rpmsg info between cpu (master: no)proxy <==> server:
   
   [proxy]   rpmsg ept list:
   
   [proxy]     ept NS 0x404b1be8: addr=53 dest=53 refcnt=1 priority=127 
priv=0x404b1bd8
   
   [proxy]     ept rpmsg-syslog 0x404a3278: addr=1024 dest=1026 refcnt=1 
priority=127 priv=0x404a3228
   
   [proxy]     ept rpmsg-sensor 0x404ca230: addr=1025 dest=1024 refcnt=1 
priority=127 priv=0x404ca220
   
   [proxy]     ept rpmsg-ping 0x404b1b40: addr=1026 dest=1025 refcnt=1 
priority=127 priv=0
   
   [proxy] rpmsg vq RX:
   
   [proxy] VQ: rx_vq - size=8; free=8; queued=0; desc_head_idx=0; 
available_idx=8; avail.idx=8; used_cons_idx=0; used.idx=8; avail.flags=0x0; u
   [proxy] rpmsg vq TX:
   
   [proxy] VQ: tx_vq - size=8; free=8; queued=0; desc_head_idx=0; 
available_idx=10; avail.idx=18; used_cons_idx=0; used.idx=10; avail.flags=0x0
   [proxy]   rpmsg buffer list:
   
   [proxy]     RX buffer total 8
   
   [proxy]       unretrieved 0
   
   ```
   
   </details>
   
   <details><summary>this PR, level 1</summary>
   
   ```
   [    3.417465] [ 8] [ EMERG] [server] ping times: 3
   
   [    3.417728] [ 8] [ EMERG] [server] buffer_len: 1520, send_len: 64
   
   [    3.418171] [ 8] [ EMERG] [server] avg: 0 s, 800034 ns
   
   [    3.418549] [ 8] [ EMERG] [server] min: 0 s, 226249 ns
   
   [    3.418883] [ 8] [ EMERG] [server] max: 0 s, 1917556 ns
   
   [    3.419290] [ 8] [ EMERG] [server] rate: 0.639972 Mbits/sec
   
   ```
   
   </details>
   
   **Manual dump**: "rpmsg dump all" on sim and qemu-armv8a with the apps
   PR prints the verbose dump; with nsh passing 0 it prints the header and
   the rings only.
   
   <details><summary>baseline (results.md, with the apps PR)</summary>
   
   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 81f76ebfa98 apps 6942415f7
   - qemu-armv8a:rpserver qemu-armv8a:rpproxy 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)
   
   </details>
   


-- 
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]

Reply via email to