06 Feb, 2014

1 commit

  • When compiling for the IA-64 ski emulator, HZ is set to 32 because the
    emulation is slow and we don't want to waste too many cycles processing
    timers. Alpha also has an option to set HZ to 32.

    This causes integer underflow in
    kernel/time/jiffies.c:
    kernel/time/jiffies.c:66:2: warning: large integer implicitly truncated to unsigned type [-Woverflow]
    .mult = NSEC_PER_JIFFY << JIFFIES_SHIFT, /* details above */
    ^

    This patch reduces the JIFFIES_SHIFT value to avoid the overflow.

    Signed-off-by: Mikulas Patocka
    Link: http://lkml.kernel.org/r/alpine.LRH.2.02.1401241639100.23871@file01.intranet.prod.int.rdu2.redhat.com
    Cc: stable@vger.kernel.org
    Signed-off-by: Thomas Gleixner

    Mikulas Patocka
     

14 Nov, 2012

2 commits

  • Now that timekeeping is protected by its own locks, rename
    the xtime_lock to jifffies_lock to better describe what it
    protects.

    CC: Thomas Gleixner
    CC: Eric Dumazet
    CC: Richard Cochran
    Signed-off-by: John Stultz

    John Stultz
     
  • Commit f1b8274 ("clocksource: Cleanup clocksource selection") removed all
    external references to clocksource_jiffies so there is no need to have the
    symbol globally visible.

    Fixes the following sparse warning:
    CHECK kernel/time/jiffies.c kernel/time/jiffies.c:61:20: warning: symbol 'clocksource_jiffies' was not declared. Should it be static?

    Signed-off-by: Lars-Peter Clausen
    Signed-off-by: John Stultz

    Lars-Peter Clausen
     

25 Sep, 2012

1 commit

  • CLOCK_TICK_RATE is used to accurately caclulate exactly how
    a tick will be at a given HZ.

    This is useful, because while we'd expect NSEC_PER_SEC/HZ,
    the underlying hardware will have some granularity limit,
    so we won't be able to have exactly HZ ticks per second.

    This slight error can cause timekeeping quality problems
    when using the jiffies or other jiffies driven clocksources.
    Thus we currently use compile time CLOCK_TICK_RATE value to
    generate SHIFTED_HZ and NSEC_PER_JIFFIES, which we then use
    to adjust the jiffies clocksource to correct this error.

    Unfortunately though, since CLOCK_TICK_RATE is a compile
    time value, and the jiffies clocksource is registered very
    early during boot, there are a number of cases where there
    are different possible hardware timers that have different
    tick rates. This causes problems in cases like ARM where
    there are numerous different types of hardware, each having
    their own compile-time CLOCK_TICK_RATE, making it hard to
    accurately support different hardware with a single kernel.

    For the most part, this doesn't matter all that much, as not
    too many systems actually utilize the jiffies or jiffies driven
    clocksource. Usually there are other highres clocksources
    who's granularity error is negligable.

    Even so, we have some complicated calcualtions that we do
    everywhere to handle these edge cases.

    This patch removes the compile time SHIFTED_HZ value, and
    introduces a register_refined_jiffies() function. This results
    in the default jiffies clock as being assumed a perfect HZ
    freq, and allows archtectures that care about jiffies accuracy
    to call register_refined_jiffies() with the tick rate, specified
    dynamically at boot.

    This allows us, where necessary, to not have a compile time
    CLOCK_TICK_RATE constant, simplifies the jiffies code, and
    still provides a way to have an accurate jiffies clock.

    NOTE: Since this patch does not add register_refinied_jiffies()
    calls for every arch, it may cause time quality regressions
    in some cases. Its likely these will not be noticable, but
    if they are an issue, adding the following to the end of
    setup_arch() should resolve the regression:
    register_refinied_jiffies(CLOCK_TICK_RATE)

    Cc: Catalin Marinas
    Cc: Arnd Bergmann
    Cc: Richard Cochran
    Cc: Prarit Bhargava
    Cc: Thomas Gleixner
    Signed-off-by: John Stultz

    John Stultz
     

31 Jul, 2012

1 commit

  • Ingo noted that ACTHZ is a confusing name, and requested it
    be renamed, so this patch renames ACTHZ to SHIFTED_HZ to
    better describe it.

    Signed-off-by: John Stultz
    Cc: Prarit Bhargava
    Link: http://lkml.kernel.org/r/1343414893-45779-3-git-send-email-john.stultz@linaro.org
    Signed-off-by: Ingo Molnar

    John Stultz
     

31 Mar, 2011

1 commit


01 Feb, 2011

1 commit

  • All callers of do_timer() are converted to xtime_update(). The only
    users of xtime_lock are in kernel/time/. Make both local to
    kernel/time/ and remove them from the global header files.

    [ tglx: Reuse tick-internal.h instead of creating another local header
    file. Massaged changelog ]

    Signed-off-by: Torben Hohn
    Cc: Peter Zijlstra
    Cc: johnstul@us.ibm.com
    Cc: yong.zhang0@gmail.com
    Cc: hch@infradead.org
    Signed-off-by: Thomas Gleixner

    Torben Hohn
     

