1. 13 10月, 2012 1 次提交
  2. 31 7月, 2012 1 次提交
  3. 23 3月, 2012 1 次提交
    • J
      ntp: Fix leap-second hrtimer livelock · 6b43ae8a
      John Stultz 提交于
      Since commit 7dffa3c6 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(&ntp_lock);
          process_adjtimex_modes();				 timer_interrupt()
            process_adj_status();                                do_timer()
              ntp_start_leap_timer();                             write_lock(&xtime_lock);
                hrtimer_start();                                  update_wall_time();
                   hrtimer_reprogram();                            ntp_tick_length()
                     tick_program_event()                            spin_lock(&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 <levinsasha928@gmail.com>
      CC: Thomas Gleixner <tglx@linutronix.de>
      Reported-by: NSasha Levin <levinsasha928@gmail.com>
      Diagnoised-by: NThomas Gleixner <tglx@linutronix.de>
      Tested-by: NSasha Levin <levinsasha928@gmail.com>
      Signed-off-by: NJohn Stultz <john.stultz@linaro.org>
      6b43ae8a
  4. 27 1月, 2012 2 次提交
    • J
      ntp: Access tick_length variable via ntp_tick_length() · ea7cf49a
      John Stultz 提交于
      Currently the NTP managed tick_length value is accessed globally,
      in preparations for locking cleanups, make sure it is accessed via
      a function and mark it as static.
      
      CC: Thomas Gleixner <tglx@linutronix.de>
      CC: Eric Dumazet <eric.dumazet@gmail.com>
      CC: Richard Cochran <richardcochran@gmail.com>
      Signed-off-by: NJohn Stultz <john.stultz@linaro.org>
      ea7cf49a
    • J
      ntp: Cleanup timex.h · 8357929e
      John Stultz 提交于
      Move ntp_sycned to ntp.c and mark time_status as static.
      Also yank function declaration for non-existant function.
      
      CC: Thomas Gleixner <tglx@linutronix.de>
      CC: Eric Dumazet <eric.dumazet@gmail.com>
      CC: Richard Cochran <richardcochran@gmail.com>
      Signed-off-by: NJohn Stultz <john.stultz@linaro.org>
      8357929e
  5. 02 2月, 2011 1 次提交
  6. 14 1月, 2011 1 次提交
    • A
      ntp: add hardpps implementation · 025b40ab
      Alexander Gordeev 提交于
      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: NAlexander Gordeev <lasaine@lvk.cs.msu.su>
      Acked-by: NJohn Stultz <johnstul@us.ibm.com>
      Cc: Rodolfo Giometti <giometti@enneenne.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      025b40ab
  7. 24 3月, 2010 2 次提交
  8. 29 1月, 2010 1 次提交
  9. 05 10月, 2009 1 次提交
    • J
      time: Implement logarithmic time accumulation · a092ff0f
      john stultz 提交于
      Accumulating one tick at a time works well unless we're using NOHZ.
      Then it can be an issue, since we may have to run through the loop
      a few thousand times, which can increase timer interrupt caused
      latency.
      
      The current solution was to accumulate in half-second intervals
      with NOHZ. This kept the number of loops down, however it did
      slightly change how we make NTP adjustments. While not an issue
      with NTPd users, as NTPd makes adjustments over a longer period of
      time, other adjtimex() users have noticed the half-second
      granularity with which we can apply frequency changes to the clock.
      
      For instance, if a application tries to apply a 100ppm frequency
      correction for 20ms to correct a 2us offset, with NOHZ they either
      get no correction, or a 50us correction.
      
      Now, there will always be some granularity error for applying
      frequency corrections. However with users sensitive to this error
      have seen a 50-500x increase with NOHZ compared to running without
      NOHZ.
      
      So I figured I'd try another approach then just simply increasing
      the interval. My approach is to consume the time interval
      logarithmically. This reduces the number of times through the loop
      needed keeping latency down, while still preserving the original
      granularity error for adjtimex() changes.
      
      Further, this change allows us to remove the xtime_cache code
      (patch to follow), as xtime is always within one tick of the
      current time, instead of the half-second updates it saw before.
      
      An earlier version of this patch has been shipping to x86 users in
      the RedHat MRG releases for awhile without issue, but I've reworked
      this version to be even more careful about avoiding possible
      overflows if the shift value gets too large.
      Signed-off-by: NJohn Stultz <johnstul@us.ibm.com>
      Acked-by: NThomas Gleixner <tglx@linutronix.de>
      Reviewed-by: NJohn Kacur <jkacur@redhat.com>
      Cc: Clark Williams <williams@redhat.com>
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      LKML-Reference: <1254525473.7741.88.camel@localhost.localdomain>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      a092ff0f
  10. 28 8月, 2009 1 次提交
    • J
      ntp: Provide compability defines (You say MOD_NANO, I say ADJ_NANO) · c95b4502
      john stultz 提交于
      MOD_NANO, ADJ_NANO, MOD_NANO, ADJ_NANO!
      Lets call the whole thing off!
      But oh! If we call the whole thing off,
      Then we must part.
      And oh! If we ever part,
      Then that might break my heart^H^H^H^Hclock!
      So, if you like MOD_NANO and I like ADJ_NANO,
      I'll include MOD_NANO and give up ADJ_NANO (not really!).
      For we know we need each other,
      So we better call the calling off off.
      Let's call the whole thing off!
      
      The tumultuous NTP and Linux relationship has hit another snag: Ends
      up NTPd still uses the "xntp 3.4 compatability names" and when the
      STA_NANO value was added (along with ADJ_NANO), NTPd expected MOD_NANO
      to be added and has apparently hit some build errors.
      
      Report to ntp hackers:
      https://lists.ntp.org/pipermail/hackers/2009-August/004455.html
      
      Related Bugs:
      https://support.ntp.org/bugs/show_bug.cgi?id=1219
      https://bugzilla.redhat.com/show_bug.cgi?id=505566
      
      So in an effort to make peace, here's a patch to help get things
      building again. I also have updated the comment to make sure folks
      don't think the MOD_* values are just legacy constants.
      
      Of course, NTPd really uses the glibc-headers, so those will need to
      be similarly updated before things are working again (the RH bug above
      should probably cover that).
      
      Thanks to Michael Tatarinov and Hal Murray for finding and reporting
      the issue!
      Signed-off-by: NJohn Stultz <johnstul@us.ibm.com>
      Cc: Miroslav Lichvar <mlichvar@redhat.com>
      Cc: hmurray@megapathdsl.net
      Cc: Ulrich Drepper <drepper@redhat.com>
      Cc: Michael Tatarinov <kukabu@gmail.com>
      LKML-Reference: <1251417882.7905.42.camel@localhost.localdomain>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      c95b4502
  11. 17 6月, 2009 1 次提交
    • A
      time: move PIT_TICK_RATE to linux/timex.h · 08604bd9
      Arnd Bergmann 提交于
      PIT_TICK_RATE is currently defined in four architectures, but in three
      different places.  While linux/timex.h is not the perfect place for it, it
      is still a reasonable replacement for those drivers that traditionally use
      asm/timex.h to get CLOCK_TICK_RATE and expect it to be the PIT frequency.
      
      Note that for Alpha, the actual value changed from 1193182UL to 1193180UL.
       This is unlikely to make a difference, and probably can only improve
      accuracy.  There was a discussion on the correct value of CLOCK_TICK_RATE
      a few years ago, after which every existing instance was getting changed
      to 1193182.  According to the specification, it should be
      1193181.818181...
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Cc: Richard Henderson <rth@twiddle.net>
      Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Len Brown <lenb@kernel.org>
      Cc: john stultz <johnstul@us.ibm.com>
      Cc: Dmitry Torokhov <dtor@mail.ru>
      Cc: Takashi Iwai <tiwai@suse.de>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      08604bd9
  12. 12 5月, 2009 1 次提交
  13. 06 5月, 2009 1 次提交
    • J
      ntp: adjust SHIFT_PLL to improve NTP convergence · 22cfbbfd
      john stultz 提交于
      The conversion to the ntpv4 reference model
      f1992393 ("ntp: convert to the NTP4
      reference model") in 2.6.19 added nanosecond resolution the adjtimex
      interface, but also changed the "stiffness" of the frequency adjustments,
      causing NTP convergence time to greatly increase.
      
      SHIFT_PLL, which reduces the stiffness of the freq adjustments, was
      designed to be inversely linked to HZ, and the reference value of 4 was
      designed for Unix systems using HZ=100.  However Linux's clock steering
      code mostly independent of HZ.
      
      So this patch reduces the SHIFT_PLL value from 4 to 2, which causes NTPd
      behavior to match kernels prior to 2.6.19, greatly reducing convergence
      times, and improving close synchronization through environmental thermal
      changes.
      
      The patch also changes some l's to L's in nearby code to avoid misreading
      50l as 501.
      
      [ Impact: tweak NTP algorithm for faster convergence ]
      Signed-off-by: NJohn Stultz <johnstul@us.ibm.com>
      Acked-by: NRik van Riel <riel@redhat.com>
      Cc: zippel@linux-m68k.org
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      LKML-Reference: <200905051956.n45JuVo9025575@imap1.linux-foundation.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      22cfbbfd
  14. 26 2月, 2009 1 次提交
    • I
      time: ntp: make 64-bit constants more robust · 2b9d1496
      Ingo Molnar 提交于
      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: NIngo Molnar <mingo@elte.hu>
      2b9d1496
  15. 13 12月, 2008 1 次提交
  16. 24 9月, 2008 1 次提交
  17. 22 8月, 2008 1 次提交
  18. 01 5月, 2008 7 次提交
  19. 09 3月, 2008 1 次提交
  20. 10 2月, 2008 1 次提交
  21. 07 2月, 2008 1 次提交
    • A
      read_current_timer() cleanups · 941e492b
      Andrew Morton 提交于
      - All implementations can be __devinit
      
      - The function prototypes were in asm/timex.h but they all must be the same,
        so create a single declaration in linux/timex.h.
      
      - uninline the sparc64 version to match the other architectures
      
      - Don't bother #defining ARCH_HAS_READ_CURRENT_TIMER to a particular value.
      
      [ezk@cs.sunysb.edu: fix build]
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Haavard Skinnemoen <hskinnemoen@atmel.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Andi Kleen <ak@suse.de>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      941e492b
  22. 27 11月, 2007 1 次提交
  23. 21 7月, 2007 1 次提交
  24. 17 2月, 2007 1 次提交
  25. 12 2月, 2007 1 次提交
  26. 06 10月, 2006 1 次提交
  27. 01 10月, 2006 6 次提交