aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/hrtimer.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/hrtimer.h')
-rw-r--r--include/linux/hrtimer.h34
1 files changed, 17 insertions, 17 deletions
diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h
index 62f500c724f9..fd0dc30c9f15 100644
--- a/include/linux/hrtimer.h
+++ b/include/linux/hrtimer.h
@@ -135,6 +135,7 @@ struct hrtimer_sleeper {
135 * @cpu_base: per cpu clock base 135 * @cpu_base: per cpu clock base
136 * @index: clock type index for per_cpu support when moving a 136 * @index: clock type index for per_cpu support when moving a
137 * timer to a base on another cpu. 137 * timer to a base on another cpu.
138 * @clockid: clock id for per_cpu support
138 * @active: red black tree root node for the active timers 139 * @active: red black tree root node for the active timers
139 * @resolution: the resolution of the clock, in nanoseconds 140 * @resolution: the resolution of the clock, in nanoseconds
140 * @get_time: function to retrieve the current time of the clock 141 * @get_time: function to retrieve the current time of the clock
@@ -143,19 +144,18 @@ struct hrtimer_sleeper {
143 */ 144 */
144struct hrtimer_clock_base { 145struct hrtimer_clock_base {
145 struct hrtimer_cpu_base *cpu_base; 146 struct hrtimer_cpu_base *cpu_base;
146 clockid_t index; 147 int index;
148 clockid_t clockid;
147 struct timerqueue_head active; 149 struct timerqueue_head active;
148 ktime_t resolution; 150 ktime_t resolution;
149 ktime_t (*get_time)(void); 151 ktime_t (*get_time)(void);
150 ktime_t softirq_time; 152 ktime_t softirq_time;
151#ifdef CONFIG_HIGH_RES_TIMERS
152 ktime_t offset; 153 ktime_t offset;
153#endif
154}; 154};
155 155
156enum hrtimer_base_type { 156enum hrtimer_base_type {
157 HRTIMER_BASE_REALTIME,
158 HRTIMER_BASE_MONOTONIC, 157 HRTIMER_BASE_MONOTONIC,
158 HRTIMER_BASE_REALTIME,
159 HRTIMER_BASE_BOOTTIME, 159 HRTIMER_BASE_BOOTTIME,
160 HRTIMER_MAX_CLOCK_BASES, 160 HRTIMER_MAX_CLOCK_BASES,
161}; 161};
@@ -164,7 +164,7 @@ enum hrtimer_base_type {
164 * struct hrtimer_cpu_base - the per cpu clock bases 164 * struct hrtimer_cpu_base - the per cpu clock bases
165 * @lock: lock protecting the base and associated clock bases 165 * @lock: lock protecting the base and associated clock bases
166 * and timers 166 * and timers
167 * @clock_base: array of clock bases for this cpu 167 * @active_bases: Bitfield to mark bases with active timers
168 * @expires_next: absolute time of the next event which was scheduled 168 * @expires_next: absolute time of the next event which was scheduled
169 * via clock_set_next_event() 169 * via clock_set_next_event()
170 * @hres_active: State of high resolution mode 170 * @hres_active: State of high resolution mode
@@ -173,10 +173,11 @@ enum hrtimer_base_type {
173 * @nr_retries: Total number of hrtimer interrupt retries 173 * @nr_retries: Total number of hrtimer interrupt retries
174 * @nr_hangs: Total number of hrtimer interrupt hangs 174 * @nr_hangs: Total number of hrtimer interrupt hangs
175 * @max_hang_time: Maximum time spent in hrtimer_interrupt 175 * @max_hang_time: Maximum time spent in hrtimer_interrupt
176 * @clock_base: array of clock bases for this cpu
176 */ 177 */
177struct hrtimer_cpu_base { 178struct hrtimer_cpu_base {
178 raw_spinlock_t lock; 179 raw_spinlock_t lock;
179 struct hrtimer_clock_base clock_base[HRTIMER_MAX_CLOCK_BASES]; 180 unsigned long active_bases;
180#ifdef CONFIG_HIGH_RES_TIMERS 181#ifdef CONFIG_HIGH_RES_TIMERS
181 ktime_t expires_next; 182 ktime_t expires_next;
182 int hres_active; 183 int hres_active;
@@ -186,6 +187,7 @@ struct hrtimer_cpu_base {
186 unsigned long nr_hangs; 187 unsigned long nr_hangs;
187 ktime_t max_hang_time; 188 ktime_t max_hang_time;
188#endif 189#endif
190 struct hrtimer_clock_base clock_base[HRTIMER_MAX_CLOCK_BASES];
189}; 191};
190 192
191static inline void hrtimer_set_expires(struct hrtimer *timer, ktime_t time) 193static inline void hrtimer_set_expires(struct hrtimer *timer, ktime_t time)
@@ -256,8 +258,6 @@ static inline ktime_t hrtimer_expires_remaining(const struct hrtimer *timer)
256#ifdef CONFIG_HIGH_RES_TIMERS 258#ifdef CONFIG_HIGH_RES_TIMERS
257struct clock_event_device; 259struct clock_event_device;
258 260
259extern void clock_was_set(void);
260extern void hres_timers_resume(void);
261extern void hrtimer_interrupt(struct clock_event_device *dev); 261extern void hrtimer_interrupt(struct clock_event_device *dev);
262 262
263/* 263/*
@@ -291,16 +291,8 @@ extern void hrtimer_peek_ahead_timers(void);
291# define MONOTONIC_RES_NSEC LOW_RES_NSEC 291# define MONOTONIC_RES_NSEC LOW_RES_NSEC
292# define KTIME_MONOTONIC_RES KTIME_LOW_RES 292# define KTIME_MONOTONIC_RES KTIME_LOW_RES
293 293
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) { } 294static inline void hrtimer_peek_ahead_timers(void) { }
301 295
302static inline void hres_timers_resume(void) { }
303
304/* 296/*
305 * In non high resolution mode the time reference is taken from 297 * In non high resolution mode the time reference is taken from
306 * the base softirq time variable. 298 * the base softirq time variable.
@@ -316,10 +308,18 @@ static inline int hrtimer_is_hres_active(struct hrtimer *timer)
316} 308}
317#endif 309#endif
318 310
311extern void clock_was_set(void);
312#ifdef CONFIG_TIMERFD
313extern void timerfd_clock_was_set(void);
314#else
315static inline void timerfd_clock_was_set(void) { }
316#endif
317extern void hrtimers_resume(void);
318
319extern ktime_t ktime_get(void); 319extern ktime_t ktime_get(void);
320extern ktime_t ktime_get_real(void); 320extern ktime_t ktime_get_real(void);
321extern ktime_t ktime_get_boottime(void); 321extern ktime_t ktime_get_boottime(void);
322 322extern ktime_t ktime_get_monotonic_offset(void);
323 323
324DECLARE_PER_CPU(struct tick_device, tick_cpu_device); 324DECLARE_PER_CPU(struct tick_device, tick_cpu_device);
325 325