1. 26 2月, 2009 6 次提交
    • I
      time: ntp: refactor and clean up ntp_update_offset() · f939890b
      Ingo Molnar 提交于
      Impact: cleanup, no functionality changed
      
      - introduce the ntp_update_offset_fll() helper
      - clean up the flow and variable naming
      
      kernel/time/ntp.o:
      
         text	   data	    bss	    dec	    hex	filename
         2504	    114	    136	   2754	    ac2	ntp.o.before
         2504	    114	    136	   2754	    ac2	ntp.o.after
      
      md5:
         01f7b8e1a5472a3056f9e4ae84d46315  ntp.o.before.asm
         01f7b8e1a5472a3056f9e4ae84d46315  ntp.o.after.asm
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      f939890b
    • I
      time: ntp: refactor up ntp_update_frequency() · bc26c31d
      Ingo Molnar 提交于
      Impact: cleanup, no functionality changed
      
      Change ntp_update_frequency() from a hard to follow code
      flow that uses global variables as temporaries, to a clean
      input+output flow.
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      bc26c31d
    • I
      time: ntp: clean up ntp_update_frequency() · 9ce616aa
      Ingo Molnar 提交于
      Impact: cleanup, no functionality changed
      
      Prepare a refactoring of ntp_update_frequency().
      
      kernel/time/ntp.o:
      
         text	   data	    bss	    dec	    hex	filename
         2504	    114	    136	   2754	    ac2	ntp.o.before
         2504	    114	    136	   2754	    ac2	ntp.o.after
      
      md5:
         41f3009debc9b397d7394dd77d912f0a  ntp.o.before.asm
         41f3009debc9b397d7394dd77d912f0a  ntp.o.after.asm
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      9ce616aa
    • I
      time: ntp: simplify the MAX_TICKADJ_SCALED definition · bbd12676
      Ingo Molnar 提交于
      Impact: cleanup, no functionality changed
      
      There's an ugly u64 typecase in the MAX_TICKADJ_SCALED definition,
      this can be eliminated by making the MAX_TICKADJ constant's type
      64-bit (signed).
      
      kernel/time/ntp.o:
      
         text	   data	    bss	    dec	    hex	filename
         2504	    114	    136	   2754	    ac2	ntp.o.before
         2504	    114	    136	   2754	    ac2	ntp.o.after
      
      md5:
         41f3009debc9b397d7394dd77d912f0a  ntp.o.before.asm
         41f3009debc9b397d7394dd77d912f0a  ntp.o.after.asm
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      bbd12676
    • I
      time: ntp: simplify the second_overflow() code flow · 3c972c24
      Ingo Molnar 提交于
      Impact: cleanup, no functionality changed
      
      Instead of a hierarchy of conditions, transform them to clean
      gradual conditions and return's.
      
      This makes the flow easier to read and makes the purpose of
      the function easier to understand.
      
      kernel/time/ntp.o:
      
         text	   data	    bss	    dec	    hex	filename
         2552	    170	    168	   2890	    b4a	ntp.o.before
         2552	    170	    168	   2890	    b4a	ntp.o.after
      
      md5:
         eae1275df0b7d6290c13f6f6f8f05c8c  ntp.o.before.asm
         eae1275df0b7d6290c13f6f6f8f05c8c  ntp.o.after.asm
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      3c972c24
    • I
      time: ntp: clean up kernel/time/ntp.c · 53bbfa9e
      Ingo Molnar 提交于
      Impact: cleanup, no functionality changed
      
      Make this file a bit more readable by applying a consistent coding style.
      
      No code changed:
      
      kernel/time/ntp.o:
      
         text	   data	    bss	    dec	    hex	filename
         2552	    170	    168	   2890	    b4a	ntp.o.before
         2552	    170	    168	   2890	    b4a	ntp.o.after
      
      md5:
         eae1275df0b7d6290c13f6f6f8f05c8c  ntp.o.before.asm
         eae1275df0b7d6290c13f6f6f8f05c8c  ntp.o.after.asm
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      53bbfa9e
  2. 19 2月, 2009 1 次提交
    • J
      time: apply NTP frequency/tick changes immediately · fdcedf7b
      john stultz 提交于
      Since the GENERIC_TIME changes landed, the adjtimex behavior changed
      for struct timex.tick and .freq changed. When the tick or freq value
      is set, we adjust the tick_length_base in ntp_update_frequency().
      However, this new value doesn't get applied to tick_length until the
      next second (via second_overflow).
      
      This means some applications that do quick time tweaking do not see the
      requested change made as quickly as expected.
      
      I've run a few tests with this change, and ntpd still functions fine.
      Signed-off-by: NJohn Stultz <johnstul@us.ibm.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      fdcedf7b
  3. 25 11月, 2008 1 次提交
    • P
      hrtimer: removing all ur callback modes · ca109491
      Peter Zijlstra 提交于
      Impact: cleanup, move all hrtimer processing into hardirq context
      
      This is an attempt at removing some of the hrtimer complexity by
      reducing the number of callback modes to 1.
      
      This means that all hrtimer callback functions will be ran from HARD-irq
      context.
      
      I went through all the 30 odd hrtimer callback functions in the kernel
      and saw only one that I'm not quite sure of, which is the one in
      net/can/bcm.c - hence I'm CC-ing the folks responsible for that code.
      
      Furthermore, the hrtimer core now calls callbacks directly with IRQs
      disabled in case you try to enqueue an expired timer. If this timer is a
      periodic timer (which should use hrtimer_forward() to advance its time)
      then it might be possible to end up in an inf. recursive loop due to the
      fact that hrtimer_forward() doesn't round up to the next timer
      granularity, and therefore keeps on calling the callback - obviously
      this needs a fix.
      
      Aside from that, this seems to compile and actually boot on my dual core
      test box - although I'm sure there are some bugs in, me not hitting any
      makes me certain :-)
      Signed-off-by: NPeter Zijlstra <a.p.zijlstra@chello.nl>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      ca109491
  4. 24 9月, 2008 2 次提交
  5. 06 9月, 2008 2 次提交
    • M
      ntp: fix calculation of the next jiffie to trigger RTC sync · 4ff4b9e1
      Maciej W. Rozycki 提交于
      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: NMaciej W. Rozycki <macro@linux-mips.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      4ff4b9e1
    • A
      hrtimer: convert kernel/* to the new hrtimer apis · cc584b21
      Arjan van de Ven 提交于
      In order to be able to do range hrtimers we need to use accessor functions
      to the "expire" member of the hrtimer struct.
      This patch converts kernel/* to these accessors.
      Signed-off-by: NArjan van de Ven <arjan@linux.intel.com>
      cc584b21
  6. 22 8月, 2008 1 次提交
  7. 01 5月, 2008 10 次提交
  8. 09 3月, 2008 2 次提交
  9. 10 2月, 2008 1 次提交
  10. 27 11月, 2007 1 次提交
  11. 17 11月, 2007 1 次提交
    • D
      ntp: fix typo that makes sync_cmos_clock erratic · fa6a1a55
      David P. Reed 提交于
      Fix a typo in ntp.c that has caused updating of the persistent (RTC)
      clock when synced to NTP to behave erratically.
      
      When debugging a freeze that arises on my AMD64 machines when I
      run the ntpd service, I added a number of printk's to monitor the
      sync_cmos_clock procedure.  I discovered that it was not syncing to
      cmos RTC every 11 minutes as documented, but instead would keep trying
      every second for hours at a time.  The reason turned out to be a typo
      in sync_cmos_clock, where it attempts to ensure that
      update_persistent_clock is called very close to 500 msec. after a 1
      second boundary (required by the PC RTC's spec). That typo referred to
      "xtime" in one spot, rather than "now", which is derived from "xtime"
      but not equal to it.  This makes the test erratic, creating a
      "coin-flip" that decides when update_persistent_clock is called - when
      it is called, which is rarely, it may be at any time during the one
      second period, rather than close to 500 msec, so the value written is
      needlessly incorrect, too.
      
      Signed-off-by: David P. Reed
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      fa6a1a55
  12. 12 9月, 2007 1 次提交
  13. 22 7月, 2007 1 次提交
  14. 21 7月, 2007 1 次提交
  15. 17 7月, 2007 1 次提交
    • A
      Remove capability.h from mm.h · aa0ac365
      Alexey Dobriyan 提交于
      I forgot to remove capability.h from mm.h while removing sched.h!  This
      patch remedies that, because the only inline function which was using
      CAP_something was made out of line.
      
      Cross-compile tested without regressions on:
      
      	all powerpc defconfigs
      	all mips defconfigs
      	all m68k defconfigs
      	all arm defconfigs
      	all ia64 defconfigs
      
      	alpha alpha-allnoconfig alpha-defconfig alpha-up
      	arm
      	i386 i386-allnoconfig i386-defconfig i386-up
      	ia64 ia64-allnoconfig ia64-defconfig ia64-up
      	m68k
      	mips
      	parisc parisc-allnoconfig parisc-defconfig parisc-up
      	powerpc powerpc-up
      	s390 s390-allnoconfig s390-defconfig s390-up
      	sparc sparc-allnoconfig sparc-defconfig sparc-up
      	sparc64 sparc64-allnoconfig sparc64-defconfig sparc64-up
      	um-x86_64
      	x86_64 x86_64-allnoconfig x86_64-defconfig x86_64-up
      
      as well as my two usual configs.
      Signed-off-by: NAlexey Dobriyan <adobriyan@gmail.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      aa0ac365
  16. 04 7月, 2007 1 次提交
    • T
      NTP: remove clock_was_set() call to prevent deadlock · 746976a3
      Thomas Gleixner 提交于
      The clock_was_set() call in seconds_overflow() which happens only when
      leap seconds are inserted / deleted is wrong in two aspects:
      
      1. it results in a call to on_each_cpu() with interrupts disabled
      2. it is potential deadlock source vs. call_lock in smp_call_function()
      
      The only possible side effect of the removal might be, that an absolute
      CLOCK_REALTIME timer fires 1 second too late, in the rare case of leap
      second deletion and an absolute CLOCK_REALTIME timer which expires in
      the affected time frame. It will never fire too early.
      
      This was probably observed by the reporter of a June 30th -> July 1st
      hang: http://lkml.org/lkml/2007/7/3/103
      
      A similar problem was observed by Dave Jones, who provided a screen shot
      with a lockdep back trace, which allowed to analyse the problem.
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Acked-by: NIngo Molnar <mingo@elte.hu>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      746976a3
  17. 22 5月, 2007 1 次提交
    • A
      Detach sched.h from mm.h · e8edc6e0
      Alexey Dobriyan 提交于
      First thing mm.h does is including sched.h solely for can_do_mlock() inline
      function which has "current" dereference inside. By dealing with can_do_mlock()
      mm.h can be detached from sched.h which is good. See below, why.
      
      This patch
      a) removes unconditional inclusion of sched.h from mm.h
      b) makes can_do_mlock() normal function in mm/mlock.c
      c) exports can_do_mlock() to not break compilation
      d) adds sched.h inclusions back to files that were getting it indirectly.
      e) adds less bloated headers to some files (asm/signal.h, jiffies.h) that were
         getting them indirectly
      
      Net result is:
      a) mm.h users would get less code to open, read, preprocess, parse, ... if
         they don't need sched.h
      b) sched.h stops being dependency for significant number of files:
         on x86_64 allmodconfig touching sched.h results in recompile of 4083 files,
         after patch it's only 3744 (-8.3%).
      
      Cross-compile tested on
      
      	all arm defconfigs, all mips defconfigs, all powerpc defconfigs,
      	alpha alpha-up
      	arm
      	i386 i386-up i386-defconfig i386-allnoconfig
      	ia64 ia64-up
      	m68k
      	mips
      	parisc parisc-up
      	powerpc powerpc-up
      	s390 s390-up
      	sparc sparc-up
      	sparc64 sparc64-up
      	um-x86_64
      	x86_64 x86_64-up x86_64-defconfig x86_64-allnoconfig
      
      as well as my two usual configs.
      Signed-off-by: NAlexey Dobriyan <adobriyan@gmail.com>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      e8edc6e0
  18. 28 3月, 2007 1 次提交
  19. 17 2月, 2007 1 次提交
  20. 29 10月, 2006 1 次提交
  21. 01 10月, 2006 3 次提交
    • A
      [PATCH] kernel/time/ntp.c: possible cleanups · 70bc42f9
      Adrian Bunk 提交于
      This patch contains the following possible cleanups:
      - make the following needlessly global function static:
        - ntp_update_frequency()
      - make the following needlessly global variables static:
        - time_state
        - time_offset
        - time_constant
        - time_reftime
      - remove the following read-only global variable:
        - time_precision
      Signed-off-by: NAdrian Bunk <bunk@stusta.de>
      Cc: Roman Zippel <zippel@linux-m68k.org>
      Cc: john stultz <johnstul@us.ibm.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      70bc42f9
    • R
      [PATCH] ntp: convert to the NTP4 reference model · f1992393
      Roman Zippel 提交于
      This converts the kernel ntp model into a model which matches the nanokernel
      reference implementations.  The previous patches already increased the
      resolution and precision of the computations, so that this conversion becomes
      quite simple.
      
      <linux@horizon.com> explains:
      
      The original NTP kernel interface was defined in units of microseconds.
      That's what Linux implements.  As computers have gotten faster and can now
      split microseconds easily, a new kernel interface using nanosecond units was
      defined ("the nanokernel", confusing as that name is to OS hackers), and
      there's an STA_NANO bit in the adjtimex() status field to tell the application
      which units it's using.
      
      The current ntpd supports both, but Linux loses some possible timing
      resolution because of quantization effects, and the ntpd hackers would really
      like to be able to drop the backwards compatibility code.
      
      Ulrich Windl has been maintaining a patch set to do the conversion for years,
      but it's hard to keep in sync.
      Signed-off-by: NRoman Zippel <zippel@linux-m68k.org>
      Cc: john stultz <johnstul@us.ibm.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      f1992393
    • R
      [PATCH] ntp: convert time_freq to nsec value · 04b617e7
      Roman Zippel 提交于
      This converts time_freq to a scaled nsec value and adds around 6bit of extra
      resolution.  This pushes the time_freq to its 32bit limits so the calculatons
      have to be done with 64bit.
      Signed-off-by: NRoman Zippel <zippel@linux-m68k.org>
      Cc: john stultz <johnstul@us.ibm.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      04b617e7