Repository navigation
drivers/rpmsg: verbose dump ops and panic-time dump - #21609
Merged
Merged
Conversation
CV-Bowen
requested review from
anchao,
jerpelea and
xiaoxiang781216
as code owners
November 10, 2026 04:17
|
rpmsg_virtio_dump_buffer() printed only the total and the pending buffers, so a stuck link did not show whether the buffers were still unretrieved in the ring or already taken by an endpoint. Print, for both rings, the total, how many entries are unretrieved, how many are retrieved, and then the pending (rx) or sent (tx) buffers. Signed-off-by: Yongrong Wang <[email protected]>
rpmsg_ops_s.dump() and rpmsg_port_ops_s.dump() always printed the endpoint list and every rx/tx buffer, which is too much for a quick look or for a dump taken on a small system. Add a verbose argument: RPMSGIOC_DUMP passes its ioctl argument through, the transports print the endpoint list and the buffer lists only when it is true, and the port timeout dump keeps the full output. Signed-off-by: chenzihan1 <[email protected]> Signed-off-by: Bowen Wang <[email protected]>
CV-Bowen
force-pushed
the
up/P61-rpmsg-dump
branch
from
November 10, 2026 07:07
81f76eb to
6757189
Compare
xiaoxiang781216
previously approved these changes
Nov 10, 2026
When a core panics, the state of its rpmsg links (rings, buffers, endpoints) is often what explains the crash, but nothing dumps it. Register a panic notifier per rpmsg device and run RPMSGIOC_DUMP at PANIC_KERNEL_FINAL. CONFIG_RPMSG_PANIC_DUMP_LEVEL selects how much is printed: 0 disables the dump, 1 prints the brief dump, 2 the verbose one (default unless DEFAULT_SMALL). The rpmsg dump command is not affected. Signed-off-by: Bowen Wang <[email protected]>
verdin-mx8mp:rpmsg runs from the 128K ITCM and the rpmsg panic dump added by the previous patch makes the image overflow it: arm-none-eabi-ld: region `flash' overflowed by 80 bytes Set CONFIG_RPMSG_PANIC_DUMP_LEVEL=0 for this config, which keeps it the same as before the panic dump was added. Signed-off-by: Bowen Wang <[email protected]>
rpmsg_register() adds the panic notifier before the vdev is started. rvdev->vdev is set at the start of rpmsg_init_vdev_with_config(), but rdev->endpoints is initialized only near its end, so a panic in that window walks an endpoint list whose next pointer is still NULL and faults inside the panic handler. rpmsg_virtio_start() sets rdev->ns_unbind_cb after rpmsg_init_vdev_with_config() returns; skip the dump until it is set. Signed-off-by: wangyongrong <[email protected]> Signed-off-by: Bowen Wang <[email protected]>
rpmsg_virtio_dump_buffer() reads desc_idx from the ring (avail->ring[] or used->ring[].u.id) and indexes vq_ring.desc[] with it unchecked. When the peer panics in the middle of a ring update the ring can hold a stale or out-of-range index; desc[] then reads into the avail/used area, and on sim UBSan reports the misaligned 64-bit desc.addr load, which aborts the panic dump. Skip entries whose index is not below vq_nentries and keep printing the others. Signed-off-by: dengwenqi <[email protected]> Signed-off-by: Bowen Wang <[email protected]>
CV-Bowen
force-pushed
the
up/P61-rpmsg-dump
branch
from
November 10, 2026 14:55
6757189 to
d745c9c
Compare
xiaoxiang781216
approved these changes
Nov 11, 2026
GUIDINGLI
approved these changes
Nov 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Make the rpmsg dump useful on a crash and safe to run from the panic
path. Companion apps PR: apache/nuttx-apps#4000.
rpmsg_virtio_dump()prints the unretrieved/retrieved counts ofboth rings, not only the pending buffers.
rpmsg_ops_s.dump()andrpmsg_port_ops_s.dump()take averboseflag;RPMSGIOC_DUMPpasses its argument through. Theendpoint 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.
PANIC_KERNEL_FINAL.CONFIG_RPMSG_PANIC_DUMP_LEVEL: 0 off,1 brief, 2 verbose (default unless
DEFAULT_SMALL).RPMSG_PANIC_DUMP_LEVEL=0: it runs from the128K ITCM and the panic dump made it overflow by 80 bytes.
between
rpmsg_register()and the end ofrpmsg_init_vdev_with_config()would otherwise walk an endpointlist that is not initialized yet.
rpmsg_virtio_dump_buffer()ignores ring entries whose descriptorindex is not below
vq_nentries; a peer that panicked mid-updatecan leave such an index, and reading
desc[]with it faulted insidethe panic dump.
Impact
rpmsg_ops_s.dump/rpmsg_port_ops_s.dumpsignature change; allin-tree implementations are updated. Out-of-tree transports add the
bool verboseargument.RPMSGIOC_DUMPargument: 0 brief, non-zero verbose. nsh's"rpmsg dump" passes 0 today, so without the apps PR it prints the
brief dump.
RPMSG_PANIC_DUMP_LEVEL; at 0 nothing is registered onthe panic chain and the notifier code is not built.
every commit; 328 bytes are left on master and 32 with this PR (panic
dump off there), the cost of the verbose flag and the ring counters.
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/hellothat callsPANIC(),CONFIG_BOARD_RESET_ON_ASSERT=2so a task assert takes the kernelpanic path (
PANIC_KERNEL_FINAL). On the proxy:hello.RPMSG_PANIC_DUMP_LEVEL=2(default)RPMSG_PANIC_DUMP_LEVEL=1master
this PR, level 2 (rpmsg_virtio link)
this PR, level 1
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.
baseline (results.md, with the apps PR)
Baseline (
test.sh, cases: baseline.yaml):uname -a(server)rpmsg dump all(server)rpmsg ping all 10 1024 3 0(server)uname -a(proxy)rpmsg ping all 10 1024 3 0(proxy)mount -t rpmsgfs -o cpu=server,fs=/proc /sp(proxy)cat /sp/version(proxy)rpmsg dump all(proxy)uname -a(server)uname -a(proxy)rpmsg dump all(server)rpmsg ping all 10 1024 3 0(server)rpmsg ping all 10 1024 3 0(proxy)mount -t rpmsgfs -o cpu=server,fs=/proc /sp(proxy)cat /sp/version(proxy)