kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] KVM: Adding 'else' to reduce checking.
@ 2020-01-16  9:03 Haiwei Li
  2020-01-21 12:15 ` Paolo Bonzini
  0 siblings, 1 reply; 2+ messages in thread
From: Haiwei Li @ 2020-01-16  9:03 UTC (permalink / raw)
  To: linux-kernel, kvm, x86
  Cc: pbonzini, Sean Christopherson, vkuznets, wanpengli, jmattson,
	joro, tglx, mingo, bp, hpa

 From 009bfba9b6f6b41018708323d9ca651ae2075900 Mon Sep 17 00:00:00 2001
From: Haiwei Li <lihaiwei@tencent.com>
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@tencent.com>
Reviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Reviewed-by: Miaohe Lin <linmiaohe@huawei.com>
---
  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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] KVM: Adding 'else' to reduce checking.
  2020-01-16  9:03 [PATCH v2] KVM: Adding 'else' to reduce checking Haiwei Li
@ 2020-01-21 12:15 ` Paolo Bonzini
  0 siblings, 0 replies; 2+ messages in thread
From: Paolo Bonzini @ 2020-01-21 12:15 UTC (permalink / raw)
  To: Haiwei Li, linux-kernel, kvm, x86
  Cc: Sean Christopherson, vkuznets, wanpengli, jmattson, joro, tglx,
	mingo, bp, hpa

On 16/01/20 10:03, Haiwei Li wrote:
> From 009bfba9b6f6b41018708323d9ca651ae2075900 Mon Sep 17 00:00:00 2001
> From: Haiwei Li <lihaiwei@tencent.com>
> 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@tencent.com>
> Reviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com>
> Reviewed-by: Miaohe Lin <linmiaohe@huawei.com>
> ---
>  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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-01-21 12:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-16  9:03 [PATCH v2] KVM: Adding 'else' to reduce checking Haiwei Li
2020-01-21 12:15 ` Paolo Bonzini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).