From: john stultz <johnstul@us.ibm.com>
To: Alexander Gordeev <lasaine@lvk.cs.msu.su>
Cc: linux-kernel@vger.kernel.org,
"Nikita V. Youshchenko" <yoush@cs.msu.su>,
linuxpps@ml.enneenne.com,
Rodolfo Giometti <giometti@enneenne.com>,
Andrew Morton <akpm@linux-foundation.org>,
Thomas Gleixner <tglx@linutronix.de>,
John Kacur <jkacur@redhat.com>, Ingo Molnar <mingo@elte.hu>,
Martin Schwidefsky <schwidefsky@de.ibm.com>
Subject: Re: [PATCHv3 12/16] ntp: add hardpps implementation
Date: Wed, 04 Aug 2010 15:49:47 -0700 [thread overview]
Message-ID: <1280962187.2678.14.camel@localhost.localdomain> (raw)
In-Reply-To: <358275628c418f5f328adc4a4ea23fc902776566.1280952801.git.lasaine@lvk.cs.msu.su>
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@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@us.ibm.com>
thanks
-john
next prev parent reply other threads:[~2010-08-04 22:49 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-04 21:06 [PATCHv3 00/16] pps: several fixes and improvements Alexander Gordeev
2010-08-04 21:06 ` [PATCHv3 01/16] pps: trivial fixes Alexander Gordeev
2010-08-05 8:57 ` Rodolfo Giometti
2010-08-04 21:06 ` [PATCHv3 02/16] pps: declare variables where they are used in switch Alexander Gordeev
2010-08-05 9:05 ` Rodolfo Giometti
2010-08-04 21:06 ` [PATCHv3 03/16] pps: fix race in PPS_FETCH handler Alexander Gordeev
2010-08-05 5:19 ` Vitezslav Samel
2010-08-05 10:19 ` Alexander Gordeev
2010-08-05 11:07 ` Vitezslav Samel
2010-08-05 14:31 ` Alexander Gordeev
2010-08-05 9:15 ` Rodolfo Giometti
2010-08-04 21:06 ` [PATCHv3 04/16] pps: unify timestamp gathering Alexander Gordeev
2010-08-05 9:17 ` Rodolfo Giometti
2010-08-04 21:06 ` [PATCHv3 05/16] pps: access pps device by direct pointer Alexander Gordeev
2010-08-05 9:32 ` Rodolfo Giometti
2010-08-05 11:42 ` Alexander Gordeev
2010-08-05 12:31 ` Rodolfo Giometti
2010-08-09 7:53 ` Alexander Gordeev
2010-08-09 12:47 ` Rodolfo Giometti
2010-08-04 21:06 ` [PATCHv3 06/16] pps: convert printk/pr_* to dev_* Alexander Gordeev
2010-08-04 21:06 ` [PATCHv3 07/16] pps: move idr stuff to pps.c Alexander Gordeev
2010-08-04 21:06 ` [PATCHv3 08/16] pps: add async PPS event handler Alexander Gordeev
2010-08-04 21:06 ` [PATCHv3 09/16] pps: don't disable interrupts when using spin locks Alexander Gordeev
2010-08-04 21:06 ` [PATCHv3 10/16] pps: use BUG_ON for kernel API safety checks Alexander Gordeev
2010-08-04 21:06 ` [PATCHv3 11/16] pps: simplify conditions a bit Alexander Gordeev
2010-08-04 21:06 ` [PATCHv3 12/16] ntp: add hardpps implementation Alexander Gordeev
2010-08-04 22:49 ` john stultz [this message]
2010-08-05 12:00 ` Alexander Gordeev
2010-08-04 23:26 ` Andrew Morton
2010-08-04 23:39 ` David Daney
2010-08-04 23:49 ` Andrew Morton
2010-08-04 21:06 ` [PATCHv3 13/16] pps: capture MONOTONIC_RAW timestamps as well Alexander Gordeev
2010-08-04 23:03 ` john stultz
2010-08-05 12:16 ` Alexander Gordeev
2010-08-04 23:29 ` Andrew Morton
2010-08-05 12:29 ` Alexander Gordeev
2010-08-04 21:06 ` [PATCHv3 14/16] pps: add kernel consumer support Alexander Gordeev
2010-08-04 21:06 ` [PATCHv3 15/16] pps: add parallel port PPS client Alexander Gordeev
2010-08-04 23:34 ` Andrew Morton
2010-08-05 12:48 ` Alexander Gordeev
2010-08-04 21:06 ` [PATCHv3 16/16] pps: add parallel port PPS signal generator Alexander Gordeev
2010-08-04 23:38 ` Andrew Morton
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1280962187.2678.14.camel@localhost.localdomain \
--to=johnstul@us.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=giometti@enneenne.com \
--cc=jkacur@redhat.com \
--cc=lasaine@lvk.cs.msu.su \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxpps@ml.enneenne.com \
--cc=mingo@elte.hu \
--cc=schwidefsky@de.ibm.com \
--cc=tglx@linutronix.de \
--cc=yoush@cs.msu.su \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).