1. 08 5月, 2014 1 次提交
  2. 28 1月, 2013 1 次提交
  3. 01 9月, 2012 1 次提交
  4. 12 10月, 2010 1 次提交
  5. 15 9月, 2010 1 次提交
    • T
      x86: hpet: Work around hardware stupidity · 54ff7e59
      Thomas Gleixner 提交于
      This more or less reverts commits 08be9796 (x86: Force HPET
      readback_cmp for all ATI chipsets) and 30a564be (x86, hpet: Restrict
      read back to affected ATI chipsets) to the status of commit 8da854cb
      (x86, hpet: Erratum workaround for read after write of HPET
      comparator).
      
      The delta to commit 8da854cb is mostly comments and the change from
      WARN_ONCE to printk_once as we know the call path of this function
      already.
      
      This needs really in depth explanation:
      
      First of all the HPET design is a complete failure. Having a counter
      compare register which generates an interrupt on matching values
      forces the software to do at least one superfluous readback of the
      counter register.
      
      While it is nice in theory to program "absolute" time events it is
      practically useless because the timer runs at some absurd frequency
      which can never be matched to real world units. So we are forced to
      calculate a relative delta and this forces a readout of the actual
      counter value, adding the delta and programming the compare
      register. When the delta is small enough we run into the danger that
      we program a compare value which is already in the past. Due to the
      compare for equal nature of HPET we need to read back the counter
      value after writing the compare rehgister (btw. this is necessary for
      absolute timeouts as well) to make sure that we did not miss the timer
      event. We try to work around that by setting the minimum delta to a
      value which is larger than the theoretical time which elapses between
      the counter readout and the compare register write, but that's only
      true in theory. A NMI or SMI which hits between the readout and the
      write can easily push us beyond that limit. This would result in
      waiting for the next HPET timer interrupt until the 32bit wraparound
      of the counter happens which takes about 306 seconds.
      
      So we designed the next event function to look like:
      
         match = read_cnt() + delta;
         write_compare_ref(match);
         return read_cnt() < match ? 0 : -ETIME;
      
      At some point we got into trouble with certain ATI chipsets. Even the
      above "safe" procedure failed. The reason was that the write to the
      compare register was delayed probably for performance reasons. The
      theory was that they wanted to avoid the synchronization of the write
      with the HPET clock, which is understandable. So the write does not
      hit the compare register directly instead it goes to some intermediate
      register which is copied to the real compare register in sync with the
      HPET clock. That opens another window for hitting the dreaded "wait
      for a wraparound" problem.
      
      To work around that "optimization" we added a read back of the compare
      register which either enforced the update of the just written value or
      just delayed the readout of the counter enough to avoid the issue. We
      unfortunately never got any affirmative info from ATI/AMD about this.
      
      One thing is sure, that we nuked the performance "optimization" that
      way completely and I'm pretty sure that the result is worse than
      before some HW folks came up with those.
      
      Just for paranoia reasons I added a check whether the read back
      compare register value was the same as the value we wrote right
      before. That paranoia check triggered a couple of years after it was
      added on an Intel ICH9 chipset. Venki added a workaround (commit
      8da854cb) which was reading the compare register twice when the first
      check failed. We considered this to be a penalty in general and
      restricted the readback (thus the wasted CPU cycles) to the known to
      be affected ATI chipsets.
      
      This turned out to be a utterly wrong decision. 2.6.35 testers
      experienced massive problems and finally one of them bisected it down
      to commit 30a564be which spured some further investigation.
      
      Finally we got confirmation that the write to the compare register can
      be delayed by up to two HPET clock cycles which explains the problems
      nicely. All we can do about this is to go back to Venki's initial
      workaround in a slightly modified version.
      
      Just for the record I need to say, that all of this could have been
      avoided if hardware designers and of course the HPET committee would
      have thought about the consequences for a split second. It's out of my
      comprehension why designing a working timer is so hard. There are two
      ways to achieve it:
      
       1) Use a counter wrap around aware compare_reg <= counter_reg
          implementation instead of the easy compare_reg == counter_reg
      
          Downsides:
      
      	- It needs more silicon.
      
      	- It needs a readout of the counter to apply a relative
      	  timeout. This is necessary as the counter does not run in
      	  any useful (and adjustable) frequency and there is no
      	  guarantee that the counter which is used for timer events is
      	  the same which is used for reading the actual time (and
      	  therefor for calculating the delta)
      
          Upsides:
      
      	- None
      
        2) Use a simple down counter for relative timer events
      
          Downsides:
      
      	- Absolute timeouts are not possible, which is not a problem
      	  at all in the context of an OS and the expected
      	  max. latencies/jitter (also see Downsides of #1)
      
         Upsides:
      
      	- It needs less or equal silicon.
      
      	- It works ALWAYS
      
      	- It is way faster than a compare register based solution (One
      	  write versus one write plus at least one and up to four
      	  reads)
      
      I would not be so grumpy about all of this, if I would not have been
      ignored for many years when pointing out these flaws to various
      hardware folks. I really hate timers (at least those which seem to be
      designed by janitors).
      
      Though finally we got a reasonable explanation plus a solution and I
      want to thank all the folks involved in chasing it down and providing
      valuable input to this.
      Bisected-by: NNix <nix@esperi.org.uk>
      Reported-by: NArtur Skawina <art.08.09@gmail.com>
      Reported-by: NDamien Wyart <damien.wyart@free.fr>
      Reported-by: NJohn Drescher <drescherjm@gmail.com>
      Cc: Venkatesh Pallipadi <venki@google.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Arjan van de Ven <arjan@linux.intel.com>
      Cc: Andreas Herrmann <andreas.herrmann3@amd.com>
      Cc: Borislav Petkov <borislav.petkov@amd.com>
      Cc: stable@kernel.org
      Acked-by: NSuresh Siddha <suresh.b.siddha@intel.com>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      54ff7e59
  6. 29 4月, 2010 1 次提交
  7. 23 1月, 2010 1 次提交
  8. 28 8月, 2009 1 次提交
  9. 22 8月, 2009 1 次提交
    • J
      x86, hpet: Simplify the HPET code · 5946fa3d
      Jan Beulich 提交于
      On 64-bits, using unsigned long when unsigned int suffices
      needlessly creates larger code (due to the need for REX
      prefixes), and most of the logic in hpet.c really doesn't need
      64-bit operations.
      
      At once this avoids the need for a couple of type casts.
      Signed-off-by: NJan Beulich <jbeulich@novell.com>
      Cc: Shaohua Li <shaohua.li@intel.com>
      Cc: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
      LKML-Reference: <4A8BC9780200007800010832@vpn.id2.novell.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      5946fa3d
  10. 23 10月, 2008 2 次提交
  11. 16 10月, 2008 1 次提交
  12. 23 7月, 2008 1 次提交
    • V
      x86: consolidate header guards · 77ef50a5
      Vegard Nossum 提交于
      This patch is the result of an automatic script that consolidates the
      format of all the headers in include/asm-x86/.
      
      The format:
      
      1. No leading underscore. Names with leading underscores are reserved.
      2. Pathname components are separated by two underscores. So we can
         distinguish between mm_types.h and mm/types.h.
      3. Everything except letters and numbers are turned into single
         underscores.
      Signed-off-by: NVegard Nossum <vegard.nossum@gmail.com>
      77ef50a5
  13. 09 7月, 2008 1 次提交
    • A
      x86: merge tsc calibration · bfc0f594
      Alok Kataria 提交于
      Merge the tsc calibration code for the 32bit and 64bit kernel.
      The paravirtualized calculate_cpu_khz for 64bit now points to the correct
      tsc_calibrate code as in 32bit.
      Original native_calculate_cpu_khz for 64 bit is now called as calibrate_cpu.
      
      Also moved the recalibrate_cpu_khz function in the common file.
      Note that this function is called only from powernow K7 cpu freq driver.
      Signed-off-by: NAlok N Kataria <akataria@vmware.com>
      Signed-off-by: NDan Hecht <dhecht@vmware.com>
      Cc: Dan Hecht <dhecht@vmware.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      bfc0f594
  14. 30 1月, 2008 2 次提交
    • B
      x86, rtc: make CONFIG_HPET_EMULATE_RTC usable from modules · 1bdbdaac
      Bernhard Walle 提交于
      enabled, then interrupts don't work for the rtc-cmos driver which results in
      RTC_AIE*, RTC_PIE* and RTC_ALM being unusable.  This affects hwclock from
      util-linux-ng at least on i386 since that uses RTC_PIE_ON.  (For x86-64, a
      polling method is used for unknown reasons.)
      
      This patch series now
      
        1. export the functions from arch/x86/kernel/hpet.c that the old char/rtc
           driver uses to work around that problem,
      
        2. makes it possible to compile the old rtc driver as module, while still
           having CONFIG_HPET_EMULATE_RTC enabled and
      
        3. makes use of the exported functions in (1) in the new rtc-cmos driver.
      
      This patch:
      
      This patch makes the RTC emulation functions in arch/x86/kernel/hpet.c usable
      for kernel modules. It
      
        - exports the functions (EXPORT_SYMBOL_GPL()),
        - adds an interface to register the interrupt callback function
          instead of using only a fixed callback function and
        - replaces the rtc_get_rtc_time() function which depends on
          CONFIG_RTC with a call to get_rtc_time() which is defined in
          include/asm-generic/rtc.h.
      
      The only dependency to CONFIG_RTC is the call to rtc_interrupt() which is
      removed by the next patch. After this, there's no (code) dependency of
      this functions to CONFIG_RTC=y any more.
      Signed-off-by: NBernhard Walle <bwalle@suse.de>
      Cc: Alessandro Zummo <a.zummo@towertech.it>
      Cc: David Brownell <david-b@pacbell.net>
      Cc: Andi Kleen <ak@suse.de>
      Cc: john stultz <johnstul@us.ibm.com>
      Cc: Robert Picco <Robert.Picco@hp.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      1bdbdaac
    • I
      x86: offer is_hpet_enabled() on !CONFIG_HPET_TIMER too · df619e6b
      Ingo Molnar 提交于
      offer is_hpet_enabled() on !CONFIG_HPET_TIMER too.
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      df619e6b
  15. 04 12月, 2007 1 次提交
  16. 20 10月, 2007 2 次提交
  17. 13 10月, 2007 5 次提交
  18. 11 10月, 2007 1 次提交