aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-10-26 11:15:03 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-10-26 11:15:03 -0400
commit39adff5f69d6849ca22353a88058c9f8630528c0 (patch)
treeb0c2d2de77ebc5c97fd19c29b81eeb03549553f8 /include
parent8a4a8918ed6e4a361f4df19f199bbc2d0a89a46c (diff)
parente35f95b36e43f67a6f806172555a152c11ea0a78 (diff)
Merge branch 'timers-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
* 'timers-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (23 commits) time, s390: Get rid of compile warning dw_apb_timer: constify clocksource name time: Cleanup old CONFIG_GENERIC_TIME references that snuck in time: Change jiffies_to_clock_t() argument type to unsigned long alarmtimers: Fix error handling clocksource: Make watchdog reset lockless posix-cpu-timers: Cure SMP accounting oddities s390: Use direct ktime path for s390 clockevent device clockevents: Add direct ktime programming function clockevents: Make minimum delay adjustments configurable nohz: Remove "Switched to NOHz mode" debugging messages proc: Consider NO_HZ when printing idle and iowait times nohz: Make idle/iowait counter update conditional nohz: Fix update_ts_time_stat idle accounting cputime: Clean up cputime_to_usecs and usecs_to_cputime macros alarmtimers: Rework RTC device selection using class interface alarmtimers: Add try_to_cancel functionality alarmtimers: Add more refined alarm state tracking alarmtimers: Remove period from alarm structure alarmtimers: Remove interval cap limit hack ...
Diffstat (limited to 'include')
-rw-r--r--include/asm-generic/cputime.h4
-rw-r--r--include/linux/alarmtimer.h51
-rw-r--r--include/linux/clockchips.h12
-rw-r--r--include/linux/dw_apb_timer.h2
-rw-r--r--include/linux/jiffies.h2
-rw-r--r--include/linux/posix-timers.h5
6 files changed, 61 insertions, 15 deletions
diff --git a/include/asm-generic/cputime.h b/include/asm-generic/cputime.h
index 61e03dd7939e..62ce6823c0f2 100644
--- a/include/asm-generic/cputime.h
+++ b/include/asm-generic/cputime.h
@@ -38,8 +38,8 @@ typedef u64 cputime64_t;
38/* 38/*
39 * Convert cputime to microseconds and back. 39 * Convert cputime to microseconds and back.
40 */ 40 */
41#define cputime_to_usecs(__ct) jiffies_to_usecs(__ct); 41#define cputime_to_usecs(__ct) jiffies_to_usecs(__ct)
42#define usecs_to_cputime(__msecs) usecs_to_jiffies(__msecs); 42#define usecs_to_cputime(__msecs) usecs_to_jiffies(__msecs)
43 43
44/* 44/*
45 * Convert cputime to seconds and back. 45 * Convert cputime to seconds and back.
diff --git a/include/linux/alarmtimer.h b/include/linux/alarmtimer.h
index c5d6095b46f8..975009e1cbe6 100644
--- a/include/linux/alarmtimer.h
+++ b/include/linux/alarmtimer.h
@@ -13,6 +13,16 @@ enum alarmtimer_type {
13 ALARM_NUMTYPE, 13 ALARM_NUMTYPE,
14}; 14};
15 15
16enum alarmtimer_restart {
17 ALARMTIMER_NORESTART,
18 ALARMTIMER_RESTART,
19};
20
21
22#define ALARMTIMER_STATE_INACTIVE 0x00
23#define ALARMTIMER_STATE_ENQUEUED 0x01
24#define ALARMTIMER_STATE_CALLBACK 0x02
25
16/** 26/**
17 * struct alarm - Alarm timer structure 27 * struct alarm - Alarm timer structure
18 * @node: timerqueue node for adding to the event list this value 28 * @node: timerqueue node for adding to the event list this value
@@ -25,16 +35,45 @@ enum alarmtimer_type {
25 */ 35 */
26struct alarm { 36struct alarm {
27 struct timerqueue_node node; 37 struct timerqueue_node node;
28 ktime_t period; 38 enum alarmtimer_restart (*function)(struct alarm *, ktime_t now);
29 void (*function)(struct alarm *);
30 enum alarmtimer_type type; 39 enum alarmtimer_type type;
31 bool enabled; 40 int state;
32 void *data; 41 void *data;
33}; 42};
34 43
35void alarm_init(struct alarm *alarm, enum alarmtimer_type type, 44void alarm_init(struct alarm *alarm, enum alarmtimer_type type,
36 void (*function)(struct alarm *)); 45 enum alarmtimer_restart (*function)(struct alarm *, ktime_t));
37void alarm_start(struct alarm *alarm, ktime_t start, ktime_t period); 46void alarm_start(struct alarm *alarm, ktime_t start);
38void alarm_cancel(struct alarm *alarm); 47int alarm_try_to_cancel(struct alarm *alarm);
48int alarm_cancel(struct alarm *alarm);
49
50u64 alarm_forward(struct alarm *alarm, ktime_t now, ktime_t interval);
51
52/*
53 * A alarmtimer is active, when it is enqueued into timerqueue or the
54 * callback function is running.
55 */
56static inline int alarmtimer_active(const struct alarm *timer)
57{
58 return timer->state != ALARMTIMER_STATE_INACTIVE;
59}
60
61/*
62 * Helper function to check, whether the timer is on one of the queues
63 */
64static inline int alarmtimer_is_queued(struct alarm *timer)
65{
66 return timer->state & ALARMTIMER_STATE_ENQUEUED;
67}
68
69/*
70 * Helper function to check, whether the timer is running the callback
71 * function
72 */
73static inline int alarmtimer_callback_running(struct alarm *timer)
74{
75 return timer->state & ALARMTIMER_STATE_CALLBACK;
76}
77
39 78
40#endif 79#endif
diff --git a/include/linux/clockchips.h b/include/linux/clockchips.h
index d6733e27af34..81e803e90aa4 100644
--- a/include/linux/clockchips.h
+++ b/include/linux/clockchips.h
@@ -45,20 +45,22 @@ enum clock_event_nofitiers {
45 */ 45 */
46#define CLOCK_EVT_FEAT_PERIODIC 0x000001 46#define CLOCK_EVT_FEAT_PERIODIC 0x000001
47#define CLOCK_EVT_FEAT_ONESHOT 0x000002 47#define CLOCK_EVT_FEAT_ONESHOT 0x000002
48#define CLOCK_EVT_FEAT_KTIME 0x000004
48/* 49/*
49 * x86(64) specific misfeatures: 50 * x86(64) specific misfeatures:
50 * 51 *
51 * - Clockevent source stops in C3 State and needs broadcast support. 52 * - Clockevent source stops in C3 State and needs broadcast support.
52 * - Local APIC timer is used as a dummy device. 53 * - Local APIC timer is used as a dummy device.
53 */ 54 */
54#define CLOCK_EVT_FEAT_C3STOP 0x000004 55#define CLOCK_EVT_FEAT_C3STOP 0x000008
55#define CLOCK_EVT_FEAT_DUMMY 0x000008 56#define CLOCK_EVT_FEAT_DUMMY 0x000010
56 57
57/** 58/**
58 * struct clock_event_device - clock event device descriptor 59 * struct clock_event_device - clock event device descriptor
59 * @event_handler: Assigned by the framework to be called by the low 60 * @event_handler: Assigned by the framework to be called by the low
60 * level handler of the event source 61 * level handler of the event source
61 * @set_next_event: set next event function 62 * @set_next_event: set next event function using a clocksource delta
63 * @set_next_ktime: set next event function using a direct ktime value
62 * @next_event: local storage for the next event in oneshot mode 64 * @next_event: local storage for the next event in oneshot mode
63 * @max_delta_ns: maximum delta value in ns 65 * @max_delta_ns: maximum delta value in ns
64 * @min_delta_ns: minimum delta value in ns 66 * @min_delta_ns: minimum delta value in ns
@@ -81,6 +83,8 @@ struct clock_event_device {
81 void (*event_handler)(struct clock_event_device *); 83 void (*event_handler)(struct clock_event_device *);
82 int (*set_next_event)(unsigned long evt, 84 int (*set_next_event)(unsigned long evt,
83 struct clock_event_device *); 85 struct clock_event_device *);
86 int (*set_next_ktime)(ktime_t expires,
87 struct clock_event_device *);
84 ktime_t next_event; 88 ktime_t next_event;
85 u64 max_delta_ns; 89 u64 max_delta_ns;
86 u64 min_delta_ns; 90 u64 min_delta_ns;
@@ -140,7 +144,7 @@ extern void clockevents_set_mode(struct clock_event_device *dev,
140 enum clock_event_mode mode); 144 enum clock_event_mode mode);
141extern int clockevents_register_notifier(struct notifier_block *nb); 145extern int clockevents_register_notifier(struct notifier_block *nb);
142extern int clockevents_program_event(struct clock_event_device *dev, 146extern int clockevents_program_event(struct clock_event_device *dev,
143 ktime_t expires, ktime_t now); 147 ktime_t expires, bool force);
144 148
145extern void clockevents_handle_noop(struct clock_event_device *dev); 149extern void clockevents_handle_noop(struct clock_event_device *dev);
146 150
diff --git a/include/linux/dw_apb_timer.h b/include/linux/dw_apb_timer.h
index 49638ea3b776..07261d52a6df 100644
--- a/include/linux/dw_apb_timer.h
+++ b/include/linux/dw_apb_timer.h
@@ -46,7 +46,7 @@ struct dw_apb_clock_event_device *
46dw_apb_clockevent_init(int cpu, const char *name, unsigned rating, 46dw_apb_clockevent_init(int cpu, const char *name, unsigned rating,
47 void __iomem *base, int irq, unsigned long freq); 47 void __iomem *base, int irq, unsigned long freq);
48struct dw_apb_clocksource * 48struct dw_apb_clocksource *
49dw_apb_clocksource_init(unsigned rating, char *name, void __iomem *base, 49dw_apb_clocksource_init(unsigned rating, const char *name, void __iomem *base,
50 unsigned long freq); 50 unsigned long freq);
51void dw_apb_clocksource_register(struct dw_apb_clocksource *dw_cs); 51void dw_apb_clocksource_register(struct dw_apb_clocksource *dw_cs);
52void dw_apb_clocksource_start(struct dw_apb_clocksource *dw_cs); 52void dw_apb_clocksource_start(struct dw_apb_clocksource *dw_cs);
diff --git a/include/linux/jiffies.h b/include/linux/jiffies.h
index f97672a36fa8..265e2c3cbd1c 100644
--- a/include/linux/jiffies.h
+++ b/include/linux/jiffies.h
@@ -303,7 +303,7 @@ extern void jiffies_to_timespec(const unsigned long jiffies,
303extern unsigned long timeval_to_jiffies(const struct timeval *value); 303extern unsigned long timeval_to_jiffies(const struct timeval *value);
304extern void jiffies_to_timeval(const unsigned long jiffies, 304extern void jiffies_to_timeval(const unsigned long jiffies,
305 struct timeval *value); 305 struct timeval *value);
306extern clock_t jiffies_to_clock_t(long x); 306extern clock_t jiffies_to_clock_t(unsigned long x);
307extern unsigned long clock_t_to_jiffies(unsigned long x); 307extern unsigned long clock_t_to_jiffies(unsigned long x);
308extern u64 jiffies_64_to_clock_t(u64 x); 308extern u64 jiffies_64_to_clock_t(u64 x);
309extern u64 nsec_to_clock_t(u64 x); 309extern u64 nsec_to_clock_t(u64 x);
diff --git a/include/linux/posix-timers.h b/include/linux/posix-timers.h
index 959c14132f46..042058fdb0af 100644
--- a/include/linux/posix-timers.h
+++ b/include/linux/posix-timers.h
@@ -81,7 +81,10 @@ struct k_itimer {
81 unsigned long incr; 81 unsigned long incr;
82 unsigned long expires; 82 unsigned long expires;
83 } mmtimer; 83 } mmtimer;
84 struct alarm alarmtimer; 84 struct {
85 struct alarm alarmtimer;
86 ktime_t interval;
87 } alarm;
85 struct rcu_head rcu; 88 struct rcu_head rcu;
86 } it; 89 } it;
87}; 90};