Re: [PATCH v2 02/16] KVM: x86: Refactor GPR accessors to differentiate register access types
From: Chang S. Bae
Date: Fri Mar 06 2026 - 20:33:40 EST
On 3/4/2026 5:49 PM, Sean Christopherson wrote:
On Mon, Jan 12, 2026, Chang S. Bae wrote:
Refactor the GPR accessors to introduce internal helpers to distinguish
between legacy and extended GPRs. Add CONFIG_KVM_APX to selectively
enable EGPR support.
Why? If we really want to make this code efficient, use static calls to wire
things up if and only if APX is fully supported.
I think the idea was just build out APX-specific code behind the option. Ah...sorry, the last sentence was wrong to say.
Yes, I agree on static calls for switching.
Has anyone done analysis to determine if KVM's currently inlining of
kvm_register_read() and kvm_register_write() is actually a net positive? I.e.
can we just cut over to non-inline functions with static calls?
A quick measurment between inline vs non-inline: When invoked repeatedly, the non-inline takes about 5-7% cycles. But, when VM exits are involved, the diff goes into a noise level -- e.g. invoking accessors 1000 times accounts for about 1% on the exit/entry route.