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

   ## Summary
   
   `rpmsg_virtio_notify_wait()` returns `-EAGAIN` when it cannot wait in
   place (not in the recursive rx context). openamp's
   `rpmsg_virtio_get_tx_payload_buffer()` sleeps and retries only when
   `notify_wait_cb()` returns `RPMSG_EOPNOTSUPP`; any other value breaks
   the loop. So a thread that asks for a tx buffer with `wait = true`
   while the peer holds all of them fails at once and hits
   
   ```
   metal_assert(!wait || rp_hdr != NULL)
   ```
   
   in `openamp/open-amp/lib/rpmsg/rpmsg_virtio.c`. Return
   `RPMSG_EOPNOTSUPP` so the caller waits for a buffer as intended.
   
   ## Impact
   
   Only the case where all tx buffers are in use changes: a waiting caller
   now waits (up to openamp's `RPMSG_TICK_COUNT`) instead of asserting.
   No API 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
   
   Reproducer: `sim:rpserver` + `sim:rpproxy` with an out-of-tree
   extension of `drivers/rpmsg/rpmsg_test.c` (not part of this PR). Its
   existing hold-rx case leaves the peer holding every tx buffer; the added
   case then calls `rpmsg_get_tx_payload_buffer(ept, &space, true)` and
   round-trips the buffer with `rpmsg_send_nocopy()`. nsh on each side:
   `rpmsg test all`.
   
   | tree | server | proxy |
   | --- | --- | --- |
   | master + reproducer | assert in `rpmsg_virtio.c:303` | assert in 
`rpmsg_virtio.c:303` |
   | this PR + reproducer | pass | pass |
   
   <details><summary>before (server)</summary>
   
   ```
   [   19.180252] [server] Rpmsg Test: start send
   [   19.180283] [server] Rpmsg Test: tx buffer num=8 space=1520
   [   19.180301] [server] Rpmsg Test: send finish
   [   19.180342] [server] dump_assert_info: Assertion failed : at file: 
/openamp/open-amp/lib/rpmsg/rpmsg_virtio.c:303 task: sh
   ```
   
   </details>
   
   <details><summary>after (server)</summary>
   
   ```
   [   19.180247] [server] Rpmsg Test: start send
   [   19.180282] [server] Rpmsg Test: tx buffer num=8 space=1520
   [   19.180301] [server] Rpmsg Test: send finish
   [   19.230095] [server] Rpmsg Test: Test rpmsg send nocopy success!
   [   19.240097] [server] Rpmsg Test: Test rpmsg send success!
   [   19.240122] [server] Rpmsg Test: tx buffer num=8
   [   19.240137] [server] Rpmsg Test: release buffer success!
   ```
   
   </details>
   
   No regression on the fixed rpmsg cases:
   
   <details><summary>results.md</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 18b578fc922 apps 19a303645
   - 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]

  • [PR] drivers/rpmsg/rpmsg_virt... CV-Bowen (via GitHub) via commits

Reply via email to