Re: [ntp:questions] NTP phase lock loop inputs and outputs?

2008-05-20 Thread David Woolley
Unruh wrote:

 I do not understand this. You seem to be measuring the offsets, not the
 frequencies. The offset is irrelevant. What you want to do is to measure

Measuring phase error to control frequency is pretty much THE standard 
way of doing it in modern electronics.  It's called a phase locked loop 
(PLL) and it is getting difficult to find any piece of electrnics that 
doesn't include one these days.  E.g. the typical digitally tuned radio 
or TV has a crystal oscillator, which is divided down to the channel 
spacing or a sub-multiple, and a configurable divider on the local 
oscillator divides that down to the same frequency.  The resulting two 
signals are then phase locked, by measuring the phase error on each 
cycle, low pass filtering it, and using it to control the local 
oscillator frequency, resulting in their matching in frequency, and 
having some constant phase error.

 the offset twice, and ask if the difference is constant or not. Ie, th
 eoffset does not correspond to being off by 5Hz. 

ntpd only uses this method on a cold start, to get the initial coarse 
calibration.  Typical electronic implementations don't use it at all, 
but either do a frequency sweep or simply open up the low pass filter, 
to get initial lock.

___
questions mailing list
questions@lists.ntp.org
https://lists.ntp.org/mailman/listinfo/questions


Re: [ntp:questions] Power-saving patch to NTP

2008-05-20 Thread Martin Burnicki
Uwe Klein wrote:
 Martin Burnicki wrote:
 Agreed. However, you can at least configure the dynamic interface scan
 interval using the -U parameter, so you can decide if you prefer short
 response times or a longer response time with maybe decreased power
 requirements.
 push a trigger for this into ntpdc?

I think that would be an ugly workaround. The proper solution would be to
use the mechanisms which are available for such purposes.

[...]
 A question:
 what would happen if one throws out binding to select interfaces and
 instead pushes this out to the firewall/ip-tables infrastructure?

I don't know whether this would be possible, and if it would make sense.

AFAIK ntpd has to manage the binding to interfaces at least if autokey is
enabled since the signature hash also includes the IP address of the
interface via which a packet is sent.

Martin
-- 
Martin Burnicki

Meinberg Funkuhren
Bad Pyrmont
Germany

___
questions mailing list
questions@lists.ntp.org
https://lists.ntp.org/mailman/listinfo/questions


Re: [ntp:questions] NTP phase lock loop inputs and outputs?

2008-05-20 Thread Unruh
David Woolley [EMAIL PROTECTED] writes:

Unruh wrote:

 I do not understand this. You seem to be measuring the offsets, not the
 frequencies. The offset is irrelevant. What you want to do is to measure

Measuring phase error to control frequency is pretty much THE standard 
way of doing it in modern electronics.  It's called a phase locked loop 

Sure. In the case of ntp you want to have zero phase error. ntp reduces the
phase error slowly by changing the frequency. This has the advantage that
the frequency error also gets reduced (slowly). He wants to reduce the
frequency error only. He does not give a damn about the phase error
apparently. Thus you do NOT want to reduce the frequecy error by attacking
the phase error. That is a slow way of doing it. You want to estimate the
frequency error directly. Now in his case he is doing so by measuring the
phase, so you need at least two phase measurements to estimate the
frequency error. But you do NOT want to reduce the frequency error by
reducing the phase error-- far too slow. 

