1. 10 11月, 2007 1 次提交
    • P
      sched: restore deterministic CPU accounting on powerpc · fa13a5a1
      Paul Mackerras 提交于
      Since powerpc started using CONFIG_GENERIC_CLOCKEVENTS, the
      deterministic CPU accounting (CONFIG_VIRT_CPU_ACCOUNTING) has been
      broken on powerpc, because we end up counting user time twice: once in
      timer_interrupt() and once in update_process_times().
      
      This fixes the problem by pulling the code in update_process_times
      that updates utime and stime into a separate function called
      account_process_tick.  If CONFIG_VIRT_CPU_ACCOUNTING is not defined,
      there is a version of account_process_tick in kernel/timer.c that
      simply accounts a whole tick to either utime or stime as before.  If
      CONFIG_VIRT_CPU_ACCOUNTING is defined, then arch code gets to
      implement account_process_tick.
      
      This also lets us simplify the s390 code a bit; it means that the s390
      timer interrupt can now call update_process_times even when
      CONFIG_VIRT_CPU_ACCOUNTING is turned on, and can just implement a
      suitable account_process_tick().
      
      account_process_tick() now takes the task_struct * as an argument.
      Tested both with and without CONFIG_VIRT_CPU_ACCOUNTING.
      Signed-off-by: NPaul Mackerras <paulus@samba.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      fa13a5a1
  2. 08 11月, 2007 1 次提交
    • P
      [POWERPC] Fix off-by-one error in setting decrementer on Book E/4xx (v2) · 43875cc0
      Paul Mackerras 提交于
      The decrementer in Book E and 4xx processors interrupts on the
      transition from 1 to 0, rather than on the 0 to -1 transition as on
      64-bit server and 32-bit "classic" (6xx/7xx/7xxx) processors.  At the
      moment we subtract 1 from the count of how many decrementer ticks are
      required before the next interrupt before putting it into the
      decrementer, which is correct for server/classic processors, but could
      possibly cause the interrupt to happen too early on Book E and 4xx if
      the timebase/decrementer frequency is low.
      
      This fixes the problem by making set_dec subtract 1 from the count for
      server and classic processors, instead of having the callers subtract
      1.  Since set_dec already had a bunch of ifdefs to handle different
      processor types, there is no net increase in ugliness. :)
      
      Note that calling set_dec(0) may not generate an interrupt on some
      processors.  To make sure that decrementer_set_next_event always calls
      set_dec with an interval of at least 1 tick, we set min_delta_ns of
      the decrementer_clockevent to correspond to 2 ticks (2 rather than 1
      to compensate for truncations in the conversions between ticks and
      ns).
      
      This also removes a redundant call to set the decrementer to
      0x7fffffff - it was already set to that earlier in timer_interrupt.
      Signed-off-by: NPaul Mackerras <paulus@samba.org>
      43875cc0
  3. 19 10月, 2007 1 次提交
    • M
      powerpc: add scaled time accounting · 4603ac18
      Michael Neuling 提交于
      This adds POWERPC specific hooks for scaled time accounting.
      
      POWER6 includes a SPURR register.  The SPURR is based off the PURR register
      but is scaled based on CPU frequency and issue rates.  This gives a more
      accurate account of the instructions used per task.  The PURR and timebase
      will be constant relative to the wall clock, irrespective of the CPU
      frequency.
      
      This implementation reads the SPURR register in account_system_vtime which
      is only call called on context witch and hard and soft irq entry and exit.
      The percentage of user and system time is then estimated using the ratio of
      these accounted by the PURR.  If the SPURR is not present, the PURR read.
      
      An earlier implementation of this patch read the SPURR whenever the PURR
      was read, which included the system call entry and exit path.
      Unfortunately this showed a performance regression on lmbench runs, so was
      re-implemented.
      
      I've included the lmbench results here when run bare metal on POWER6.  1st
      column is the unpatch results.  2nd column is the results using the below
      patch and the 3rd is the % diff of these results from the base.  4th and
      5th columns are the results and % differnce from the base using the older
      patch (SPURR read in syscall entry/exit path).
      
                                    Base        Scaled-Acct     SPURR-in-syscall
                                   Result      Result  % diff    Result % diff
      Simple syscall:              0.3086      0.3086  0.0000    0.3452 11.8600
      Simple read:                 0.4591      0.4671  1.7425    0.5044 9.86713
      Simple write:                0.4364      0.4366  0.0458    0.4731 8.40971
      Simple stat:                 2.0055      2.0295  1.1967    2.0669 3.06158
      Simple fstat:                0.5962      0.5876  -1.442    0.6368 6.80979
      Simple open/close:           3.1283      3.1009  -0.875    3.2088 2.57328
      Select on 10 fd's:           0.8554      0.8457  -1.133    0.8667 1.32101
      Select on 100 fd's:          3.5292      3.6329  2.9383    3.6664 3.88756
      Select on 250 fd's:          7.9097      8.1881  3.5197    8.2242 3.97613
      Select on 500 fd's:          15.2659     15.836  3.7357    15.873 3.97814
      Select on 10 tcp fd's:       0.9576      0.9416  -1.670    0.9752 1.83792
      Select on 100 tcp fd's:      7.248       7.2254  -0.311    7.2685 0.28283
      Select on 250 tcp fd's:      17.7742     17.707  -0.375    17.749 -0.1406
      Select on 500 tcp fd's:      35.4258     35.25   -0.496    35.286 -0.3929
      Signal handler installation: 0.6131      0.6075  -0.913    0.647  5.52927
      Signal handler overhead:     2.0919      2.1078  0.7600    2.1831 4.35967
      Protection fault:            0.7345      0.7478  1.8107    0.8031 9.33968
      Pipe latency:                33.006      16.398  -50.31    33.475 1.42368
      AF_UNIX sock stream latency: 14.5093     30.910  113.03    30.715 111.692
      Process fork+exit:           219.8       222.8   1.3648    229.37 4.35623
      Process fork+execve:         876.14      873.28  -0.32     868.66 -0.8533
      Process fork+/bin/sh -c:     2830        2876.5  1.6431    2958   4.52296
      File /var/tmp/XXX write bw:  1193497     1195536 0.1708    118657 -0.5799
      Pagefaults on /var/tmp/XXX:  3.1272      3.2117  2.7020    3.2521 3.99398
      
      Also, kernel compile times show no difference with this patch applied.
      
      [pbadari@us.ibm.com: Avoid unnecessary PURR reading]
      Signed-off-by: NMichael Neuling <mikey@neuling.org>
      Cc: Balbir Singh <balbir@in.ibm.com>
      Cc: Jay Lan <jlan@engr.sgi.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: NBadari Pulavarty <pbadari@us.ibm.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      4603ac18
  4. 17 10月, 2007 1 次提交
  5. 11 10月, 2007 2 次提交
    • P
      [POWERPC] Make clockevents work on PPC601 processors · cdec12ae
      Paul Mackerras 提交于
      In testing the new clocksource and clockevent code on a PPC601
      processor, I discovered that the clockevent multiplier value for the
      decrementer clockevent was overflowing.  Because the RTCL register in
      the 601 effectively counts at 1GHz (it doesn't actually, but it
      increases by 128 every 128ns), and the shift value was 32, that meant
      the multiplier value had to be 2^32, which won't fit in an unsigned
      long on 32-bit.  The same problem would arise on any platform where
      the timebase frequency was 1GHz or more (not that we actually have any
      such machines today).
      
      This fixes it by reducing the shift value to 16.  Doing the
      calculations with a resolution of 2^-16 nanoseconds (15 femtoseconds)
      should be quite adequate.  :)
      Signed-off-by: NPaul Mackerras <paulus@samba.org>
      cdec12ae
    • P
      [POWERPC] Prevent decrementer clockevents from firing early · d968014b
      Paul Mackerras 提交于
      On old powermacs, we sometimes set the decrementer to 1 in order to
      trigger a decrementer interrupt, which we use to handle an interrupt
      that was pending at the time when it was re-enabled.  This was causing
      the decrementer clock event device to call the event function for the
      next event early, which was causing problems when high-res timers were
      not enabled.
      
      This fixes the problem by recording the timebase value at which the
      next event should occur, and checking the current timebase against the
      recorded value in timer_interrupt.  If it isn't time for the next
      event, it just reprograms the decrementer and returns.
      
      This also subtracts 1 from the value stored into the decrementer,
      which is appropriate because the decrementer interrupts on the
      transition from 0 to -1, not when the decrementer reaches 0.
      Signed-off-by: NPaul Mackerras <paulus@samba.org>
      d968014b
  6. 03 10月, 2007 3 次提交
  7. 19 9月, 2007 1 次提交
  8. 20 8月, 2007 1 次提交
  9. 17 8月, 2007 1 次提交
  10. 21 7月, 2007 1 次提交
  11. 10 7月, 2007 1 次提交
    • T
      [POWERPC] Modify sched_clock() to make CONFIG_PRINTK_TIME more sane · fc9069fe
      Tony Breeds 提交于
      When booting a current kernel with CONFIG_PRINTK_TIME enabled you'll
      see messages like:
      
      [    0.000000] time_init: decrementer frequency = 188.044000 MHz
      [    0.000000] time_init: processor frequency   = 1504.352000 MHz
      [3712914.436297] Console: colour dummy device 80x25
      
      This cause by the initialisation of tb_to_ns_scale in time_init(), suddenly the
      multiplication in sched_clock() now does something :).  This patch modifies
      sched_clock() to report the offset since the machine booted so the same
      printk's now look like:
      
      [    0.000000] time_init: decrementer frequency = 188.044000 MHz
      [    0.000000] time_init: processor frequency   = 1504.352000 MHz
      [    0.000135] Console: colour dummy device 80x25
      
      Effectivly including the uptime in printk()s.
      
      This patch makes tb_to_ns_scale and tb_to_ns_shift static and
      read_mostly for good measure.
      Signed-off-by: NTony Breeds <tony@bakeyournoodle.com>
      Signed-off-by: NPaul Mackerras <paulus@samba.org>
      fc9069fe
  12. 28 6月, 2007 1 次提交
    • T
      [POWERPC] Move iSeries_tb_recal into its own late_initcall. · 71712b45
      Tony Breeds 提交于
      Currently iSeries will recalibrate the cputime_factors in the first
      settimeofday() call.
      
      It seems the reason for doing this is to ensure a resaonable time delta after
      time_init().  On current kernels (with udev), this call is made 40-60 seconds
      into the boot process, by moving it to a late initcall it is called
      approximately 5 seconds after time_init() is called.  This is sufficient to
      recalibrate the timebase.
      Signed-off-by: NTony Breeds <tony@bakeyournoodle.com>
      CC: Stephen Rothwell <sfr@canb.auug.org.au>
      Signed-off-by: NPaul Mackerras <paulus@samba.org>
      71712b45
  13. 25 6月, 2007 2 次提交
  14. 12 5月, 2007 1 次提交
    • W
      [POWERPC] Simplify smp_space_timers · e147ec8f
      will schmidt 提交于
      Greatly simplify the function smp_space_timers.
      
      The stolen time calculation (per comment within the code) doesn't need the
      half-jiffy stagger any more.  There isn't an issue with bouncing off global
      locks, so we really shouldn't need any sort of staggering at all.
      
      However, the last_jiffy value still needs to be set.   This removes the
      extra stagger logic, and just sets the values.
      
      This change should benefit applications that rely on barrier
      synchronization, and will help cut down OS jitter.
      
      Boot tested across the board (G5,power3,power4,power5,970mp blade).
      Signed-off-by: NWill Schmidt <will_schmidt@vnet.ibm.com>
      Signed-off-by: NPaul Mackerras <paulus@samba.org>
      e147ec8f
  15. 13 4月, 2007 1 次提交
  16. 04 12月, 2006 1 次提交
  17. 22 11月, 2006 1 次提交
  18. 23 10月, 2006 1 次提交
    • S
      [POWERPC] Simplify stolen time calculation · cbcdb93d
      Stephen Rothwell 提交于
      In calculating stolen time, we were trying to actually account for time
      spent in the hypervisor.  We don't really have enough information to do
      that accurately, so don't try.  Instead, we now calculate stolen time as
      time that the current cpu thread is not actually dispatching instructions.
      On chips without a PURR, we cannot do this, so stolen time will always
      be zero.  On chips with a PURR, this is merely the difference between
      the elapsed PURR values and the elapsed TB values.
      
      This gives us much more sane vaules from tools such as mpstat, even if
      they are still a bit strange e.g. 2 busy threads on one cpu will both
      appear to have 50% user time and 50% stolen time while 1 busy thread on
      a cpu will look like 100% user on one of them and 100% idle on the other.
      Signed-off-by: NStephen Rothwell <sfr@canb.auug.org.au>
      Signed-off-by: NPaul Mackerras <paulus@samba.org>
      cbcdb93d
  19. 07 10月, 2006 1 次提交
  20. 05 10月, 2006 1 次提交
    • D
      IRQ: Maintain regs pointer globally rather than passing to IRQ handlers · 7d12e780
      David Howells 提交于
      Maintain a per-CPU global "struct pt_regs *" variable which can be used instead
      of passing regs around manually through all ~1800 interrupt handlers in the
      Linux kernel.
      
      The regs pointer is used in few places, but it potentially costs both stack
      space and code to pass it around.  On the FRV arch, removing the regs parameter
      from all the genirq function results in a 20% speed up of the IRQ exit path
      (ie: from leaving timer_interrupt() to leaving do_IRQ()).
      
      Where appropriate, an arch may override the generic storage facility and do
      something different with the variable.  On FRV, for instance, the address is
      maintained in GR28 at all times inside the kernel as part of general exception
      handling.
      
      Having looked over the code, it appears that the parameter may be handed down
      through up to twenty or so layers of functions.  Consider a USB character
      device attached to a USB hub, attached to a USB controller that posts its
      interrupts through a cascaded auxiliary interrupt controller.  A character
      device driver may want to pass regs to the sysrq handler through the input
      layer which adds another few layers of parameter passing.
      
      I've build this code with allyesconfig for x86_64 and i386.  I've runtested the
      main part of the code on FRV and i386, though I can't test most of the drivers.
      I've also done partial conversion for powerpc and MIPS - these at least compile
      with minimal configurations.
      
      This will affect all archs.  Mostly the changes should be relatively easy.
      Take do_IRQ(), store the regs pointer at the beginning, saving the old one:
      
      	struct pt_regs *old_regs = set_irq_regs(regs);
      
      And put the old one back at the end:
      
      	set_irq_regs(old_regs);
      
      Don't pass regs through to generic_handle_irq() or __do_IRQ().
      
      In timer_interrupt(), this sort of change will be necessary:
      
      	-	update_process_times(user_mode(regs));
      	-	profile_tick(CPU_PROFILING, regs);
      	+	update_process_times(user_mode(get_irq_regs()));
      	+	profile_tick(CPU_PROFILING);
      
      I'd like to move update_process_times()'s use of get_irq_regs() into itself,
      except that i386, alone of the archs, uses something other than user_mode().
      
      Some notes on the interrupt handling in the drivers:
      
       (*) input_dev() is now gone entirely.  The regs pointer is no longer stored in
           the input_dev struct.
      
       (*) finish_unlinks() in drivers/usb/host/ohci-q.c needs checking.  It does
           something different depending on whether it's been supplied with a regs
           pointer or not.
      
       (*) Various IRQ handler function pointers have been moved to type
           irq_handler_t.
      Signed-Off-By: NDavid Howells <dhowells@redhat.com>
      (cherry picked from 1b16e7ac850969f38b375e511e3fa2f474a33867 commit)
      7d12e780
  21. 02 10月, 2006 1 次提交
  22. 01 10月, 2006 1 次提交
    • A
      [PATCH] kill wall_jiffies · 8ef38609
      Atsushi Nemoto 提交于
      With 2.6.18-rc4-mm2, now wall_jiffies will always be the same as jiffies.
      So we can kill wall_jiffies completely.
      
      This is just a cleanup and logically should not change any real behavior
      except for one thing: RTC updating code in (old) ppc and xtensa use a
      condition "jiffies - wall_jiffies == 1".  This condition is never met so I
      suppose it is just a bug.  I just remove that condition only instead of
      kill the whole "if" block.
      
      [heiko.carstens@de.ibm.com: s390 build fix and cleanup]
      Signed-off-by: NAtsushi Nemoto <anemo@mba.ocn.ne.jp>
      Cc: Andi Kleen <ak@muc.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Richard Henderson <rth@twiddle.net>
      Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
      Cc: Russell King <rmk@arm.linux.org.uk>
      Cc: Ian Molton <spyro@f2s.com>
      Cc: Mikael Starvik <starvik@axis.com>
      Cc: David Howells <dhowells@redhat.com>
      Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
      Cc: Hirokazu Takata <takata.hirokazu@renesas.com>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: Kyle McMartin <kyle@mcmartin.ca>
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Cc: Paul Mundt <lethal@linux-sh.org>
      Cc: Kazumoto Kojima <kkojima@rr.iij4u.or.jp>
      Cc: Richard Curnow <rc@rc0.org.uk>
      Cc: William Lee Irwin III <wli@holomorphy.com>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Jeff Dike <jdike@addtoit.com>
      Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
      Cc: Miles Bader <uclinux-v850@lsi.nec.co.jp>
      Cc: Chris Zankel <chris@zankel.net>
      Cc: "Luck, Tony" <tony.luck@intel.com>
      Cc: Geert Uytterhoeven <geert@linux-m68k.org>
      Cc: Roman Zippel <zippel@linux-m68k.org>
      Signed-off-by: NHeiko Carstens <heiko.carstens@de.ibm.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      8ef38609
  23. 30 9月, 2006 1 次提交
    • A
      [PATCH] simplify update_times (avoid jiffies/jiffies_64 aliasing problem) · 3171a030
      Atsushi Nemoto 提交于
      Pass ticks to do_timer() and update_times(), and adjust x86_64 and s390
      timer interrupt handler with this change.
      
      Currently update_times() calculates ticks by "jiffies - wall_jiffies", but
      callers of do_timer() should know how many ticks to update.  Passing ticks
      get rid of this redundant calculation.  Also there are another redundancy
      pointed out by Martin Schwidefsky.
      
      This cleanup make a barrier added by
      5aee405c needless.  So this patch removes
      it.
      
      As a bonus, this cleanup make wall_jiffies can be removed easily, since now
      wall_jiffies is always synced with jiffies.  (This patch does not really
      remove wall_jiffies.  It would be another cleanup patch)
      Signed-off-by: NAtsushi Nemoto <anemo@mba.ocn.ne.jp>
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Cc: "Eric W. Biederman" <ebiederm@xmission.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: john stultz <johnstul@us.ibm.com>
      Cc: Andi Kleen <ak@muc.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Richard Henderson <rth@twiddle.net>
      Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
      Acked-by: NRussell King <rmk@arm.linux.org.uk>
      Cc: Ian Molton <spyro@f2s.com>
      Cc: Mikael Starvik <starvik@axis.com>
      Acked-by: NDavid Howells <dhowells@redhat.com>
      Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
      Cc: Hirokazu Takata <takata.hirokazu@renesas.com>
      Acked-by: NRalf Baechle <ralf@linux-mips.org>
      Cc: Kyle McMartin <kyle@mcmartin.ca>
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Cc: Paul Mundt <lethal@linux-sh.org>
      Cc: Kazumoto Kojima <kkojima@rr.iij4u.or.jp>
      Cc: Richard Curnow <rc@rc0.org.uk>
      Cc: William Lee Irwin III <wli@holomorphy.com>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Jeff Dike <jdike@addtoit.com>
      Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
      Cc: Miles Bader <uclinux-v850@lsi.nec.co.jp>
      Cc: Chris Zankel <chris@zankel.net>
      Acked-by: N"Luck, Tony" <tony.luck@intel.com>
      Cc: Geert Uytterhoeven <geert@linux-m68k.org>
      Cc: Roman Zippel <zippel@linux-m68k.org>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      3171a030
  24. 20 9月, 2006 1 次提交
    • P
      [POWERPC] Define of_read_ulong helper · a4dc7ff0
      Paul Mackerras 提交于
      There are various places where we want to extract an unsigned long
      value from a device-tree property that can be 1 or 2 cells in length.
      This replaces some open-coded calculations, and one place where we
      assumed without checking that properties were the length we wanted,
      with a little of_read_ulong() helper.
      Signed-off-by: NPaul Mackerras <paulus@samba.org>
      a4dc7ff0
  25. 31 8月, 2006 1 次提交
  26. 30 8月, 2006 1 次提交
    • P
      [POWERPC] Fix problem with time not advancing on 32-bit platforms · e0d872d5
      Paul Mackerras 提交于
      This fixes a problem introduced in 5db9fa95.
      The last_jiffy per-cpu variable is only 32 bits on 32-bit machines, but it
      was being compared with a 64-bit quantity (tb_next_jiffy), which resulted in
      time not advancing.
      
      This fixes it by changing last_jiffy to be 64 bits on all platforms.  With
      this, we no longer need tb_last_stamp as a 32-bit version of tb_last_jiffy,
      so this gets rid of tb_last_stamp and we just use tb_last_jiffy instead.
      This also fixes a bug when the boot cpu is not online, because using
      tb_last_stamp could have caused the wrong timebase origin value to be used
      when calculating the time of day.
      Signed-off-by: NPaul Mackerras <paulus@samba.org>
      e0d872d5
  27. 23 8月, 2006 1 次提交
    • N
      [POWERPC] Fix gettimeofday inaccuracies · 5db9fa95
      Nathan Lynch 提交于
      There are two problems in the powerpc gettimeofday code which can
      cause incorrect results to be returned.
      
      The first is that there is a race between do_gettimeofday and the
      timer interrupt:
      
      1. do_gettimeofday does get_tb()
      
      2. decrementer exception on boot cpu which runs timer_recalc_offset,
         which also samples the timebase and updates the do_gtod structure
         with a greater timebase value.
      
      3. do_gettimeofday calls __do_gettimeofday, which leads to the
         negative result from tb_val - temp_varp->tb_orig_stamp.
      
      The second is caused by taking the boot cpu offline, which can cause
      the value of tb_last_jiffy to be increased past the currently
      available timebase, causing the same underflow as above.
      
      [paulus@samba.org - define and use data_barrier() instead of mb().]
      Signed-off-by: NNathan Lynch <ntl@pobox.com>
      Signed-off-by: NPaul Mackerras <paulus@samba.org>
      5db9fa95
  28. 31 7月, 2006 1 次提交
  29. 01 7月, 2006 1 次提交
  30. 27 6月, 2006 2 次提交
  31. 21 6月, 2006 1 次提交
  32. 22 4月, 2006 2 次提交
  33. 29 3月, 2006 1 次提交
  34. 16 3月, 2006 1 次提交
    • P
      powerpc: Fix problem with time going backwards · 0a45d449
      Paul Mackerras 提交于
      The recent changes to keep gettimeofday in sync with xtime had the side
      effect that it was occasionally possible for the time reported by
      gettimeofday to go back by a microsecond.  There were two reasons:
      (1) when we recalculated the offsets used by gettimeofday every 2^31
      timebase ticks, we lost an accumulated fractional microsecond, and
      (2) because the update is done some time after the notional start of
      jiffy, if ntp is slowing the clock, it is possible to see time go backwards
      when the timebase factor gets reduced.
      
      This fixes it by (a) slowing the gettimeofday clock by about 1us in
      2^31 timebase ticks (a factor of less than 1 in 3.7 million), and (b)
      adjusting the timebase offsets in the rare case that the gettimeofday
      result could possibly go backwards (i.e. when ntp is slowing the clock
      and the timer interrupt is late).  In this case the adjustment will
      reduce to zero eventually because of (a).
      Signed-off-by: NPaul Mackerras <paulus@samba.org>
      0a45d449