From: Olaf Hering <olaf@aepfle.de>
To: Jan Beulich <JBeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
Wei Liu <wei.liu2@citrix.com>,
xen-devel <xen-devel@lists.xenproject.org>,
Roger Pau Monne <roger.pau@citrix.com>
Subject: Re: [PATCH v12] tolerate jitter in cpu_khz calculation to avoid TSC emulation
Date: Mon, 11 Mar 2019 11:49:47 +0100 [thread overview]
Message-ID: <20190311114947.1d47e04e.olaf@aepfle.de> (raw)
In-Reply-To: <5C863567020000780021D1FE@prv1-mh.provo.novell.com>
[-- Attachment #1.1: Type: text/plain, Size: 3192 bytes --]
Am Mon, 11 Mar 2019 04:16:07 -0600
schrieb "Jan Beulich" <JBeulich@suse.com>:
> >>> On 08.03.19 at 20:20, <olaf@aepfle.de> wrote:
> > To reiterate the second paragraph: if a domU uses TSC as primary clock
> > source, it is expected that it runs NTP to cover for the resulting
> > drift. Therefore this change does no need a knob to turn it on or off.
> Did you omit a 't' or a 'w' above? Judging from the patch I think you
> mean "not", but I don't see how this follows, especially with your
> subsequent reply validly stating that such a requirement did not
> exist with the XenoLinux kernels.
This does indeed mean 'does not need a knob'.
I do not see how the HVM domU clock can be without drift if it does not
sync with an external source. It seems xenlinux based PV drivers lack
a clocksource, so they would better run ntp. pvops provides a clocksource=xen,
but apparently with a low resolution.
> > +#define VTSC_NTP_PPM_TOLERANCE 500UL /* Amount of drift NTP will handle */
> As per above, "will" is too strong here: I think this wants to be "can", and
> you want to add "if enabled in the guest".
I will reword this comment.
> > +#define VTSC_JITTER_RANGE_KHZ 200UL /* Assumed jitter in cpu_khz */
> I'm struggling to understand the comment: Surely not every single
> CPU surfaces a jitter of precisely 200kHz?
This is the observed range of frequencies on a large number of hosts.
The frequencies are expected to be exactly like "2.4GHz", but due to
inaccurate measurement the value of "cpu_khz" is higher or lower.
The value of "200" is simple the range of observed frequencies.
I will find a better name for this variable.
> > + * freq tolerated freq difference
> > + * ------- = -------------------------
> > + * Million Million + PPM
> > + */
> > + tmp = 1000 * 1000;
> > + tmp += VTSC_NTP_PPM_TOLERANCE;
> > + tmp *= cpu_khz;
> > + tmp /= 1000 * 1000;
> > +
> > + tmp -= cpu_khz;
> > +
> > + /*
> > + * Reduce the theoretical upper limit by the assumed measuring inaccuracy.
> > + */
> > + if ( tmp >= VTSC_JITTER_RANGE_KHZ )
> > + tmp -= VTSC_JITTER_RANGE_KHZ;
> This could suggest the constant is meant to be an upper bound, but
> (as said in review of prior versions) subtracting introduce a non-
> linearity, _and_ it doesn't guarantee the result to be within the
> assumed bounds.
The upper bound is the PPM value. ntpd in Linux can handle up to 500.
What is unclear about this formula?
First PPM is converted into "khz", on a 2GHz system tmp will become 1000.
Then the inaccuracy has to be handled, Xen can not know if cpu_khz is correct.
As said above, the observed range was 200, so this will be subtracted.
> > + vtsc_tolerance_khz = tmp;
> > + printk("Tolerating vtsc jitter for domUs: %u kHz\n", vtsc_tolerance_khz);
> Could you remind me again how Dom0 remains unaffected here?
> And if that's indeed the case, why would that be?
A dom0 does not move from one host to another.
And it better synchronizes with an external clock if domUs are supposed to be migrated in the future.
Olaf
[-- Attachment #1.2: Digitale Signatur von OpenPGP --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
[-- Attachment #2: Type: text/plain, Size: 157 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
next prev parent reply other threads:[~2019-03-11 10:49 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-08 19:20 [PATCH v12] tolerate jitter in cpu_khz calculation to avoid TSC emulation Olaf Hering
2019-03-08 19:29 ` Olaf Hering
2019-03-11 10:02 ` Jan Beulich
2019-03-11 10:26 ` Olaf Hering
2019-03-11 10:42 ` Jan Beulich
2019-03-11 10:16 ` Jan Beulich
2019-03-11 10:49 ` Olaf Hering [this message]
2019-03-11 11:19 ` Jan Beulich
2019-03-11 11:57 ` Olaf Hering
2019-03-11 14:07 ` Jan Beulich
2019-03-11 12:09 ` Olaf Hering
2019-03-11 14:11 ` Jan Beulich
2019-03-12 10:03 ` Olaf Hering
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=20190311114947.1d47e04e.olaf@aepfle.de \
--to=olaf@aepfle.de \
--cc=JBeulich@suse.com \
--cc=andrew.cooper3@citrix.com \
--cc=roger.pau@citrix.com \
--cc=wei.liu2@citrix.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.