]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
KVM/x86: add comment to kvm_mmu_do_page_fault()
authorJuergen Gross <jgross@suse.com>
Fri, 8 Nov 2024 16:14:16 +0000 (17:14 +0100)
committerSean Christopherson <seanjc@google.com>
Mon, 16 Dec 2024 23:27:34 +0000 (15:27 -0800)
On a first glance it isn't obvious why calling kvm_tdp_page_fault() in
kvm_mmu_do_page_fault() is special cased, as the general case of using
an indirect case would result in calling of kvm_tdp_page_fault()
anyway.

Add a comment to explain the reason.

Signed-off-by: Juergen Gross <jgross@suse.com>
Link: https://lore.kernel.org/r/20241108161416.28552-1-jgross@suse.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
arch/x86/kvm/mmu/mmu_internal.h

index b00abbe3f6cfa88ff6ce0ef2525a80d21b0c490b..72de71f4bc8bea9eedf9d8fbaaf8f41eb7361be4 100644 (file)
@@ -321,6 +321,10 @@ static inline int kvm_mmu_do_page_fault(struct kvm_vcpu *vcpu, gpa_t cr2_or_gpa,
                fault.slot = kvm_vcpu_gfn_to_memslot(vcpu, fault.gfn);
        }
 
+       /*
+        * With retpoline being active an indirect call is rather expensive,
+        * so do a direct call in the most common case.
+        */
        if (IS_ENABLED(CONFIG_MITIGATION_RETPOLINE) && fault.is_tdp)
                r = kvm_tdp_page_fault(vcpu, &fault);
        else