Skip to contentSkip to conversation

KVM/x86: add comment to kvm_mmu_do_page_fault()

PATCH Applied Juergen Gross 2 participants 2 messages Nov 8, 2024 – Dec 19, 2024

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 KVM/x86: add comment to kvm_mmu_do_page_fault()

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.

---
 arch/x86/kvm/mmu/mmu_internal.h | 4 ++++
 1 file changed, 4 insertions(+)
arch/x86/kvm/mmu/mmu_internal.h +4 -0
index c98827840e07..a49cd0c438a1 100644
@@ -322,6 +322,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
Signature · 1 line
2.43.0
maintainer Applied
#1 lore raw
Quoted 8 lines · Juergen Gross

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.

[...]

Applied to kvm-x86 mmu, thanks!

[1/1] KVM/x86: add comment to kvm_mmu_do_page_fault()

      https://github.com/kvm-x86/linux/commit/2d5faa6a8402

--
https://github.com/kvm-x86/linux/tree/next