Re: [PATCH v5 1/9] KVM: VMX: Use on-stack copy of @flags in __vmx_vcpu_run()

Borislav Petkov
2025-11-14T16:41:10Z

On Thu, Nov 13, 2025 at 03:37:38PM -0800, Sean Christopherson wrote:
> Suggested-by: Borislav Petkov <bp@alien8.de>

Bah, I didn't suggest that - that's all your effort :)

> Signed-off-by: Sean Christopherson <seanjc@google.com>
> ---
> arch/x86/kvm/vmx/run_flags.h | 10 +++-------
> arch/x86/kvm/vmx/vmenter.S | 13 ++++---------
> 2 files changed, 7 insertions(+), 16 deletions(-)

...

> @@ -173,8 +167,9 @@ SYM_FUNC_START(__vmx_vcpu_run)
> /* Clobbers EFLAGS.ZF */
> CLEAR_CPU_BUFFERS
>
> - /* Check EFLAGS.CF from the VMX_RUN_VMRESUME bit test above. */
> - jnc .Lvmlaunch
> + /* Check @flags to see if vmlaunch or vmresume is needed. */

VMRESUME/VMLAUNCH in caps, like the rest of the file. We like our x86 insns in
all caps. :)

> + testl $VMX_RUN_VMRESUME, WORD_SIZE(%_ASM_SP)
> + jz .Lvmlaunch
>
> /*
> * After a successful VMRESUME/VMLAUNCH, control flow "magically"
> --

But yeah, AFAIU this code, that's a nice cleanup.

Acked-by: Borislav Petkov (AMD) <bp@alien8.de>

--
Regards/Gruss,
Boris.