On Tue, 26 Jul 2016 01:30:03 -0400
Alan Altmark <[email protected]> wrote:

> On Monday, 07/25/2016 at 11:36 GMT, WF Konynenberg <[email protected]>
> wrote:
> > Yes, when your hardware clock is not managed by NTP you cannot rely on
> it to accurately initialize
> > the system clock on boot, so you should force an NTP clock sync ("jump")
> on startup.  Otherwise the
> > NTP smooth clock adjustment could take quite a while to get the system
> clock synced.
> >
> > Once the initial sync has happened, NTP should be able to keep the clock
> within at most a few
> > milliseconds accurate, even on a VM with some scheduling artifacts.
>
> Linux on z does not alter the TOD clock after it's booted.  NTP affects
> only the offset from the TOD that the kernel maintains.  Any app that
> wants to know the time must ask the kernel.  It can't just issue STCK(E).

This is important enough to reiterate: STCK(E) will not give you the correct
system time if you are using NTP to drift the time. Use gettimeofday() to
retrieve the time, this call is optimized with a function in the VDSO.
The VDSO knows about the offset between the TOD clock and the system time
and does the necessary calculations. It is reasonable fast as no system
call is required.

> In an LPAR, Linux will sync the LPAR TOD to the CPC TOD when it boots.
> After that it depends on STP, and it really depends on having the proper
> number of leap seconds configured in the CPC and in Linux.

Only if STP is enabled. The default is off, in this case Linux just uses the
current TOD clock to initialize the system time.

> We really need CP to virtualize STP (when real STP is being used e.g. with
> NTP).  That would allow Linux to always have the correct time without
> running its own NTP client.

It would certainly improve things but for at least one aspect you still
need NTP: to inject leap seconds.

> The problem today is that VM will not generate a sync check when the
> difference between NTP and the TOD becomes large enough that it cannot be
> steered out in a short period of time, such as when the external time
> source is reconnected or when a leap second is added.

STP does not generate a sync check for leap seconds, they are not included in
the TOD clock. The programming notes in the PoP about the Time-of-Day Clock
you will find this:

"In converting to or from the current date or time, the programming support
 must take into account that leap seconds have been inserted or deleted
 because of time-correction standards. When the TOD clock has been set
 correctly to a time within the standard epoch, the sum of the accumulated
 leap seconds must be subtracted from the clock time to determine UTC time."

--
blue skies,
   Martin.

"Reality continues to ruin my life." - Calvin.

----------------------------------------------------------------------
For LINUX-390 subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390
----------------------------------------------------------------------
For more information on Linux on System z, visit
http://wiki.linuxvm.org/

Reply via email to