01 Jul, 2015

1 commit

  • time.o gets rebuilt unconditionally due to a leftover Makefile rule
    which was placed there for development purposes.

    Remove it along with the commented out always rule in the toplevel
    Kbuild file.

    Fixes: 0a227985d4a9 'time: Move timeconst.h into include/generated'
    Reported-by; Stephen Boyd
    Signed-off-by: Thomas Gleixner
    Cc: Nicholas Mc Guire

    Thomas Gleixner
     

19 May, 2015

1 commit

  • kernel/time/timeconst.h is moved to include/generated/ and generated
    by the top level Kbuild. This allows using timeconst.h in an earlier
    build stage.

    Signed-off-by: Nicholas Mc Guire
    Cc: Masahiro Yamada
    Cc: Sam Ravnborg
    Cc: Joe Perches
    Cc: John Stultz
    Cc: Andrew Hunter
    Cc: Paul Turner
    Cc: Michal Marek
    Link: http://lkml.kernel.org/r/1431951554-5563-1-git-send-email-hofrat@osadl.org
    Signed-off-by: Thomas Gleixner

    Nicholas Mc Guire
     

01 Apr, 2015

1 commit

  • This option was for simpler migration to the clock events code.
    Most architectures have been converted and the option has been
    disfunctional as a standalone option for quite some time. Remove
    it.

    Signed-off-by: Thomas Gleixner
    Signed-off-by: Rafael J. Wysocki
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/5021859.jl9OC1medj@vostro.rjw.lan
    Signed-off-by: Ingo Molnar

    Thomas Gleixner
     

31 Dec, 2014

1 commit


22 Nov, 2014

1 commit

  • Kees requested that this test module be renamed for consistency sake,
    so this patch renames the udelay_test.c file (recently added to
    tip/timers/core for 3.17) to test_udelay.c

    Cc: Kees Cook
    Cc: Greg KH
    Cc: Stephen Rothwell
    Cc: Thomas Gleixner
    Cc: Ingo Molnar
    Cc: Linux-Next
    Cc: David Riley
    Signed-off-by: John Stultz

    John Stultz
     

24 Jul, 2014

1 commit

  • Create a module that allows udelay() to be executed to ensure that
    it is delaying at least as long as requested (with a little bit of
    error allowed).

    There are some configurations which don't have reliably udelay
    due to using a loop delay with cpufreq changes which should use
    a counter time based delay instead. This test aims to identify
    those configurations where timing is unreliable.

    Signed-off-by: David Riley
    Signed-off-by: John Stultz

    David Riley
     

23 Jun, 2014

1 commit


09 Feb, 2014

1 commit

  • The hrtimer mode of broadcast is supported only when
    GENERIC_CLOCKEVENTS_BROADCAST and TICK_ONESHOT config options
    are enabled. Hence compile in the functions for hrtimer mode
    of broadcast only when these options are selected.
    Also fix max_delta_ticks value for the pseudo clock device.

    Reported-by: Fengguang Wu
    Reported-by: Ingo Molnar
    Signed-off-by: Preeti U Murthy
    Link: http://lkml.kernel.org/r/52F719EE.9010304@linux.vnet.ibm.com
    Signed-off-by: Thomas Gleixner

    Preeti U Murthy
     

07 Feb, 2014

1 commit

  • On some architectures, in certain CPU deep idle states the local timers stop.
    An external clock device is used to wakeup these CPUs. The kernel support for the
    wakeup of these CPUs is provided by the tick broadcast framework by using the
    external clock device as the wakeup source.

    However not all implementations of architectures provide such an external
    clock device. This patch includes support in the broadcast framework to handle
    the wakeup of the CPUs in deep idle states on such systems by queuing a hrtimer
    on one of the CPUs, which is meant to handle the wakeup of CPUs in deep idle states.

    This patchset introduces a pseudo clock device which can be registered by the
    archs as tick_broadcast_device in the absence of a real external clock
    device. Once registered, the broadcast framework will work as is for these
    architectures as long as the archs take care of the BROADCAST_ENTER
    notification failing for one of the CPUs. This CPU is made the stand by CPU to
    handle wakeup of the CPUs in deep idle and it *must not enter deep idle states*.

    The CPU with the earliest wakeup is chosen to be this CPU. Hence this way the
    stand by CPU dynamically moves around and so does the hrtimer which is queued
    to trigger at the next earliest wakeup time. This is consistent with the case where
    an external clock device is present. The smp affinity of this clock device is
    set to the CPU with the earliest wakeup. This patchset handles the hotplug of
    the stand by CPU as well by moving the hrtimer on to the CPU handling the CPU_DEAD
    notification.

    Originally-from: Thomas Gleixner
    Signed-off-by: Preeti U Murthy
    Cc: deepthi@linux.vnet.ibm.com
    Cc: paulmck@linux.vnet.ibm.com
    Cc: fweisbec@gmail.com
    Cc: paulus@samba.org
    Cc: srivatsa.bhat@linux.vnet.ibm.com
    Cc: svaidy@linux.vnet.ibm.com
    Cc: peterz@infradead.org
    Cc: benh@kernel.crashing.org
    Cc: rafael.j.wysocki@intel.com
    Cc: linuxppc-dev@lists.ozlabs.org
    Link: http://lkml.kernel.org/r/20140207080632.17187.80532.stgit@preeti.in.ibm.com
    Signed-off-by: Thomas Gleixner

    Preeti U Murthy
     

