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

   ## Summary
   
   > **Behaviour change:** a sender that cannot get a tx buffer from the
   > peer for 15 s now fails (and asserts with assertions enabled) instead of
   > waiting forever. See Impact.
   
   Five rpmsg changes, in the order they were made:
   
   - `test the virtio role with VIRTIO_ROLE_IS_*()`: use the OpenAMP role
     macros in rpmsg_virtio instead of comparing the role directly. No
     functional change. The defines that make these macros constant are not
     exported to `drivers/rpmsg` yet, so code size does not change either.
   - `poll the rx virtqueue NAPI style`: keep the rx virtqueue callback
     disabled while draining, then re-enable it and drain again if buffers
     arrived in the meantime. This bounds the notifications taken per
     burst; on the qemu-armv8a ivshmem link below it shows no measurable
     change in interrupt count or latency, it only has to keep the rx path
     correct under load.
   - `check the result of rpmsg_create_wqueues()` and
     `check the result of work_queue_setpriority_wq()`: `DEBUGVERIFY(x == 0)`
     can never fire, because `DEBUGVERIFY()` checks for a negative value.
     Pass the return value itself.
   - `give up waiting for a tx buffer after 15s`: `rpmsg_virtio_notify_wait()`
     swallowed every 20 ms timeout, so a sender spun forever once the peer
     stopped returning buffers and the OpenAMP liveness assert was never
     reached. Return `-ETIMEDOUT` after `RPMSG_TICK_COUNT` (15 s) of
     consecutive timeouts.
   
   ## Impact
   
   - **Behaviour change:** with assertions enabled, a sender blocked on a
     peer that returns no tx buffer for 15 s now hits the OpenAMP assert
     instead of hanging forever. With assertions disabled, the OpenAMP tx
     path gets no buffer and returns an error to the caller.
   - Work queue creation or priority failures are now caught by
     `DEBUGVERIFY()`.
   - No API, ABI or 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
   
   Each commit builds with 0 warnings on `sim:rpserver`, `sim:rpproxy`,
   `qemu-armv8a:rpserver`, `qemu-armv8a:rpproxy`, and `sim:rpserver` with
   `VIRTIO_DEVICE_SUPPORT` off.
   
   ### Peer stops returning tx buffers
   
   `qemu-armv8a:rpserver` + `rpproxy` over ivshmem. Stop the proxy QEMU with
   `SIGSTOP`, then on the server:
   
   ```
   rpmsg ping /dev/rpmsg/proxy 50 2048 0 0
   ```
   
   | | Result |
   |---|---|
   | master | no return and no assert within the 45 s observed |
   | this PR | assert after 15.1 s |
   
   ```
   [ EMERG] [server] dump_assert_info: Assertion failed !wait || rp_hdr != 
((void*)0): at file: /openamp/open-amp/lib/rpmsg/rpmsg_virtio.c:303 task: sh 
process: sh 0x4031329c
   ```
   
   ### rx polling, before/after
   
   `qemu-armv8a:rpserver` + `rpproxy`, plus `CONFIG_SCHED_IRQMONITOR=y`, three
   boots each. `rpmsg ping all <times> <len> <ack> 0`; values are the median
   of the three runs on the ivshmem link (`/dev/rpmsg/proxy`, 1520-byte
   payload unless noted).
   
   | Case (1000 pings) | master avg | this PR avg |
   |---|---|---|
   | server to proxy, ack | 202.3 us | 208.0 us |
   | server to proxy, 64 bytes, ack | 200.1 us | 161.7 us |
   | proxy to server, ack | 202.6 us | 201.9 us |
   | server to proxy, no ack | 21.8 us | 15.7 us |
   
   | ivshmem interrupts over the whole sequence | master | this PR |
   |---|---|---|
   | server | 39126 | 39123 |
   | proxy | 38610 | 38493 |
   
   This workload shows **no reduction in interrupts**, and the latency
   differences are within run-to-run spread (no-ack: master 20.8-24.8 us,
   this PR 15.5-25.4 us). It shows that the rx path still works under
   load; it does not demonstrate a performance gain.
   
   ### Regression
   
   Baseline (`test.sh`, cases: baseline.yaml + extra):
   
   - 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 7a2441e8731 apps bce81d57a
   - 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)
     - [x] `rpmsg dump all` (server)
     - [x] `rpmsg ping all 200 2048 3 0` (server)
     - [x] `rpmsg ping all 200 2048 3 0` (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)
     - [x] `rpmsg dump all` (server)
     - [x] `rpmsg ping all 200 2048 3 0` (server)
     - [x] `rpmsg ping all 200 2048 3 0` (proxy)
     - [x] `rpmsg dump all` (proxy)
   
   ### Not run
   
   - Real hardware.
   - `vio` configurations: only rpmsg_virtio and rpmsg core are changed.
   - The failure paths of the two `DEBUGVERIFY()` fixes were not injected.
   


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