<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/kernel/time/ntp.c, branch linux-2.6.32.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-2.6.32.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-2.6.32.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2012-10-07T21:37:58Z</updated>
<entry>
<title>ntp: Fix STA_INS/DEL clearing bug</title>
<updated>2012-10-07T21:37:58Z</updated>
<author>
<name>John Stultz</name>
</author>
<published>2012-07-13T05:21:50Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=c96f4bffe5679af5b9f512f19248cd1d3a62feab'/>
<id>urn:sha1:c96f4bffe5679af5b9f512f19248cd1d3a62feab</id>
<content type='text'>
commit 6b1859dba01c7d512b72d77e3fd7da8354235189 upstream.

In commit 6b43ae8a619d17c4935c3320d2ef9e92bdeed05d, I
introduced a bug that kept the STA_INS or STA_DEL bit
from being cleared from time_status via adjtimex()
without forcing STA_PLL first.

Usually once the STA_INS is set, it isn't cleared
until the leap second is applied, so its unlikely this
affected anyone. However during testing I noticed it
took some effort to cancel a leap second once STA_INS
was set.

Signed-off-by: John Stultz &lt;johnstul@us.ibm.com&gt;
Cc: Ingo Molnar &lt;mingo@kernel.org&gt;
Cc: Peter Zijlstra &lt;a.p.zijlstra@chello.nl&gt;
Cc: Richard Cochran &lt;richardcochran@gmail.com&gt;
Cc: Prarit Bhargava &lt;prarit@redhat.com&gt;
Link: http://lkml.kernel.org/r/1342156917-25092-2-git-send-email-john.stultz@linaro.org
Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Signed-off-by: Willy Tarreau &lt;w@1wt.eu&gt;
</content>
</entry>
<entry>
<title>ntp: Fix integer overflow when setting time</title>
<updated>2012-10-07T21:37:34Z</updated>
<author>
<name>Sasha Levin</name>
</author>
<published>2012-03-15T16:36:14Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=58c37cca51fc5976dbaa7e62c18da072e7a8e622'/>
<id>urn:sha1:58c37cca51fc5976dbaa7e62c18da072e7a8e622</id>
<content type='text'>
commit a078c6d0e6288fad6d83fb6d5edd91ddb7b6ab33 upstream.

'long secs' is passed as divisor to div_s64, which accepts a 32bit
divisor. On 64bit machines that value is trimmed back from 8 bytes
back to 4, causing a divide by zero when the number is bigger than
(1 &lt;&lt; 32) - 1 and all 32 lower bits are 0.

Use div64_long() instead.

Signed-off-by: Sasha Levin &lt;levinsasha928@gmail.com&gt;
Cc: johnstul@us.ibm.com
Link: http://lkml.kernel.org/r/1331829374-31543-2-git-send-email-levinsasha928@gmail.com
Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
[WT: div64_long() does not exist on 2.6.32 and needs a deeper backport than
 desired. Instead, address the issue by controlling that the divisor is
 correct for use as an s32 divisor]
Signed-off-by: Willy Tarreau &lt;w@1wt.eu&gt;
</content>
</entry>
<entry>
<title>ntp: Correct TAI offset during leap second</title>
<updated>2012-10-07T21:37:04Z</updated>
<author>
<name>Richard Cochran</name>
</author>
<published>2012-07-17T22:05:26Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=285a7953c6c404f68af341914e90038442ebe289'/>
<id>urn:sha1:285a7953c6c404f68af341914e90038442ebe289</id>
<content type='text'>
This is a backport of dd48d708ff3e917f6d6b6c2b696c3f18c019feed

When repeating a UTC time value during a leap second (when the UTC
time should be 23:59:60), the TAI timescale should not stop. The kernel
NTP code increments the TAI offset one second too late. This patch fixes
the issue by incrementing the offset during the leap second itself.

