Re: [PATCH v2 16/23] x86,vmx: Provide asm-goto-output vmread
From: Peter Zijlstra
Date: Tue Dec 14 2021 - 17:46:49 EST
On Tue, Dec 14, 2021 at 06:44:48PM +0000, Sean Christopherson wrote:
> This needs to route through a noinline vmread_error(), the intent is that KVM only
> does WARN once for all VMREAD failures, whereas having this inline will WARN once
> on each unique vmcs_read*().
Oh, fair enough.
> And at that point, we might as well hide the asm
> trampoline too. The amount of ifdeffery gets a bit gross, but in for a penny in
> for a pound?
>
> And like the other VMX instruction, I assume it's safe to annotate the failure
> path as instrumentation safe.
>
> So this?
Yep, think so.
> ---
> arch/x86/kvm/vmx/vmenter.S | 2 ++
> arch/x86/kvm/vmx/vmx.c | 7 +++++++
> arch/x86/kvm/vmx/vmx_ops.h | 31 +++++++++++++++++++++++++++++++
> 3 files changed, 40 insertions(+)
>
> diff --git a/arch/x86/kvm/vmx/vmenter.S b/arch/x86/kvm/vmx/vmenter.S
> index 3a6461694fc2..d8a7a0a69ec1 100644
> --- a/arch/x86/kvm/vmx/vmenter.S
> +++ b/arch/x86/kvm/vmx/vmenter.S
> @@ -238,6 +238,7 @@ SYM_FUNC_END(__vmx_vcpu_run)
>
> .section .text, "ax"
>
> +#ifdef CONFIG_CC_HAS_ASM_GOTO_OUTPUT
#ifndef ?
> /**
> * vmread_error_trampoline - Trampoline from inline asm to vmread_error()
> * @field: VMCS field encoding that failed