aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/time/timer.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/time/timer.c')
-rw-r--r--kernel/time/timer.c32
1 files changed, 18 insertions, 14 deletions
diff --git a/kernel/time/timer.c b/kernel/time/timer.c
index 2fce056f8a49..343c7ba33b1c 100644
--- a/kernel/time/timer.c
+++ b/kernel/time/timer.c
@@ -536,6 +536,8 @@ static void enqueue_timer(struct timer_base *base, struct timer_list *timer,
536 hlist_add_head(&timer->entry, base->vectors + idx); 536 hlist_add_head(&timer->entry, base->vectors + idx);
537 __set_bit(idx, base->pending_map); 537 __set_bit(idx, base->pending_map);
538 timer_set_idx(timer, idx); 538 timer_set_idx(timer, idx);
539
540 trace_timer_start(timer, timer->expires, timer->flags);
539} 541}
540 542
541static void 543static void
@@ -757,13 +759,6 @@ static inline void debug_init(struct timer_list *timer)
757 trace_timer_init(timer); 759 trace_timer_init(timer);
758} 760}
759 761
760static inline void
761debug_activate(struct timer_list *timer, unsigned long expires)
762{
763 debug_timer_activate(timer);
764 trace_timer_start(timer, expires, timer->flags);
765}
766
767static inline void debug_deactivate(struct timer_list *timer) 762static inline void debug_deactivate(struct timer_list *timer)
768{ 763{
769 debug_timer_deactivate(timer); 764 debug_timer_deactivate(timer);
@@ -1037,7 +1032,7 @@ __mod_timer(struct timer_list *timer, unsigned long expires, unsigned int option
1037 } 1032 }
1038 } 1033 }
1039 1034
1040 debug_activate(timer, expires); 1035 debug_timer_activate(timer);
1041 1036
1042 timer->expires = expires; 1037 timer->expires = expires;
1043 /* 1038 /*
@@ -1171,7 +1166,7 @@ void add_timer_on(struct timer_list *timer, int cpu)
1171 } 1166 }
1172 forward_timer_base(base); 1167 forward_timer_base(base);
1173 1168
1174 debug_activate(timer, timer->expires); 1169 debug_timer_activate(timer);
1175 internal_add_timer(base, timer); 1170 internal_add_timer(base, timer);
1176 raw_spin_unlock_irqrestore(&base->lock, flags); 1171 raw_spin_unlock_irqrestore(&base->lock, flags);
1177} 1172}
@@ -1298,7 +1293,9 @@ int del_timer_sync(struct timer_list *timer)
1298EXPORT_SYMBOL(del_timer_sync); 1293EXPORT_SYMBOL(del_timer_sync);
1299#endif 1294#endif
1300 1295
1301static void call_timer_fn(struct timer_list *timer, void (*fn)(struct timer_list *)) 1296static void call_timer_fn(struct timer_list *timer,
1297 void (*fn)(struct timer_list *),
1298 unsigned long baseclk)
1302{ 1299{
1303 int count = preempt_count(); 1300 int count = preempt_count();
1304 1301
@@ -1321,14 +1318,14 @@ static void call_timer_fn(struct timer_list *timer, void (*fn)(struct timer_list
1321 */ 1318 */
1322 lock_map_acquire(&lockdep_map); 1319 lock_map_acquire(&lockdep_map);
1323 1320
1324 trace_timer_expire_entry(timer); 1321 trace_timer_expire_entry(timer, baseclk);
1325 fn(timer); 1322 fn(timer);
1326 trace_timer_expire_exit(timer); 1323 trace_timer_expire_exit(timer);
1327 1324
1328 lock_map_release(&lockdep_map); 1325 lock_map_release(&lockdep_map);
1329 1326
1330 if (count != preempt_count()) { 1327 if (count != preempt_count()) {
1331 WARN_ONCE(1, "timer: %pF preempt leak: %08x -> %08x\n", 1328 WARN_ONCE(1, "timer: %pS preempt leak: %08x -> %08x\n",
1332 fn, count, preempt_count()); 1329 fn, count, preempt_count());
1333 /* 1330 /*
1334 * Restore the preempt count. That gives us a decent 1331 * Restore the preempt count. That gives us a decent
@@ -1342,6 +1339,13 @@ static void call_timer_fn(struct timer_list *timer, void (*fn)(struct timer_list
1342 1339
1343static void expire_timers(struct timer_base *base, struct hlist_head *head) 1340static void expire_timers(struct timer_base *base, struct hlist_head *head)
1344{ 1341{
1342 /*
1343 * This value is required only for tracing. base->clk was
1344 * incremented directly before expire_timers was called. But expiry
1345 * is related to the old base->clk value.
1346 */
1347 unsigned long baseclk = base->clk - 1;
1348
1345 while (!hlist_empty(head)) { 1349 while (!hlist_empty(head)) {
1346 struct timer_list *timer; 1350 struct timer_list *timer;
1347 void (*fn)(struct timer_list *); 1351 void (*fn)(struct timer_list *);
@@ -1355,11 +1359,11 @@ static void expire_timers(struct timer_base *base, struct hlist_head *head)
1355 1359
1356 if (timer->flags & TIMER_IRQSAFE) { 1360 if (timer->flags & TIMER_IRQSAFE) {
1357 raw_spin_unlock(&base->lock); 1361 raw_spin_unlock(&base->lock);
1358 call_timer_fn(timer, fn); 1362 call_timer_fn(timer, fn, baseclk);
1359 raw_spin_lock(&base->lock); 1363 raw_spin_lock(&base->lock);
1360 } else { 1364 } else {
1361 raw_spin_unlock_irq(&base->lock); 1365 raw_spin_unlock_irq(&base->lock);
1362 call_timer_fn(timer, fn); 1366 call_timer_fn(timer, fn, baseclk);
1363 raw_spin_lock_irq(&base->lock); 1367 raw_spin_lock_irq(&base->lock);
1364 } 1368 }
1365 } 1369 }