OSDN Git Service

KVM: x86/mmu: Fix pf_fixed count in tdp_mmu_map_handle_target_level()
authorKai Huang <kai.huang@intel.com>
Tue, 15 Jun 2021 00:57:10 +0000 (12:57 +1200)
committerPaolo Bonzini <pbonzini@redhat.com>
Thu, 17 Jun 2021 18:27:16 +0000 (14:27 -0400)
commit857f84743e4b78500afae010d866675642e18e90
tree048896974e64888ae08cd5cb0016ff0745e6342d
parent57a3e96d6d17ae5ac9861ef34af024a627f1c3bb
KVM: x86/mmu: Fix pf_fixed count in tdp_mmu_map_handle_target_level()

Currently pf_fixed is not increased when prefault is true.  This is not
correct, since prefault here really means "async page fault completed".
In that case, the original page fault from the guest was morphed into as
async page fault and pf_fixed was not increased.  So when prefault
indicates async page fault is completed, pf_fixed should be increased.

Additionally, currently pf_fixed is also increased even when page fault
is spurious, while legacy MMU increases pf_fixed when page fault returns
RET_PF_EMULATE or RET_PF_FIXED.

To fix above two issues, change to increase pf_fixed when return value
is not RET_PF_SPURIOUS (RET_PF_RETRY has already been ruled out by
reaching here).

More information:
https://lore.kernel.org/kvm/cover.1620200410.git.kai.huang@intel.com/T/#mbb5f8083e58a2cd262231512b9211cbe70fc3bd5

Fixes: bb18842e2111 ("kvm: x86/mmu: Add TDP MMU PF handler")
Reviewed-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Kai Huang <kai.huang@intel.com>
Message-Id: <2ea8b7f5d4f03c99b32bc56fc982e1e4e3d3fc6b.1623717884.git.kai.huang@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/mmu/tdp_mmu.c