All of lore.kernel.org
 help / color / mirror / Atom feed
From: Keir Fraser <keir.fraser@eu.citrix.com>
To: "dan.magenheimer@oracle.com" <dan.magenheimer@oracle.com>,
	"Xen-Devel (E-mail)" <xen-devel@lists.xensource.com>
Cc: Ian Pratt <Ian.Pratt@eu.citrix.com>,
	Dave Winchell <dwinchell@virtualiron.com>
Subject: Re: [PATCH] rendezvous-based local time calibration WOW!
Date: Mon, 04 Aug 2008 20:47:09 +0100	[thread overview]
Message-ID: <C4BD1B4D.1BCBE%keir.fraser@eu.citrix.com> (raw)
In-Reply-To: <20080804134006640.00000008444@djm-pc>

Thanks, Dan! Of course, there are new features since 3.2 that I did not
include in by version-number-change announcement email. I'll make a suitably
updated list for the actual 4.0 release announcement.

 -- Keir

On 4/8/08 20:40, "Dan Magenheimer" <dan.magenheimer@oracle.com> wrote:

> After two hours of constant samples with c/s 18229, max
> skew is at 251ns!  That's 70-150x better than I was
> measuring just a couple of weeks ago.  YMMV of course.
> 
> If you are looking for another marketing-speak bullet for
> the 4.0 release announcement, you can call this:
> 
> * Greatly improved precision for time-sensitive SMP VMs
> 
> or as I am subject to American hyperbole:
> 
> * Dramatically improved precision for time-sensitive SMP VMs
> 
> Thanks again!
> Dan
> 
>> -----Original Message-----
>> From: Dan Magenheimer [mailto:dan.magenheimer@oracle.com]
>> Sent: Monday, August 04, 2008 11:37 AM
>> To: 'Keir Fraser'; 'Xen-Devel (E-mail)'
>> Cc: 'Ian Pratt'; 'Dave Winchell'
>> Subject: RE: [PATCH] rendezvous-based local time calibration WOW!
>> 
>> 
>> Looks good to me (and much cleaner).  I've booted it and
>> will leave it running for a few hours.
>> 
>> Thanks!
>> Dan
>> 
>>> -----Original Message-----
>>> From: Keir Fraser [mailto:keir.fraser@eu.citrix.com]
>>> Sent: Monday, August 04, 2008 11:10 AM
>>> To: dan.magenheimer@oracle.com; Xen-Devel (E-mail)
>>> Cc: Ian Pratt; Dave Winchell
>>> Subject: Re: [PATCH] rendezvous-based local time calibration WOW!
>>> 
>>> 
>>> Applied as c/s 18229. I rewrote it quite a bit, although
>> the principle
>>> remains the same.
>>> 
>>>  -- Keir
>>> 
>>> On 4/8/08 16:24, "Dan Magenheimer"
>> <dan.magenheimer@oracle.com> wrote:
>>> 
>>>> OK, how about this version.  The rendezvous only collects
>>>> the key per-cpu time data then sets up a per-cpu 1ms timer
>>>> to later update the timestamp record and vcpu system time,
>>>> so neither should have racing issues.
>>>> 
>>>> I've only run it for about an hour but still haven't seen
>>>> any skew over 600nsec so apparently it is the collection of
>>>> the key time data that must be closely synchronized (probably
>>>> to ensure the slope is correct) while exact synchronization
>>>> of setting the timestamp records is less important.
>>>> 
>>>> Note that I'm not positive I got the clocksource=tsc part
>>>> correct... but am interested in your opinion on whether
>>>> clocksource=tsc can now be eliminated anyway (as the
>>>> main reason I pushed for it was because of unacceptable
>>>> skew which with this patch appears to be fixed).
>>>> 
>>>> Signed-off-by: Dan Magenheimer <dan.magenheimer@oracle.com>
>>>> 
>>>>> -----Original Message-----
>>>>> From: Keir Fraser [mailto:keir.fraser@eu.citrix.com]
>>>>> Sent: Sunday, August 03, 2008 11:25 AM
>>>>> To: dan.magenheimer@oracle.com; Xen-Devel (E-mail)
>>>>> Cc: Ian Pratt; Dave Winchell
>>>>> Subject: Re: [PATCH] rendezvous-based local time calibration WOW!
>>>>> 
>>>>> 
>>>>> It's not safe to poke a new timestamp record from an
>>> interrupt handler
>>>>> (which is what the smp_call_function() callback functions
>>>>> are). Users of the
>>>>> timestamp records (e.g., get_s_time) need
>>>>> local_irq_save/restore() or an
>>>>> equivalent of the Linux seqlock. The latter is likely faster.
>>>>> I'm dubious
>>>>> about update_vcpu_system_time() from an interrupt handler
>>>>> too. It needs
>>>>> thought about how it might race with a context switch (change
>>>>> of 'current')
>>>>> or if it interrupts an existing invocation of
>>>>> update_vcpu_system_time().
>>>>> 
>>>>>  -- Keir
>>>>> 
>>>>> On 3/8/08 17:50, "Dan Magenheimer"
>>> <dan.magenheimer@oracle.com> wrote:
>>>>> 
>>>>>> The synchronization of local_time_calibration (l_t_c) via
>>>>>> round-to-nearest-epoch provided some improvement, but I was
>>>>>> still seeing skew up to 16usec and higher.  I measured the
>>>>>> temporal distance between the rounded-epoch vs when ltc
>>>>>> was actually running to ensure there wasn't some kind of
>>>>>> bug and found that l_t_c was running up to 150us after the
>>>>>> round-epoch and sometimes up to 50us before.  I guess this
>>>>>> is the granularity of setting a Xen timer.  While it seemed
>>>>>> that +/- 100us shouldn't cause that much skew, I finally
>>>>>> decided to try synchronization-via-rendezvous, as suggested
>>>>>> by Ian here:
>>>>>> 
>>>>>> 
>>>>> http://lists.xensource.com/archives/html/xen-devel/2008-07/msg
>>>> 01074.html
>>>>> 
>> http://lists.xensource.com/archives/html/xen-devel/2008-07/msg
> 01080.html
>>> 
>>> The result is phenomenal... using this approach (in attached
>>> patch), I have yet to see a skew exceed 1usec!!!  So this is
>>> about a 10-fold increase in accuracy vs the rounded-epoch
>>> method and about 20-fold over the one-epoch-from-NOW() method.
>>> 
>>> The platform time is now read once for all processors rather
>>> than once per processor.  (Actually, it is read once again
>>> in platform_time_calibration()... by "inlining" that routine
>>> into master_local_time_calibration() that extra read can
>>> be -- and probably should be -- avoided too.)
>>> 
>>> It may be too late to get this into 3.3.0 but, if so, please
>>> consider it asap for 3.3.1 rather than just xen-unstable/3.4.
>>> 
>>> Dan
>>> 
>>> ===================================
>>> Thanks... for the memory
>>> I really could use more / My throughput's on the floor
>>> The balloon is flat / My swap disk's fat / I've OOM's in store
>>> Overcommitted so much
>>> (with apologies to the late great Bob Hope)
>> 
>> 
> 
> 
> 

  reply	other threads:[~2008-08-04 19:47 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-03 16:50 [PATCH] rendezvous-based local time calibration WOW! Dan Magenheimer
2008-08-03 17:24 ` Keir Fraser
2008-08-04 15:24   ` Dan Magenheimer
2008-08-04 15:36     ` Keir Fraser
2008-08-04 17:10     ` Keir Fraser
2008-08-04 17:37       ` Dan Magenheimer
2008-08-04 19:40         ` Dan Magenheimer
2008-08-04 19:47           ` Keir Fraser [this message]
2008-08-05 18:56           ` John Levon
2008-08-05 20:49             ` Dan Magenheimer
2008-08-05 21:12               ` John Levon
2008-08-05 21:27                 ` Dan Magenheimer
2008-08-05 21:43                   ` Keir Fraser
2008-08-06 13:25                 ` Dan Magenheimer
2008-08-06 13:38                   ` John Levon
2008-08-06 15:09                     ` Dan Magenheimer
2008-08-06 15:21                       ` John Levon
2008-08-06 15:34                         ` Dan Magenheimer
2008-08-09 14:47                         ` Nils Nieuwejaar
2008-08-09 20:55                           ` Dan Magenheimer
2008-08-11 14:37                             ` John Levon
2008-08-11 14:38                               ` Keir Fraser
2008-08-11 14:43                                 ` John Levon
2008-08-11 14:46                                   ` Keir Fraser
2008-08-11 14:49                                     ` John Levon
2008-08-11 14:50                                       ` Keir Fraser
2008-08-11 18:41                                         ` John Levon

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=C4BD1B4D.1BCBE%keir.fraser@eu.citrix.com \
    --to=keir.fraser@eu.citrix.com \
    --cc=Ian.Pratt@eu.citrix.com \
    --cc=dan.magenheimer@oracle.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.