One way of reducing the frequency error is to use the ntp procedure but
applied to the frequency. But you must feed in an estimate of the frequecy
error. Anothr way is the chrony technique. -- collect phase points, do a
least squares fit to find the frequency, and then use that information to
drive the frequecy to zero. To reuse past data, also correct the prior
phase measurements by the change in frequency.
 (t_{i-j}-=(t_{i}-t_{i-j}) df

(PLL) and it is getting difficult to find any piece of electrnics that 
doesn't include one these days.  E.g. the typical digitally tuned radio 

A PLL is a dirt simply thing to impliment electronically. A few resistors
and capacitors. It however is a very simply Markovian process. There is far
more information in the data than that, and digititally it is easy to
impliment far more complex feedback loops than that.


or TV has a crystal oscillator, which is divided down to the channel 
spacing or a sub-multiple, and a configurable divider on the local 
oscillator divides that down to the same frequency.  The resulting two 
signals are then phase locked, by measuring the phase error on each 
cycle, low pass filtering it, and using it to control the local 
oscillator frequency, resulting in their matching in frequency, and 
having some constant phase error.

 the offset twice, and ask if the difference is constant or not. Ie, th
 eoffset does not correspond to being off by 5Hz. 

ntpd only uses this method on a cold start, to get the initial coarse 
calibration.  Typical electronic implementations don't use it at all, 
but either do a frequency sweep or simply open up the low pass filter, 
to get initial lock.

And? You are claiming that that is efficient or easy? I would claim the
latter. And his requirements are NOT ntp's requirements. He does not care
about the phase errors. He is onlyconcerned about the frequency errors.
driving the frequency errors to zero by driving the phase errors to zero is
not a very efficient technique-- unless of course you want the phase errors
to be zero( as ntp does, and he does not). 




___
questions mailing list
questions@lists.ntp.org
https://lists.ntp.org/mailman/listinfo/questions


Re: [ntp:questions] Power-saving patch to NTP

2008-05-20 Thread Garrett Wollman
In article [EMAIL PROTECTED],
Martin Burnicki  [EMAIL PROTECTED] wrote:

AFAIK ntpd has to manage the binding to interfaces at least if autokey is
enabled since the signature hash also includes the IP address of the
interface via which a packet is sent.

At least some operating systems (don't know about Linux) allow this to
be controlled using a control message.  For example, from the FreeBSD
6.3 ip(4) manual page:

 The source address to be used for outgoing UDP datagrams on a socket that
 is not bound to a specific IP address can be specified as ancillary data
 with a type code of IP_SENDSRCADDR.  The msg_control field in the msghdr
 structure should point to a buffer that contains a cmsghdr structure fol-
 lowed by the IP address.  The cmsghdr fields should have the following
 values:

 cmsg_len = sizeof(struct in_addr)
 cmsg_level = IPPROTO_IP
 cmsg_type = IP_SENDSRCADDR

 For convenience, IP_SENDSRCADDR is defined to have the same value as
 IP_RECVDSTADDR, so the IP_RECVDSTADDR control message from recvmsg(2) can
 be used directly as a control message for sendmsg(2).

The IPV6_PKTINFO message is used for analogous functions in IPv6.

-GAWollman
-- 
Garrett A. Wollman   | The real tragedy of human existence is not that we are
[EMAIL PROTECTED]| nasty by nature, but that a cruel structural asymmetry
Opinions not those   | grants to rare events of meanness such power to shape
of MIT or CSAIL. | our history. - S.J. Gould, Ten Thousand Acts of Kindness

___
questions mailing list
questions@lists.ntp.org
https://lists.ntp.org/mailman/listinfo/questions


Re: [ntp:questions] NTP phase lock loop inputs and outputs?

2008-05-20 Thread David L. Mills
Bill,

If you need only the frequency, least-squares doesn't help a lot; all 
you need are the first and last points during the measurement interval. 
The NIST LOCKCLOCK and nptd FLL disciplines compute the frequency 
directly and exponentially average successive intervals. The NTP 
discipline is in fact a hybrid PLL/FLL where the PLL dominates below the 
Allan intercept and FLL above it and also when started without a 
frequency file. The trick is to separate the phase component from the 
frequency component, which requires some delicate computations. This 
allows the frequency to be accurately computed as above, yet allows a 
phase correction during the measurement interval.

Dave

Unruh wrote:
 David Woolley [EMAIL PROTECTED] writes:
 
 
Unruh wrote:
 
 
I do not understand this. You seem to be measuring the offsets, not the
frequencies. The offset is irrelevant. What you want to do is to measure
 
 
Measuring phase error to control frequency is pretty much THE standard 
way of doing it in modern electronics.  It's called a phase locked loop 
 
 
 Sure. In the case of ntp you want to have zero phase error. ntp reduces the
 phase error slowly by changing the frequency. This has the advantage that
 the frequency error also gets reduced (slowly). He wants to reduce the
 frequency error only. He does not give a damn about the phase error
 apparently. Thus you do NOT want to reduce the frequecy error by attacking
 the phase error. That is a slow way of doing it. You want to estimate the
 frequency error directly. Now in his case he is doing so by measuring the
 phase, so you need at least two phase measurements to estimate the
 frequency error. But you do NOT want to reduce the frequency error by
 reducing the phase error-- far too slow. 
 
 One way of reducing the frequency error is to use the ntp procedure but
 applied to the frequency. But you must feed in an estimate of the frequecy
 error. Anothr way is the chrony technique. -- collect phase points, do a
 least squares fit to find the frequency, and then use that information to
 drive the frequecy to zero. To reuse past data, also correct the prior
 phase measurements by the change in frequency.
  (t_{i-j}-=(t_{i}-t_{i-j}) df
 
 
(PLL) and it is getting difficult to find any piece of electrnics that 
doesn't include one these days.  E.g. the typical digitally tuned radio 
 
 
 A PLL is a dirt simply thing to impliment electronically. A few resistors
 and capacitors. It however is a very simply Markovian process. There is far
 more information in the data than that, and digititally it is easy to
 impliment far more complex feedback loops than that.
 
 
 
or TV has a crystal oscillator, which is divided down to the channel 
spacing or a sub-multiple, and a configurable divider on the local 
oscillator divides that down to the same frequency.  The resulting two 
signals are then phase locked, by measuring the phase error on each 
cycle, low pass filtering it, and using it to control the local 
oscillator frequency, resulting in their matching in frequency, and 
having some constant phase error.
 
 
the offset twice, and ask if the difference is constant or not. Ie, th
eoffset does not correspond to being off by 5Hz. 
 
 
ntpd only uses this method on a cold start, to get the initial coarse 
calibration.  Typical electronic implementations don't use it at all, 
but either do a frequency sweep or simply open up the low pass filter, 
to get initial lock.
 
 
 And? You are claiming that that is efficient or easy? I would claim the
 latter. And his requirements are NOT ntp's requirements. He does not care
 about the phase errors. He is onlyconcerned about the frequency errors.
 driving the frequency errors to zero by driving the phase errors to zero is
 not a very efficient technique-- unless of course you want the phase errors
 to be zero( as ntp does, and he does not). 
 
 
 
 

___
questions mailing list
questions@lists.ntp.org
https://lists.ntp.org/mailman/listinfo/questions


Re: [ntp:questions] Power-saving patch to NTP

2008-05-20 Thread David Woolley
Uwe Klein wrote:
 David Woolley wrote:
 Evandro Menezes wrote:

 HLT instructions are a complete red herring here. They've been available 
 Modern CPUs, chipsets and OSes have a wide range of features to manage

I'm aware of that.

 power _and_ these are heavily used on any platform, be it PDA, Laptop, 
 embedded
 device .. or Numbercrunching Cluster.

My argument is that these aren't or shouldn't be important for servers.

 The current trend seems to be dedicated boxes
 or myriads of VM-boxes on a mainframe which depends heavily
 on a VM-box being suspended when it is idle.

That only requires the 1970s (or earlier) HLT technology and 
multi-tasking friendly applications; generally Unix applications are 
friendly but some Windows applications, particularly from five or more 
years ago, aren't (although they tend to be desk top ones).

 I haven't looked into how the VM people handle timekeeping though.

A typical solution is to run ntpd on the host system and run some code 
that is virtualisation aware and can peek at the host system, to, in 
some proprietary way, align the virtual software clock with the host 
software clock.  Trying to run time synchronisation directly on the 
guest is a recipe for disaster.

One impact of virtualisation is that the virtual machines cannot 
coordinate their timer interrupts unless they include extensive 
virtualisation aware code.  My impression is that the VMWare code 
doesn't go anything like that far.

Also, as I understand it, enterprise (i.e. expensive) virtualisation 
software can move running guests between hosts, so, whilst that would be 
rather bad for timing critical applications, one imagines the best power 
management strategy is to concentrate the active systems on a few hosts 
and completely power down any others.

___
questions mailing list
questions@lists.ntp.org
https://lists.ntp.org/mailman/listinfo/questions