[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH] x86/hvm/hpet: avoid 'small' time diff test on resume
> -----Original Message----- > From: Jan Beulich [mailto:JBeulich@xxxxxxxx] > Sent: 29 May 2019 14:37 > To: Paul Durrant <Paul.Durrant@xxxxxxxxxx> > Cc: Andrew Cooper <Andrew.Cooper3@xxxxxxxxxx>; Roger Pau Monne > <roger.pau@xxxxxxxxxx>; xen-devel <xen- > devel@xxxxxxxxxxxxxxxxxxxx>; WeiLiu <wl@xxxxxxx> > Subject: Re: [PATCH] x86/hvm/hpet: avoid 'small' time diff test on resume > > >>> On 29.05.19 at 15:09, <paul.durrant@xxxxxxxxxx> wrote: > > I notice that we seemingly don't handle main counter wrap in the HPET code. > > The spec. says that timers should fire at the point the counter wraps at the > > timer's width. I think the need for the 'small' time test would go away if > > this was implemented, but that's for another day. > > Oh, indeed. I wasn't even (actively) aware of this. (I haven't been able to > spot a statement to this effect though for wrapping of a 64-bit timer, just > 32-bit ones.) I could have sworn I read that for 64-bit too, but upon re-reading it does appear to only apply to 32-bit timers. > > > @@ -273,10 +273,13 @@ static void hpet_set_timer(HPETState *h, unsigned int > > tn, > > * Detect time values set in the past. This is hard to do for 32-bit > > * comparators as the timer does not have to be set that far in the > > future > > * for the counter difference to wrap a 32-bit signed integer. We fudge > > - * by looking for a 'small' time value in the past. > > + * by looking for a 'small' time value in the past. However, if we > > + * are resuming from suspend, treat any wrap as past since the value > > + * is unlikely to be 'small'. > > */ > > "resuming" and "suspend" are at best ambiguous - to me the terms > relate more to ACPI S-states than to migrate/save/restore. Could > I get you to agree to using "restoring after migration" or some such? Sure, I agree suspend and resume are somewhat overloaded. > > With this in mind - is a new bool parameter needed at all? Can't you > instead key this off of vhpet_domain(h)->creation_finished? Oh, I'd not considered that... I'll give that a try. > > > if ( (int64_t)diff < 0 ) > > - diff = (timer_is_32bit(h, tn) && (-diff > HPET_TINY_TIME_SPAN)) > > + diff = (timer_is_32bit(h, tn) && (-diff > HPET_TINY_TIME_SPAN) && > > + !resume) > > Logically I would see the new part of the condition go first, but that's > really minor as all three checks are sufficiently cheap. No problem. I'll re-arrange. Paul > > Jan > _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |