On Wednesday 21 January 2009 02:51:39 Marcelo Tosatti wrote: > Hi Sheng, > > On Tue, Jan 20, 2009 at 09:43:15PM +0800, Sheng Yang wrote: > > Marcelo, I realize some interesting things. > > > > In fact, on my machine, when I measured the delta of now() and > > last_update at kvm_apic_timer_intr_post(), the delta was bigger and > > bigger...(and now() is always bigger for me, so still no clue for why > > data can be like above, last_update always ahead of when for about one > > period...). > > > > Then I found something not good in original design - it ignored the > > interval between time fire and injection, so we got: > > > > last_update = now() + n * period; > > > > And the time we update last_update: > > > > time = now() + n * period + n * interval. > > > > So last_update time is more and more inaccurate... Though it was revised > > by tmcct function, it's still not a good way to go. > > > > Then I understand your purpose more. > > > > + if (unlikely(atomic_read(&apic->timer.pending) > 0)) { > > + remaining = apic->timer.injection_delay; > > + if (ktime_to_ns(remaining) > apic->timer.period) > > + remaining = ns_to_ktime(apic->timer.period); > > + } else > > + remaining = hrtimer_expires_remaining(&apic->timer.dev); > > > > And about your patch, how about take interval between intr_post() and > > read tmcct in to account as well? > > You mean to sum up interval between intr_post() and read tmcct into > injection_delay? > > I don't get it. Can you be more descriptive please? Mind continue to change... A: time_fire B: intr_post C: read TMCCT I think the sequence can be AABC or AACB(I just consider AABC last night...). We have determined to return A->C as TMCCT, and the interval between different A is period which can be ignored. So how about simply return hrtimer_expires_remaining() for all tmcct reading including pending ones? (And sorry for I still can't get why you return injection delay for TMCCT...) -- regards Yang, Sheng -- 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