[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1572060239-17401-3-git-send-email-zhenzhong.duan@oracle.com>
Date: Sat, 26 Oct 2019 11:23:56 +0800
From: Zhenzhong Duan <zhenzhong.duan@...cle.com>
To: linux-kernel@...r.kernel.org
Cc: kvm@...r.kernel.org, mtosatti@...hat.com,
joao.m.martins@...cle.com, rafael.j.wysocki@...el.com,
rkrcmar@...hat.com, pbonzini@...hat.com,
Zhenzhong Duan <zhenzhong.duan@...cle.com>
Subject: [PATCH 2/5] KVM: add a check to ensure grow start value is nonzero
vcpu->halt_poll_ns could be zeroed in certain cases (e.g. by
halt_poll_ns_shrink). If halt_poll_ns_grow_start is zero,
vcpu->halt_poll_ns will never be larger than zero.
Signed-off-by: Zhenzhong Duan <zhenzhong.duan@...cle.com>
---
virt/kvm/kvm_main.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 2ca2979..1b6fe3b 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -2266,6 +2266,13 @@ static void grow_halt_poll_ns(struct kvm_vcpu *vcpu)
goto out;
val *= grow;
+
+ /*
+ * vcpu->halt_poll_ns needs a nonzero start point to grow if it's zero.
+ */
+ if (!grow_start)
+ grow_start = 1;
+
if (val < grow_start)
val = grow_start;
--
1.8.3.1
Powered by blists - more mailing lists