From: john stultz <johnstul@us.ibm.com>
To: Roman Zippel <zippel@linux-m68k.org>
Cc: lkml <linux-kernel@vger.kernel.org>,
Thomas Gleixner <tglx@linutronix.de>,
George Anzinger <george@mvista.com>,
Ulrich Windl <ulrich.windl@rz.uni-regensburg.de>
Subject: Re: [RFC][PATCH 2/2] Reduced NTP rework (part 2)
Date: Thu, 29 Sep 2005 12:33:42 -0700 [thread overview]
Message-ID: <1128022423.8195.302.camel@cog.beaverton.ibm.com> (raw)
In-Reply-To: <Pine.LNX.4.61.0509291658130.3728@scrub.home>
On Thu, 2005-09-29 at 20:43 +0200, Roman Zippel wrote:
> On Tue, 27 Sep 2005, john stultz wrote:
> > The idea being:
> >
> > update_wall_clock():
> > ticks = jiffies - wall_jiffies
> > while (ticks):
> > ticks--
> > xtime += tick_nsec + ntp_adjustment
> >
> >
> > isn't that different from:
> >
> > timekeeping_periodic_hook():
> > now = timesource_read(ts)
> > delta_cycle = now - last
> > while (delta_cycle > interval_cycle):
> > delta_cycle -= interval_cycle
> > system_time += interval_nsec
>
> BTW that's not what you do in the first part of the patch:
>
> +static void ntp_advance(unsigned long interval_ns)
Well, I was trying to describe what I am going to follow the NTP patches
with.
So yes, the reduced NTP rework patches are not discussed in the above
(but ntp_advance() does have a place in the above, I just left it out to
shorten the comparison), but they allow the two examples above to look
similar.
For clarity here's the ntp details included
update_wall_clock():
ticks = jiffies - wall_jiffies
while (ticks):
ticks--
xtime += tick_nsec + ntp_adjustment
ntp_advance(tick_nsec)
timekeeping_periodic_hook():
now = timesource_read(ts)
delta_cycle = now - last
while (delta_cycle > interval_cycle):
delta_cycle -= interval_cycle
system_time += interval_nsec
ntp_advance(interval_nsec)
> I'm quite sure that the interval_ns is wrong, it's important to advance
> the ntp state in constant intervals (i.e. interval_cycle). Your patch
> already includes time adjustments and e.g. the "while (interval_ns >=
> tick_nsec)" loop is not executed anymore, once time_adjust_step becomes
> negative.
Commenting the specific code would help clarify this. If I'm
understanding you, you're talking about the following logic:
static void ntp_advance(unsigned long interval_ns):
static unsigned long interval_sum;
/* increment the interval sum */
interval_sum += interval_ns
/* calculate the per tick singleshot adjtime adjustment step */
while (interval_ns >= tick_nsec):
time_adjust_step = time_adjust
if (time_adjust_step):
time_adjust_step = min(time_adjust_step, tickadj)
time_adjust_step = max(time_adjust_step, -tickadj)
time_adjust -= time_adjust_step
interval_ns -= tick_nsec
I'm not sure I understand the problem if time_adjust_step becomes
negative.
> In general I would prefer it if we could finalize the basic design first,
> before doing such changes, otherwise I'm afraid we need a cleanup of the
> cleanup.
Well, that's evolution. :) But really, the reduced ntp rework stuff
isn't a cleanup. Its just the bare minimum changes to NTP that I'm
needing for my generic timeofday code. Hopefully the reduced changes
will clarify what exactly I need (or think I need ;) from the NTP
subsystem to get my timekeeping code to function properly. Then maybe
you (or anyone else - don't let Roman have all the fun) can point to a
better way.
> > The only difference between continuous and tick based systems would then
> > be in gettimeofday() (which really could be the same with a simple
> > #define)
> >
> > continuous_gettimeofday():
> > now = timesource_read(ts)
> > delta_cycle = now - last
> > delta_nsec = cyc2ns(timesource, delta_cycle)
> > return system_time + delta_nsec
> >
> > tick_gettime():
> > now = timesource_read(jiffes_timesource)
> > delta_cycle = now - last
> > delta_nsec = cyc2ns(timesource, delta_cycle)
> > delta_nsec += arch_get_offset()
> > return system_time + delta_nsec
>
> The basic idea of gettimeofday is of course always the same: "base +
> get_offset() * mult". I can understand the temptation to unify the
> implementation, but please accept the current reality that we have
> different gettimeofday implementations (for whatever reasons), so unifying
> them would be a premature change. If the situation changes later we can
> still do that unification.
I'm sorta going at it from the other way (call me optimistic :), where
I'm trying to unify what I can until I hit the exception. Then I'll
happily break out an arch specific gettimeofday implementation.
Once again, I do appreciate your feedback. Hopefully I'll have patches
out later today for you to look at.
thanks
-john
next prev parent reply other threads:[~2005-09-29 19:34 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-09-22 19:58 [RFC][PATCH 1/2] Reduced NTP rework (part 1) john stultz
2005-09-22 19:59 ` [RFC][PATCH 2/2] Reduced NTP rework (part 2) john stultz
2005-09-27 16:37 ` Roman Zippel
2005-09-27 20:19 ` john stultz
2005-09-27 21:57 ` Thomas Gleixner
2005-09-29 18:43 ` Roman Zippel
2005-09-29 19:33 ` john stultz [this message]
2005-10-10 12:39 ` Roman Zippel
2005-10-10 20:46 ` john stultz
2005-10-04 7:58 ` Ulrich Windl
2005-10-04 18:30 ` john stultz
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=1128022423.8195.302.camel@cog.beaverton.ibm.com \
--to=johnstul@us.ibm.com \
--cc=george@mvista.com \
--cc=linux-kernel@vger.kernel.org \
--cc=tglx@linutronix.de \
--cc=ulrich.windl@rz.uni-regensburg.de \
--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
all inboxes | Powered by JetHome®