<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/kernel/time/ntp.c, branch v2.6.27.59</title>
<subtitle>Linux kernel source tree</subtitle>
<id>https://git.amat.us/linux/atom/kernel/time/ntp.c?h=v2.6.27.59</id>
<link rel='self' href='https://git.amat.us/linux/atom/kernel/time/ntp.c?h=v2.6.27.59'/>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/'/>
<updated>2008-09-06T13:31:48Z</updated>
<entry>
<title>ntp: fix calculation of the next jiffie to trigger RTC sync</title>
<updated>2008-09-06T13:31:48Z</updated>
<author>
<name>Maciej W. Rozycki</name>
<email>macro@linux-mips.org</email>
</author>
<published>2008-09-05T21:05:31Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=4ff4b9e19a80b73959ebeb28d1df40176686f0a8'/>
<id>urn:sha1:4ff4b9e19a80b73959ebeb28d1df40176686f0a8</id>
<content type='text'>
We have a bug in the calculation of the next jiffie to trigger the RTC
synchronisation.  The aim here is to run sync_cmos_clock() as close as
possible to the middle of a second.  Which means we want this function to
be called less than or equal to half a jiffie away from when now.tv_nsec
equals 5e8 (500000000).

If this is not the case for a given call to the function, for this purpose
instead of updating the RTC we calculate the offset in nanoseconds to the
next point in time where now.tv_nsec will be equal 5e8.  The calculated
offset is then converted to jiffies as these are the unit used by the
timer.

Hovewer timespec_to_jiffies() used here uses a ceil()-type rounding mode,
where the resulting value is rounded up.  As a result the range of
now.tv_nsec when the timer will trigger is from 5e8 to 5e8 + TICK_NSEC
rather than the desired 5e8 - TICK_NSEC / 2 to 5e8 + TICK_NSEC / 2.

As a result if for example sync_cmos_clock() happens to be called at the
time when now.tv_nsec is between 5e8 + TICK_NSEC / 2 and 5e8 to 5e8 +
TICK_NSEC, it will simply be rescheduled HZ jiffies later, falling in the
same range of now.tv_nsec again.  Similarly for cases offsetted by an
integer multiple of TICK_NSEC.

This change addresses the problem by subtracting TICK_NSEC / 2 from the
nanosecond offset to the next point in time where now.tv_nsec will be
equal 5e8, effectively shifting the following rounding in
timespec_to_jiffies() so that it produces a rounded-to-nearest result.

Signed-off-by: Maciej W. Rozycki &lt;macro@linux-mips.org&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
</content>
</entry>
<entry>
<title>ntp: handle leap second via timer</title>
<updated>2008-05-01T15:03:59Z</updated>
<author>
<name>Roman Zippel</name>
<email>zippel@linux-m68k.org</email>
</author>
<published>2008-05-01T11:34:41Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=7dffa3c673fbcf835cd7be80bb4aec8ad3f51168'/>
<id>urn:sha1:7dffa3c673fbcf835cd7be80bb4aec8ad3f51168</id>
<content type='text'>
Remove the leap second handling from second_overflow(), which doesn't have to
check for it every second anymore.  With CONFIG_NO_HZ this also makes sure the
leap second is handled close to the full second.  Additionally this makes it
possible to abort a leap second properly by resetting the STA_INS/STA_DEL
status bits.

Signed-off-by: Roman Zippel &lt;zippel@linux-m68k.org&gt;
Cc: john stultz &lt;johnstul@us.ibm.com&gt;
Cc: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>ntp: remove current_tick_length()</title>
<updated>2008-05-01T15:03:59Z</updated>
<author>
<name>Roman Zippel</name>
<email>zippel@linux-m68k.org</email>
</author>
<published>2008-05-01T11:34:39Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=8383c42399f394a89bd6c2f03632c53689bdde7a'/>
<id>urn:sha1:8383c42399f394a89bd6c2f03632c53689bdde7a</id>
<content type='text'>
current_tick_length used to do a little more, but now it just returns
tick_length, which we can also access directly at the few places, where it's
needed.

Signed-off-by: Roman Zippel &lt;zippel@linux-m68k.org&gt;
Cc: john stultz &lt;johnstul@us.ibm.com&gt;
Cc: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>ntp: rename TICK_LENGTH_SHIFT to NTP_SCALE_SHIFT</title>
<updated>2008-05-01T15:03:59Z</updated>
<author>
<name>Roman Zippel</name>
<email>zippel@linux-m68k.org</email>
</author>
<published>2008-05-01T11:34:38Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=7fc5c78409479d826341b103bdf734cb4fb02436'/>
<id>urn:sha1:7fc5c78409479d826341b103bdf734cb4fb02436</id>
<content type='text'>
As TICK_LENGTH_SHIFT is used for more than just the tick length, the name
isn't quite approriate anymore, so this renames it to NTP_SCALE_SHIFT.

Signed-off-by: Roman Zippel &lt;zippel@linux-m68k.org&gt;
Cc: john stultz &lt;johnstul@us.ibm.com&gt;
Cc: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>ntp: support for TAI</title>
<updated>2008-05-01T15:03:59Z</updated>
<author>
<name>Roman Zippel</name>
<email>zippel@linux-m68k.org</email>
</author>
<published>2008-05-01T11:34:37Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=153b5d054ac2d98ea0d86504884326b6777f683d'/>
<id>urn:sha1:153b5d054ac2d98ea0d86504884326b6777f683d</id>
<content type='text'>
This adds support for setting the TAI value (International Atomic Time).  The
value is reported back to userspace via timex (as we don't have a
ntp_gettime() syscall).

