Re: [PATCH] kvm/x86: simplify kvm_mmu_do_page_fault() a little bit

From: Jürgen Groß
Date: Thu Oct 24 2024 - 06:37:41 EST


On 22.10.24 19:01, Sean Christopherson wrote:
On Tue, Oct 22, 2024, Juergen Gross wrote:
Testing whether to call kvm_tdp_page_fault() or
vcpu->arch.mmu->page_fault() doesn't make sense, as kvm_tdp_page_fault()
is selected only if vcpu->arch.mmu->page_fault == kvm_tdp_page_fault.

It does when retpolines are enabled and significantly inflate the cost of the
indirect call. This is a hot path in various scenarios, but KVM can't use
static_call() to avoid the retpoline due to mmu->page_fault being a property of
the current vCPU. Only kvm_tdp_page_fault() is special cased because all other
mmu->page_fault targets are slow-ish and/or we don't care terribly about their
performance.

Fair enough. :-)

I'll modify the patch to add a comment in this regard in order to avoid
similar simplification attempts in the future.


Juergen

Attachment: OpenPGP_0xB0DE9DD628BF132F.asc
Description: OpenPGP public key

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature