All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ian Campbell <Ian.Campbell@citrix.com>
To: Stefano Stabellini <Stefano.Stabellini@eu.citrix.com>
Cc: Jeremy Fitzhardinge <jeremy@goop.org>,
	"xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>
Subject: Re: [PATCH] [PVOPS] dom0 sync xen wallclock
Date: Thu, 11 Feb 2010 11:36:43 +0000	[thread overview]
Message-ID: <1265888203.24394.42917.camel@zakaz.uk.xensource.com> (raw)
In-Reply-To: <alpine.DEB.2.00.1002111112360.26970@kaball-desktop>

On Thu, 2010-02-11 at 11:24 +0000, Stefano Stabellini wrote:
> On Wed, 10 Feb 2010, Jeremy Fitzhardinge wrote:
> > I'm not sure this is the right thing to do.  We have a set_wallclock 
> > pvop, which Xen currently implements as a no-op, but it should do the 
> > appropriate hypercall to set Xen's time if privileged enough.
> > 
> > Conceptually the Xen persistent time is the same as the platform CMOS 
> > clock, so I don't think we should update it any differently.  Your patch 
> > may make sense, but it should also address the native case.   At the 
> > moment it happens via sync_cmos_clock(), which is called periodically (I 
> > think) independently of whether the clock has actually been changed.
> > 
> > There is one big difference between the Xen clock and the CMOS clock, 
> > which is that the Xen clock is being concurrently accessed by other 
> > domains.  If it is being updated periodically, then there will be 
> > discontinuities in time which may affect other domains.  But since 
> > there's no time-warp ABI to Xen, I don't think this can really be 
> > avoided; anyone reading periodically the Xen clock needs to be able to 
> > deal with any discontinuities.  pvops kernels only inspect it at boot 
> > time, and so won't see any subsequent time adjustments anyway.
> > 
> 
> Linux 2.6.18 does consider xen persistent time as the platform
> CMOS clock, but I don't think this is what we actually want: if we run
> ntpd in dom0 we probably want to sync xen time with dom0 time more often
> than linux usually update the CMOS clock.
> In particular we want that as soon as ntpd in dom0 set the right time,
> it gets propagated in xen so that all the PV guests created after that
> moment can read the right wallclock at boot.
> I think that the right approach to achieve that is to break the
> assumption that xen persistent time is like the CMOS and treat it more
> like xtime instead.

I agree, guests which have a dependent wallclock are reading this
variable from the hypervisor as their xtime, not their CMOS RTC. Having
domain 0 write it as if it were the CMOS seems asymmetric with this
approach.

Any explicit setting of the time in domain 0 should be immediately
propagated through to the hypervisor, with all the usual caveats that
calling settimeofday has on any normal Linux system, but it appears it
is necessary for the same reasons we usually allow ntpd (or ntpdate) to
step the time once at start of day. Without this we have to wait some
time after boot for the time setting to be propagated, this delay is
often long enough to have started several VMs which will now be running
with the wrong time and/or see even worse discontinuities when the time
is eventually set.

As for propagating variations derived from the ntp drift calculations a
drift based interface to the hypervisor would be an improvement but I
think what Stefano proposes is basically inline with historical domain 0
behaviour. Guests which have a dependent wallclock already handle any
discontinuities by adding their own monotonicity checks.

One tricky issue with pushing drift parameters into the hypervisor is
that presumably ntp would need to calculate them based on the
hypervisor's idea of time, calculating based on domain 0's idea of time
when the two are allowed to drift seems like it would simply lead to
using the wrong drift paramters and making things worse for the
hypervisor.

Ian.

  reply	other threads:[~2010-02-11 11:36 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-09 18:12 [PATCH] [PVOPS] dom0 sync xen wallclock Stefano Stabellini
2010-02-09 18:20 ` Stefano Stabellini
2010-02-10 23:09 ` Jeremy Fitzhardinge
2010-02-11  0:06   ` Keir Fraser
2010-02-11  0:47     ` Jeremy Fitzhardinge
2010-02-11  8:03       ` Keir Fraser
2010-02-11 19:16         ` Jeremy Fitzhardinge
2010-02-11 11:24   ` Stefano Stabellini
2010-02-11 11:36     ` Ian Campbell [this message]
2010-02-18 23:43     ` Jeremy Fitzhardinge
2010-02-19  1:02       ` Dan Magenheimer
2010-02-19  9:10       ` Ian Campbell
2010-02-19  9:39         ` Keir Fraser
2010-02-23 12:13           ` Stefano Stabellini
2010-02-23 14:25           ` Ian Campbell
2010-02-19 23:05         ` Jeremy Fitzhardinge
2010-02-23 14:25           ` Ian Campbell

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=1265888203.24394.42917.camel@zakaz.uk.xensource.com \
    --to=ian.campbell@citrix.com \
    --cc=Stefano.Stabellini@eu.citrix.com \
    --cc=jeremy@goop.org \
    --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.