Signed-off-by: Roman Zippel &lt;zippel@linux-m68k.org&gt;
Cc: john stultz &lt;johnstul@us.ibm.com&gt;
Cc: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>ntp: increase time_offset resolution</title>
<updated>2008-05-01T15:03:58Z</updated>
<author>
<name>Roman Zippel</name>
<email>zippel@linux-m68k.org</email>
</author>
<published>2008-05-01T11:34:36Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=9f14f669d18477fe3df071e2fa4da36c00acee8e'/>
<id>urn:sha1:9f14f669d18477fe3df071e2fa4da36c00acee8e</id>
<content type='text'>
time_offset is already a 64bit value but its resolution barely used, so this
makes better use of it by replacing SHIFT_UPDATE with TICK_LENGTH_SHIFT.

Side note: the SHIFT_HZ in SHIFT_UPDATE was incorrect for CONFIG_NO_HZ and the
primary reason for changing time_offset to 64bit to avoid the overflow.

Signed-off-by: Roman Zippel &lt;zippel@linux-m68k.org&gt;
Cc: john stultz &lt;johnstul@us.ibm.com&gt;
Cc: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>ntp: increase time_freq resolution</title>
<updated>2008-05-01T15:03:58Z</updated>
<author>
<name>Roman Zippel</name>
<email>zippel@linux-m68k.org</email>
</author>
<published>2008-05-01T11:34:34Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=074b3b87941c99bc0ce35385b5817924b1ed0c23'/>
<id>urn:sha1:074b3b87941c99bc0ce35385b5817924b1ed0c23</id>
<content type='text'>
This changes time_freq to a 64bit value and makes it static (the only outside
user had no real need to modify it).  Intermediate values were already 64bit,
so the change isn't that big, but it saves a little in shifts by replacing
SHIFT_NSEC with TICK_LENGTH_SHIFT.  PPM_SCALE is then used to convert between
user space and kernel space representation.

Signed-off-by: Roman Zippel &lt;zippel@linux-m68k.org&gt;
Cc: john stultz &lt;johnstul@us.ibm.com&gt;
Cc: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>ntp: NTP4 user space bits update</title>
<updated>2008-05-01T15:03:58Z</updated>
<author>
<name>Roman Zippel</name>
<email>zippel@linux-m68k.org</email>
</author>
<published>2008-05-01T11:34:33Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=eea83d896e318bda54be2d2770d2c5d6668d11db'/>
<id>urn:sha1:eea83d896e318bda54be2d2770d2c5d6668d11db</id>
<content type='text'>
This adds a few more things from the ntp nanokernel related to user space.
It's now possible to select the resolution used of some values via STA_NANO
and the kernel reports in which mode it works (pll/fll).

If some values for adjtimex() are outside the acceptable range, they are now
simply normalized instead of letting the syscall fail.  I removed
MOD_CLKA/MOD_CLKB as the mapping didn't really makes any sense, the kernel
doesn't support setting the clock.

Signed-off-by: Roman Zippel &lt;zippel@linux-m68k.org&gt;
Cc: john stultz &lt;johnstul@us.ibm.com&gt;
Cc: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>ntp: cleanup ntp.c</title>
<updated>2008-05-01T15:03:58Z</updated>
<author>
<name>Roman Zippel</name>
<email>zippel@linux-m68k.org</email>
</author>
<published>2008-05-01T11:34:32Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=ee9851b218b8bafa22942b5404505ff3d2d34324'/>
<id>urn:sha1:ee9851b218b8bafa22942b5404505ff3d2d34324</id>
<content type='text'>
This is mostly a style cleanup of ntp.c and extracts part of do_adjtimex as
ntp_update_offset().  Otherwise the functionality is still the same as before.

Signed-off-by: Roman Zippel &lt;zippel@linux-m68k.org&gt;
Cc: john stultz &lt;johnstul@us.ibm.com&gt;
Cc: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>remove div_long_long_rem</title>
<updated>2008-05-01T15:03:58Z</updated>
<author>
<name>Roman Zippel</name>
<email>zippel@linux-m68k.org</email>
</author>
<published>2008-05-01T11:34:31Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=f8bd2258e2d520dff28c855658bd24bdafb5102d'/>
<id>urn:sha1:f8bd2258e2d520dff28c855658bd24bdafb5102d</id>
<content type='text'>
x86 is the only arch right now, which provides an optimized for
div_long_long_rem and it has the downside that one has to be very careful that
the divide doesn't overflow.

The API is a little akward, as the arguments for the unsigned divide are
signed.  The signed version also doesn't handle a negative divisor and
produces worse code on 64bit archs.

There is little incentive to keep this API alive, so this converts the few
users to the new API.

Signed-off-by: Roman Zippel &lt;zippel@linux-m68k.org&gt;
Cc: Ralf Baechle &lt;ralf@linux-mips.org&gt;
Cc: Ingo Molnar &lt;mingo@elte.hu&gt;
Cc: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Cc: john stultz &lt;johnstul@us.ibm.com&gt;
Cc: Christoph Lameter &lt;clameter@sgi.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
</feed>
