Re: [PATCH 0/7] KVM: x86: APX reg prep work
From: Chang S. Bae
Date: Thu Mar 12 2026 - 12:35:03 EST
On 3/11/2026 12:01 PM, Paolo Bonzini wrote:
On the other hand, the extra 16 regs[] entries would be more or less unused, the ugly switch statements wouldn't go away. In other words, most of your remarks to Changseok's patches would remain...
I think so...
If the host kernel ever starts using EGPRs, the state would need to be switched in the entry code. At that point, they would likely be saved somewhere other than XSAVE buffer. In turn, the guest state would also need to be saved to regs[] on VM exit.
However, that is sort of what-if scenarios at best. The host kernel still manages EGPR context switching through XSAVE. Saving EGPRs into regs[] would introduce an oddity to synchronize between two buffers: regs[] and gfpu->fpstate, which looks like unnecessary complexity.
So while ugly, the switch statements are a bit of a trade-off here. Also bits 16-31 in the extended regs_avail will remain unset with APX=y.