kb:linux:kvm:hyperv_enightments

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
kb:linux:kvm:hyperv_enightments [2015/12/12 21:15] – created milanokb:linux:kvm:hyperv_enightments [2015/12/12 21:32] (current) milano
Line 1: Line 1:
 ====== Enabling Hyper-V enlightenments with KVM ====== ====== Enabling Hyper-V enlightenments with KVM ======
  
-Windows has support for several paravirt features that it will use when  running on Hyper-V, Microsoft's hypervisor. These features are called  enlightenments. Many of the features are similar to paravirt  functionality that exists with Linux on KVM (virtio, kvmclock, PV EOI,  etc.)\\ +Author: [[http://blog.wikichoon.com/2014/07/enabling-hyper-v-enlightenments-with-kvm.html|Cole Robins]] 
-\\ +  
-Nowadays QEMU/KVM can also enable support for several Hyper-V  enlightenments. When enabled, Windows VMs running on KVM will use many  of the same paravirt optimizations they would use when running on  Hyper-V. For detailed info, see [[http://www.linux-kvm.org/wiki/images/0/0a/2012-forum-kvm_hyperv.pdf|Vadim's presentation]] from KVM Forum 2012.\\ +Windows has support for several paravirt features that it will use when running on Hyper-V, Microsoft's hypervisor. These features are called enlightenments. Many of the features are similar to paravirt functionality that exists with Linux on KVM (virtio, kvmclock, PV EOI, etc.) 
-\\+ 
 +Nowadays QEMU/KVM can also enable support for several Hyper-V enlightenments. When enabled, Windows VMs running on KVM will use many of the same paravirt optimizations they would use when running on Hyper-V. For detailed info, see [[http://www.linux-kvm.org/images/0/0a/2012-forum-kvm_hyperv.pdf|Vadim's presentation from KVM Forum 2012]]
 From the QEMU/KVM developers, the recommended configuration is: From the QEMU/KVM developers, the recommended configuration is:
  
-<code>''-cpu ...,hv_relaxed,hv_spinlocks=0x1fff,hv_vapic,hv_time   ''+<code> 
 +cpu ...,hv_relaxed,hv_spinlocks=0x1fff,hv_vapic,hv_time
 </code> </code>
-\\ 
-Which maps to the libvirt XML: 
  
-<code>''<features>     <hyperv>   <relaxed state='on'/>      <vapic state='on'/>      <spinlocks state='on' retries='8191'/>     </hyperv>    <features/>        <clock ...>     <timer name='hypervclock' present='yes'/>    </clock>   ''+Which maps to the libvirt XML: 
 +<code> 
 + <features>   
 +  <hyperv>   
 +   <relaxed state='on'/>   // only this option is supported on Centos 6.5 KVM hypervisor 
 +   <vapic state='on'/>   
 +   <spinlocks state='on' retries='8191'/>   
 +  </hyperv>   
 + <features/>   
 +    
 + <clock ...>   
 +  <timer name='hypervclock' present='yes'/>   
 + </clock>  
 </code> </code>
-\\+
 Some details about the individual features: Some details about the individual features:
  
-    * relaxed/hv_relaxedAvailable in libvirt 1.0.0+ ([[http://libvirt.org/git/?p=libvirt.git;a=commit;h=cc922fddc3fcbbcecce7e438a51045c2feacf767|commit]]) and qemu 1.1+ ([[http://git.qemu.org/?p=qemu.git;a=commit;h=28f52cc04d341045e810bd487a478fa9ec5f40be|commit]]).  This bit disables a Windows sanity check that commonly results in a  BSOD when the VM is running on a heavily loaded host (example bugs [[https://bugzilla.redhat.com/show_bug.cgi?id=1110305|here]][[https://bugzilla.redhat.com/show_bug.cgi?id=990824|here]], and [[https://bugs.launchpad.net/ubuntu/+source/qemu/+bug/1308341|here]]). Sounds similar to the Linux kernel option no_timer_check, which is automatically enabled when Linux is running on KVM. +^ Fetaure ^ Description ^ 
-    vapic/hv_vapicAvailable in libvirt 1.1.0+ ([[http://libvirt.org/git/?p=libvirt.git;a=commit;h=19f75d5eeb6bedd49597034832284146c7591a00|commit]]) and qemu 1.1+ ([[http://git.qemu.org/?p=qemu.git;a=commit;h=28f52cc04d341045e810bd487a478fa9ec5f40be|commit]]). +|relaxed/hv_relaxedAvailable in libvirt 1.0.0+ (commit) and qemu 1.1+ (commit). This bit disables a Windows sanity check that commonly results in a BSOD when the VM is running on a heavily loaded host (example bugs here, here, and here). Sounds similar to the Linux kernel option no_timer_check, which is automatically enabled when Linux is running on KVM.| 
-    spinlocks/hv_spinlocksAvailable in libvirt 1.1.0+ ([[http://libvirt.org/git/?p=libvirt.git;a=commit;h=19f75d5eeb6bedd49597034832284146c7591a00|commit]]) and qemu 1.1+ ([[http://git.qemu.org/?p=qemu.git;a=commit;h=28f52cc04d341045e810bd487a478fa9ec5f40be|commit]]) +|vapic/hv_vapicAvailable in libvirt 1.1.0+ (commit) and qemu 1.1+ (commit).| 
-    hypervclock/hv_timeAvailable in libvirt 1.2.2+ ([[http://libvirt.org/git/?p=libvirt.git;a=commit;h=600bca592b2352b683856f4b7f2694f366feac36|commit]]) and qemu 2.0+ ([[http://git.qemu.org/?p=qemu.git;a=commit;h=48a5f3bcbbbe59a3120a39106bfda59fd1933fbc|commit]]). Sounds similar to [[http://www.linux-kvm.org/page/KVMClock|kvmclock]], a paravirt time source which is used when Linux is running on KVM.+|spinlocks/hv_spinlocksAvailable in libvirt 1.1.0+ (commit) and qemu 1.1+ (commit)
 +|hypervclock/hv_timeAvailable in libvirt 1.2.2+ (commit) and qemu 2.0+ (commit). Sounds similar to kvmclock, a paravirt time source which is used when Linux is running on KVM.|
  
- \\ It should be safe to enable these bits for all Windows VM, though only  Vista/Server 2008 and later will actually make use of the features. \\  \\ (In fact, Linux also has support for using these Hyper-V features, like the [[http://lwn.net/Articles/342305/|paravirt device drivers]] and hyperv_clocksource. Though these are really only for running Linux  on top of Hyper-V. With Linux on KVM, the natively  developed paravirt extensions are understandably preferred). \\ 
- \\ 
-The next version of virt-manager will enable Hyper-V enlightenments when creating a Windows VM ([[https://git.fedorahosted.org/cgit/virt-manager.git/commit/?id=8ea634f9e437153a30f06b7267db2bd685af0561|git commit]]). virt-xml can also be used to enable these bits easily from the command line for an existing VM: 
  
-<code>'' sudo virt-xml $VMNAME --edit --features hyperv_relaxed=on,hyperv_vapic=on,hyperv_spinlocks=on,hyperv_spinlocks_retries=8191  sudo virt-xml $VMNAME --edit --clock hypervclock_present=yes   ''+It should be safe to enable these bits for all Windows VM, though only Vista/Server 2008 and later will actually make use of the features. 
 + 
 +(In fact, Linux also has support for using these Hyper-V features, like the paravirt device drivers and hyperv_clocksource. Though these are really only for running Linux on top of Hyper-V. With Linux on KVM, the natively developed paravirt extensions are understandably preferred). 
 + 
 +The next version of virt-manager will enable Hyper-V enlightenments when creating a Windows VM (git commit). virt-xml can also be used to enable these bits easily from the command line for an existing VM: 
 + 
 +<code> 
 + sudo virt-xml $VMNAME --edit --features hyperv_relaxed=on,hyperv_vapic=on,hyperv_spinlocks=on,hyperv_spinlocks_retries=8191 
 + sudo virt-xml $VMNAME --edit --clock hypervclock_present=yes  
 </code> </code>
  
- \\ The first invocation will work with virt-manager 1.0.1, the second  invocation requires virt-manager.git. In my testing this didn't upset my  existing Windows VMs and they worked fine after a reboot. \\  \\ Other tools aren't enabling these features yet, though there are bugs tracking this for the big ones: 
  
-    * ovirt/vdsm: [[https://bugzilla.redhat.com/show_bug.cgi?id=1083529|https://bugzilla.redhat.com/show_bug.cgi?id=1083529]] +The first invocation will work with virt-manager 1.0.1, the second invocation requires virt-manager.gitIn my testing this didn't upset my existing Windows VMs and they worked fine after a reboot
-    * openstack: [[https://bugzilla.redhat.com/show_bug.cgi?id=1083525|https://bugzilla.redhat.com/show_bug.cgi?id=1083525]] + 
-    * gnome-boxes[[https://bugzilla.gnome.org/show_bug.cgi?id=732811|https://bugzilla.gnome.org/show_bug.cgi?id=732811]]+Other tools aren't enabling these features yet, though there are bugs tracking this for the big ones:
  
-(edit 2014-09-08: This change was released in [[http://blog.wikichoon.com/2014/09/virt-manager-110-released.html|virt-manager-1.1.0]])+[[https://bugzilla.redhat.com/show_bug.cgi?id=1083529|ovirt/vdsm]] 
 +[[https://bugzilla.redhat.com/show_bug.cgi?id=1083525|openstack]] 
 +[[https://bugzilla.gnome.org/show_bug.cgi?id=732811|gnome-boxes]]
  
 +(edit 2014-09-08: This change was released in virt-manager-1.1.0) 
  • kb/linux/kvm/hyperv_enightments.1449954906.txt.gz
  • Last modified: 2015/12/12 21:15
  • by milano