public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* KVM: x86: reset lapic_timer.expired_tscdeadline at SET_LAPIC time
@ 2016-06-17 23:41 Marcelo Tosatti
  2016-06-18 13:43 ` Alan Jenkins
  0 siblings, 1 reply; 10+ messages in thread
From: Marcelo Tosatti @ 2016-06-17 23:41 UTC (permalink / raw)
  To: kvm-devel, Alan Jenkins; +Cc: Paolo Bonzini


Alan Jenkins reports hang at
https://bugzilla.redhat.com/show_bug.cgi?id=1337667.

* APIC write: expiration = 1000.
* LAPIC tsc deadline code sets timer to 1000-30.
* Timer fires at 970.
* Guest writes TSC=w.

Guest fails to VM-entry to process signal to perform
"vmload" in userspace.

Case 1: w > 970:
Guest entry can be performed.

Case 2: w < 970:
Guest entry should not be performed because "An interrupt is generated
when the logical processor’s time-stamp counter equals or exceeds the
target value in the IA32_TSC_DEADLINE MSR."

Setting of APIC test resets all APIC state, including 
any pending interrupts.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index ea306ad..89be6e9 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -2991,6 +2991,7 @@ static int kvm_vcpu_ioctl_set_lapic(struct kvm_vcpu *vcpu,
 {
 	kvm_apic_post_state_restore(vcpu, s);
 	update_cr8_intercept(vcpu);
+	vcpu->arch.apic->lapic_timer.expired_tscdeadline = 0;
 
 	return 0;
 }

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

end of thread, other threads:[~2016-06-21 11:42 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-17 23:41 KVM: x86: reset lapic_timer.expired_tscdeadline at SET_LAPIC time Marcelo Tosatti
2016-06-18 13:43 ` Alan Jenkins
2016-06-20 13:05   ` [PATCH v2] " Marcelo Tosatti
2016-06-20 15:22     ` Alan Jenkins
     [not found]     ` <87bb5b7c-ab8c-7bb4-b01d-f535eb716522@gmail.com>
2016-06-21  1:31       ` Marcelo Tosatti
2016-06-21  7:50     ` Paolo Bonzini
2016-06-21 11:35       ` Marcelo Tosatti
2016-06-21 11:37         ` Paolo Bonzini
2016-06-20 13:11   ` Marcelo Tosatti
2016-06-20 15:22     ` Alan Jenkins

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox