Re: [PATCH 09/10] KVM: VMX: Cache vmx->exit_reason in local u16 in vmx_handle_exit_irqoff()

From: Vitaly Kuznetsov
Date: Fri Mar 13 2020 - 10:10:09 EST


Sean Christopherson <sean.j.christopherson@xxxxxxxxx> writes:

> Use a u16 to hold the exit reason in vmx_handle_exit_irqoff(), as the
> checks for INTR/NMI/WRMSR expect to encounter only the basic exit reason
> in vmx->exit_reason.
>

True Sean would also add:

"No functional change intended."

"Opportunistically align the params to handle_external_interrupt_irqoff()."

> Signed-off-by: Sean Christopherson <sean.j.christopherson@xxxxxxxxx>
> ---
> arch/x86/kvm/vmx/vmx.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
> index d43e1d28bb58..910a7cadeaf7 100644
> --- a/arch/x86/kvm/vmx/vmx.c
> +++ b/arch/x86/kvm/vmx/vmx.c
> @@ -6287,16 +6287,16 @@ static void handle_external_interrupt_irqoff(struct kvm_vcpu *vcpu)
> STACK_FRAME_NON_STANDARD(handle_external_interrupt_irqoff);
>
> static void vmx_handle_exit_irqoff(struct kvm_vcpu *vcpu,
> - enum exit_fastpath_completion *exit_fastpath)
> + enum exit_fastpath_completion *exit_fastpath)
> {
> struct vcpu_vmx *vmx = to_vmx(vcpu);
> + u16 exit_reason = vmx->exit_reason;
>
> - if (vmx->exit_reason == EXIT_REASON_EXTERNAL_INTERRUPT)
> + if (exit_reason == EXIT_REASON_EXTERNAL_INTERRUPT)
> handle_external_interrupt_irqoff(vcpu);
> - else if (vmx->exit_reason == EXIT_REASON_EXCEPTION_NMI)
> + else if (exit_reason == EXIT_REASON_EXCEPTION_NMI)
> handle_exception_nmi_irqoff(vmx);
> - else if (!is_guest_mode(vcpu) &&
> - vmx->exit_reason == EXIT_REASON_MSR_WRITE)
> + else if (!is_guest_mode(vcpu) && exit_reason == EXIT_REASON_MSR_WRITE)
> *exit_fastpath = handle_fastpath_set_msr_irqoff(vcpu);
> }

Reviewed-by: Vitaly Kuznetsov <vkuznets@xxxxxxxxxx>

--
Vitaly