Skip to content

Commit 8d5265b

Browse files
sean-jcbonzini
authored andcommitted
KVM: x86/mmu: Use IS_ENABLED() to avoid RETPOLINE for TDP page faults
Use IS_ENABLED() instead of an #ifdef to activate the anti-RETPOLINE fast path for TDP page faults. The generated code is identical, and the #ifdef makes it dangerously difficult to extend the logic (guess who forgot to add an "else" inside the #ifdef and ran through the page fault handler twice). No functional or binary change intented. Signed-off-by: Sean Christopherson <seanjc@google.com> Message-Id: <20220423034752.1161007-9-seanjc@google.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
1 parent 8a009d5 commit 8d5265b

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

arch/x86/kvm/mmu/mmu_internal.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -248,10 +248,10 @@ static inline int kvm_mmu_do_page_fault(struct kvm_vcpu *vcpu, gpa_t cr2_or_gpa,
248248
.req_level = PG_LEVEL_4K,
249249
.goal_level = PG_LEVEL_4K,
250250
};
251-
#ifdef CONFIG_RETPOLINE
252-
if (fault.is_tdp)
251+
252+
if (IS_ENABLED(CONFIG_RETPOLINE) && fault.is_tdp)
253253
return kvm_tdp_page_fault(vcpu, &fault);
254-
#endif
254+
255255
return vcpu->arch.mmu->page_fault(vcpu, &fault);
256256
}
257257

0 commit comments

Comments
 (0)