5
0
mirror of git://git.proxmox.com/git/qemu-server.git synced 2025-01-25 06:03:52 +03:00

fix #2083: Add hv_tlbflush, hv_ipi, hv_evmcs enlightenments

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>
This commit is contained in:
Stefan Reiter 2019-06-19 10:23:20 +02:00 committed by Thomas Lamprecht
parent 0eb2169136
commit 392dfbf51e

View 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';
}
}
}