Lines Matching refs:timer
506 static inline unsigned int timer_get_idx(struct timer_list *timer) in timer_get_idx() argument
508 return (timer->flags & TIMER_ARRAYMASK) >> TIMER_ARRAYSHIFT; in timer_get_idx()
511 static inline void timer_set_idx(struct timer_list *timer, unsigned int idx) in timer_set_idx() argument
513 timer->flags = (timer->flags & ~TIMER_ARRAYMASK) | in timer_set_idx()
578 trigger_dyntick_cpu(struct timer_base *base, struct timer_list *timer) in trigger_dyntick_cpu() argument
587 if (timer->flags & TIMER_DEFERRABLE) { in trigger_dyntick_cpu()
607 static void enqueue_timer(struct timer_base *base, struct timer_list *timer, in enqueue_timer() argument
611 hlist_add_head(&timer->entry, base->vectors + idx); in enqueue_timer()
613 timer_set_idx(timer, idx); in enqueue_timer()
615 trace_timer_start(timer, timer->expires, timer->flags); in enqueue_timer()
630 trigger_dyntick_cpu(base, timer); in enqueue_timer()
634 static void internal_add_timer(struct timer_base *base, struct timer_list *timer) in internal_add_timer() argument
639 idx = calc_wheel_index(timer->expires, base->clk, &bucket_expiry); in internal_add_timer()
640 enqueue_timer(base, timer, idx, bucket_expiry); in internal_add_timer()
661 struct delayed_work, timer, work.func),
663 struct kthread_delayed_work, timer, work.func),
668 struct timer_list *timer = addr; in timer_debug_hint() local
672 if (timer_hints[i].function == timer->function) { in timer_debug_hint()
679 return timer->function; in timer_debug_hint()
684 struct timer_list *timer = addr; in timer_is_static_object() local
686 return (timer->entry.pprev == NULL && in timer_is_static_object()
687 timer->entry.next == TIMER_ENTRY_STATIC); in timer_is_static_object()
696 struct timer_list *timer = addr; in timer_fixup_init() local
700 del_timer_sync(timer); in timer_fixup_init()
701 debug_object_init(timer, &timer_debug_descr); in timer_fixup_init()
721 struct timer_list *timer = addr; in timer_fixup_activate() local
725 timer_setup(timer, stub_timer, 0); in timer_fixup_activate()
742 struct timer_list *timer = addr; in timer_fixup_free() local
746 del_timer_sync(timer); in timer_fixup_free()
747 debug_object_free(timer, &timer_debug_descr); in timer_fixup_free()
760 struct timer_list *timer = addr; in timer_fixup_assert_init() local
764 timer_setup(timer, stub_timer, 0); in timer_fixup_assert_init()
781 static inline void debug_timer_init(struct timer_list *timer) in debug_timer_init() argument
783 debug_object_init(timer, &timer_debug_descr); in debug_timer_init()
786 static inline void debug_timer_activate(struct timer_list *timer) in debug_timer_activate() argument
788 debug_object_activate(timer, &timer_debug_descr); in debug_timer_activate()
791 static inline void debug_timer_deactivate(struct timer_list *timer) in debug_timer_deactivate() argument
793 debug_object_deactivate(timer, &timer_debug_descr); in debug_timer_deactivate()
796 static inline void debug_timer_assert_init(struct timer_list *timer) in debug_timer_assert_init() argument
798 debug_object_assert_init(timer, &timer_debug_descr); in debug_timer_assert_init()
801 static void do_init_timer(struct timer_list *timer,
806 void init_timer_on_stack_key(struct timer_list *timer, in init_timer_on_stack_key() argument
811 debug_object_init_on_stack(timer, &timer_debug_descr); in init_timer_on_stack_key()
812 do_init_timer(timer, func, flags, name, key); in init_timer_on_stack_key()
816 void destroy_timer_on_stack(struct timer_list *timer) in destroy_timer_on_stack() argument
818 debug_object_free(timer, &timer_debug_descr); in destroy_timer_on_stack()
823 static inline void debug_timer_init(struct timer_list *timer) { } in debug_timer_init() argument
824 static inline void debug_timer_activate(struct timer_list *timer) { } in debug_timer_activate() argument
825 static inline void debug_timer_deactivate(struct timer_list *timer) { } in debug_timer_deactivate() argument
826 static inline void debug_timer_assert_init(struct timer_list *timer) { } in debug_timer_assert_init() argument
829 static inline void debug_init(struct timer_list *timer) in debug_init() argument
831 debug_timer_init(timer); in debug_init()
832 trace_timer_init(timer); in debug_init()
835 static inline void debug_deactivate(struct timer_list *timer) in debug_deactivate() argument
837 debug_timer_deactivate(timer); in debug_deactivate()
838 trace_timer_cancel(timer); in debug_deactivate()
841 static inline void debug_assert_init(struct timer_list *timer) in debug_assert_init() argument
843 debug_timer_assert_init(timer); in debug_assert_init()
846 static void do_init_timer(struct timer_list *timer, in do_init_timer() argument
851 timer->entry.pprev = NULL; in do_init_timer()
852 timer->function = func; in do_init_timer()
855 timer->flags = flags | raw_smp_processor_id(); in do_init_timer()
856 lockdep_init_map(&timer->lockdep_map, name, key, 0); in do_init_timer()
871 void init_timer_key(struct timer_list *timer, in init_timer_key() argument
875 debug_init(timer); in init_timer_key()
876 do_init_timer(timer, func, flags, name, key); in init_timer_key()
880 static inline void detach_timer(struct timer_list *timer, bool clear_pending) in detach_timer() argument
882 struct hlist_node *entry = &timer->entry; in detach_timer()
884 debug_deactivate(timer); in detach_timer()
892 static int detach_if_pending(struct timer_list *timer, struct timer_base *base, in detach_if_pending() argument
895 unsigned idx = timer_get_idx(timer); in detach_if_pending()
897 if (!timer_pending(timer)) in detach_if_pending()
900 if (hlist_is_singular_node(&timer->entry, base->vectors + idx)) { in detach_if_pending()
905 detach_timer(timer, clear_pending); in detach_if_pending()
988 static struct timer_base *lock_timer_base(struct timer_list *timer, in lock_timer_base() argument
990 __acquires(timer->base->lock) in lock_timer_base()
1001 tf = READ_ONCE(timer->flags); in lock_timer_base()
1006 if (timer->flags == tf) in lock_timer_base()
1019 __mod_timer(struct timer_list *timer, unsigned long expires, unsigned int options) in __mod_timer() argument
1026 BUG_ON(!timer->function); in __mod_timer()
1033 if (!(options & MOD_TIMER_NOTPENDING) && timer_pending(timer)) { in __mod_timer()
1039 long diff = timer->expires - expires; in __mod_timer()
1052 base = lock_timer_base(timer, &flags); in __mod_timer()
1055 if (timer_pending(timer) && (options & MOD_TIMER_REDUCE) && in __mod_timer()
1056 time_before_eq(timer->expires, expires)) { in __mod_timer()
1069 if (idx == timer_get_idx(timer)) { in __mod_timer()
1071 timer->expires = expires; in __mod_timer()
1072 else if (time_after(timer->expires, expires)) in __mod_timer()
1073 timer->expires = expires; in __mod_timer()
1078 base = lock_timer_base(timer, &flags); in __mod_timer()
1082 ret = detach_if_pending(timer, base, false); in __mod_timer()
1086 new_base = get_target_base(base, timer->flags); in __mod_timer()
1096 if (likely(base->running_timer != timer)) { in __mod_timer()
1098 timer->flags |= TIMER_MIGRATING; in __mod_timer()
1103 WRITE_ONCE(timer->flags, in __mod_timer()
1104 (timer->flags & ~TIMER_BASEMASK) | base->cpu); in __mod_timer()
1109 debug_timer_activate(timer); in __mod_timer()
1111 timer->expires = expires; in __mod_timer()
1119 enqueue_timer(base, timer, idx, bucket_expiry); in __mod_timer()
1121 internal_add_timer(base, timer); in __mod_timer()
1139 int mod_timer_pending(struct timer_list *timer, unsigned long expires) in mod_timer_pending() argument
1141 return __mod_timer(timer, expires, MOD_TIMER_PENDING_ONLY); in mod_timer_pending()
1165 int mod_timer(struct timer_list *timer, unsigned long expires) in mod_timer() argument
1167 return __mod_timer(timer, expires, 0); in mod_timer()
1180 int timer_reduce(struct timer_list *timer, unsigned long expires) in timer_reduce() argument
1182 return __mod_timer(timer, expires, MOD_TIMER_REDUCE); in timer_reduce()
1200 void add_timer(struct timer_list *timer) in add_timer() argument
1202 BUG_ON(timer_pending(timer)); in add_timer()
1203 __mod_timer(timer, timer->expires, MOD_TIMER_NOTPENDING); in add_timer()
1214 void add_timer_on(struct timer_list *timer, int cpu) in add_timer_on() argument
1219 BUG_ON(timer_pending(timer) || !timer->function); in add_timer_on()
1221 new_base = get_timer_cpu_base(timer->flags, cpu); in add_timer_on()
1228 base = lock_timer_base(timer, &flags); in add_timer_on()
1230 timer->flags |= TIMER_MIGRATING; in add_timer_on()
1235 WRITE_ONCE(timer->flags, in add_timer_on()
1236 (timer->flags & ~TIMER_BASEMASK) | cpu); in add_timer_on()
1240 debug_timer_activate(timer); in add_timer_on()
1241 internal_add_timer(base, timer); in add_timer_on()
1257 int del_timer(struct timer_list *timer) in del_timer() argument
1263 debug_assert_init(timer); in del_timer()
1265 if (timer_pending(timer)) { in del_timer()
1266 base = lock_timer_base(timer, &flags); in del_timer()
1267 ret = detach_if_pending(timer, base, true); in del_timer()
1282 int try_to_del_timer_sync(struct timer_list *timer) in try_to_del_timer_sync() argument
1288 debug_assert_init(timer); in try_to_del_timer_sync()
1290 base = lock_timer_base(timer, &flags); in try_to_del_timer_sync()
1292 if (base->running_timer != timer) in try_to_del_timer_sync()
1293 ret = detach_if_pending(timer, base, true); in try_to_del_timer_sync()
1344 static void del_timer_wait_running(struct timer_list *timer) in del_timer_wait_running() argument
1348 tf = READ_ONCE(timer->flags); in del_timer_wait_running()
1371 static inline void del_timer_wait_running(struct timer_list *timer) { } in del_timer_wait_running() argument
1411 int del_timer_sync(struct timer_list *timer) in del_timer_sync() argument
1423 lock_map_acquire(&timer->lockdep_map); in del_timer_sync()
1424 lock_map_release(&timer->lockdep_map); in del_timer_sync()
1431 WARN_ON(in_irq() && !(timer->flags & TIMER_IRQSAFE)); in del_timer_sync()
1437 if (IS_ENABLED(CONFIG_PREEMPT_RT) && !(timer->flags & TIMER_IRQSAFE)) in del_timer_sync()
1441 ret = try_to_del_timer_sync(timer); in del_timer_sync()
1444 del_timer_wait_running(timer); in del_timer_sync()
1454 static void call_timer_fn(struct timer_list *timer, in call_timer_fn() argument
1470 lockdep_copy_map(&lockdep_map, &timer->lockdep_map); in call_timer_fn()
1479 trace_timer_expire_entry(timer, baseclk); in call_timer_fn()
1480 fn(timer); in call_timer_fn()
1481 trace_timer_expire_exit(timer); in call_timer_fn()
1508 struct timer_list *timer; in expire_timers() local
1511 timer = hlist_entry(head->first, struct timer_list, entry); in expire_timers()
1513 base->running_timer = timer; in expire_timers()
1514 detach_timer(timer, true); in expire_timers()
1516 fn = timer->function; in expire_timers()
1518 if (timer->flags & TIMER_IRQSAFE) { in expire_timers()
1520 call_timer_fn(timer, fn, baseclk); in expire_timers()
1525 call_timer_fn(timer, fn, baseclk); in expire_timers()
1860 struct timer_list timer; member
1866 struct process_timer *timeout = from_timer(timeout, t, timer); in process_timeout()
1904 struct process_timer timer; in schedule_timeout() local
1938 timer.task = current; in schedule_timeout()
1939 timer_setup_on_stack(&timer.timer, process_timeout, 0); in schedule_timeout()
1940 __mod_timer(&timer.timer, expire, MOD_TIMER_NOTPENDING); in schedule_timeout()
1942 del_singleshot_timer_sync(&timer.timer); in schedule_timeout()
1945 destroy_timer_on_stack(&timer.timer); in schedule_timeout()
1993 struct timer_list *timer; in migrate_timer_list() local
1997 timer = hlist_entry(head->first, struct timer_list, entry); in migrate_timer_list()
1998 detach_timer(timer, false); in migrate_timer_list()
1999 timer->flags = (timer->flags & ~TIMER_BASEMASK) | cpu; in migrate_timer_list()
2000 internal_add_timer(new_base, timer); in migrate_timer_list()