On 21/06/2016 13:35, Marcelo Tosatti wrote: > On Tue, Jun 21, 2016 at 09:50:54AM +0200, Paolo Bonzini wrote: >> >> >> On 20/06/2016 15:05, Marcelo Tosatti wrote: >>> >>> 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; >>> >> >> I think this is not correct. You have programmed the host timer to an >> early value when kvm_apic_post_state_restore called start_apic_timer. >> >> I think that: >> >> 1) post_state_restore should cancel the timer and clear >> lapic_timer.pending before writing the registers, not afterwards. >> lapic_timer.expired_tscdeadline can be cleared at the same time. >> >> 2) kvm_write_tsc should do the same and restart the timer afterwards. >> >> Thanks, > > Actually, the max should deal with the problem Alan is having with > vmload as well (one delay of tenths of microseconds, or 0, per vmload > should be irrelevant). Yes, it does. Though I think it's a bug that we don't clear .pending on KVM_SET_LAPIC, and I'm happy if you do a v2 of this patch to fix it. :) Paolo -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html