]> git.proxmox.com Git - qemu-server.git/commitdiff
fix #2083: Add hv_tlbflush, hv_ipi, hv_evmcs enlightenments
authorStefan Reiter <s.reiter@proxmox.com>
Wed, 19 Jun 2019 08:23:20 +0000 (10:23 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Mon, 24 Jun 2019 15:22:35 +0000 (17:22 +0200)
Kernels 4.18+ (4.17+ for evmcs) support new Hyper-V enlightenments for
Windows KVM guests. QEMU supports these since 3.0 and 3.1 respectively.
tlbflush and ipi improve performance on overcommitted systems, evmcs
improves nested virtualization.

It's not entirely clear to me if Win7 already supports these, but since
it doesn't cause any performance penalties (and it works fine without
crashing, which makes sense either way, because Hyper-V enlightenments
are opt-in by the guest OS), enabling it regardless should be fine.
(As opposed to adding a new if branch for win8+)

Feature explanations to the best of my understanding:

hv_tlbflush allows the guest OS to trigger tlb shootdowns via a
hypercall. This allows CPUs to be identified via their vpindex (which
makes hv_vpindex a prerequisite to hv_tlbflush, but that is already
handled in our code). In overcommited configurations, where multiple
vCPUs reside on one pCPU, this increases performance of guest tlb
flushes, by only flushing each pCPU once. It also allows multiple tlb
flushes with only one vmexit.

hv_ipi allows sending inter-processor interrupts via vpindex, once again
making it a prerequisite. Benefits are pretty much as with tlbflush.

hv_evmcs is a VM control structure in L1 guest memory, allowing an L1 guest
to modify L2 VMCS and entering L2 without having the L0 host perform an
expensive VMCS update on trapping the nested vmenter.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
PVE/QemuServer.pm

index ed11609b005b9fa925ea369dd396e828ff22df83..fb0bd770fc346725a13a0656bdc80e4e5a84a758 100644 (file)
@@ -7174,6 +7174,15 @@ sub add_hyperv_enlightenments {
            push @$cpuFlags , 'hv_synic';
            push @$cpuFlags , 'hv_stimer';
        }
+
+       if (qemu_machine_feature_enabled ($machine_type, $kvmver, 3, 0)) {
+           push @$cpuFlags , 'hv_tlbflush';
+       }
+
+       if (qemu_machine_feature_enabled ($machine_type, $kvmver, 3, 1)) {
+           push @$cpuFlags , 'hv_ipi';
+           push @$cpuFlags , 'hv_evmcs';
+       }
     }
 }