[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87h7zp9ngl.fsf@vitty.brq.redhat.com>
Date: Mon, 17 Feb 2020 17:40:26 +0100
From: Vitaly Kuznetsov <vkuznets@...hat.com>
To: linmiaohe <linmiaohe@...wei.com>
Cc: kvm@...r.kernel.org, linux-kernel@...r.kernel.org, x86@...nel.org,
pbonzini@...hat.com, rkrcmar@...hat.com,
sean.j.christopherson@...el.com, wanpengli@...cent.com,
jmattson@...gle.com, joro@...tes.org, tglx@...utronix.de,
mingo@...hat.com, bp@...en8.de, hpa@...or.com
Subject: Re: [PATCH v2] KVM: VMX: Add 'else' to split mutually exclusive case
linmiaohe <linmiaohe@...wei.com> writes:
> From: Miaohe Lin <linmiaohe@...wei.com>
>
> Each if branch in handle_external_interrupt_irqoff() is mutually
> exclusive. Add 'else' to make it clear and also avoid some unnecessary
> check.
>
> Signed-off-by: Miaohe Lin <linmiaohe@...wei.com>
> ---
> v1->v2:
> add braces to all if branches
> ---
> arch/x86/kvm/vmx/vmx.c | 8 +++-----
> 1 file changed, 3 insertions(+), 5 deletions(-)
>
> diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
> index 9a6664886f2e..a13368b2719c 100644
> --- a/arch/x86/kvm/vmx/vmx.c
> +++ b/arch/x86/kvm/vmx/vmx.c
> @@ -6176,15 +6176,13 @@ static void handle_exception_nmi_irqoff(struct vcpu_vmx *vmx)
> vmx->exit_intr_info = vmcs_read32(VM_EXIT_INTR_INFO);
>
> /* if exit due to PF check for async PF */
> - if (is_page_fault(vmx->exit_intr_info))
> + if (is_page_fault(vmx->exit_intr_info)) {
> vmx->vcpu.arch.apf.host_apf_reason = kvm_read_and_reset_pf_reason();
> -
> /* Handle machine checks before interrupts are enabled */
> - if (is_machine_check(vmx->exit_intr_info))
> + } else if (is_machine_check(vmx->exit_intr_info)) {
> kvm_machine_check();
> -
> /* We need to handle NMIs before interrupts are enabled */
> - if (is_nmi(vmx->exit_intr_info)) {
> + } else if (is_nmi(vmx->exit_intr_info)) {
> kvm_before_interrupt(&vmx->vcpu);
> asm("int $2");
> kvm_after_interrupt(&vmx->vcpu);
Reviewed-by: Vitaly Kuznetsov <vkuznets@...hat.com>
--
Vitaly
Powered by blists - more mailing lists