Signed-off-by: Richard Cochran &lt;richardcochran@gmail.com&gt;
Cc: Prarit Bhargava &lt;prarit@redhat.com&gt;
Cc: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Cc: Linux Kernel &lt;linux-kernel@vger.kernel.org&gt;
Signed-off-by: John Stultz &lt;john.stultz@linaro.org&gt;
Signed-off-by: Willy Tarreau &lt;w@1wt.eu&gt;
</content>
</entry>
<entry>
<title>ntp: Fix leap-second hrtimer livelock</title>
<updated>2012-10-07T21:37:04Z</updated>
<author>
<name>John Stultz</name>
</author>
<published>2012-07-17T22:05:25Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=6a29b109b9fb4c76bf55851223ae59e3322d9616'/>
<id>urn:sha1:6a29b109b9fb4c76bf55851223ae59e3322d9616</id>
<content type='text'>
This is a backport of 6b43ae8a619d17c4935c3320d2ef9e92bdeed05d

This should have been backported when it was commited, but I
mistook the problem as requiring the ntp_lock changes
that landed in 3.4 in order for it to occur.

Unfortunately the same issue can happen (with only one cpu)
as follows:
do_adjtimex()
 write_seqlock_irq(&amp;xtime_lock);
  process_adjtimex_modes()
   process_adj_status()
    ntp_start_leap_timer()
     hrtimer_start()
      hrtimer_reprogram()
       tick_program_event()
        clockevents_program_event()
         ktime_get()
          seq = req_seqbegin(xtime_lock); [DEADLOCK]

This deadlock will no always occur, as it requires the
leap_timer to force a hrtimer_reprogram which only happens
if its set and there's no sooner timer to expire.

