diff options
author | Lai Jiangshan <jiangshan.ljs@antgroup.com> | 2023-02-17 07:53:18 +0800 |
---|---|---|
committer | Sean Christopherson <seanjc@google.com> | 2023-03-16 17:19:53 -0700 |
commit | ed335278bd1282641748b2b0ca23291c457038ef (patch) | |
tree | d8272893185cd5044581101b78a701581af0eda4 /arch/x86/kvm/mmu/paging_tmpl.h | |
parent | 2c86c444e2751a867bfa6a059a80ba67ef9d441a (diff) |
KVM: x86/mmu: Allow the roots to be invalid in FNAME(invlpg)
Don't assume the current root to be valid, just check it and remove
the WARN().
Also move the code to check if the root is valid into FNAME(invlpg)
to simplify the code.
Signed-off-by: Lai Jiangshan <jiangshan.ljs@antgroup.com>
Link: https://lore.kernel.org/r/20230216235321.735214-2-jiangshanlai@gmail.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
Diffstat (limited to 'arch/x86/kvm/mmu/paging_tmpl.h')
-rw-r--r-- | arch/x86/kvm/mmu/paging_tmpl.h | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/arch/x86/kvm/mmu/paging_tmpl.h b/arch/x86/kvm/mmu/paging_tmpl.h index 4047b8ff83d6..0b4e3c9a3f05 100644 --- a/arch/x86/kvm/mmu/paging_tmpl.h +++ b/arch/x86/kvm/mmu/paging_tmpl.h @@ -863,10 +863,8 @@ static void FNAME(invlpg)(struct kvm_vcpu *vcpu, u64 addr, hpa_t root_hpa) */ mmu_topup_memory_caches(vcpu, true); - if (!VALID_PAGE(root_hpa)) { - WARN_ON(1); + if (!VALID_PAGE(root_hpa)) return; - } write_lock(&vcpu->kvm->mmu_lock); for_each_shadow_entry_using_root(vcpu, root_hpa, addr, iterator) { |