Re: [PATCH v4 06/21] x86/fpu: Ignore APX when copying from/to guest FPU
From: Paolo Bonzini
Date: Wed May 27 2026 - 06:34:18 EST
On 5/14/26 19:33, Paolo Bonzini wrote:
If we _just_ look at making a good, consistent ABI, I don't think
XFEATURE_APX is special. The registers can be managed by XSAVE. There's
a KVM XSAVE ABI. Why would *this* feature be special from all of the others?
Indeed, it's not special from the userspace point of view.
KVM_GET_XSAVE and KVM_SET_XSAVE *do* include APX, but the copy needs
to be done from struct kvm_vcpu rather than from the guest FPU state
(which as of this series means arch/x86/kvm/ instead of
arch/x86/fpu/core/).
This is in the commit message, but it might be easy to miss:
"Therefore, let KVM handle the APX feature on its own *when executing
ioctls to get and set the virtual machine's XSAVE state*" (emphasis
added).
I don't think the fact that the kernel is using those registers as GPRs
changes what makes a good ABI. That's a kernel-internal implementation
detail.
Now, that's not to say we should ignore kernel complexity. Maybe making
a nice ABI is so nasty to the kernel internals that we shouldn't bother.
I _think_ that's what you're suggesting.
No no, I'm only suggesting to keep the complexity out of FPU code
until we have an idea of what the needs are for non-guest FPU state.
Hi Dave, can you confirm that this is okay for you?
Paolo