Re: [PATCH v2] KVM: Adding 'else' to reduce checking.

From: Paolo Bonzini
Date: Tue Jan 21 2020 - 07:15:39 EST


On 16/01/20 10:03, Haiwei Li wrote:
> From 009bfba9b6f6b41018708323d9ca651ae2075900 Mon Sep 17 00:00:00 2001
> From: Haiwei Li <lihaiwei@xxxxxxxxxxx>
> Date: Thu, 16 Jan 2020 16:50:21 +0800
> Subject: [PATCH] Adding 'else' to reduce checking.
>
> These two conditions are in conflict, adding 'else' to reduce checking.
>
> Signed-off-by: Haiwei Li <lihaiwei@xxxxxxxxxxx>
> Reviewed-by: Vitaly Kuznetsov <vkuznets@xxxxxxxxxx>
> Reviewed-by: Miaohe Lin <linmiaohe@xxxxxxxxxx>
> ---
> Âarch/x86/kvm/lapic.c | 4 ++--
> Â1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
> index 679692b..f1cfb94 100644
> --- a/arch/x86/kvm/lapic.c
> +++ b/arch/x86/kvm/lapic.c
> @@ -1571,9 +1571,9 @@ static void
> kvm_apic_inject_pending_timer_irqs(struct kvm_lapic *apic)
> ÂÂÂÂÂÂÂ struct kvm_timer *ktimer = &apic->lapic_timer;
>
> ÂÂÂÂÂÂÂ kvm_apic_local_deliver(apic, APIC_LVTT);
> -ÂÂÂÂÂÂ if (apic_lvtt_tscdeadline(apic))
> +ÂÂÂÂÂÂ if (apic_lvtt_tscdeadline(apic)) {
> ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ ktimer->tscdeadline = 0;
> -ÂÂÂÂÂÂ if (apic_lvtt_oneshot(apic)) {
> +ÂÂÂÂÂÂ } else if (apic_lvtt_oneshot(apic)) {
> ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ ktimer->tscdeadline = 0;
> ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ ktimer->target_expiration = 0;
> ÂÂÂÂÂÂÂ }
> --
> 1.8.3.1
>

Queued, thanks.

Paolo