Skip to content

virtio: put last seen used index into ring itself

Michael S. Tsirkin kvm lkml qemu-devel virtualization 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 18 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2virtio: support layout with avail ring before idxdrivers/virtio/virtio_ring.c include/linux/virtio_ring.h+26 -80 replies
1/2virtio: support layout with avail ring before idxdrivers/virtio/virtio_ring.c include/linux/virtio_ring.h+26 -80 replies
2/2virtio: publish used idxdrivers/net/virtio_net.c drivers/virtio/virtio_ring.c include/linux/virtio_ring.h+21 -20 replies
2/2virtio: publish used idxdrivers/net/virtio_net.c drivers/virtio/virtio_ring.c include/linux/virtio_ring.h+21 -20 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCHv2-RFC 0/2] virtio: put last seen used index into ring itself

Here's a rewrite of the original patch with a new layout. I haven't tested it yet so no idea how this performs, but I think this addresses the cache bounce issue raised by Avi. Posting for early flames/comments.

Generally, the Host end of the virtio ring doesn't need to see where Guest is up to in consuming the ring. However, to completely understand what's going on from the outside, this information must be exposed. For example, host can reduce the number of interrupts by detecting that the guest is currently handling previous buffers.

We add a feature bit so the guest can tell the host that it's writing out the current value there, if it wants to use that.

This differs from original approach in that the used index is put after avail index (they are typically written out together). To avoid cache bounces on descriptor access,
and make future extensions easier, we put the ring itself at start of page, and move the control after it.

Michael S. Tsirkin (2):
virtio: support layout with avail ring before idx
virtio: publish used idx

 drivers/net/virtio_net.c     |    2 ++
 drivers/virtio/virtio_ring.c |   19 ++++++++++++++++---
 include/linux/virtio_ring.h  |   34 ++++++++++++++++++++++++++++------
 3 files changed, 46 insertions(+), 9 deletions(-)