13 Jun, 2013

1 commit


30 May, 2013

1 commit

  • Below is a patch from android kernel that maintains a histogram of
    suspend times. Please review and provide feedback.

    Statistices on the time spent in suspend are kept in
    /sys/kernel/debug/sleep_time.

    Cc: Android Kernel Team
    Cc: Colin Cross
    Cc: Todd Poynor
    Cc: San Mehat
    Cc: Benoit Goby
    Cc: John Stultz
    Cc: Thomas Gleixner
    Signed-off-by: Colin Cross
    Signed-off-by: Todd Poynor
    [zoran.markovic@linaro.org: Re-formatted suspend time table to better
    fit expected values. Moved accounting of suspend time into timekeeping
    core. Removed CONFIG_SUSPEND_TIME flag and made the feature conditional
    on CONFIG_DEBUG_FS. Changed the file name to sleep_time to better fit
    terminology in timekeeping core. Changed seq_printf to seq_puts. Tweaked
    commit message]
    Signed-off-by: Zoran Markovic
    Signed-off-by: John Stultz

    Colin Cross
     

01 Nov, 2012

1 commit

  • This patch removes the timecompare code from the kernel. The top five
    reasons to do this are:

    1. There are no more users of this code.
    2. The original idea was a bit weak.
    3. The original author has disappeared.
    4. The code was not general purpose but tuned to a particular hardware,
    5. There are better ways to accomplish clock synchronization.

    Signed-off-by: Richard Cochran
    Acked-by: John Stultz
    Tested-by: Bob Liu
    Signed-off-by: David S. Miller

    Richard Cochran
     

27 Apr, 2011

1 commit

  • This provides the in kernel interface and infrastructure for
    alarm-timers.

    Alarm-timers are a hybrid style timer, similar to hrtimers,
    but when the system is suspended, the RTC device is set to
    fire and wake the system for when the soonest alarm-timer
    expires.

    The concept for Alarm-timers was inspired by the Android Alarm
    driver (by Arve Hjønnevåg) found in the Android kernel tree.

    See: http://android.git.kernel.org/?p=kernel/common.git;a=blob;f=drivers/rtc/alarm.c;h=1250edfbdf3302f5e4ea6194847c6ef4bb7beb1c;hb=android-2.6.36

    This in-kernel interface should be fairly compatible with the
    Android alarm driver in-kernel interface, but has the advantage
    of utilizing the new RTC timerqueue code instead of doing direct
    RTC manipulation.

    CC: Arve Hjønnevåg
    CC: Thomas Gleixner
    CC: Alessandro Zummo
    Acked-by: Arnd Bergmann
    Signed-off-by: John Stultz

    John Stultz
     

02 Feb, 2011

1 commit

  • This patch adds support for adding and removing posix clocks. The
    clock lifetime cycle is patterned after usb devices. Each clock is
    represented by a standard character device. In addition, the driver
    may optionally implement custom character device operations.

    The posix clock and timer system calls listed below now work with
    dynamic posix clocks, as well as the traditional static clocks.
    The following system calls are affected:

    - clock_adjtime (brand new syscall)
    - clock_gettime
    - clock_getres
    - clock_settime
    - timer_create
    - timer_delete
    - timer_gettime
    - timer_settime

    [ tglx: Adapted to the posix-timer cleanup. Moved clock_posix_dynamic
    to posix-clock.c and made all referenced functions static ]

    Signed-off-by: Richard Cochran
    Acked-by: John Stultz
    LKML-Reference:
    Signed-off-by: Thomas Gleixner

    Richard Cochran
     

24 Sep, 2009

