diff options
Diffstat (limited to 'kernel/hrtimer.c')
-rw-r--r-- | kernel/hrtimer.c | 42 |
1 files changed, 34 insertions, 8 deletions
diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c index 1363c1aac158..6d7020490f94 100644 --- a/kernel/hrtimer.c +++ b/kernel/hrtimer.c | |||
@@ -48,6 +48,8 @@ | |||
48 | 48 | ||
49 | #include <asm/uaccess.h> | 49 | #include <asm/uaccess.h> |
50 | 50 | ||
51 | #include <trace/events/timer.h> | ||
52 | |||
51 | /* | 53 | /* |
52 | * The timer bases: | 54 | * The timer bases: |
53 | * | 55 | * |
@@ -429,6 +431,7 @@ void hrtimer_init_on_stack(struct hrtimer *timer, clockid_t clock_id, | |||
429 | debug_object_init_on_stack(timer, &hrtimer_debug_descr); | 431 | debug_object_init_on_stack(timer, &hrtimer_debug_descr); |
430 | __hrtimer_init(timer, clock_id, mode); | 432 | __hrtimer_init(timer, clock_id, mode); |
431 | } | 433 | } |
434 | EXPORT_SYMBOL_GPL(hrtimer_init_on_stack); | ||
432 | 435 | ||
433 | void destroy_hrtimer_on_stack(struct hrtimer *timer) | 436 | void destroy_hrtimer_on_stack(struct hrtimer *timer) |
434 | { | 437 | { |
@@ -441,6 +444,26 @@ static inline void debug_hrtimer_activate(struct hrtimer *timer) { } | |||
441 | static inline void debug_hrtimer_deactivate(struct hrtimer *timer) { } | 444 | static inline void debug_hrtimer_deactivate(struct hrtimer *timer) { } |
442 | #endif | 445 | #endif |
443 | 446 | ||
447 | static inline void | ||
448 | debug_init(struct hrtimer *timer, clockid_t clockid, | ||
449 | enum hrtimer_mode mode) | ||
450 | { | ||
451 | debug_hrtimer_init(timer); | ||
452 | trace_hrtimer_init(timer, clockid, mode); | ||
453 | } | ||
454 | |||
455 | static inline void debug_activate(struct hrtimer *timer) | ||
456 | { | ||
457 | debug_hrtimer_activate(timer); | ||
458 | trace_hrtimer_start(timer); | ||
459 | } | ||
460 | |||
461 | static inline void debug_deactivate(struct hrtimer *timer) | ||
462 | { | ||
463 | debug_hrtimer_deactivate(timer); | ||
464 | trace_hrtimer_cancel(timer); | ||
465 | } | ||
466 | |||
444 | /* High resolution timer related functions */ | 467 | /* High resolution timer related functions */ |
445 | #ifdef CONFIG_HIGH_RES_TIMERS | 468 | #ifdef CONFIG_HIGH_RES_TIMERS |
446 | 469 | ||
@@ -804,7 +827,7 @@ static int enqueue_hrtimer(struct hrtimer *timer, | |||
804 | struct hrtimer *entry; | 827 | struct hrtimer *entry; |
805 | int leftmost = 1; | 828 | int leftmost = 1; |
806 | 829 | ||
807 | debug_hrtimer_activate(timer); | 830 | debug_activate(timer); |
808 | 831 | ||
809 | /* | 832 | /* |
810 | * Find the right place in the rbtree: | 833 | * Find the right place in the rbtree: |
@@ -900,7 +923,7 @@ remove_hrtimer(struct hrtimer *timer, struct hrtimer_clock_base *base) | |||
900 | * reprogramming happens in the interrupt handler. This is a | 923 | * reprogramming happens in the interrupt handler. This is a |
901 | * rare case and less expensive than a smp call. | 924 | * rare case and less expensive than a smp call. |
902 | */ | 925 | */ |
903 | debug_hrtimer_deactivate(timer); | 926 | debug_deactivate(timer); |
904 | timer_stats_hrtimer_clear_start_info(timer); | 927 | timer_stats_hrtimer_clear_start_info(timer); |
905 | reprogram = base->cpu_base == &__get_cpu_var(hrtimer_bases); | 928 | reprogram = base->cpu_base == &__get_cpu_var(hrtimer_bases); |
906 | __remove_hrtimer(timer, base, HRTIMER_STATE_INACTIVE, | 929 | __remove_hrtimer(timer, base, HRTIMER_STATE_INACTIVE, |
@@ -1133,7 +1156,7 @@ static void __hrtimer_init(struct hrtimer *timer, clockid_t clock_id, | |||
1133 | void hrtimer_init(struct hrtimer *timer, clockid_t clock_id, | 1156 | void hrtimer_init(struct hrtimer *timer, clockid_t clock_id, |
1134 | enum hrtimer_mode mode) | 1157 | enum hrtimer_mode mode) |
1135 | { | 1158 | { |
1136 | debug_hrtimer_init(timer); | 1159 | debug_init(timer, clock_id, mode); |
1137 | __hrtimer_init(timer, clock_id, mode); | 1160 | __hrtimer_init(timer, clock_id, mode); |
1138 | } | 1161 | } |
1139 | EXPORT_SYMBOL_GPL(hrtimer_init); | 1162 | EXPORT_SYMBOL_GPL(hrtimer_init); |
@@ -1157,7 +1180,7 @@ int hrtimer_get_res(const clockid_t which_clock, struct timespec *tp) | |||
1157 | } | 1180 | } |
1158 | EXPORT_SYMBOL_GPL(hrtimer_get_res); | 1181 | EXPORT_SYMBOL_GPL(hrtimer_get_res); |
1159 | 1182 | ||
1160 | static void __run_hrtimer(struct hrtimer *timer) | 1183 | static void __run_hrtimer(struct hrtimer *timer, ktime_t *now) |
1161 | { | 1184 | { |
1162 | struct hrtimer_clock_base *base = timer->base; | 1185 | struct hrtimer_clock_base *base = timer->base; |
1163 | struct hrtimer_cpu_base *cpu_base = base->cpu_base; | 1186 | struct hrtimer_cpu_base *cpu_base = base->cpu_base; |
@@ -1166,7 +1189,7 @@ static void __run_hrtimer(struct hrtimer *timer) | |||
1166 | 1189 | ||
1167 | WARN_ON(!irqs_disabled()); | 1190 | WARN_ON(!irqs_disabled()); |
1168 | 1191 | ||
1169 | debug_hrtimer_deactivate(timer); | 1192 | debug_deactivate(timer); |
1170 | __remove_hrtimer(timer, base, HRTIMER_STATE_CALLBACK, 0); | 1193 | __remove_hrtimer(timer, base, HRTIMER_STATE_CALLBACK, 0); |
1171 | timer_stats_account_hrtimer(timer); | 1194 | timer_stats_account_hrtimer(timer); |
1172 | fn = timer->function; | 1195 | fn = timer->function; |
@@ -1177,7 +1200,9 @@ static void __run_hrtimer(struct hrtimer *timer) | |||
1177 | * the timer base. | 1200 | * the timer base. |
1178 | */ | 1201 | */ |
1179 | spin_unlock(&cpu_base->lock); | 1202 | spin_unlock(&cpu_base->lock); |
1203 | trace_hrtimer_expire_entry(timer, now); | ||
1180 | restart = fn(timer); | 1204 | restart = fn(timer); |
1205 | trace_hrtimer_expire_exit(timer); | ||
1181 | spin_lock(&cpu_base->lock); | 1206 | spin_lock(&cpu_base->lock); |
1182 | 1207 | ||
1183 | /* | 1208 | /* |
@@ -1288,7 +1313,7 @@ void hrtimer_interrupt(struct clock_event_device *dev) | |||
1288 | break; | 1313 | break; |
1289 | } | 1314 | } |
1290 | 1315 | ||
1291 | __run_hrtimer(timer); | 1316 | __run_hrtimer(timer, &basenow); |
1292 | } | 1317 | } |
1293 | base++; | 1318 | base++; |
1294 | } | 1319 | } |
@@ -1410,7 +1435,7 @@ void hrtimer_run_queues(void) | |||
1410 | hrtimer_get_expires_tv64(timer)) | 1435 | hrtimer_get_expires_tv64(timer)) |
1411 | break; | 1436 | break; |
1412 | 1437 | ||
1413 | __run_hrtimer(timer); | 1438 | __run_hrtimer(timer, &base->softirq_time); |
1414 | } | 1439 | } |
1415 | spin_unlock(&cpu_base->lock); | 1440 | spin_unlock(&cpu_base->lock); |
1416 | } | 1441 | } |
@@ -1437,6 +1462,7 @@ void hrtimer_init_sleeper(struct hrtimer_sleeper *sl, struct task_struct *task) | |||
1437 | sl->timer.function = hrtimer_wakeup; | 1462 | sl->timer.function = hrtimer_wakeup; |
1438 | sl->task = task; | 1463 | sl->task = task; |
1439 | } | 1464 | } |
1465 | EXPORT_SYMBOL_GPL(hrtimer_init_sleeper); | ||
1440 | 1466 | ||
1441 | static int __sched do_nanosleep(struct hrtimer_sleeper *t, enum hrtimer_mode mode) | 1467 | static int __sched do_nanosleep(struct hrtimer_sleeper *t, enum hrtimer_mode mode) |
1442 | { | 1468 | { |
@@ -1586,7 +1612,7 @@ static void migrate_hrtimer_list(struct hrtimer_clock_base *old_base, | |||
1586 | while ((node = rb_first(&old_base->active))) { | 1612 | while ((node = rb_first(&old_base->active))) { |
1587 | timer = rb_entry(node, struct hrtimer, node); | 1613 | timer = rb_entry(node, struct hrtimer, node); |
1588 | BUG_ON(hrtimer_callback_running(timer)); | 1614 | BUG_ON(hrtimer_callback_running(timer)); |
1589 | debug_hrtimer_deactivate(timer); | 1615 | debug_deactivate(timer); |
1590 | 1616 | ||
1591 | /* | 1617 | /* |
1592 | * Mark it as STATE_MIGRATE not INACTIVE otherwise the | 1618 | * Mark it as STATE_MIGRATE not INACTIVE otherwise the |