diff options
Diffstat (limited to 'kernel/hrtimer.c')
-rw-r--r-- | kernel/hrtimer.c | 40 |
1 files changed, 32 insertions, 8 deletions
diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c index c03f221fee44..e5d98ce50f89 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 | * |
@@ -442,6 +444,26 @@ static inline void debug_hrtimer_activate(struct hrtimer *timer) { } | |||
442 | static inline void debug_hrtimer_deactivate(struct hrtimer *timer) { } | 444 | static inline void debug_hrtimer_deactivate(struct hrtimer *timer) { } |
443 | #endif | 445 | #endif |
444 | 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 | |||
445 | /* High resolution timer related functions */ | 467 | /* High resolution timer related functions */ |
446 | #ifdef CONFIG_HIGH_RES_TIMERS | 468 | #ifdef CONFIG_HIGH_RES_TIMERS |
447 | 469 | ||
@@ -798,7 +820,7 @@ static int enqueue_hrtimer(struct hrtimer *timer, | |||
798 | struct hrtimer *entry; | 820 | struct hrtimer *entry; |
799 | int leftmost = 1; | 821 | int leftmost = 1; |
800 | 822 | ||
801 | debug_hrtimer_activate(timer); | 823 | debug_activate(timer); |
802 | 824 | ||
803 | /* | 825 | /* |
804 | * Find the right place in the rbtree: | 826 | * Find the right place in the rbtree: |
@@ -884,7 +906,7 @@ remove_hrtimer(struct hrtimer *timer, struct hrtimer_clock_base *base) | |||
884 | * reprogramming happens in the interrupt handler. This is a | 906 | * reprogramming happens in the interrupt handler. This is a |
885 | * rare case and less expensive than a smp call. | 907 | * rare case and less expensive than a smp call. |
886 | */ | 908 | */ |
887 | debug_hrtimer_deactivate(timer); | 909 | debug_deactivate(timer); |
888 | timer_stats_hrtimer_clear_start_info(timer); | 910 | timer_stats_hrtimer_clear_start_info(timer); |
889 | reprogram = base->cpu_base == &__get_cpu_var(hrtimer_bases); | 911 | reprogram = base->cpu_base == &__get_cpu_var(hrtimer_bases); |
890 | __remove_hrtimer(timer, base, HRTIMER_STATE_INACTIVE, | 912 | __remove_hrtimer(timer, base, HRTIMER_STATE_INACTIVE, |
@@ -1117,7 +1139,7 @@ static void __hrtimer_init(struct hrtimer *timer, clockid_t clock_id, | |||
1117 | void hrtimer_init(struct hrtimer *timer, clockid_t clock_id, | 1139 | void hrtimer_init(struct hrtimer *timer, clockid_t clock_id, |
1118 | enum hrtimer_mode mode) | 1140 | enum hrtimer_mode mode) |
1119 | { | 1141 | { |
1120 | debug_hrtimer_init(timer); | 1142 | debug_init(timer, clock_id, mode); |
1121 | __hrtimer_init(timer, clock_id, mode); | 1143 | __hrtimer_init(timer, clock_id, mode); |
1122 | } | 1144 | } |
1123 | EXPORT_SYMBOL_GPL(hrtimer_init); | 1145 | EXPORT_SYMBOL_GPL(hrtimer_init); |
@@ -1141,7 +1163,7 @@ int hrtimer_get_res(const clockid_t which_clock, struct timespec *tp) | |||
1141 | } | 1163 | } |
1142 | EXPORT_SYMBOL_GPL(hrtimer_get_res); | 1164 | EXPORT_SYMBOL_GPL(hrtimer_get_res); |
1143 | 1165 | ||
1144 | static void __run_hrtimer(struct hrtimer *timer) | 1166 | static void __run_hrtimer(struct hrtimer *timer, ktime_t *now) |
1145 | { | 1167 | { |
1146 | struct hrtimer_clock_base *base = timer->base; | 1168 | struct hrtimer_clock_base *base = timer->base; |
1147 | struct hrtimer_cpu_base *cpu_base = base->cpu_base; | 1169 | struct hrtimer_cpu_base *cpu_base = base->cpu_base; |
@@ -1150,7 +1172,7 @@ static void __run_hrtimer(struct hrtimer *timer) | |||
1150 | 1172 | ||
1151 | WARN_ON(!irqs_disabled()); | 1173 | WARN_ON(!irqs_disabled()); |
1152 | 1174 | ||
1153 | debug_hrtimer_deactivate(timer); | 1175 | debug_deactivate(timer); |
1154 | __remove_hrtimer(timer, base, HRTIMER_STATE_CALLBACK, 0); | 1176 | __remove_hrtimer(timer, base, HRTIMER_STATE_CALLBACK, 0); |
1155 | timer_stats_account_hrtimer(timer); | 1177 | timer_stats_account_hrtimer(timer); |
1156 | fn = timer->function; | 1178 | fn = timer->function; |
@@ -1161,7 +1183,9 @@ static void __run_hrtimer(struct hrtimer *timer) | |||
1161 | * the timer base. | 1183 | * the timer base. |
1162 | */ | 1184 | */ |
1163 | spin_unlock(&cpu_base->lock); | 1185 | spin_unlock(&cpu_base->lock); |
1186 | trace_hrtimer_expire_entry(timer, now); | ||
1164 | restart = fn(timer); | 1187 | restart = fn(timer); |
1188 | trace_hrtimer_expire_exit(timer); | ||
1165 | spin_lock(&cpu_base->lock); | 1189 | spin_lock(&cpu_base->lock); |
1166 | 1190 | ||
1167 | /* | 1191 | /* |
@@ -1272,7 +1296,7 @@ void hrtimer_interrupt(struct clock_event_device *dev) | |||
1272 | break; | 1296 | break; |
1273 | } | 1297 | } |
1274 | 1298 | ||
1275 | __run_hrtimer(timer); | 1299 | __run_hrtimer(timer, &basenow); |
1276 | } | 1300 | } |
1277 | base++; | 1301 | base++; |
1278 | } | 1302 | } |
@@ -1394,7 +1418,7 @@ void hrtimer_run_queues(void) | |||
1394 | hrtimer_get_expires_tv64(timer)) | 1418 | hrtimer_get_expires_tv64(timer)) |
1395 | break; | 1419 | break; |
1396 | 1420 | ||
1397 | __run_hrtimer(timer); | 1421 | __run_hrtimer(timer, &base->softirq_time); |
1398 | } | 1422 | } |
1399 | spin_unlock(&cpu_base->lock); | 1423 | spin_unlock(&cpu_base->lock); |
1400 | } | 1424 | } |
@@ -1571,7 +1595,7 @@ static void migrate_hrtimer_list(struct hrtimer_clock_base *old_base, | |||
1571 | while ((node = rb_first(&old_base->active))) { | 1595 | while ((node = rb_first(&old_base->active))) { |
1572 | timer = rb_entry(node, struct hrtimer, node); | 1596 | timer = rb_entry(node, struct hrtimer, node); |
1573 | BUG_ON(hrtimer_callback_running(timer)); | 1597 | BUG_ON(hrtimer_callback_running(timer)); |
1574 | debug_hrtimer_deactivate(timer); | 1598 | debug_deactivate(timer); |
1575 | 1599 | ||
1576 | /* | 1600 | /* |
1577 | * Mark it as STATE_MIGRATE not INACTIVE otherwise the | 1601 | * Mark it as STATE_MIGRATE not INACTIVE otherwise the |