7

In one of my KVM guest, when I typed the following command, I get the following

/sbin/lsmod | grep vi
virtio_balloon          3692  0 

So does it mean I am using virtio?

Update:

When I type

cat "/boot/config-`uname -r`" | grep -i vir

I can see

CONFIG_PARAVIRT_GUEST=y
CONFIG_PARAVIRT=y
CONFIG_PARAVIRT_SPINLOCKS=y
CONFIG_PARAVIRT_CLOCK=y
# CONFIG_PARAVIRT_DEBUG is not set
CONFIG_VIRT_TO_BUS=y
CONFIG_NET_9P_VIRTIO=m
CONFIG_VIRTIO_BLK=y
CONFIG_VIRTIO_NET=y
CONFIG_VIRTIO_CONSOLE=m
CONFIG_HW_RANDOM_VIRTIO=m
CONFIG_REGULATOR_VIRTUAL_CONSUMER=m
# CONFIG_FB_VIRTUAL is not set
CONFIG_SND_VIRMIDI=m
CONFIG_SND_VIRTUOSO=m
# CONFIG_DEBUG_VIRTUAL is not set
CONFIG_VIRTUALIZATION=y
CONFIG_VIRTIO=y
CONFIG_VIRTIO_RING=y
CONFIG_VIRTIO_PCI=y
CONFIG_VIRTIO_BALLOON=m

So sound like I am using virtio already?

Howard
  • 2,005
  • 11
  • 47
  • 70

2 Answers2

7

As you can see you have:

CONFIG_VIRTIO_BALLOON=m

It means it is compiled as a module, hence visible via lsmod. Furthermore, you have:

CONFIG_VIRTIO_BLK=y
CONFIG_VIRTIO_NET=y

It means that they are compiled within the kernel, hence lsmod does not report them.

So your guest has the virtio drivers for:

  • blk: block devices, aka disks;
  • net: network devices;
  • balloon: memory ballooning, the fact that you could have a total maximum memory allocated to all your guest bigger that the physical host memory. This works of course as long as not all guests consume all their respective memory. KVM uses the unused memory of one guest to feed another more demanding guest, aka balloon.
  • pci: I guess PCI passthrough support, though I am not sure. With VirtualBox, ethernet controllers exposed to the guest are using this driver instead of the virtio_net one.
  • console: You can configure a serial console in KVM. This can be accesses by virsh concole domain. A great feature (for Linux guests). You have nearly complete access to the VM even without VNC (thus with minimal bandwidth and C&P available) when the network has crashed, preventing SSH access.
  • ring: don't know what this is
Hauke Laging
  • 5,157
  • 2
  • 23
  • 40
Huygens
  • 1,678
  • 2
  • 19
  • 36
  • 1
    I made my answer a community wiki so you can add information about the virtio_console driver :) and others could do that for the rest. – Huygens Feb 14 '13 at 19:11
6

KVM provides paravirtualization drivers for several bits of hardware; this particular one is the memory balloon driver.

In particular, you should see virtio_net when using the virtio network drivers, and virtio_blk when using the block device (disk) driver. And in the latter case, your disk would be /dev/vda instead of /dev/sda.

In your case, the virtio disk and network drivers are compiled into the kernel, rather than as modules, so you would not see them with lsmod.

CONFIG_VIRTIO_BLK=y
CONFIG_VIRTIO_NET=y

Several other less important virtio drivers also exist on your system and are compiled directly into the kernel (such as VIRTIO_PCI, the paravirtualized PCI bus).

Michael Hampton
  • 237,123
  • 42
  • 477
  • 940
  • For some reason I don't know the memory ballon is one of the very few (3?) devices which must be part of a KVM configuration. Thus it makes sense that the module is always loaded. – Hauke Laging Feb 14 '13 at 18:10