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

   ## Summary
   
   The device (vhost) side of the virtqueue ping device added to the virtio
   framework in apache/nuttx#22167 (merged); together they measure the bare
   virtqueue round trip between two cores.
   
   - `drivers/vhost: add vhost_foreach_device()`: walk the claimed devices
     with a given id under the bus lock. `/dev/vhost` is a single global
     node, so an ioctl aimed at one device needs this to find it.
   - `drivers/vhost: add the vhost-ping backend`:
     `CONFIG_DRIVERS_VHOST_PING`. It answers the requests of a virtio-ping
     driver on the other core and can also initiate; `VHOSTIOC_PING` has the
     same value and argument as `VIRTIOIOC_PING`. The wire format is the
     one in `include/nuttx/virtio/virtio-ping.h`.
   
   The nsh `vhost ping` subcommand is in apache/nuttx-apps#4112.
   
   ## Impact
   
   - New Kconfig `DRIVERS_VHOST_PING`, default n.
   - New ioctl `VHOSTIOC_PING`, new `vhost_foreach_device()`.
   - No change for existing devices.
   
   ## 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
   
   Every commit builds sim:rpproxy and qemu-armv8a:rpproxy with
   `DRIVERS_VHOST_PING` with 0 warnings.
   
   **Ping over ivshmem.** qemu-armv8a:rpserver (+`DRIVERS_VIRTIO_PING`) and
   qemu-armv8a:rpproxy (+`DRIVERS_VHOST_PING`), with a test-only patch (not
   in this PR) adding a ping vdev named `ping0` to the
   `drivers/rptun/rptun_ivshmem.c` resource table, plus the nsh subcommand
   from the apps PR. Three runs (the third on the final head), 100 round
   trips each, period 0:
   
   | command | node | avg | min (runs 1/2) | max (runs 1/2) | rate |
   |---|---|---|---|---|---|
   | `virtio ping all 100 64 0` | server | 114 / 207 / 125 us | 87 / 97 us | 
1554 / 1364 us | 5.4 / 3.0 / 4.9 Mbit/s |
   | `virtio ping all 100 1024 0` | server | 97 / 197 / 102 us | 84 / 172 us | 
265 / 246 us | 85 / 42 / 81 Mbit/s |
   | `vhost ping all 100 64 0` | proxy | 186 / 108 / 197 us | 85 / 71 us | 447 
/ 545 us | 3.3 / 5.7 / 3.1 Mbit/s |
   | `rpmsg ping all 100 64 1 0` (same link, for comparison) | server | 212 / 
211 / 212 us | 125 / 176 us | 1497 / 1242 us | 2.4 / 2.4 / 2.4 Mbit/s |
   
   `virtio dump all` / `vhost dump all` list the device as
   `ping: name=ping0`. A ping to a name that does not exist fails with
   `ENODEV`.
   
   The same on sim:rpserver + sim:rpproxy, with the ping vdev added to
   `arch/sim/src/sim/sim_rptun.c` (test-only): both directions complete
   100/100 round trips; latency there is bounded by the 10 ms sim tick.
   
   <details><summary>qemu-armv8a log</summary>
   
   ```
   server> virtio ping all 100 1024 0
   [server] ping device: ping0
   [server] ping times: 100, send_len: 1024
   [server] avg: 0 s, 97493 ns
   [server] min: 0 s, 83815 ns
   [server] max: 0 s, 264979 ns
   [server] rate: 85.093288 Mbits/sec
   proxy> vhost ping all 100 64 0
   [proxy] ping device: ping0
   [proxy] ping times: 100, send_len: 64
   [proxy] avg: 0 s, 186211 ns
   [proxy] min: 0 s, 85348 ns
   [proxy] max: 0 s, 446686 ns
   [proxy] rate: 3.308075 Mbits/sec
   ```
   </details>
   
   Not tested: the virtio-mmio and virtio-pci transports (QEMU has no ping
   device).
   
   No regression in rpmsg: sim:rpserver/rpproxy and 
qemu-armv8a:rpserver/rpproxy boot and pass the fixed rpmsg cases (dump, ping, 
rpmsgfs; 15/15). No regression in virtio: qemu-armv8a:netnsh boot and pass the 
fixed virtio cases (rng, blk on mmio and pci, net, 9p; 24/24). qemu-armv8a was 
built with LIBC_ENVPATH and BINFMT_CHECKEXEC disabled, which current master 
needs for nxinit to start nsh there; unrelated to this change.
   


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