3

I was trying to verify that my Win 8.1 VM running in QEMU is getting the full VirtIO benefit for the disk (raw image format) and for the network card. I read this related post and accessed the QEMU human monitor interface and found that it shows:

bus:  virtio-bus
    type virtio-pci-bus
    dev: virtio-blk-device, id ""
         drive = "virtio0"
....
bus:  virtio-bus
    type virtio-pci-bus
    dev: virtio-net-device, id ""

This makes it appear to be using VirtIO as does the fact that the Windows Device Manager shows Red Hat VirtIO SCSI Disk Device and Red Hat VirtIO Ethernet Adapter. However, when I run lsmod on my linux host it does not show any virtio modules loaded and when I check my virtio kernel configuration it doesn't show virtio, virtio_net or virtio_blk built in:

zcat /proc/config.gz | grep -i virtio
CONFIG_NET_9P_VIRTIO=m
CONFIG_VIRTIO_BLK=m
CONFIG_SCSI_VIRTIO=m
CONFIG_VIRTIO_NET=m
CONFIG_CAIF_VIRTIO=m
CONFIG_VIRTIO_CONSOLE=m
CONFIG_HW_RANDOM_VIRTIO=m
CONFIG_DRM_VIRTIO_GPU=m
CONFIG_VIRTIO=m
# Virtio drivers
CONFIG_VIRTIO_PCI=m
CONFIG_VIRTIO_PCI_LEGACY=y
CONFIG_VIRTIO_BALLOON=m
CONFIG_VIRTIO_INPUT=m
CONFIG_VIRTIO_MMIO=m
CONFIG_VIRTIO_MMIO_CMDLINE_DEVICES=y

I run my VM with a command like:

qemu-system-x86_64 -enable-kvm -cpu host -smp cores=2,threads=1 -drive file=filename.raw,index=0,media=disk,if=virtio,cache=none,format=raw -net nic,model=virtio,macaddr=xx:xx:xx:xx:xx:xx -net bridge,br=br0 -m 4096 -localtime

What am I missing here? Could it be that it's working via pci_virtio_legacy support built in to the kernel? If so, would it be faster to use the other variation and if so do I just make sure to load the virtio, virtio_net and virtio_blk modules before starting the VM?

3

The virtio backend is in qemu itself, not in the host kernel. qemu is taking packets from the guest virtio frontend network driver and sending them to the bridge device you requested.

In the host kernel you can have vhost drivers to optimise part of the backend function, namely passing the data packets.

See this blog post.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.