aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-05-23 14:30:28 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-05-23 14:30:28 -0400
commit30cb6d5f2eb24d15d20139d5ceefaccc68734bd7 (patch)
tree773c5a98645e4b945343caddcfe5af365566ccc5 /include
parent4867faab1e3eb8cc3f74e390357615d9b8e8cda6 (diff)
parent68fa61c026057a39d6ccb850aa8785043afbee02 (diff)
Merge branch 'timers-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'timers-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: hrtimers: Reorder clock bases hrtimers: Avoid touching inactive timer bases hrtimers: Make struct hrtimer_cpu_base layout less stupid timerfd: Manage cancelable timers in timerfd clockevents: Move C3 stop test outside lock alarmtimer: Drop device refcount after rtc_open() alarmtimer: Check return value of class_find_device() timerfd: Allow timers to be cancelled when clock was set hrtimers: Prepare for cancel on clock was set timers
Diffstat (limited to 'include')
-rw-r--r--include/linux/hrtimer.h33
-rw-r--r--include/linux/thread_info.h2
-rw-r--r--include/linux/timerfd.h3
3 files changed, 19 insertions, 19 deletions
diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h
index 62f500c724f9..51932e5acf7c 100644
--- a/include/linux/hrtimer.h
+++ b/include/linux/hrtimer.h
@@ -143,19 +143,18 @@ struct hrtimer_sleeper {
143 */ 143 */
144struct hrtimer_clock_base { 144struct hrtimer_clock_base {
145 struct hrtimer_cpu_base *cpu_base; 145 struct hrtimer_cpu_base *cpu_base;
146 clockid_t index; 146 int index;
147 clockid_t clockid;
147 struct timerqueue_head active; 148 struct timerqueue_head active;
148 ktime_t resolution; 149 ktime_t resolution;
149 ktime_t (*get_time)(void); 150 ktime_t (*get_time)(void);
150 ktime_t softirq_time; 151 ktime_t softirq_time;
151#ifdef CONFIG_HIGH_RES_TIMERS
152 ktime_t offset; 152 ktime_t offset;
153#endif
154}; 153};
155 154
156enum hrtimer_base_type { 155enum hrtimer_base_type {
157 HRTIMER_BASE_REALTIME,
158 HRTIMER_BASE_MONOTONIC, 156 HRTIMER_BASE_MONOTONIC,
157 HRTIMER_BASE_REALTIME,
159 HRTIMER_BASE_BOOTTIME, 158 HRTIMER_BASE_BOOTTIME,
160 HRTIMER_MAX_CLOCK_BASES, 159 HRTIMER_MAX_CLOCK_BASES,
161}; 160};
@@ -164,7 +163,7 @@ enum hrtimer_base_type {
164 * struct hrtimer_cpu_base - the per cpu clock bases 163 * struct hrtimer_cpu_base - the per cpu clock bases
165 * @lock: lock protecting the base and associated clock bases 164 * @lock: lock protecting the base and associated clock bases
166 * and timers 165 * and timers
167 * @clock_base: array of clock bases for this cpu 166 * @active_bases: Bitfield to mark bases with active timers
168 * @expires_next: absolute time of the next event which was scheduled 167 * @expires_next: absolute time of the next event which was scheduled
169 * via clock_set_next_event() 168 * via clock_set_next_event()
170 * @hres_active: State of high resolution mode 169 * @hres_active: State of high resolution mode
@@ -173,10 +172,11 @@ enum hrtimer_base_type {
173 * @nr_retries: Total number of hrtimer interrupt retries 172 * @nr_retries: Total number of hrtimer interrupt retries
174 * @nr_hangs: Total number of hrtimer interrupt hangs 173 * @nr_hangs: Total number of hrtimer interrupt hangs
175 * @max_hang_time: Maximum time spent in hrtimer_interrupt 174 * @max_hang_time: Maximum time spent in hrtimer_interrupt
175 * @clock_base: array of clock bases for this cpu
176 */ 176 */
177struct hrtimer_cpu_base { 177struct hrtimer_cpu_base {
178 raw_spinlock_t lock; 178 raw_spinlock_t lock;
179 struct hrtimer_clock_base clock_base[HRTIMER_MAX_CLOCK_BASES]; 179 unsigned long active_bases;
180#ifdef CONFIG_HIGH_RES_TIMERS 180#ifdef CONFIG_HIGH_RES_TIMERS
181 ktime_t expires_next; 181 ktime_t expires_next;
182 int hres_active; 182 int hres_active;
@@ -186,6 +186,7 @@ struct hrtimer_cpu_base {
186 unsigned long nr_hangs; 186 unsigned long nr_hangs;
187 ktime_t max_hang_time; 187 ktime_t max_hang_time;
188#endif 188#endif
189 struct hrtimer_clock_base clock_base[HRTIMER_MAX_CLOCK_BASES];
189}; 190};
190 191
191static inline void hrtimer_set_expires(struct hrtimer *timer, ktime_t time) 192static inline void hrtimer_set_expires(struct hrtimer *timer, ktime_t time)
@@ -256,8 +257,6 @@ static inline ktime_t hrtimer_expires_remaining(const struct hrtimer *timer)
256#ifdef CONFIG_HIGH_RES_TIMERS 257#ifdef CONFIG_HIGH_RES_TIMERS
257struct clock_event_device; 258struct clock_event_device;
258 259
259extern void clock_was_set(void);
260extern void hres_timers_resume(void);
261extern void hrtimer_interrupt(struct clock_event_device *dev); 260extern void hrtimer_interrupt(struct clock_event_device *dev);
262 261
263/* 262/*
@@ -291,16 +290,8 @@ extern void hrtimer_peek_ahead_timers(void);
291# define MONOTONIC_RES_NSEC LOW_RES_NSEC 290# define MONOTONIC_RES_NSEC LOW_RES_NSEC
292# define KTIME_MONOTONIC_RES KTIME_LOW_RES 291# define KTIME_MONOTONIC_RES KTIME_LOW_RES
293 292
294/*
295 * clock_was_set() is a NOP for non- high-resolution systems. The
296 * time-sorted order guarantees that a timer does not expire early and
297 * is expired in the next softirq when the clock was advanced.
298 */
299static inline void clock_was_set(void) { }
300static inline void hrtimer_peek_ahead_timers(void) { } 293static inline void hrtimer_peek_ahead_timers(void) { }
301 294
302static inline void hres_timers_resume(void) { }
303
304/* 295/*
305 * In non high resolution mode the time reference is taken from 296 * In non high resolution mode the time reference is taken from
306 * the base softirq time variable. 297 * the base softirq time variable.
@@ -316,10 +307,18 @@ static inline int hrtimer_is_hres_active(struct hrtimer *timer)
316} 307}
317#endif 308#endif
318 309
310extern void clock_was_set(void);
311#ifdef CONFIG_TIMERFD
312extern void timerfd_clock_was_set(void);
313#else
314static inline void timerfd_clock_was_set(void) { }
315#endif
316extern void hrtimers_resume(void);
317
319extern ktime_t ktime_get(void); 318extern ktime_t ktime_get(void);
320extern ktime_t ktime_get_real(void); 319extern ktime_t ktime_get_real(void);
321extern ktime_t ktime_get_boottime(void); 320extern ktime_t ktime_get_boottime(void);
322 321extern ktime_t ktime_get_monotonic_offset(void);
323 322
324DECLARE_PER_CPU(struct tick_device, tick_cpu_device); 323DECLARE_PER_CPU(struct tick_device, tick_cpu_device);
325 324
diff --git a/include/linux/thread_info.h b/include/linux/thread_info.h
index 20fc303947d3..8d03f079688c 100644
--- a/include/linux/thread_info.h
+++ b/include/linux/thread_info.h
@@ -29,7 +29,7 @@ struct restart_block {
29 } futex; 29 } futex;
30 /* For nanosleep */ 30 /* For nanosleep */
31 struct { 31 struct {
32 clockid_t index; 32 clockid_t clockid;
33 struct timespec __user *rmtp; 33 struct timespec __user *rmtp;
34#ifdef CONFIG_COMPAT 34#ifdef CONFIG_COMPAT
35 struct compat_timespec __user *compat_rmtp; 35 struct compat_timespec __user *compat_rmtp;
diff --git a/include/linux/timerfd.h b/include/linux/timerfd.h
index 2d0792983f8c..d3b57fa12225 100644
--- a/include/linux/timerfd.h
+++ b/include/linux/timerfd.h
@@ -19,6 +19,7 @@
19 * shared O_* flags. 19 * shared O_* flags.
20 */ 20 */
21#define TFD_TIMER_ABSTIME (1 << 0) 21#define TFD_TIMER_ABSTIME (1 << 0)
22#define TFD_TIMER_CANCEL_ON_SET (1 << 1)
22#define TFD_CLOEXEC O_CLOEXEC 23#define TFD_CLOEXEC O_CLOEXEC
23#define TFD_NONBLOCK O_NONBLOCK 24#define TFD_NONBLOCK O_NONBLOCK
24 25
@@ -26,6 +27,6 @@
26/* Flags for timerfd_create. */ 27/* Flags for timerfd_create. */
27#define TFD_CREATE_FLAGS TFD_SHARED_FCNTL_FLAGS 28#define TFD_CREATE_FLAGS TFD_SHARED_FCNTL_FLAGS
28/* Flags for timerfd_settime. */ 29/* Flags for timerfd_settime. */
29#define TFD_SETTIME_FLAGS TFD_TIMER_ABSTIME 30#define TFD_SETTIME_FLAGS (TFD_TIMER_ABSTIME | TFD_TIMER_CANCEL_ON_SET)
30 31
31#endif /* _LINUX_TIMERFD_H */ 32#endif /* _LINUX_TIMERFD_H */