Re: [PATCH 01/10] KVM: VMX: Use vpid_sync_context() directly when possible

From: linmiaohe
Date: Fri Feb 21 2020 - 01:36:07 EST


Sean Christopherson <sean.j.christopherson@xxxxxxxxx> writes:
>Use vpid_sync_context() directly for flows that run if and only if enable_vpid=1, or more specifically, nested VMX flows that are gated by
>vmx->nested.msrs.secondary_ctls_high.SECONDARY_EXEC_ENABLE_VPID being
>set, which is allowed if and only if enable_vpid=1. Because these flows call __vmx_flush_tlb() with @invalidate_gpa=false, the if-statement that decides between INVEPT and >INVVPID will always go down the INVVPID path, i.e. call vpid_sync_context() because "enable_ept && (invalidate_gpa || !enable_vpid)" always evaluates false.
>
>This helps pave the way toward removing @invalidate_gpa and @vpid from
>__vmx_flush_tlb() and its callers.
>
>No functional change intended.
>
>Signed-off-by: Sean Christopherson <sean.j.christopherson@xxxxxxxxx>

Reviewed-by: Miaohe Lin <linmiaohe@xxxxxxxxxx>