[LinuxPPS] delay through the irq code

James Boddington boddingt at internode.on.net
Mon Apr 14 19:31:09 CEST 2008


Rodolfo Giometti wrote:
> This is a "work-around" in order to not use serial_core code... but
> I'm not sure it could be the right solution. Maybe we can add a special
> ldisc which register/deregister the pps source and then use the trick above to
> report pps timestamps!
> 

The work around was only so I could compare the 2 time stamps. When I move to 
using only the lower level time stamp all of that work around involving a 
modified ktimer disappears.

> You got a really interesting solution! However, please, help me in not
> rewriting the code each time. You should provide a patch for each new
> functionality so I can prepare specific patches for kernel inclusion.

There was no code rewritten for submission, only some changes for my own use. 
It is some ideas I was trying with promising results. The closest it is to a 
solution is the idea of getting a time stamp early and changing pps_event() to 
use that instead of getnstimeofday() which gives a more stable time stamp that 
is less affected by system load. A lot of the rest of the changes I think of 
more as proof of concept.

I like nano offsets for the finer control. I like the smaller kernel time 
constant. At the moment I am undecided about the kernel using the pps directly, 
especially without filtering. If the pps is unfiltered performance is worse 
then if ntp is providing the offset.


> Currently the new solution could be (in this order):
> 
> 1) implementing the pps_irqs_timestamps[] array support.
> 

This is similar to something I had wondered about in do_IRQ()

	/*
		Time stamp irq that has pps enabled.
	*/
	if (pps_irqs_timestamps[irq].flag & PPS_ENABLED) {
		getnstimeofday(&pps_irqs_timestamps[irq].ts);
	}

That line of thinking is as far as I got. With some kind of flag you only spend 
time getting a time stamp for an irq that was being used as a pps source.

The problem with going this low is this is arch specific. This do_IRQ() is in 
arch/x86/kernel/irq_32.c so x86 only. Other arch would also need modifying. I 
am wondering if the time stamp will be let go this low or a bit higher up in 
some more arch neutral code.

> 2) adding a new ldisc which create the pps source according to the
> serial port configuration (irq number).

Did you get a response about the tty->ops stuff?

 > Please, do these modifications on top of the GIT repository providing
 > the new patches into this list for review.

I am using a git repository. Doing a 'git diff' for one patch of all changes is 
the limit of what I know. With git I don't know how to generate 1 little patch 
for each change.

-- 
    James



More information about the LinuxPPS mailing list