All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Dan Magenheimer" <dan.magenheimer@oracle.com>
To: Ian Pratt <Ian.Pratt@eu.citrix.com>,
	Keir Fraser <Keir.Fraser@eu.citrix.com>,
	"Xen-Devel (E-mail)" <xen-devel@lists.xensource.com>
Cc: Dave Winchell <dwinchell@virtualiron.com>
Subject: RE: Xen system skew MUCH worse than tsc skew (was RE: RE:	[PATCH] record max stime skew (was RE: [PATCH] strictly	increasinghvm guest time))
Date: Tue, 22 Jul 2008 18:40:38 -0600	[thread overview]
Message-ID: <20080722184038671.00000001992@djm-pc> (raw)
In-Reply-To: <DD74FBB8EE28D441903D56487861CD9D32AC257C@lonpexch01.citrite.net>

> If you want to test this theory, you can easily get all the CPUs to
> recalibrate at the same instant, though it's a bit expensive:
> 
> Get one CPU to issue an smp_call_function on all CPUs (including
> itself). The called function should atomic_inc a variable and 
> then spin
> waiting reading the count until all CPUs have reached this point. When
> this happens, turn interrupts off, atomic_dec the same counter, spin
> until it hits zero, then read the TSC, re-enable interrupts, finish.
> The TSC reads should all happen very close to each other. 

The code invoked by "xm debug-key t" does exactly that and I've been
using it (as one way) to measure skew.  Any idea how expensive it is?
Is it too expensive to do once/second?  If it's not more expensive
than the (1Hz per processor) local_time_calibration(), perhaps we
should just use it to set TSC on all processors once/second and dispense
with the existing (beautiful but one additional frequency to resonate)
platform-timer-interpolated-by-tsc approach?

On the other hand, I'll bet the bigger the system, the more difficult
it is to rendezvous them... and the more natural skew there will be
between the sockets.
 
> The only thing that could mess this up would be NMI's or SMI's. You
> could at least detect that by reading the TSC after all CPUs have
> incremented the counter, and check that only a "reasonable" amount of
> time had elapsed. If not, set a flag to indicate that a 
> recalibration is
> required (you'd need to add another gather loop to enable all CPUs to
> vote on whether they're happy).

I think I've seen this code in recent Linux.

But assuming we stay with the existing approach, I'm not sure
the processors need to be calibrated at "exactly" the same time,
just "close".  Something similar to "round jiffies" (see
http://lkml.org/lkml/2006/10/10/189) may be enough... though
I guess that depends on the character of the timesource jitter.

Thanks,
Dan

  reply	other threads:[~2008-07-23  0:40 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-02 16:03 [PATCH] strictly increasing hvm guest time Dan Magenheimer
2008-07-02 16:07 ` Keir Fraser
2008-07-02 21:50   ` Dan Magenheimer
2008-07-02 22:41     ` [PATCH] record max stime skew (was RE: [PATCH] strictly increasing hvm guest time) Dan Magenheimer
2008-07-03  8:03       ` Keir Fraser
2008-07-03 16:24         ` Dan Magenheimer
2008-07-03 16:35           ` Dan Magenheimer
2008-07-03 20:03             ` Dan Magenheimer
2008-07-03 23:00               ` Keir Fraser
2008-07-04 15:11                 ` Dan Magenheimer
2008-07-04 15:22                   ` Keir Fraser
2008-07-04 19:32                     ` Dan Magenheimer
2008-07-04 19:56                       ` Keir Fraser
2008-07-10  0:24                         ` Dan Magenheimer
2008-07-10  7:40                           ` Keir Fraser
2008-07-10 22:42                             ` Xen system skew MUCH worse than tsc skew (was RE: RE: [PATCH] record max stime skew (was RE: [PATCH] strictly increasing hvm guest time)) Dan Magenheimer
2008-07-11  8:27                               ` Keir Fraser
2008-07-11 20:53                                 ` Dan Magenheimer
2008-07-11 21:27                                   ` Xen system skew MUCH worse than tsc skew (was RE: RE: [PATCH] record max stime skew (was RE: [PATCH] strictly increasinghvm " Ian Pratt
2008-07-12 21:05                                     ` Dan Magenheimer
2008-07-11 21:27                                   ` Xen system skew MUCH worse than tsc skew (was RE: RE: [PATCH] record max stime skew (was RE: [PATCH] strictly increasing hvm " Keir Fraser
2008-07-12 21:07                                     ` Dan Magenheimer
2008-07-19 17:51                                 ` Dan Magenheimer
2008-07-21  8:32                                   ` Keir Fraser
2008-07-22 22:27                                     ` Dan Magenheimer
2008-07-22 23:07                                       ` Xen system skew MUCH worse than tsc skew (was RE: RE: [PATCH] record max stime skew (was RE: [PATCH] strictly increasinghvm " Ian Pratt
2008-07-23  0:40                                         ` Dan Magenheimer [this message]
2008-07-23  1:16                                           ` Ian Pratt
2008-07-23  6:11                                       ` Tian, Kevin

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=20080722184038671.00000001992@djm-pc \
    --to=dan.magenheimer@oracle.com \
    --cc=Ian.Pratt@eu.citrix.com \
    --cc=Keir.Fraser@eu.citrix.com \
    --cc=dwinchell@virtualiron.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.