6

I am using libvirt to control kvm on a fairly new (core i3) host running Debian Squeeze amd64. The Host as well as Linux guests work and feel fast and responsive. Simply installing Win7 with virt-manager standard profile for windows7 takes forever. I mainly blame the disk io, but Windows generally does not seem as responsive as linux guests.

Do you have some hints regarding performance optimal settings for Win7 guests on kvm?

(Sorry for the many dumps, but I think they are good as a point of reference.)

Host Konfiguration:

kvm: Version: 1:0.12.5+dfsg-5+squeeze8
libvirt-bin: Version: 0.8.3-5+squeeze2

virsh dumpxml:

<domain type='kvm' id='27'>
  <name>win7-template</name>
  <uuid>a4eb05fa-0d4e-5ced-2ff1-e15507795d1b</uuid>
  <memory>2097152</memory>
  <currentMemory>2097152</currentMemory>
  <vcpu>2</vcpu>
  <os>
    <type arch='x86_64' machine='pc-0.12'>hvm</type>
    <boot dev='hd'/>
  </os>
  <features>
    <acpi/>
    <apic/>
    <pae/>
  </features>
  <clock offset='localtime'/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <devices>
    <emulator>/usr/bin/kvm</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw'/>
      <source file='/var/lib/libvirt/images/win7-template.img'/>
      <target dev='hda' bus='ide'/>
      <alias name='ide0-0-0'/>
      <address type='drive' controller='0' bus='0' unit='0'/>
    </disk>
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <source file='/var/lib/libvirt/images/isos/de_windows_7_professional_with_sp1_x64_dvd.iso'/>
      <target dev='hdc' bus='ide'/>
      <readonly/>
      <alias name='ide0-1-0'/>
      <address type='drive' controller='0' bus='1' unit='0'/>
    </disk>
    <controller type='ide' index='0'>
      <alias name='ide0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
    </controller>
    <interface type='network'>
      <mac address='52:54:00:af:89:f2'/>
      <source network='default'/>
      <target dev='vnet2'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>
    <serial type='pty'>
      <source path='/dev/pts/5'/>
      <target port='0'/>
      <alias name='serial0'/>
    </serial>
    <console type='pty' tty='/dev/pts/5'>
      <source path='/dev/pts/5'/>
      <target type='serial' port='0'/>
      <alias name='serial0'/>
    </console>
    <input type='tablet' bus='usb'>
      <alias name='input0'/>
    </input>
    <input type='mouse' bus='ps2'/>
    <graphics type='vnc' port='5902' autoport='yes'/>
    <video>
      <model type='vga' vram='9216' heads='1'/>
      <alias name='video0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    </video>
    <memballoon model='virtio'>
      <alias name='balloon0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
    </memballoon>
  </devices>
</domain>

cat /proc/cpuinfo (snippet)

processor   : 3
vendor_id   : GenuineIntel
cpu family  : 6
model       : 37
model name  : Intel(R) Core(TM) i3 CPU         540  @ 3.07GHz
stepping    : 2
cpu MHz     : 3058.386
cache size  : 4096 KB
physical id : 0
siblings    : 4
core id     : 2
cpu cores   : 2
apicid      : 5
initial apicid  : 5
fpu     : yes
fpu_exception   : yes
cpuid level : 11
wp      : yes
flags       : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good xtopology nonstop_tsc aperfmperf pni dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm sse4_1 sse4_2 popcnt lahf_lm arat tpr_shadow vnmi flexpriority ept vpid
bogomips    : 6117.86
clflush size    : 64
cache_alignment : 64
address sizes   : 36 bits physical, 48 bits virtual

2 Answers 2

8
  1. Use virtio for disks and network.
  2. for the mountpoint where you keep the images and the isos, use the noatime and nodiratime options
  3. use the deadline scheduler on the host
  4. use spice/qxl for video for proper video performance
5
  • Very interesting answer. Could you expand a bit on the reasoning behind these practices? Jun 11, 2012 at 7:32
  • 1
    these are the most common ones, and if you take a minute to google, you'll see them all over the place. virtio devices provide much better performance than the emulated devices (ide, rtl, e1000) because they are paravirtualised. noatime and nodiratime prevent the host from generating redundant io to the disk, deadline is just known to be the best for most VM loads, and spice/qxl is a much better graphical system than VNC can ever be - providing high resolutions and good video performance
    – dyasny
    Jun 11, 2012 at 7:37
  • Windows refuses to install on virtio, do I need that special driver on the kvm site?
    – AndreasT
    Jun 12, 2012 at 19:51
  • Very helpful thx! Accepted.
    – AndreasT
    Jun 19, 2012 at 14:56
4

I just installed Windows 7 and then after the installation changed the disk to use virtio.

To load the drivers, I added a temporary virtio device (1G) and then rebooted the guest. Then, loaded in the Windows drivers for the virtio through device manager.

Then, shutdown the guest, changed the main disk from IDE to virtio. Becuase Windows 7 had already loaded in the virtio drivers from my temporary device, it coped fine with the IDE disk changing to virtio.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .