From: Paul Durrant <Paul.Durrant@citrix.com>
To: 'Jan Beulich' <JBeulich@suse.com>
Cc: Andrew Cooper <Andrew.Cooper3@citrix.com>,
xen-devel <xen-devel@lists.xenproject.org>, WeiLiu <wl@xen.org>,
Roger Pau Monne <roger.pau@citrix.com>
Subject: Re: [Xen-devel] [PATCH] x86/hvm/hpet: avoid 'small' time diff test on resume
Date: Wed, 29 May 2019 13:43:46 +0000 [thread overview]
Message-ID: <238cd126b58c4f3396c2a45f3dfb9c3e@AMSPEX02CL03.citrite.net> (raw)
Message-ID: <20190529134346.0PcttDtMy2NX68-6wPI3bPvzaX6zcFHAEo959UnRVjU@z> (raw)
In-Reply-To: <5CEE8AF5020000780023373F@prv1-mh.provo.novell.com>
> -----Original Message-----
> From: Jan Beulich [mailto:JBeulich@suse.com]
> Sent: 29 May 2019 14:37
> To: Paul Durrant <Paul.Durrant@citrix.com>
> Cc: Andrew Cooper <Andrew.Cooper3@citrix.com>; Roger Pau Monne <roger.pau@citrix.com>; xen-devel <xen-
> devel@lists.xenproject.org>; WeiLiu <wl@xen.org>
> Subject: Re: [PATCH] x86/hvm/hpet: avoid 'small' time diff test on resume
>
> >>> On 29.05.19 at 15:09, <paul.durrant@citrix.com> 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@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
next prev parent reply other threads:[~2019-05-29 13:44 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-29 13:09 [PATCH] x86/hvm/hpet: avoid 'small' time diff test on resume Paul Durrant
2019-05-29 13:09 ` [Xen-devel] " Paul Durrant
2019-05-29 13:27 ` Paul Durrant
2019-05-29 13:27 ` [Xen-devel] " Paul Durrant
2019-05-29 13:36 ` Jan Beulich
2019-05-29 13:36 ` [Xen-devel] " Jan Beulich
2019-05-29 13:43 ` Paul Durrant [this message]
2019-05-29 13:43 ` Paul Durrant
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=238cd126b58c4f3396c2a45f3dfb9c3e@AMSPEX02CL03.citrite.net \
--to=paul.durrant@citrix.com \
--cc=Andrew.Cooper3@citrix.com \
--cc=JBeulich@suse.com \
--cc=roger.pau@citrix.com \
--cc=wl@xen.org \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).