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

   ## Summary
   
   Rework the rpmsg_virtio rx path so endpoints that need a low latency
   answer can get it. Part of it lives in open-amp, so the first commit
   adds two open-amp patches the rest of the series builds on:
   
   - `0022-rpmsg_virtio-export-the-rx-buffer-helpers.patch`: make
     `rpmsg_virtio_get_rx_buffer()`, `rpmsg_virtio_release_rx_buffer_nolock()`
     and `rpmsg_virtio_buf_held_dec_test()` public, and move the buffer held
     counter macros to `rpmsg_internal.h`. The function bodies are the
     current 2025.10.0 ones, only their linkage changes.
   - `0023-rpmsg_virtio-let-the-caller-provide-the-virtqueue-ca.patch`: add
     `rx_callback` and `tx_callback` to `struct rpmsg_virtio_config`. When
     set they are installed on the virtqueues instead of the default
     callbacks.
   
   On the NuttX side:
   
   - Fix the PM wakelock handling: relax it only from the tx done callback,
     update headrx during initialization, do not toggle the rx virtqueue
     callback (which may touch the peer's memory), and enable the tx
     callback at init.
   - Install the rx/tx callbacks through `struct rpmsg_virtio_config`, so an
     rx interrupt that arrives while the vdev is being initialized already
     reaches rpmsg_virtio, and use the virtqueue the callback was called
     with since `rvdev->rvq` is not set yet at that point.
   - Record the tx head index and print it in the dump next to headrx.
   - Walk the rx used ring from the interrupt. Messages for an
     `RPMSG_PRIO_RT` endpoint that has completed its name service handshake
     are delivered there; everything else goes to a ready list handled by
     the rx thread as before. An RT endpoint still waiting for
     `NS_CREATE_ACK` keeps going through the thread so its first data
     message cannot overtake the ACK.
   
   ## Impact
   
   Endpoints keep their current behaviour unless they set
   `RPMSG_PRIO_RT`, in which case their callback now runs in the rx
   interrupt and must not block. The open-amp changes are API additions;
   other users of `struct rpmsg_virtio_config` (e.g. rpmsg_virtio_lite)
   leave the new fields NULL and keep the default callbacks. No Kconfig
   change.
   
   ## 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
   
   All 23 open-amp patches apply in order on a fresh 2025.10.0 tree with
   both the Make (`open-amp.defs`) and the CMake (`open-amp.cmake`) lists.
   
   Baseline (sim and qemu-armv8a rpserver/rpproxy, all through
   rpmsg_virtio, `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 5867c3b10ec apps b017038e5
   - 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)
   
   The same cases also pass on `sim:rpserver_virtio` + `sim:rpproxy_virtio`
   (rpmsg_virtio_lite), which checks that the lite driver still gets the
   default virtqueue callbacks.
   
   RT path: a test-only change sets the `rpmsg-ping` endpoint to
   `RPMSG_PRIO_RT` and logs the first deliveries that take the RT branch.
   `rpmsg ping all 20 1024 3 0` (every byte checked by the peer) passes on
   both boards from both sides. On qemu-armv8a the messages are delivered
   from the rx interrupt:
   
   ```
   [    7.842069] [ 0] [ EMERG] [server] RTPATH rpmsg-ping in irq=1
   [    7.843126] [ 0] [ EMERG] [server] RTPATH rpmsg-ping in irq=1
   ```
   
   On sim the rptun notification is raised from a work queue rather than
   an interrupt, so the same branch runs in that context:
   
   ```
   [    7.990353] [server] RTPATH rpmsg-ping in irq=0
   ```
   


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