From: john stultz on
On Thu, 2010-08-05 at 01:06 +0400, Alexander Gordeev wrote:
> This commit adds hardpps() implementation based upon the original one
> from the NTPv4 reference kernel code from David Mills. However, it is
> highly optimized towards very fast syncronization and maximum stickness
> to PPS signal. The typical error is less then a microsecond.
> To make it sync faster I had to throw away exponential phase filter so
> that the full phase offset is corrected immediately. Then I also had to
> throw away median phase filter because it gives a bigger error itself
> if used without exponential filter.
> Maybe we will find an appropriate filtering scheme in the future but
> it's not necessary if the signal quality is ok.
>
> Signed-off-by: Alexander Gordeev <lasaine(a)lvk.cs.msu.su>

[snip]

> +#ifdef CONFIG_NTP_PPS
> +
> +struct pps_normtime {
> + __kernel_time_t sec; /* seconds */
> + long nsec; /* nanoseconds */
> +};

I don't quite remember the history here (it may be I suggested you use
this instead of overloading a timespec? I honestly don't recall), but
could you add some extra context in a comment here for what a
pps_normtime structure represents and why its used instead of a
timespec? The comment below sort of hints at it, but it would be useful
if it was more explicit.

> +/* normalize the timestamp so that nsec is in the
> + ( -NSEC_PER_SEC / 2, NSEC_PER_SEC / 2 ] interval */
> +static inline struct pps_normtime pps_normalize_ts(struct timespec ts)
> +{
> + struct pps_normtime norm = {
> + .sec = ts.tv_sec,
> + .nsec = ts.tv_nsec
> + };
> +
> + if (norm.nsec > (NSEC_PER_SEC >> 1)) {
> + norm.nsec -= NSEC_PER_SEC;
> + norm.sec++;
> + }
> +
> + return norm;
> +}

Otherwise the code looks pretty good to me.

Acked-by: John Stultz <johnstul(a)us.ibm.com>

thanks
-john


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Andrew Morton on
sigh. The amount of inlining which this patch does is nutty.

But I don't think I'll bother making a fuss over it.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: David Daney on
On 08/04/2010 04:26 PM, Andrew Morton wrote:
> sigh. The amount of inlining which this patch does is nutty.

Well one could ask about the rationale behind it all and hope that it
wasn't purely gratuitous.

David Daney

>
> But I don't think I'll bother making a fuss over it.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Andrew Morton on
On Wed, 04 Aug 2010 16:39:13 -0700
David Daney <ddaney(a)caviumnetworks.com> wrote:

> On 08/04/2010 04:26 PM, Andrew Morton wrote:
> > sigh. The amount of inlining which this patch does is nutty.
>
> Well one could ask about the rationale behind it all and hope that it
> wasn't purely gratuitous.
>

Rationale needs rethinking, because removing every one of those inlines
makes no change at all to the generated code.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Alexander Gordeev on
В Wed, 04 Aug 2010 15:49:47 -0700
john stultz <johnstul(a)us.ibm.com> пишет:

> On Thu, 2010-08-05 at 01:06 +0400, Alexander Gordeev wrote:
> > This commit adds hardpps() implementation based upon the original one
> > from the NTPv4 reference kernel code from David Mills. However, it is
> > highly optimized towards very fast syncronization and maximum stickness
> > to PPS signal. The typical error is less then a microsecond.
> > To make it sync faster I had to throw away exponential phase filter so
> > that the full phase offset is corrected immediately. Then I also had to
> > throw away median phase filter because it gives a bigger error itself
> > if used without exponential filter.
> > Maybe we will find an appropriate filtering scheme in the future but
> > it's not necessary if the signal quality is ok.
> >
> > Signed-off-by: Alexander Gordeev <lasaine(a)lvk.cs.msu.su>
>
> [snip]
>
> > +#ifdef CONFIG_NTP_PPS
> > +
> > +struct pps_normtime {
> > + __kernel_time_t sec; /* seconds */
> > + long nsec; /* nanoseconds */
> > +};
>
> I don't quite remember the history here (it may be I suggested you use
> this instead of overloading a timespec? I honestly don't recall), but
> could you add some extra context in a comment here for what a
> pps_normtime structure represents and why its used instead of a
> timespec? The comment below sort of hints at it, but it would be useful
> if it was more explicit.

Yes, you asked me to do this. :)
Sure, I'll add an explicit comment.

> > +/* normalize the timestamp so that nsec is in the
> > + ( -NSEC_PER_SEC / 2, NSEC_PER_SEC / 2 ] interval */
> > +static inline struct pps_normtime pps_normalize_ts(struct timespec ts)
> > +{
> > + struct pps_normtime norm = {
> > + .sec = ts.tv_sec,
> > + .nsec = ts.tv_nsec
> > + };
> > +
> > + if (norm.nsec > (NSEC_PER_SEC >> 1)) {
> > + norm.nsec -= NSEC_PER_SEC;
> > + norm.sec++;
> > + }
> > +
> > + return norm;
> > +}
>
> Otherwise the code looks pretty good to me.
>
> Acked-by: John Stultz <johnstul(a)us.ibm.com>

Thanks!

--
Alexander