kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH][RFC] KVM: x86: Don't reset deadline to period when timer is in one shot mode
@ 2022-10-12 12:54 Li RongQing
  2022-10-12 16:05 ` Sean Christopherson
  0 siblings, 1 reply; 5+ messages in thread
From: Li RongQing @ 2022-10-12 12:54 UTC (permalink / raw)
  To: kvm

In one-shot mode, the APIC timer stops counting when the timer
reaches zero, so don't reset deadline to period for one shot mode

Signed-off-by: Li RongQing <lirongqing@baidu.com>
---
 arch/x86/kvm/lapic.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
index 9dda989..bf39027 100644
--- a/arch/x86/kvm/lapic.c
+++ b/arch/x86/kvm/lapic.c
@@ -1840,8 +1840,12 @@ static bool set_target_expiration(struct kvm_lapic *apic, u32 count_reg)
 		if (unlikely(count_reg != APIC_TMICT)) {
 			deadline = tmict_to_ns(apic,
 				     kvm_lapic_get_reg(apic, count_reg));
-			if (unlikely(deadline <= 0))
-				deadline = apic->lapic_timer.period;
+			if (unlikely(deadline <= 0)) {
+				if (apic_lvtt_period(apic))
+					deadline = apic->lapic_timer.period;
+				else
+					deadline = 0;
+			}
 			else if (unlikely(deadline > apic->lapic_timer.period)) {
 				pr_info_ratelimited(
 				    "kvm: vcpu %i: requested lapic timer restore with "
-- 
2.9.4


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

end of thread, other threads:[~2022-10-20  1:48 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-12 12:54 [PATCH][RFC] KVM: x86: Don't reset deadline to period when timer is in one shot mode Li RongQing
2022-10-12 16:05 ` Sean Christopherson
2022-10-17  9:54   ` Li,Rongqing
2022-10-19 15:53     ` Sean Christopherson
2022-10-20  1:17       ` Li,Rongqing

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).