All of lore.kernel.org
 help / color / mirror / Atom feed
* System time monotonicity
@ 2007-03-26 18:23 John Levon
  2007-03-26 18:47 ` Keir Fraser
  2007-03-26 18:50 ` Ian Pratt
  0 siblings, 2 replies; 36+ messages in thread
From: John Levon @ 2007-03-26 18:23 UTC (permalink / raw)
  To: xen-devel


It seems that VCPU system time isn't monotonic (using 3.0.4). It seems
it might be correlated to when a VCPU is switched across real CPUs but I
haven't conclusively proved that. But e.g.:

    {
        old = {
            time = {
                version = 0x4ec
                pad0 = 0xe8e0
                tsc_timestamp = 0x22cc8398b7194
                system_time = 0xe8e0345d8805
                tsc_to_system_mul = 0xd62c0083
                tsc_shift = '\377'
                pad1 = [ '\002', '\027', '\365' ]
            }
            result = 0xe8e0484568fa
            tsc = 0x22cc86921ab00
            cpu = 0
        }
        new = {
            time = {
                version = 0x4ee
                pad0 = 0
                tsc_timestamp = 0x22cc7db96cd29
                system_time = 0xe8e00d1031f3
                tsc_to_system_mul = 0xd62ae844
                tsc_shift = '\377'
                pad1 = [ '\357', '\002', '\365' ]
            }
            result = 0xe8e048456012
            tsc = 0x22cc869225443
            cpu = 0
        }
        delta = 0xfffffffffffff718
    }

>From what I can work out, time is supposed to be monotonic but I admit I
can't really understand the time code yet at least. I couldn't find any
documentation on what to expect from system time. Any suggestions?

This seems to happen across all the hardware we've tried but this
particular case is a Sun V20Z with two CPUs:

  x86 (AuthenticAMD family 15 model 5 step 10 clock 2392 MHz)
        AMD Opteron(tm) Processor 250

cheers,
john

^ permalink raw reply	[flat|nested] 36+ messages in thread
* RE: System time monotonicity
@ 2007-04-03 14:36 Ian Pratt
  2007-04-03 14:57 ` John Levon
  0 siblings, 1 reply; 36+ messages in thread
From: Ian Pratt @ 2007-04-03 14:36 UTC (permalink / raw)
  To: John Levon, Keir Fraser; +Cc: xen-devel

> > Some instrumentation indicated that we had cross-VCPU jitter of 
> > significant deltas, ~18us at worst. Though the 
> instrumentation wasn't 
> > completely reliable so that might not be accurate.
> 
> I've done some more testing, the problem appears to be 
> significantly worse than you're claiming. I store the 
> previously read value in the thread structure and breakpoint 
> whenever it fails:

Try booting with one physical (maxcpus=1 on the xen command line) CPU
just to verify this isn't a multi-CPU issue.

If you're still seeing jitter, please post the boot logs.

We've seen this on white-box AMD systems which were over heating and the
CPU was bouncing in and out of thermal throttling, but never on a tier-1
vendor system.

You could try switching between the PIT and HPET as the calibration
source. 

Ian

^ permalink raw reply	[flat|nested] 36+ messages in thread
* RE: System time monotonicity
@ 2007-04-03 17:51 Ian Pratt
  0 siblings, 0 replies; 36+ messages in thread
From: Ian Pratt @ 2007-04-03 17:51 UTC (permalink / raw)
  To: John Levon, Ian Pratt; +Cc: xen-devel

> > Try booting with one physical (maxcpus=1 on the xen command 
> line) CPU 
> > just to verify this isn't a multi-CPU issue.
> 
> Can reproduce:
> 
> [1]> 0xfffffffed5cc0120::print kthread_t t_dhrtime 
> t_dhrtime_cpu t_dhrtime_tsc t_dhrtime_vers t_dhrtime = 
> 0x509957b7c2 t_dhrtime_cpu = 0x1 t_dhrtime_tsc = 0xf6f1529888 
> t_dhrtime_vers = 0x132
> 
> [1]> 0x509957b7c2 - 0x000000509957039e=D
>                 46116

Please can you try hitting 't' a few times on the Xen debug console
(again, maxcpus=1)

If you're seeing time jump back on a single CPU, it must mean that the
TSC ran quicker during the current period than what it was calibrated to
be running at in the last period. It's worth adding some debuging
printk's to the calibration code in Xen to see what it thinks is going
on from one calibration period to the next.

Thanks,
Ian

^ permalink raw reply	[flat|nested] 36+ messages in thread
* Re: System time monotonicity
@ 2008-04-08 16:34 Dan Magenheimer
  2008-04-08 16:42 ` Keir Fraser
  0 siblings, 1 reply; 36+ messages in thread
