[LinuxPPS] Rodolfo's and Alexander's patches together.

Alexander Gordeev lasaine at lvk.cs.msu.su
Mon Mar 1 12:23:49 CET 2010


Hi Reg,

On Sat, 27 Feb 2010 21:42:30 -0700
clemens at dwf.com wrote:

> This weekend I spent some time and merged Rodolfo's patch of 14Feb with
> Alexander Gordeev's patch of 24Feb.
> 
> Either patch applied cleanly alone, but when you applied Rodolfo's patch
> first, and then Alexander's on top of it there were some minor things that
> needed to be fixed in Makefiles and Kconfig files.

I've already done this work for you:

http://lvk.cs.msu.su/~lasaine/timesync/linux-2.6-timesync.git
branch pps-timesync

> The two merged patches could use a bit of editorial work to 'pretty things up'
> Alexander has a 'generators' subdirectory that Rodolfo's ktimer should be
> moved down into, and the order of things that you see when doing 'make xconfig'
> from the pps directory should be changed (and perhaps some of the descriptions
> need to be changed) now that there are both serial and parallel drivers.

I don't know where ktimer should belong to. In fact it is a generator
and a client at the same time. Moreover I think that the right thing to
do is to extract the part that deals with hrtimers from pps_gen_parport
and turn it to a generic infrastructure for generators of all kind. So
that both pps_gen_parport and ktimer can use it.

> There are no configuration options for Gordeev's changes, I don't know if that 
> will remain the case.

Actually there are. At least CONFIG_PPS

> The compile of the kernel went cleanly, but ntp reported an error with kcbind.
> This took me a LONG time to run down, and in the end I was surprised to find
> the problem in timepps.h .  Rodolfo had just said 'it doesn't exist'  for 
> kcbind
> there rather than having a call to the kernel, and then code in the kernel that
> reported the same thing.  Also he did not have the necessary #define nor the
> necessary structure for kc_bind in the include files.  Mumph.
> 
> So I fixed the Makefile/Kconfig overlaps, added the #define and struct from the
> (Gordeev patch back into the user includes, and fixed up timepps.h to actually
> call the kernel.

You can get the right file from my pps-tools git repo:

http://lvk.cs.msu.su/~lasaine/timesync/pps-tools.git master

I've asked Rodolfo to pull this change so I hope it will land in
his repo soon:

git://git.enneenne.com/pps-tools

> With this everything works.
> 
> However there is one strange result.
> The time offset as seen with ntpdc/dmpeers converges to about a 43us offset, 
> and then never seems to get closer.  With the Rodolfo patch alone this error
> goes to zero.
> 
> So, there is still work to be done to understand this merging of these patches.

When you use ntpd to sync against PPS it will obviously try to remove
the error it sees. When you use kernel consumer it can't influence
anything. IMHO there is no way to determine who is right using software
only. It will be hard even with an oscilloscope.

There is also an issue with 2.6.33 kernel complied with CONFIG_NO_HZ=y:
kernel consumer sync only to about 40us precision. :( This is due to
some changes in kernel. I'm working on it.
This issue should not arise in your setup but it's better to check.

Things to try:

1. use ppstest to monitor the error when the kernel consumer is used

Please check that timestamps are getting close to xxxxxxx.000000000.
What is the average error after things stabilize? How long it takes to
stabilize?
I'll publish some tools (based on ppstest's code) that make this easier.

2. try to switch of kernel consumer and check that ntpd syncs ok to PPS
(with both patchsets applied)

3. try to compile kernel with CONFIG_NO_HZ=n if it's not already and
check 1 and 2 once more

> It is great tho, that the Gordeev patch merges nicely with Rodolfo's code, and
> wasn't a totally separate venture. I was able to use my serial PPS source, tho
> it seems that Gordeev has only used his (I believe more accurate) parallel port
> devices.
> 
> Its been an interesting weekend.

Huge thanks for your work!

-- 
  Alexander
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 489 bytes
Desc: not available
Url : http://ml.enneenne.com/pipermail/linuxpps/attachments/20100301/18858bcd/attachment.pgp 


More information about the LinuxPPS mailing list