Hi,

I have been reading about the virtio and vhost specifications, however I
have a few doubts. I tried looking for them but I still
do not understand them clearly enough. From what I understand, there are
two protocols:

The virtio protocol: The one that specifies how we can have common
emulation for virtual devices. The front end drivers
interact with these devices, and these devices could then process the
information that they have received either in QEMU,
or somewhere else. From what I understand the front driver uses mmaps to
communicate with the virtio device.

The vhost protocol: The one that specifies how we can _offload_ the
processing from QEMU to a separate process. We
want to offload so that we do not have to stop the guest when we are
processing information passed to a virtio device. This
service could either be implemented in the host kernel or the host
userspace. Now when we offload the processing, we map the
memory of the device to this vhost service, so that this service has all
the information that it should process.
  Also, this process can generate the vCPU interrupts, and this process
responds to the ioeventfd notifications.

What I do not understand is, once we have this vhost service, either in
userspace or in kernel space, which does the information processing,
why do we need a virtio device still emulated in QEMU? Is it only to pass
on the configurations between the driver and the
vhost service? I know that the vhost service doesn't emulate anything, but
then what is the difference between "processing" the
information and "emulating" a device?

Also, from article[3], moving the vhost-net service to userspace was faster
somehow. I am assuming this was only the case for
networking devices, and would not be true in general. Since there would be
more context switches between user and kernel space?
(KVM receives the irq/ioevent notification and then transfers control back
to user space, as opposed to when vhost was in kernel
space.)

For context, I've been reading the following:
[1]
https://www.redhat.com/en/blog/introduction-virtio-networking-and-vhost-net
[2] https://www.redhat.com/en/blog/deep-dive-virtio-networking-and-vhost-net
[3] https://www.redhat.com/en/blog/journey-vhost-users-realm

Reply via email to