x86/kvm/mmu: Remove unnecessary ‘NULL’ values from sptep
PATCH v2 1/1 x86/kvm/mmu: Remove unnecessary ‘NULL’ values from sptep
Remove spte and sptep initialization assignments, add sptep assignment check and processing.
Signed-off-by Li zeming <[email protected]>
---
v2:
1. Remove spte initialization assignment.
2. Add sptep assignment check.
arch/x86/kvm/mmu/mmu.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
arch/x86/kvm/mmu/mmu.c +10 -2
@@ -3456,8 +3456,8 @@ static int fast_page_fault(struct kvm_vcpu *vcpu, struct kvm_page_fault *fault) {struct kvm_mmu_page *sp;int ret =RET_PF_INVALID ; -u64 spte =0ull ; -u64 *sptep =NULL ; +u64 spte; +u64 *sptep;uint retry_count =0 ;if (!page_fault_can_be_fast (fault))
@@ -3473,6 +3473,14 @@ static int fast_page_fault(struct kvm_vcpu *vcpu, struct kvm_page_fault *fault)else sptep =fast_pf_get_last_sptep (vcpu, fault->addr, &spte); +/* +* It's entirely possible for the mapping to have been zapped +* by a different task, but the root page is should always be +* available as the vCPU holds a reference to its root(s). +*/ +if (WARN_ON_ONCE (!sptep)) + spte =REMOVED_SPTE ; +if (!is_shadow_present_pte (spte))break ;
Signature · 1 line
2.18.2
Quoted 2 lines · Li zeming
Remove spte and sptep initialization assignments, add sptep assignment check and processing.
Applied to kvm-x86 mmu, with a beefed up changelog. Thanks!
[1/1] x86/kvm/mmu: Remove unnecessary ‘NULL’ values from sptep
https://github.com/kvm-x86/linux/commit/1de9992f9de0