Re: [PATCH 1/3] KVM: VMX: Macrofy GPR swapping in __vmx_vcpu_run()
From: Chang S. Bae
Date: Thu May 14 2026 - 22:04:37 EST
On 5/14/2026 12:30 PM, Sean Christopherson wrote:
This is not simpler. Maybe it ends up being less verbose, but I don't see how
anyone can claim this is simpler. E.g. for people like me that aren't already
familiar with the .ifc directive, the R32_NUM macro is inscrutable. I can at
least suss out what e.g. LOAD_REGS and friends are doing, but claiming the code
is "simpler" is rather ridiculous.
Intended to abstract away the repetitive sequences. But I can read your reaction. The compressing macro hurts readability, especially with the nested macros and directives.
For me, this needs to be the focal point of the changelog, and it needs to be
written with --verbose, because the impact of APX on the VM-Entry/VM-Exit code
isn't so obvious that a one-line "this makes future life easier" sufficiently
justifies the macro magic. And that's coming from someone that generally loves
macro magic :-)
How about this?
Convert the repeated register save/restore sequences into macros in
preparation for extended GPR support.
While the resulting macros are more compact, they do not necessarily
improve readability in fact. They rely nested macros and assembly
directives, which may not immediately obvious at first glance.
But upcoming support for additional GPRs (R16-R31) needs to extend the
VM entry/exit paths. Continuing to grow the existing open-coded
sequences line-by-line would be increasingly inefficient and tedious.
Those macros provide a more scalable approach, despite readability
tradeoff.
Thanks,
Chang