31 Jan, 2011

1 commit


15 Aug, 2009

1 commit

  • If a non high-resolution clocksource is first set as override clock
    and then registered it becomes active even if the system is in one-shot
    mode. Move the override check from sysfs_override_clocksource to the
    clocksource selection. That fixes the bug and simplifies the code. The
    check in clocksource_register for double registration of the same
    clocksource is removed without replacement.

    To find the initial clocksource a new weak function in jiffies.c is
    defined that returns the jiffies clocksource. The architecture code
    can then override the weak function with a more suitable clocksource,
    e.g. the TOD clock on s390.

    [ tglx: Folded in a fix from John Stultz ]

    Signed-off-by: Martin Schwidefsky
    Acked-by: John Stultz
    Cc: Daniel Walker
    LKML-Reference:
    Signed-off-by: Thomas Gleixner

    Martin Schwidefsky
     

22 Apr, 2009

1 commit

  • Pass clocksource pointer to the read() callback for clocksources. This
    allows us to share the callback between multiple instances.

    [hugh@veritas.com: fix powerpc build of clocksource pass clocksource mods]
    [akpm@linux-foundation.org: cleanup]
    Signed-off-by: Magnus Damm
    Acked-by: John Stultz
    Cc: Thomas Gleixner
    Signed-off-by: Hugh Dickins
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Magnus Damm
     

06 Jan, 2009

1 commit


21 Aug, 2008

1 commit

  • 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: John Stultz
    Signed-off-by: Roman Zippel
    Signed-off-by: Andrew Morton
    Signed-off-by: Ingo Molnar

    John Stultz
     

05 Apr, 2007

1 commit

  • In debugging a problem w/ the -rt tree, I noticed that on systems that mark
    the tsc as unstable before it is registered, the TSC would still be
    selected and used for a short period of time. Digging in it looks to be a
    result of the mix of the clocksource list changes and my clocksource
    initialization changes.

    With the -rt tree, using a bad TSC, even for a short period of time can
    results in a hang at boot. I was not able to reproduce this hang w/
    mainline, but I'm not completely certain that someone won't trip on it.

    This patch resolves the issue by initializing the jiffies clocksource
    earlier so a bad TSC won't get selected just because nothing else is yet
    registered.

    Signed-off-by: John Stultz
    Acked-by: Thomas Gleixner
    Cc: Ingo Molnar
    Cc: Andi Kleen
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    john stultz
     

17 Feb, 2007

1 commit

  • Using a flag filed allows to encode more than one information into a variable.
    Preparatory patch for the generic clocksource verification.

    [mingo@elte.hu: convert vmitime.c to the new clocksource flag]
    Signed-off-by: Thomas Gleixner
    Signed-off-by: Ingo Molnar
    Cc: john stultz
    Cc: Roman Zippel
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Thomas Gleixner
     

17 Oct, 2006

1 commit

  • Avoid possible PIT livelock issues seen on SMP systems (and reported by
    Andi), by not allowing it as a clocksource on SMP boxes.

    However, since the PIT may no longer be present, we have to properly handle
    the cases where SMP systems have TSC skew and fall back from the TSC.
    Since the PIT isn't there, it would "fall back" to the TSC again. So this
    changes the jiffies rating to 1, and the TSC-bad rating value to 0.

    Thus you will get the following behavior priority on i386 systems:

    tsc [if present & stable]
    hpet [if present]
    cyclone [if present]
    acpi_pm [if present]
    pit [if UP]
    jiffies

    Rather then the current more complicated:
    tsc [if present & stable]
    hpet [if present]
    cyclone [if present]
    acpi_pm [if present]
    pit [if cpus < 4]
    tsc [if present & unstable]
    jiffies

    Signed-off-by: John Stultz
    Cc: Andi Kleen
    Cc: Ingo Molnar
    Cc: Thomas Gleixner
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    john stultz
     

27 Jun, 2006

2 commits

  • As suggested by Roman Zippel, change clocksource functions to use
    clocksource_xyz rather then xyz_clocksource to avoid polluting the
    namespace.

    Signed-off-by: John Stultz
    Cc: Roman Zippel
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    john stultz
     
  • This introduces the clocksource management infrastructure. A clocksource is a
    driver-like architecture generic abstraction of a free-running counter. This
    code defines the clocksource structure, and provides management code for
    registering, selecting, accessing and scaling clocksources.

    Additionally, this includes the trivial jiffies clocksource, a lowest common
    denominator clocksource, provided mainly for use as an example.

    [hirofumi@mail.parknet.co.jp: Don't enable IRQ too early]
    Signed-off-by: John Stultz
    Signed-off-by: Ingo Molnar
    Signed-off-by: Paul Mundt
    Signed-off-by: John Stultz
    Signed-off-by: OGAWA Hirofumi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    john stultz