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