VMWare server and paravirtualisation
Virtualisation has gone through four main phases:
- full software emulation - every instruction is emulated - very, very slow. (Bochs)
- software virtualisation - instructions are checked but most run natively. (VMWare server)
- paravirtualisation - the guest operating systems know they are virtualised and are tweaked appropriately (Xen)
- hardware assisted virtualisation - the CPU provides assistance to the above methods (KVM)
The programs above are only very roughly categorised, for example virtio provides paravirtualisation to KVM.
Paravirtualisation is a good thing as the guest tries to play nicely with virtualisation (rather than having to deal with the intricacies of real hardware). Paravirtualised devices are thus normally far faster and have lower overheads (so that you can run more virtual machines on a given piece of hardware).
If you are using VMware Server then you can use VMI to provide paravirtualisation. We are using VMware Server v2, however this technique also works with ESX v3.5. We'll cover how to activate VMI in a minute, however first you should be aware that VMI is due to be retired as VMware believe that hardware assistance removes the need. Most odd, hopefully they are actually going to use the virtio interfaces in Linux to provide this functionality instead of VMI in addition to exploiting hardware assistance.
VMware provide a guide to VMI however it's a little out of date.
We used Debian Lenny with a 2.6.24 kernel (which as shipped from Debian has VMI support compiled in). In VMware select "Edit configuration" (you will need to stop the guest OS first) and change the OS type from "Debian v4" to "Ubuntu". Select the "Advanced" tab and select "Enable VMI" (if you leave the OS type as "Debian v4" the VMI option will be greyed out).
Restart the guest VM and type "lspci" - you should see (amongst other devices):
02:03.0 Memory controller: VMware Inc Virtual Machine Interface (rev 01)
To check that it's being used, enter "dmesg | grep -i vm":
[ 0.000000] VMI: Found VMware, Inc. Hypervisor OPROM, API version 3.0, ROM version 1.0
[ 0.000000] ACPI: XSDT 1FEF0780, 004C (r1 INTEL 440BX 6040000 VMW 1324272)
[ 0.000000] ACPI: SRAT 1FEF0804, 0080 (r2 VMWARE MEMPLUG 6040000 VMW 1)
[ 0.004000] vmalloc : 0xe0800000 - 0xfb7fe000 ( 431 MB)
[ 0.004000] vmi: registering clock event vmi-timer. mult=11854634 shift=22
[ 0.134945] Booting paravirtualized kernel on vmi
[ 0.203433] ACPI: DMI System Vendor: VMware, Inc.
[ 0.204012] ACPI: DMI Product Name: VMware Virtual Platform
[ 1.242896] vmi: registering clock source khz=2826365
[ 3.005046] scsi 0:0:0:0: Direct-Access VMware, VMware Virtual S 1.0 PQ: 0 ANSI: 2
That "vmi: registering clock event vmi-timer" line is the key.