diff options
author | Peter Zijlstra <peterz@infradead.org> | 2008-11-25 06:43:51 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-11-25 09:45:46 -0500 |
commit | ca109491f612aab5c8152207631c0444f63da97f (patch) | |
tree | 46d0a90e79c75fc039bda7d01862062e0ac39900 /include/linux/hrtimer.h | |
parent | ed313489badef16d700f5a3be50e8fd8f8294bc8 (diff) |
hrtimer: removing all ur callback modes
Impact: cleanup, move all hrtimer processing into hardirq context
This is an attempt at removing some of the hrtimer complexity by
reducing the number of callback modes to 1.
This means that all hrtimer callback functions will be ran from HARD-irq
context.
I went through all the 30 odd hrtimer callback functions in the kernel
and saw only one that I'm not quite sure of, which is the one in
net/can/bcm.c - hence I'm CC-ing the folks responsible for that code.
Furthermore, the hrtimer core now calls callbacks directly with IRQs
disabled in case you try to enqueue an expired timer. If this timer is a
periodic timer (which should use hrtimer_forward() to advance its time)
then it might be possible to end up in an inf. recursive loop due to the
fact that hrtimer_forward() doesn't round up to the next timer
granularity, and therefore keeps on calling the callback - obviously
this needs a fix.
Aside from that, this seems to compile and actually boot on my dual core
test box - although I'm sure there are some bugs in, me not hitting any
makes me certain :-)
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'include/linux/hrtimer.h')
-rw-r--r-- | include/linux/hrtimer.h | 34 |
1 files changed, 2 insertions, 32 deletions
diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h index 3eba43878dcb..bd37078c2d7d 100644 --- a/include/linux/hrtimer.h +++ b/include/linux/hrtimer.h | |||
@@ -43,26 +43,6 @@ enum hrtimer_restart { | |||
43 | }; | 43 | }; |
44 | 44 | ||
45 | /* | 45 | /* |
46 | * hrtimer callback modes: | ||
47 | * | ||
48 | * HRTIMER_CB_SOFTIRQ: Callback must run in softirq context | ||
49 | * HRTIMER_CB_IRQSAFE_PERCPU: Callback must run in hardirq context | ||
50 | * Special mode for tick emulation and | ||
51 | * scheduler timer. Such timers are per | ||
52 | * cpu and not allowed to be migrated on | ||
53 | * cpu unplug. | ||
54 | * HRTIMER_CB_IRQSAFE_UNLOCKED: Callback should run in hardirq context | ||
55 | * with timer->base lock unlocked | ||
56 | * used for timers which call wakeup to | ||
57 | * avoid lock order problems with rq->lock | ||
58 | */ | ||
59 | enum hrtimer_cb_mode { | ||
60 | HRTIMER_CB_SOFTIRQ, | ||
61 | HRTIMER_CB_IRQSAFE_PERCPU, | ||
62 | HRTIMER_CB_IRQSAFE_UNLOCKED, | ||
63 | }; | ||
64 | |||
65 | /* | ||
66 | * Values to track state of the timer | 46 | * Values to track state of the timer |
67 | * | 47 | * |
68 | * Possible states: | 48 | * Possible states: |
@@ -70,7 +50,6 @@ enum hrtimer_cb_mode { | |||
70 | * 0x00 inactive | 50 | * 0x00 inactive |
71 | * 0x01 enqueued into rbtree | 51 | * 0x01 enqueued into rbtree |
72 | * 0x02 callback function running | 52 | * 0x02 callback function running |
73 | * 0x04 callback pending (high resolution mode) | ||
74 | * | 53 | * |
75 | * Special cases: | 54 | * Special cases: |
76 | * 0x03 callback function running and enqueued | 55 | * 0x03 callback function running and enqueued |
@@ -92,8 +71,7 @@ enum hrtimer_cb_mode { | |||
92 | #define HRTIMER_STATE_INACTIVE 0x00 | 71 | #define HRTIMER_STATE_INACTIVE 0x00 |
93 | #define HRTIMER_STATE_ENQUEUED 0x01 | 72 | #define HRTIMER_STATE_ENQUEUED 0x01 |
94 | #define HRTIMER_STATE_CALLBACK 0x02 | 73 | #define HRTIMER_STATE_CALLBACK 0x02 |
95 | #define HRTIMER_STATE_PENDING 0x04 | 74 | #define HRTIMER_STATE_MIGRATE 0x04 |
96 | #define HRTIMER_STATE_MIGRATE 0x08 | ||
97 | 75 | ||
98 | /** | 76 | /** |
99 | * struct hrtimer - the basic hrtimer structure | 77 | * struct hrtimer - the basic hrtimer structure |
@@ -109,8 +87,6 @@ enum hrtimer_cb_mode { | |||
109 | * @function: timer expiry callback function | 87 | * @function: timer expiry callback function |
110 | * @base: pointer to the timer base (per cpu and per clock) | 88 | * @base: pointer to the timer base (per cpu and per clock) |
111 | * @state: state information (See bit values above) | 89 | * @state: state information (See bit values above) |
112 | * @cb_mode: high resolution timer feature to select the callback execution | ||
113 | * mode | ||
114 | * @cb_entry: list head to enqueue an expired timer into the callback list | 90 | * @cb_entry: list head to enqueue an expired timer into the callback list |
115 | * @start_site: timer statistics field to store the site where the timer | 91 | * @start_site: timer statistics field to store the site where the timer |
116 | * was started | 92 | * was started |
@@ -129,7 +105,6 @@ struct hrtimer { | |||
129 | struct hrtimer_clock_base *base; | 105 | struct hrtimer_clock_base *base; |
130 | unsigned long state; | 106 | unsigned long state; |
131 | struct list_head cb_entry; | 107 | struct list_head cb_entry; |
132 | enum hrtimer_cb_mode cb_mode; | ||
133 | #ifdef CONFIG_TIMER_STATS | 108 | #ifdef CONFIG_TIMER_STATS |
134 | int start_pid; | 109 | int start_pid; |
135 | void *start_site; | 110 | void *start_site; |
@@ -188,15 +163,11 @@ struct hrtimer_clock_base { | |||
188 | * @check_clocks: Indictator, when set evaluate time source and clock | 163 | * @check_clocks: Indictator, when set evaluate time source and clock |
189 | * event devices whether high resolution mode can be | 164 | * event devices whether high resolution mode can be |
190 | * activated. | 165 | * activated. |
191 | * @cb_pending: Expired timers are moved from the rbtree to this | ||
192 | * list in the timer interrupt. The list is processed | ||
193 | * in the softirq. | ||
194 | * @nr_events: Total number of timer interrupt events | 166 | * @nr_events: Total number of timer interrupt events |
195 | */ | 167 | */ |
196 | struct hrtimer_cpu_base { | 168 | struct hrtimer_cpu_base { |
197 | spinlock_t lock; | 169 | spinlock_t lock; |
198 | struct hrtimer_clock_base clock_base[HRTIMER_MAX_CLOCK_BASES]; | 170 | struct hrtimer_clock_base clock_base[HRTIMER_MAX_CLOCK_BASES]; |
199 | struct list_head cb_pending; | ||
200 | #ifdef CONFIG_HIGH_RES_TIMERS | 171 | #ifdef CONFIG_HIGH_RES_TIMERS |
201 | ktime_t expires_next; | 172 | ktime_t expires_next; |
202 | int hres_active; | 173 | int hres_active; |
@@ -404,8 +375,7 @@ static inline int hrtimer_active(const struct hrtimer *timer) | |||
404 | */ | 375 | */ |
405 | static inline int hrtimer_is_queued(struct hrtimer *timer) | 376 | static inline int hrtimer_is_queued(struct hrtimer *timer) |
406 | { | 377 | { |
407 | return timer->state & | 378 | return timer->state & HRTIMER_STATE_ENQUEUED; |
408 | (HRTIMER_STATE_ENQUEUED | HRTIMER_STATE_PENDING); | ||
409 | } | 379 | } |
410 | 380 | ||
411 | /* | 381 | /* |