linux-stable/arch/x86/kvm/mmu
Hou Wenlong eb36b79309 KVM: x86/mmu: Don't rebuild page when the page is synced and no tlb flushing is required
commit 8d5678a766 upstream.

Before Commit c3e5e415bc ("KVM: X86: Change kvm_sync_page()
to return true when remote flush is needed"), the return value
of kvm_sync_page() indicates whether the page is synced, and
kvm_mmu_get_page() would rebuild page when the sync fails.
But now, kvm_sync_page() returns false when the page is
synced and no tlb flushing is required, which leads to
rebuild page in kvm_mmu_get_page(). So return the return
value of mmu->sync_page() directly and check it in
kvm_mmu_get_page(). If the sync fails, the page will be
zapped and the invalid_list is not empty, so set flush as
true is accepted in mmu_sync_children().

Cc: stable@vger.kernel.org
Fixes: c3e5e415bc ("KVM: X86: Change kvm_sync_page() to return true when remote flush is needed")
Signed-off-by: Hou Wenlong <houwenlong.hwl@antgroup.com>
Acked-by: Lai Jiangshan <jiangshanlai@gmail.com>
Message-Id: <0dabeeb789f57b0d793f85d073893063e692032d.1647336064.git.houwenlong.hwl@antgroup.com>
[mmu_sync_children should not flush if the page is zapped. - Paolo]
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-06-06 08:47:53 +02:00
..
mmu.c KVM: x86/mmu: Don't rebuild page when the page is synced and no tlb flushing is required 2022-06-06 08:47:53 +02:00
mmu_audit.c KVM: x86/mmu: Rename __gfn_to_rmap to gfn_to_rmap 2021-08-06 07:52:58 -04:00
mmu_internal.h KVM: x86/mmu: Propagate memslot const qualifier 2021-12-08 04:24:43 -05:00
mmutrace.h KVM: X86: Rename gpte_is_8_bytes to has_4_byte_gpte and invert the direction 2021-12-08 04:25:13 -05:00
page_track.c KVM: x86/mmu: Propagate memslot const qualifier 2021-12-08 04:24:43 -05:00
paging.h KVM: x86/mmu: Do not apply HPA (memory encryption) mask to GPAs 2021-07-14 12:17:56 -04:00
paging_tmpl.h KVM: x86: Use __try_cmpxchg_user() to update guest PTE A/D bits 2022-06-06 08:47:52 +02:00
spte.c Generic: 2022-01-22 09:40:01 +02:00
spte.h KVM: x86/mmu: Document and enforce MMU-writable and Host-writable invariants 2022-01-19 12:07:06 -05:00
tdp_iter.c KVM: x86/mmu: Don't advance iterator after restart due to yielding 2021-12-20 08:06:53 -05:00
tdp_iter.h KVM: x86/mmu: Don't advance iterator after restart due to yielding 2021-12-20 08:06:53 -05:00
tdp_mmu.c KVM: x86/mmu: Check for present SPTE when clearing dirty bit in TDP MMU 2022-04-08 13:58:47 +02:00
tdp_mmu.h KVM: x86/mmu: Move "invalid" check out of kvm_tdp_mmu_get_root() 2022-04-08 13:58:47 +02:00