[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


  • To: 'Jan Beulich' <JBeulich@xxxxxxxx>
  • From: Paul Durrant <Paul.Durrant@xxxxxxxxxx>
  • Date: Wed, 29 May 2019 13:43:46 +0000
  • Accept-language: en-GB, en-US
  • Authentication-results: esa4.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=Paul.Durrant@xxxxxxxxxx; spf=Pass smtp.mailfrom=Paul.Durrant@xxxxxxxxxx; spf=None smtp.helo=postmaster@xxxxxxxxxxxxxxxxxxxxxxxxxx
  • Cc: Andrew Cooper <Andrew.Cooper3@xxxxxxxxxx>, xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>, WeiLiu <wl@xxxxxxx>, Roger Pau Monne <roger.pau@xxxxxxxxxx>
  • Delivery-date: Wed, 29 May 2019 13:43:58 +0000
  • Ironport-sdr: Gp1qzoRY0USpWFeX8k0qYVtiwjlpYcYkUhommap8Bja3JdoRfuvLsHytxIsrYOq7gE3Fm/PLu1 7sgueGjxKhojJv4EsyP/i8xcja60JORnYVT7ni+BbEead4F57/fUSMKrrOkr0ltfH/zWWAw8eV cCQNITwG6/YFWJN4vxmm9wr4AQVWECLcchhEpd21Ch/jJq5M6M8PCNO3QYv9FYcJNAV7E5wzf+ QDOSIsceBr7DU3/5d7R0vmx0JpkXs+E47gmArTEnHYLplemKKg4Co38SuXBeo9onyda6haajUB jdE=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHVFh/NLn9cTGTOSEiqgEoW+PnZTqaB+WCAgAAiClA=
  • Thread-topic: [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

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.