NOTE: This patch, being faithful to the original commit,
introduces a bug (we don't update wall_to_monotonic),
which will be resovled by backporting a following fix.

Original commit message below:

Since commit 7dffa3c673fbcf835cd7be80bb4aec8ad3f51168 the ntp
subsystem has used an hrtimer for triggering the leapsecond
adjustment. However, this can cause a potential livelock.

Thomas diagnosed this as the following pattern:
CPU 0                                                    CPU 1
do_adjtimex()
  spin_lock_irq(&amp;ntp_lock);
    process_adjtimex_modes();				 timer_interrupt()
      process_adj_status();                                do_timer()
        ntp_start_leap_timer();                             write_lock(&amp;xtime_lock);
          hrtimer_start();                                  update_wall_time();
             hrtimer_reprogram();                            ntp_tick_length()
               tick_program_event()                            spin_lock(&amp;ntp_lock);
                 clockevents_program_event()
		   ktime_get()
                     seq = req_seqbegin(xtime_lock);

This patch tries to avoid the problem by reverting back to not using
an hrtimer to inject leapseconds, and instead we handle the leapsecond
processing in the second_overflow() function.

The downside to this change is that on systems that support highres
timers, the leap second processing will occur on a HZ tick boundary,
(ie: ~1-10ms, depending on HZ)  after the leap second instead of
possibly sooner (~34us in my tests w/ x86_64 lapic).

This patch applies on top of tip/timers/core.

CC: Sasha Levin &lt;levinsasha928@gmail.com&gt;
CC: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Reported-by: Sasha Levin &lt;levinsasha928@gmail.com&gt;
Diagnoised-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Tested-by: Sasha Levin &lt;levinsasha928@gmail.com&gt;
Cc: Prarit Bhargava &lt;prarit@redhat.com&gt;
Cc: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Cc: Linux Kernel &lt;linux-kernel@vger.kernel.org&gt;
Signed-off-by: John Stultz &lt;john.stultz@linaro.org&gt;
Signed-off-by: Willy Tarreau &lt;w@1wt.eu&gt;
</content>
</entry>
<entry>
<title>timekeeping: Introduce timekeeping_leap_insert</title>
<updated>2009-08-15T08:55:45Z</updated>
<author>
<name>John Stultz</name>
</author>
<published>2009-08-14T13:47:18Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=31089c13bcb18d2cd2a3ddfbe3a28666346f237e'/>
<id>urn:sha1:31089c13bcb18d2cd2a3ddfbe3a28666346f237e</id>
<content type='text'>
Move the adjustment of xtime, wall_to_monotonic and the update of the
vsyscall variables to the timekeeping code.

Signed-off-by: John Stultz &lt;johnstul@us.ibm.com&gt;
Signed-off-by: Martin Schwidefsky &lt;schwidefsky@de.ibm.com&gt;
LKML-Reference: &lt;20090814134807.609730216@de.ibm.com&gt;
Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
</content>
</entry>
<entry>
<title>time: ntp: fix bug in ntp_update_offset() &amp; do_adjtimex(), fix</title>
<updated>2009-02-26T18:39:47Z</updated>
<author>
<name>John Stultz</name>
</author>
<published>2009-02-26T17:46:14Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=a2a5ac8650b570bea3cb3614f77739dcd07d6632'/>
<id>urn:sha1:a2a5ac8650b570bea3cb3614f77739dcd07d6632</id>
<content type='text'>
The time_status conditional was accidentally placed right after we clear
the checked time_status bits, which causes us to take the conditional
every time through. This fixes it by moving the conditional to before we
clear the time_status bits.

Signed-off-by: John Stultz &lt;johnstul@us.ibm.com&gt;
Cc: Clark Williams &lt;williams@redhat.com&gt;
Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
</content>
</entry>
<entry>
<title>time: ntp: clean up second_overflow()</title>
<updated>2009-02-25T17:38:17Z</updated>
<author>
<name>Ingo Molnar</name>
</author>
<published>2009-02-22T15:06:58Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=39854fe8c165872d743f6a0c4860ca2de8e45ac9'/>
<id>urn:sha1:39854fe8c165872d743f6a0c4860ca2de8e45ac9</id>
<content type='text'>
Impact: cleanup, no functionality changed

The 'time_adj' local variable is named in a very confusing
way because it almost shadows the 'time_adjust' global
variable - which is used in this same function.

Rename it to 'delta' - to make them stand apart more clearly.

kernel/time/ntp.o:

   text	   data	    bss	    dec	    hex	filename
   2545	    114	    144	   2803	    af3	ntp.o.before
   2545	    114	    144	   2803	    af3	ntp.o.after

md5:
   1bf0b3be564512279ba7cee299d1d2be  ntp.o.before.asm
   1bf0b3be564512279ba7cee299d1d2be  ntp.o.after.asm

Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
</content>
</entry>
<entry>
<title>time: ntp: simplify ntp_tick_adj calculations</title>
<updated>2009-02-25T17:38:16Z</updated>
<author>
<name>Ingo Molnar</name>
</author>
<published>2009-02-22T15:03:37Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=069569e025706f27f939785f86a94d5d8ce55dce'/>
<id>urn:sha1:069569e025706f27f939785f86a94d5d8ce55dce</id>
<content type='text'>
Impact: micro-optimization

Convert the (internal) ntp_tick_adj value we store from unscaled
units to scaled units. This is a constant that we never modify,
so scaling it up once during bootup is enough - we dont have to
do it for every adjustment step.

Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
</content>
</entry>
<entry>
<title>time: ntp: make 64-bit constants more robust</title>
<updated>2009-02-25T17:38:15Z</updated>
<author>
<name>Ingo Molnar</name>
</author>
<published>2009-02-22T14:48:43Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=2b9d1496e7835a603c340e8f0dd81f4b74d5f248'/>
<id>urn:sha1:2b9d1496e7835a603c340e8f0dd81f4b74d5f248</id>
<content type='text'>
Impact: cleanup, no functionality changed

 - make PPM_SCALE an explicit s64 constant, to
   remove (s64) casts from usage sites.

kernel/time/ntp.o:

   text	   data	    bss	    dec	    hex	filename
   2536	    114	    136	   2786	    ae2	ntp.o.before
   2536	    114	    136	   2786	    ae2	ntp.o.after

md5:
   40a7728d1188aa18e83e21a81fa7b150  ntp.o.before.asm
   40a7728d1188aa18e83e21a81fa7b150  ntp.o.after.asm

Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
</content>
</entry>
<entry>
<title>time: ntp: refactor do_adjtimex() some more</title>
<updated>2009-02-25T17:38:15Z</updated>
<author>
<name>Ingo Molnar</name>
</author>
<published>2009-02-22T14:35:18Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=e96291653b2e4df02f160b574070f6e632868e5e'/>
<id>urn:sha1:e96291653b2e4df02f160b574070f6e632868e5e</id>
<content type='text'>
Impact: cleanup, no functionality changed

Further simplify do_adjtimex():

 - introduce the ntp_start_leap_timer() helper function
 - eliminate the goto adj_done complication

Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
</content>
</entry>
</feed>