From: Dan Magenheimer @ 2008-04-08 16:34 UTC (permalink / raw)
  To: xen-devel@lists.xensource.com

[-- Attachment #1: Type: text/plain, Size: 1297 bytes --]

>On 26/3/07 19:50, "Ian Pratt" <Ian.Pratt@xxxxxxxxxxxx> wrote:
>
>> On your system it appears to be a couple of microseconds out, which is
>> on the high side of what we've observed. Normally you only see that kind
>> of mismatch on systems with TSCs running off different crystals.
>
> More likely a jittery chipset timer -- we've observed less-than-ideal
> stability from some chipset timers, which can throw us off a bit when
> independently sync'ing the TSCs (which each CPU does for its TSC
> independently every couple of seconds).
>
> -- Keir

Sorry, a little slow on responding here, only took a year ;-)

Where is the code that does this independent TSC sync'ing?  I see
code in smpboot.c that seems to do this at startup (though exactly
how I admit I haven't yet figured out... looks like some kind of
rendezvous loop triggered by the BP?).  But I don't see where/how
this gets called "every couple of seconds", nor do I see any writing
to the TSC (except setting BP and each AP to zero at startup).

Thanks,
Dan

===================================
If Xen could save time in a bottle / then clocks wouldn't virtually skew /
It would save every tick / for VMs that aren't quick /
and Xen then would send them anew
(with apologies to the late great Jim Croce)

[-- Attachment #2: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

^ permalink raw reply	[flat|nested] 36+ messages in thread
[parent not found: <47FFC37A.4060402@virtualiron.com>]

end of thread, other threads:[~2008-04-21 19:31 UTC | newest]

Thread overview: 36+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-03-26 18:23 System time monotonicity John Levon
2007-03-26 18:47 ` Keir Fraser
2007-03-26 20:04   ` John Levon
2007-03-27 10:47     ` Keir Fraser
2007-04-03 14:03     ` John Levon
2007-03-26 18:50 ` Ian Pratt
2007-03-26 18:59   ` Keir Fraser
2007-03-26 20:14     ` John Levon
2007-03-26 21:55       ` Ian Pratt
2007-03-27  0:27       ` Keir Fraser
  -- strict thread matches above, loose matches on Subject: below --
2007-04-03 14:36 Ian Pratt
2007-04-03 14:57 ` John Levon
2007-04-03 17:51 Ian Pratt
2008-04-08 16:34 Dan Magenheimer
2008-04-08 16:42 ` Keir Fraser
2008-04-08 17:39   ` Dan Magenheimer
2008-04-09  1:16     ` Tian, Kevin
2008-04-09  1:55       ` Dan Magenheimer
2008-04-09  3:20         ` Tian, Kevin
2008-04-09 12:42         ` Ian Pratt
2008-04-09 14:25           ` Dan Magenheimer
2008-04-09 14:41             ` Keir Fraser
2008-04-09 16:33               ` Dan Magenheimer
2008-04-09 16:40                 ` Keir Fraser
2008-04-09 18:36                   ` Dan Magenheimer
2008-04-10  7:08                     ` Keir Fraser
2008-04-10 21:27                       ` Dan Magenheimer
2008-04-11  6:48                         ` Keir Fraser
2008-04-11 22:05                           ` Dan Magenheimer
     [not found] <47FFC37A.4060402@virtualiron.com>
2008-04-11 21:20 ` Keir Fraser
2008-04-11 21:41   ` Keir Fraser
2008-04-11 22:58     ` Dave Winchell
2008-04-12  7:09       ` Keir Fraser
2008-04-21 19:26         ` Dan Magenheimer
2008-04-21 19:31           ` Keir Fraser
2008-04-11 22:22   ` Dan Magenheimer

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.