1. 19 8月, 2009 1 次提交
    • T
      clocksource: Protect the watchdog rating changes with clocksource_mutex · d0981a1b
      Thomas Gleixner 提交于
      Martin pointed out that commit 6ea41d2529 (clocksource: Call
      clocksource_change_rating() outside of watchdog_lock) has a
      theoretical reference count problem. The calls to
      clocksource_change_rating() are now done outside of the clocksource
      mutex and outside of the watchdog lock. A concurrent
      clocksource_unregister() could remove the clock.
      
      Split out the code which changes the rating from
      clocksource_change_rating() into __clocksource_change_rating().
      
      Protect the clocksource_watchdog_work() code sequence with the
      clocksource_mutex() and call __clocksource_change_rating().
      
      LKML-Reference: <alpine.LFD.2.00.0908171038420.2782@localhost.localdomain>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      d0981a1b
  2. 15 8月, 2009 8 次提交
  3. 19 7月, 2009 1 次提交
  4. 13 6月, 2009 1 次提交
  5. 11 6月, 2009 1 次提交
  6. 02 5月, 2009 1 次提交
    • M
      clocksource: setup mult_orig in clocksource_enable() · a25cbd04
      Magnus Damm 提交于
      Setup clocksource mult_orig in clocksource_enable().
      
      Clocksource drivers can save power by using keeping the
      device clock disabled while the clocksource is unused.
      
      In practice this means that the enable() and disable()
      callbacks perform clk_enable() and clk_disable().
      
      The enable() callback may also use clk_get_rate() to get
      the clock rate from the clock framework. This information
      can then be used to calculate the shift and mult variables.
      
      Currently the mult_orig variable is setup from mult at
      registration time only. This is conflicting with the above
      case since the clock is disabled and the mult variable is
      not yet calculated at the time of registration.
      
      Moving the mult_orig setup code to clocksource_enable()
      allows us to both handle the common case with no enable()
      callback and the mult-changed-after-enable() case.
      
      [ Impact: allow dynamic clock source usage ]
      Signed-off-by: NMagnus Damm <damm@igel.co.jp>
      LKML-Reference: <20090501054546.8193.10688.sendpatchset@rx1.opensource.se>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      a25cbd04
  7. 22 4月, 2009 1 次提交
  8. 16 2月, 2009 1 次提交
    • P
      clocksource: allow usage independent of timekeeping.c · a038a353
      Patrick Ohly 提交于
      So far struct clocksource acted as the interface between time/timekeeping.c
      and hardware. This patch generalizes the concept so that a similar
      interface can also be used in other contexts. For that it introduces
      new structures and related functions *without* touching the existing
      struct clocksource.
      
      The reasons for adding these new structures to clocksource.[ch] are
      * the APIs are clearly related
      * struct clocksource could be cleaned up to use the new structs
      * avoids proliferation of files with similar names (timesource.h?
        timecounter.h?)
      
      As outlined in the discussion with John Stultz, this patch adds
      * struct cyclecounter: stateless API to hardware which counts clock cycles
      * struct timecounter: stateful utility code built on a cyclecounter which
        provides a nanosecond counter
      * only the function to read the nanosecond counter; deltas are used internally
        and not exposed to users of timecounter
      
      The code does no locking of the shared state. It must be called at least
      as often as the cycle counter wraps around to detect these wrap arounds.
      Both is the responsibility of the timecounter user.
      Acked-by: NJohn Stultz <johnstul@us.ibm.com>
      Signed-off-by: NPatrick Ohly <patrick.ohly@intel.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      a038a353
  9. 01 1月, 2009 2 次提交
  10. 21 8月, 2008 1 次提交
    • J
      clocksource: keep track of original clocksource frequency · 1aa5dfb7
      John Stultz 提交于
      The clocksource frequency is represented by
      clocksource->mult/2^(clocksource->shift).  Currently, when NTP makes
      adjustments to the clock frequency, they are made directly to the mult
      value.
      
      This has the drawback that once changed, we cannot know what the orignal
      mult value was, or how much adjustment has been applied.
      
      This property causes problems in calculating proper ntp intervals when
      switching back and forth between clocksources.
      
      This patch separates the current mult value into a mult and mult_orig
      pair.  The mult_orig value stays constant, while the ntp clocksource
      adjustments are done only to the mult value.
      
      This allows for correct ntp interval calculation and additionally lays the
      groundwork for a new notion of time, what I'm calling the monotonic-raw
      time, which is introduced in a following patch.
      Signed-off-by: NJohn Stultz <johnstul@us.ibm.com>
      Signed-off-by: NRoman Zippel <zippel@linux-m68k.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      1aa5dfb7
  11. 22 7月, 2008 1 次提交
    • A
      sysdev: Pass the attribute to the low level sysdev show/store function · 4a0b2b4d
      Andi Kleen 提交于
      This allow to dynamically generate attributes and share show/store
      functions between attributes. Right now most attributes are generated
      by special macros and lots of duplicated code. With the attribute
      passed it's instead possible to attach some data to the attribute
      and then use that in shared low level functions to do different things.
      
      I need this for the dynamically generated bank attributes in the x86
      machine check code, but it'll allow some further cleanups.
      
      I converted all users in tree to the new show/store prototype. It's a single
      huge patch to avoid unbisectable sections.
      
      Runtime tested: x86-32, x86-64
      Compiled only: ia64, powerpc
      Not compile tested/only grep converted: sh, arm, avr32
      Signed-off-by: NAndi Kleen <ak@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      4a0b2b4d
  12. 24 5月, 2008 1 次提交
  13. 04 5月, 2008 2 次提交
  14. 18 4月, 2008 1 次提交
  15. 17 4月, 2008 1 次提交
  16. 26 3月, 2008 1 次提交
  17. 20 3月, 2008 1 次提交
  18. 09 2月, 2008 1 次提交
  19. 07 2月, 2008 1 次提交
    • M
      time: fix sysfs_show_{available,current}_clocksources() buffer overflow problem · 5e2cb101
      Miao Xie 提交于
      I found that there is a buffer overflow problem in the following code.
      
      Version:	2.6.24-rc2,
      File:		kernel/time/clocksource.c:417-432
      --------------------------------------------------------------------
      static ssize_t
      sysfs_show_available_clocksources(struct sys_device *dev, char *buf)
      {
      	struct clocksource *src;
      	char *curr = buf;
      
      	spin_lock_irq(&clocksource_lock);
      	list_for_each_entry(src, &clocksource_list, list) {
      		curr += sprintf(curr, "%s ", src->name);
      	}
      	spin_unlock_irq(&clocksource_lock);
      
      	curr += sprintf(curr, "\n");
      
      	return curr - buf;
      }
      -----------------------------------------------------------------------
      
      sysfs_show_current_clocksources() also has the same problem though in practice
      the size of current clocksource's name won't exceed PAGE_SIZE.
      
      I fix the bug by using snprintf according to the specification of the kernel
      (Version:2.6.24-rc2,File:Documentation/filesystems/sysfs.txt)
      
      Fix sysfs_show_available_clocksources() and sysfs_show_current_clocksources()
      buffer overflow problem with snprintf().
      Signed-off-by: NMiao Xie <miaox@cn.fujitsu.com>
      Cc: WANG Cong <xiyou.wangcong@gmail.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: john stultz <johnstul@us.ibm.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      5e2cb101
  20. 30 1月, 2008 3 次提交
  21. 25 1月, 2008 1 次提交
  22. 20 10月, 2007 1 次提交
  23. 15 5月, 2007 1 次提交
  24. 10 5月, 2007 2 次提交
  25. 26 3月, 2007 1 次提交
    • T
      [PATCH] clocksource: Fix thinko in watchdog selection · 948ac6d7
      Thomas Gleixner 提交于
      The watchdog implementation excludes low res / non continuous
      clocksources from being selected as a watchdog reference
      unintentionally.
      
      Allow using jiffies/PIT as a watchdog reference as long as no better
      clocksource is available. This is necessary to detect TSC breakage on
      systems, which have no pmtimer/hpet.
      
      The main goal of the initial patch (preventing to switch to highres/nohz
      when no reliable fallback clocksource is available) is still guaranteed
      by the checks in clocksource_watchdog().
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      948ac6d7
  26. 05 3月, 2007 1 次提交
    • J
      [PATCH] clocksource init adjustments (fix bug #7426) · 6bb74df4
      john stultz 提交于
      This patch resolves the issue found here:
      http://bugme.osdl.org/show_bug.cgi?id=7426
      
      The basic summary is:
      Currently we register most of i386/x86_64 clocksources at module_init
      time. Then we enable clocksource selection at late_initcall time. This
      causes some problems for drivers that use gettimeofday for init
      calibration routines (specifically the es1968 driver in this case),
      where durring module_init, the only clocksource available is the low-res
      jiffies clocksource. This may cause slight calibration errors, due to
      the small sampling time used.
      
      It should be noted that drivers that require fine grained time may not
      function on architectures that do not have better then jiffies
      resolution timekeeping (there are a few). However, this does not
      discount the reasonable need for such fine-grained timekeeping at init
      time.
      
      Thus the solution here is to register clocksources earlier (ideally when
      the hardware is being initialized), and then we enable clocksource
      selection at fs_initcall (before device_initcall).
      
      This patch should probably get some testing time in -mm, since
      clocksource selection is one of the most important issues for correct
      timekeeping, and I've only been able to test this on a few of my own
      boxes.
      Signed-off-by: NJohn Stultz <johnstul@us.ibm.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: "David S. Miller" <davem@davemloft.net>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      6bb74df4
  27. 17 2月, 2007 2 次提交