KVM: nVMX: Do not flush TLB on L1<->L2 transitions if L1 uses VPID and EPT
authorLiran Alon <liran.alon@oracle.com>
Mon, 8 Oct 2018 20:42:20 +0000 (23:42 +0300)
committerPaolo Bonzini <pbonzini@redhat.com>
Sat, 13 Oct 2018 10:00:55 +0000 (12:00 +0200)
commitefebf0aaec3de4df2bdb2949ebaacacd82de37db
treeb560ba2cdb3edc1a9f6f4fe5d27a80ada2f42af4
parent327c072187f7af4e4a371b635099f615c14082a7
KVM: nVMX: Do not flush TLB on L1<->L2 transitions if L1 uses VPID and EPT

If L1 uses VPID, it expects TLB to not be flushed on L1<->L2
transitions. However, code currently flushes TLB nonetheless if we
didn't allocate a vpid02 for L2. As in this case,
vmcs02->vpid == vmcs01->vpid == vmx->vpid.

But, if L1 uses EPT, TLB entires populated by L2 are tagged with EPTP02
while TLB entries populated by L1 are tagged with EPTP01.
Therefore, we can also avoid TLB flush if L1 uses VPID and EPT.

Reviewed-by: Mihai Carabas <mihai.carabas@oracle.com>
Reviewed-by: Darren Kenny <darren.kenny@oracle.com>
Reviewed-by: Nikita Leshenko <nikita.leshchenko@oracle.com>
Signed-off-by: Liran Alon <liran.alon@oracle.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/vmx.c