qemu-devel
[Top][All Lists]
Advanced

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]