]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: nVMX: Abide to KVM_REQ_TLB_FLUSH_GUEST request on nested vmentry/vmexit
authorSean Christopherson <seanjc@google.com>
Thu, 25 Nov 2021 01:49:43 +0000 (01:49 +0000)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 26 Nov 2021 12:07:49 +0000 (07:07 -0500)
commit209d684e75e2deaa26c92a148f0fef4a00ddfdd4
tree74e57e9816caca4e4ba6775e58c4acdcfa7ae5ca
parent682e3cc2cca3b53cee8dca997b0a2ef01bd7589b
KVM: nVMX: Abide to KVM_REQ_TLB_FLUSH_GUEST request on nested vmentry/vmexit

Like KVM_REQ_TLB_FLUSH_CURRENT, the GUEST variant needs to be serviced at
nested transitions, as KVM doesn't track requests for L1 vs L2.  E.g. if
there's a pending flush when a nested VM-Exit occurs, then the flush was
requested in the context of L2 and needs to be handled before switching
to L1, otherwise the flush for L2 would effectiely be lost.

Opportunistically add a helper to handle CURRENT and GUEST as a pair, the
logic for when they need to be serviced is identical as both requests are
tied to L1 vs. L2, the only difference is the scope of the flush.

Reported-by: Lai Jiangshan <jiangshanlai+lkml@gmail.com>
Fixes: 5cb556ac5073 ("KVM: nVMX: Sync all PGDs on nested transition with shadow paging")
Cc: stable@vger.kernel.org
Signed-off-by: Sean Christopherson <seanjc@google.com>
Message-Id: <20211125014944.536398-2-seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/vmx/nested.c
arch/x86/kvm/x86.c
arch/x86/kvm/x86.h