On Thu, Jun 01, 2023 at 03:13:53PM -0400, Stefan Hajnoczi wrote: > On Thu, Jun 01, 2023 at 09:09:49PM +0800, zhenwei pi wrote: > > On 6/1/23 19:33, Stefan Hajnoczi wrote: > > > On Thu, Jun 01, 2023 at 05:02:45PM +0800, zhenwei pi wrote: > > > > On 6/1/23 00:20, Stefan Hajnoczi wrote: > > > > > On Thu, May 04, 2023 at 04:19:04PM +0800, zhenwei pi wrote: > One more idea to play with: VIRTIO has flexible message framing, so > devices must process a virtqueue buffer the same regardless of whether > it has 1 large element or many small elements. Therefore the virtqueue > RDMA protocol does not need to preserve the virtqueue element count and > sizes from the driver. For example, the target can offer a list of > key/length pairs that the initiator RDMA WRITES the virtqueue buffer > contents into. For a virtio-blk device that would be a struct > virtio_blk_outhdr followed by a large page-aligned buffer for the I/O > buffer data to be transferred. Then the device always a properly aligned > and contiguous buffer. Unfortunately this approach breaks down when the > virtqueue carries requests that are organized very differently, but it > might be useful when there is a most common request type. I'm not sure if I explained this well. What I'm trying to say is that I think RDMA benefits when the receiver's memory constraints are visible to the sender. The sender performs RDMA WRITEs to the locations where the receiver can efficiently process the data. This protocol proposal doesn't really take advantage of this approach because it communicates the virtqueue buffer elements from the initiator (the sender) to the target (the receiver). That's the wrong way around. I have never used RDMA myself, so this might be wrong, but as long as the RDMA API allows the sender to specify a scatter-gather list as input, then I think the details of the virtqueue buffer elements that don't have the WRITE flag should never be communicated over the network. Instead the initiator should RDMA WRITE from the VIRTIO driver's scatter-gather list to the target's preferred destination instead. Stefan