From: "Dan Magenheimer" <dan.magenheimer@oracle.com>
To: Keir Fraser <keir.fraser@eu.citrix.com>,
"Xen-Devel (E-mail)" <xen-devel@lists.xensource.com>
Cc: Dave Winchell <dwinchell@virtualiron.com>
Subject: RE: Re: [PATCH] clocksource=tsc
Date: Fri, 18 Jul 2008 10:51:35 -0600 [thread overview]
Message-ID: <20080718105135031.00000001344@djm-pc> (raw)
In-Reply-To: <C4A66EB9.244DA%keir.fraser@eu.citrix.com>
> I don't think this is necessarily true. If we write code to generate
> accurate time records specifically for clocksource=tsc then
> we should easily
> get accuracy down to a couple of parts per billion. This is
> certainly a more
> pragmatic solution than extending the guest time interfaces.
> I am at least
> coming round to the fact that the changes required in Xen's
> time.c are going
> to have to be a bit more drastic than I first hoped.
>
> -- Keir
I guess you are correct as long as "generate a time record"
doesn't include recomputing the scaling factor every
second (which is I think what introduces the jitter... see
more on this below).
However, I'm not sure why you perceive the aesthetics to
be so bad to put "if (ideal_clocksource)" in get_s_time()
and a few other places in time.c... or for that matter in
the PV guest code.
Your existing algorithm is a very cool and elegant way to
optimize time handling for all "legacy" time sources.
The more I understand about it, the more I am impressed!
But it is very difficult to understand and for most "modern"
hardware it unnecessarily obfuscates time handling. So IMHO
I much prefer the "if (ideal_clocksource)... else ..."
approach rather than shoehorning the ideal to look like
the legacy. And that applies for the PV guest code as well.
On a related note:
> The problem is that this is sensitive to small errors in the
> scale factor!
> And unfortunately we compute a new scale factor, to convert to us, as
> scale_factor_ns/1000. The resulting scale factor is obviously
> less accurate,
> and leads to an accumulating absolute error as the TSC value
> gets large.
Yes I noticed that the mul_frac+scale_delta code gives different
answers than muldiv64, though they have essentially the same API.
I didn't do much testing but they differed after about 5 digits
and muldiv64 does a hardware divide so I suspect it is more
accurate (though also probably slower). It might be worth looking
at this to squeeze out more precision.
Thanks for all your time and attention on this. As Xen supports
more time-sensitive workloads (such as databases on enterprise
systems and games on PCs), I think it will pay off!
Dan
next prev parent reply other threads:[~2008-07-18 16:51 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-12 21:38 [PATCH] clocksource=tsc Dan Magenheimer
2008-07-13 3:59 ` Dan Magenheimer
2008-07-14 9:24 ` Keir Fraser
2008-07-14 17:59 ` Dan Magenheimer
2008-07-15 0:35 ` Tian, Kevin
2008-07-17 23:47 ` Dan Magenheimer
2008-07-15 13:05 ` Keir Fraser
2008-07-15 14:44 ` Dan Magenheimer
2008-07-15 15:08 ` Keir Fraser
2008-07-15 15:46 ` Dan Magenheimer
2008-07-15 16:04 ` Dan Magenheimer
2008-07-16 1:15 ` Dan Magenheimer
2008-07-16 4:11 ` Dan Magenheimer
2008-07-16 12:43 ` Dan Magenheimer
2008-07-16 12:49 ` Keir Fraser
2008-07-16 13:43 ` Dan Magenheimer
2008-07-16 15:42 ` Dan Magenheimer
2008-07-16 19:32 ` Keir Fraser
2008-07-17 23:05 ` Dan Magenheimer
2008-07-18 7:24 ` Keir Fraser
2008-07-18 11:01 ` Keir Fraser
2008-07-18 11:10 ` Keir Fraser
2008-07-18 14:19 ` Dan Magenheimer
2008-07-18 14:29 ` Keir Fraser
2008-07-18 14:56 ` Dan Magenheimer
2008-07-18 15:00 ` Keir Fraser
2008-07-18 16:51 ` Dan Magenheimer [this message]
2008-07-18 19:28 ` Keir Fraser
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=20080718105135031.00000001344@djm-pc \
--to=dan.magenheimer@oracle.com \
--cc=dwinchell@virtualiron.com \
--cc=keir.fraser@eu.citrix.com \
--cc=xen-devel@lists.xensource.com \
/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.