The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: linux@horizon.com
To: linux@horizon.com, zippel@linux-m68k.org
Cc: johnstul@us.ibm.com, linux-kernel@vger.kernel.org
Subject: Re: 2.6.19-rc2 and very unstable NTP
Date: 27 Oct 2006 07:30:49 -0400	[thread overview]
Message-ID: <20061027113049.7236.qmail@science.horizon.com> (raw)
In-Reply-To: <Pine.LNX.4.64.0610271250490.6761@scrub.home>

> To analyze the kernel behaviour I would at least need the information fed 
> to the kernel, e.g. by tracing the ntp daemon via "TZ=utc strace -f -tt 
> -e trace=adjtimex -o ntpd.trace ..." and the ntp peer logs of same time 
> period. Kernel boot messages and config might help as well.

Actually, I just found it!  It's kind of a combination bug.

I had hacked NTP_MINPOLL to 2 in the ntpd source, and was using that
value on the pps source.  But ntpd would copy that value, minus 4,
into ntv.constant (and set ADJ_TIMECONST), and adjtimex() would complain
and return EINVAL.

It wouldn't accept the passed-in values, but would still fill in the
structure with the current values.

But ntpd didn't notice or log this error, and would log the *returned*
consstant.  Which was oddly dissociated from the expected one.

The failure to check the return code is an ntpd bug.


Now, in the kernel, I wonder what the allowed range should properly be.

I notice that on the input side, you have
	time_constant = min(txc->constant + 4, (long)MAXTC);
but on the output side, it's
	txc->constant      = time_constant;

This is clearly inconsistent and wrong, but which side should be fixed
is an interesting question I haven't got an answer to yet.

For now, I've just hacked the kernel to allow values of time_constant
down to 0 (txc->constant >= -4), as nothing will break with that
value.  (The only complicated one is ntp.c:296, and SHIFT_PLL is 4,
while SHIFT_NSEC is 12, so it all works.)

(Also, is MAXTC high enough for ntpv4?  I think it's in "-4" space,
so it should be time_constant = min(txc->constant, (long)MAXTC) + 4;)


That was an interesting piece of debugging... I was all over the map
before finding it.  And your suggestion of "strace -e adjtimex" was
indeed exactly what found it in the end.

So thanks!

      reply	other threads:[~2006-10-27 11:30 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-26  9:24 2.6.19-rc2 and very unstable NTP linux
2006-10-26  9:45 ` Roman Zippel
2006-10-26 10:00   ` linux
2006-10-26 10:22     ` Roman Zippel
2006-10-26 12:30       ` linux
2006-10-26 13:01         ` Roman Zippel
2006-10-26 21:59         ` john stultz
2006-10-26 23:06           ` Roman Zippel
2006-10-27  9:15             ` linux
2006-10-27 10:58               ` Roman Zippel
2006-10-27 11:30                 ` linux [this message]

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=20061027113049.7236.qmail@science.horizon.com \
    --to=linux@horizon.com \
    --cc=johnstul@us.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=zippel@linux-m68k.org \
    /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