1 commit

  • There are many similar code in kernel for one object: convert time between
    calendar time and broken-down time.

    Here is some source I found:
    fs/ncpfs/dir.c
    fs/smbfs/proc.c
    fs/fat/misc.c
    fs/udf/udftime.c
    fs/cifs/netmisc.c
    net/netfilter/xt_time.c
    drivers/scsi/ips.c
    drivers/input/misc/hp_sdc_rtc.c
    drivers/rtc/rtc-lib.c
    arch/ia64/hp/sim/boot/fw-emu.c
    arch/m68k/mac/misc.c
    arch/powerpc/kernel/time.c
    arch/parisc/include/asm/rtc.h
    ...

    We can make a common function for this type of conversion, At least we
    can get following benefit:

    1: Make kernel simple and unify
    2: Easy to fix bug in converting code
    3: Reduce clone of code in future
    For example, I'm trying to make ftrace display walltime,
    this patch will make me easy.

    This code is based on code from glibc-2.6

    Signed-off-by: Zhao Lei
    Cc: OGAWA Hirofumi
    Cc: Thomas Gleixner
    Cc: Ingo Molnar
    Cc: Pavel Machek
    Cc: Andi Kleen
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Zhaolei
     

16 Feb, 2009

1 commit

  • Mapping from a struct timecounter to a time returned by functions like
    ktime_get_real() is implemented. This is sufficient to use this code
    in a network device driver which wants to support hardware time
    stamping and transformation of hardware time stamps to system time.

    The interface could have been made more versatile by not depending on
    a time counter, but this wasn't done to avoid writing glue code
    elsewhere.

    The method implemented here is the one used and analyzed under the name
    "assisted PTP" in the LCI PTP paper:
    http://www.linuxclustersinstitute.org/conferences/archive/2008/PDF/Ohly_92221.pdf

    Acked-by: John Stultz
    Signed-off-by: Patrick Ohly
    Signed-off-by: David S. Miller

    Patrick Ohly
     

13 Oct, 2007

1 commit


09 May, 2007

1 commit

  • Move the timekeeping code out of kernel/timer.c and into
    kernel/time/timekeeping.c. I made no cleanups or other changes in transit.

    [akpm@linux-foundation.org: build fix]
    Signed-off-by: John Stultz
    Cc: Ingo Molnar
    Cc: Thomas Gleixner
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    john stultz
     

17 Feb, 2007

