[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v1 7/7] kvm/x86: Hyper-V SynIC timers
From: |
Roman Kagan |
Subject: |
Re: [Qemu-devel] [PATCH v1 7/7] kvm/x86: Hyper-V SynIC timers |
Date: |
Mon, 30 Nov 2015 15:17:15 +0300 |
User-agent: |
Mutt/1.5.24 (2015-08-30) |
On Fri, Nov 27, 2015 at 11:49:40AM +0100, Paolo Bonzini wrote:
[ sorry missed your message on Friday, replying now ]
> On 27/11/2015 09:12, Roman Kagan wrote:
> >> > + n = div64_u64(time_now - stimer->exp_time, stimer->count) + 1;
> >> > + stimer->exp_time += n * stimer->count;
> > This is actually just a reminder calculation so I'd rather do it
> > directly with div64_u64_rem().
>
> It took me a while to understand why it was a remained. :)
It gets easier if you think of it this way: we've slipped a few whole
periods and the remainder of the slack into the current period, so
the time left till the next tick is ("count" is the timer period here)
delta = count - slack % count
where
slack = time_now - exp_time
This gives you immediately your
> exp_time = time_now + (count - (time_now - exp_time) % count)
Roman.
- [Qemu-devel] [PATCH v1 4/7] kvm/x86: Added Hyper-V vcpu_to_hv_vcpu()/hv_vcpu_to_vcpu() helpers, (continued)
- [Qemu-devel] [PATCH v1 4/7] kvm/x86: Added Hyper-V vcpu_to_hv_vcpu()/hv_vcpu_to_vcpu() helpers, Andrey Smetanin, 2015/11/25
- [Qemu-devel] [PATCH v1 2/7] drivers/hv: Move struct hv_message into UAPI Hyper-V x86 header, Andrey Smetanin, 2015/11/25
- [Qemu-devel] [PATCH v1 5/7] kvm/x86: Hyper-V internal helper to read MSR HV_X64_MSR_TIME_REF_COUNT, Andrey Smetanin, 2015/11/25
- [Qemu-devel] [PATCH v1 7/7] kvm/x86: Hyper-V SynIC timers, Andrey Smetanin, 2015/11/25
- [Qemu-devel] [PATCH v1 6/7] kvm/x86: Hyper-V SynIC message slot pending clearing at SINT ack, Andrey Smetanin, 2015/11/25
- Re: [Qemu-devel] [PATCH v1 6/7] kvm/x86: Hyper-V SynIC message slot pending clearing at SINT ack, Paolo Bonzini, 2015/11/25
- Re: [Qemu-devel] [PATCH v1 6/7] kvm/x86: Hyper-V SynIC message slot pending clearing at SINT ack, Andrey Smetanin, 2015/11/25
- Re: [Qemu-devel] [PATCH v1 6/7] kvm/x86: Hyper-V SynIC message slot pending clearing at SINT ack, Paolo Bonzini, 2015/11/25
- Re: [Qemu-devel] [PATCH v1 6/7] kvm/x86: Hyper-V SynIC message slot pending clearing at SINT ack, Andrey Smetanin, 2015/11/26
- Re: [Qemu-devel] [PATCH v1 6/7] kvm/x86: Hyper-V SynIC message slot pending clearing at SINT ack, Paolo Bonzini, 2015/11/26
- Re: [Qemu-devel] [PATCH v1 6/7] kvm/x86: Hyper-V SynIC message slot pending clearing at SINT ack, Andrey Smetanin, 2015/11/26
- Re: [Qemu-devel] [PATCH v1 6/7] kvm/x86: Hyper-V SynIC message slot pending clearing at SINT ack, Paolo Bonzini, 2015/11/26
- Re: [Qemu-devel] [PATCH v1 6/7] kvm/x86: Hyper-V SynIC message slot pending clearing at SINT ack, Roman Kagan, 2015/11/27
- Re: [Qemu-devel] [PATCH v1 0/7] KVM: Hyper-V SynIC timers, Wanpeng Li, 2015/11/26