virtualization-virtio-vhost-user

vhost-user

In the DPDK architecture the devices are accessed by constant polling. This avoids the context switching and interrupt processing overhead at the cost of dedicating 100% of part of the CPU cores to handle packet processing.

In practice DPDK offers a series of poll mode drivers (PMDs) that enable direct transfer of packets between user space and the physical interfaces which bypass the kernel network stack all together. This approach provides a significant performance boost over the kernel forwarding by eliminating interrupt handling and bypassing the kernel stack.

So we want to implement Virtio Backend(dataplane) in dpdk leverage vhost protocol, that’s vhost-user

vhost-user library. This library, built in DPDK, is a userspace implementation of the vhost protocol that allows qemu to offload the virtio device packet processing to any DPDK application (such as Open vSwitch). The main difference between the vhost-user library and the vhost-net kernel driver is the communication channel. While the vhost-net kernel driver implements this channel using ioctls, the vhost-user library defines the structure of messages that are sent over a unix socket.

The vhost-user library allows the primary to configure the dataplane offloading by performing the following important actions:

  • Feature negotiation: Both the virtio features and the vhost-user-specific features are negotiated in a similar way: First the primary “gets” the handler’s supported features bitmask and then it “sets” the subset of them it also supports.
  • Memory region configuration: The master sets the memory map regions so the handler can mmap() them.
  • Vring configuration: The primary sets the number of virtqueues to use and their addresses within the memory regions. Note that vhost-user supports multiqueue so more than one virtqueue can be configured to improve performance.
  • Kick and Call file descriptors sending: Usually, the irqfd and the ioeventfd mechanisms are used.

ovs-vswitchd and vhost-user

  1. vhost-user (backend) - Running on the host userspace as part of the OVSDPDK userspace application. As mentioned DPDK is a library and the vhostuser module are additional APIs inside that library. The OVS-DPDK is the actual application linked with this library and invoking the APIs. For each guest VM created on the host, another vhost-user backend will be
    instantiated to communicate with the guest’s virtio frontend.

  2. virtio-pmd (frontend) - Running on the guest userspace and is a poll mode driver consuming dedicated cores and performing polling with no interrupts. For an application running on the user space to consume the virtio-pmd it needs to be linked with the DPDK library as well

We can replace virtio-pmd with virtio-net in guest kernel for another solution

Ref