6 commits

  • add /proc/timer_list, which prints all currently pending (high-res) timers,
    all clock-event sources and their parameters in a human-readable form.

    Sample output:

    Timer List Version: v0.1
    HRTIMER_MAX_CLOCK_BASES: 2
    now at 4246046273872 nsecs

    cpu: 0
    clock 0:
    .index: 0
    .resolution: 1 nsecs
    .get_time: ktime_get_real
    .offset: 1273998312645738432 nsecs
    active timers:
    clock 1:
    .index: 1
    .resolution: 1 nsecs
    .get_time: ktime_get
    .offset: 0 nsecs
    active timers:
    #0: , hrtimer_sched_tick, hrtimer_stop_sched_tick, swapper/0
    # expires at 4246432689566 nsecs [in 386415694 nsecs]
    #1: , hrtimer_wakeup, do_nanosleep, pcscd/2050
    # expires at 4247018194689 nsecs [in 971920817 nsecs]
    #2: , hrtimer_wakeup, do_nanosleep, irqbalance/1909
    # expires at 4247351358392 nsecs [in 1305084520 nsecs]
    #3: , hrtimer_wakeup, do_nanosleep, crond/2157
    # expires at 4249097614968 nsecs [in 3051341096 nsecs]
    #4: , it_real_fn, do_setitimer, syslogd/1888
    # expires at 4251329900926 nsecs [in 5283627054 nsecs]
    .expires_next : 4246432689566 nsecs
    .hres_active : 1
    .check_clocks : 0
    .nr_events : 31306
    .idle_tick : 4246020791890 nsecs
    .tick_stopped : 1
    .idle_jiffies : 986504
    .idle_calls : 40700
    .idle_sleeps : 36014
    .idle_entrytime : 4246019418883 nsecs
    .idle_sleeptime : 4178181972709 nsecs

    cpu: 1
    clock 0:
    .index: 0
    .resolution: 1 nsecs
    .get_time: ktime_get_real
    .offset: 1273998312645738432 nsecs
    active timers:
    clock 1:
    .index: 1
    .resolution: 1 nsecs
    .get_time: ktime_get
    .offset: 0 nsecs
    active timers:
    #0: , hrtimer_sched_tick, hrtimer_restart_sched_tick, swapper/0
    # expires at 4246050084568 nsecs [in 3810696 nsecs]
    #1: , hrtimer_wakeup, do_nanosleep, atd/2227
    # expires at 4261010635003 nsecs [in 14964361131 nsecs]
    #2: , hrtimer_wakeup, do_nanosleep, smartd/2332
    # expires at 5469485798970 nsecs [in 1223439525098 nsecs]
    .expires_next : 4246050084568 nsecs
    .hres_active : 1
    .check_clocks : 0
    .nr_events : 24043
    .idle_tick : 4246046084568 nsecs
    .tick_stopped : 0
    .idle_jiffies : 986510
    .idle_calls : 26360
    .idle_sleeps : 22551
    .idle_entrytime : 4246043874339 nsecs
    .idle_sleeptime : 4170763761184 nsecs

    tick_broadcast_mask: 00000003
    event_broadcast_mask: 00000001

    CPU#0's local event device:

    Clock Event Device: lapic
    capabilities: 0000000e
    max_delta_ns: 807385544
    min_delta_ns: 1443
    mult: 44624025
    shift: 32
    set_next_event: lapic_next_event
    set_mode: lapic_timer_setup
    event_handler: hrtimer_interrupt
    .installed: 1
    .expires: 4246432689566 nsecs

    CPU#1's local event device:

    Clock Event Device: lapic
    capabilities: 0000000e
    max_delta_ns: 807385544
    min_delta_ns: 1443
    mult: 44624025
    shift: 32
    set_next_event: lapic_next_event
    set_mode: lapic_timer_setup
    event_handler: hrtimer_interrupt
    .installed: 1
    .expires: 4246050084568 nsecs

    Clock Event Device: hpet
    capabilities: 00000007
    max_delta_ns: 2147483647
    min_delta_ns: 3352
    mult: 61496110
    shift: 32
    set_next_event: hpet_next_event
    set_mode: hpet_set_mode
    event_handler: handle_nextevt_broadcast

    Signed-off-by: Ingo Molnar
    Signed-off-by: Thomas Gleixner
    Cc: john stultz
    Cc: Roman Zippel
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ingo Molnar
     
  • Add /proc/timer_stats support: debugging feature to profile timer expiration.
    Both the starting site, process/PID and the expiration function is captured.
    This allows the quick identification of timer event sources in a system.

    Sample output:

    # echo 1 > /proc/timer_stats
    # cat /proc/timer_stats
    Timer Stats Version: v0.1
    Sample period: 4.010 s
    24, 0 swapper hrtimer_stop_sched_tick (hrtimer_sched_tick)
    11, 0 swapper sk_reset_timer (tcp_delack_timer)
    6, 0 swapper hrtimer_stop_sched_tick (hrtimer_sched_tick)
    2, 1 swapper queue_delayed_work_on (delayed_work_timer_fn)
    17, 0 swapper hrtimer_restart_sched_tick (hrtimer_sched_tick)
    2, 1 swapper queue_delayed_work_on (delayed_work_timer_fn)
    4, 2050 pcscd do_nanosleep (hrtimer_wakeup)
    5, 4179 sshd sk_reset_timer (tcp_write_timer)
    4, 2248 yum-updatesd schedule_timeout (process_timeout)
    18, 0 swapper hrtimer_restart_sched_tick (hrtimer_sched_tick)
    3, 0 swapper sk_reset_timer (tcp_delack_timer)
    1, 1 swapper neigh_table_init_no_netlink (neigh_periodic_timer)
    2, 1 swapper e1000_up (e1000_watchdog)
    1, 1 init schedule_timeout (process_timeout)
    100 total events, 25.24 events/sec

    [ cleanups and hrtimers support from Thomas Gleixner ]
    [bunk@stusta.de: nr_entries can become static]
    Signed-off-by: Ingo Molnar
    Signed-off-by: Thomas Gleixner
    Cc: john stultz
    Cc: Roman Zippel
    Cc: Andi Kleen
    Signed-off-by: Adrian Bunk
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ingo Molnar
     
  • With Ingo Molnar

    Add functions to provide dynamic ticks and high resolution timers. The code
    which keeps track of jiffies and handles the long idle periods is shared
    between tick based and high resolution timer based dynticks. The dyntick
    functionality can be disabled on the kernel commandline. Provide also the
    infrastructure to support high resolution timers.

    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
     
  • With Ingo Molnar

    Add broadcast functionality, so per cpu clock event devices can be registered
    as dummy devices or switched from/to broadcast on demand. The broadcast
    function distributes the events via the broadcast function of the clock event
    device. This is primarily designed to replace the switch apic timer to / from
    IPI in power states, where the apic stops.

    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
     
  • With Ingo Molnar

    The tick-management code is the first user of the clockevents layer. It takes
    clock event devices from the clock events core and uses them to provide the
    periodic tick.

    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
     
  • Architectures register their clock event devices, in the clock events core.
    Users of the clockevents core can get clock event devices for their use. The
    clockevents core code provides notification mechanisms for various clock
    related management events.

    This allows to control the clock event devices without the architectures
    having to worry about the details of function assignment. This is also a
    preliminary for high resolution timers and dynamic ticks to allow the core
    code to control the clock functionality without intrusive changes to the
    architecture code.

    [Fixes-by: Ingo Molnar ]
    Signed-off-by: Thomas Gleixner
    Signed-off-by: Ingo Molnar
    Cc: Roman Zippel
    Cc: john stultz
    Cc: Andi Kleen
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Thomas Gleixner
     

01 Oct, 2006

1 commit


27 Jun, 2006

1 commit

  • 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