Lines Matching refs:to

270 timeout_set_flags(struct timeout *to, void (*fn)(void *), void *arg, int kclock,  in timeout_set_flags()  argument
276 to->to_func = fn; in timeout_set_flags()
277 to->to_arg = arg; in timeout_set_flags()
278 to->to_kclock = kclock; in timeout_set_flags()
279 to->to_flags = flags | TIMEOUT_INITIALIZED; in timeout_set_flags()
282 if (ISSET(to->to_flags, TIMEOUT_MPSAFE)) in timeout_set_flags()
283 KASSERT(ISSET(to->to_flags, TIMEOUT_PROC)); in timeout_set_flags()
336 timeout_add_ticks(struct timeout *to, uint64_t to_ticks, int notzero) in timeout_add_ticks() argument
343 return timeout_add(to, (int)to_ticks); in timeout_add_ticks()
347 timeout_add_tv(struct timeout *to, const struct timeval *tv) in timeout_add_tv() argument
353 return timeout_add_ticks(to, to_ticks, tv->tv_usec > 0); in timeout_add_tv()
357 timeout_add_sec(struct timeout *to, int secs) in timeout_add_sec() argument
363 return timeout_add_ticks(to, to_ticks, 1); in timeout_add_sec()
367 timeout_add_msec(struct timeout *to, uint64_t msecs) in timeout_add_msec() argument
373 return timeout_add_ticks(to, to_ticks, msecs > 0); in timeout_add_msec()
377 timeout_add_usec(struct timeout *to, uint64_t usecs) in timeout_add_usec() argument
383 return timeout_add_ticks(to, to_ticks, usecs > 0); in timeout_add_usec()
387 timeout_add_nsec(struct timeout *to, uint64_t nsecs) in timeout_add_nsec() argument
393 return timeout_add_ticks(to, to_ticks, nsecs > 0); in timeout_add_nsec()
397 timeout_abs_ts(struct timeout *to, const struct timespec *abstime) in timeout_abs_ts() argument
404 KASSERT(ISSET(to->to_flags, TIMEOUT_INITIALIZED)); in timeout_abs_ts()
405 KASSERT(to->to_kclock == KCLOCK_UPTIME); in timeout_abs_ts()
407 old_abstime = to->to_abstime; in timeout_abs_ts()
408 to->to_abstime = *abstime; in timeout_abs_ts()
409 CLR(to->to_flags, TIMEOUT_TRIGGERED); in timeout_abs_ts()
411 if (ISSET(to->to_flags, TIMEOUT_ONQUEUE)) { in timeout_abs_ts()
413 CIRCQ_REMOVE(&to->to_list); in timeout_abs_ts()
414 CIRCQ_INSERT_TAIL(&timeout_new, &to->to_list); in timeout_abs_ts()
419 SET(to->to_flags, TIMEOUT_ONQUEUE); in timeout_abs_ts()
420 CIRCQ_INSERT_TAIL(&timeout_new, &to->to_list); in timeout_abs_ts()
424 to->to_process = curproc->p_p; in timeout_abs_ts()
434 timeout_del(struct timeout *to) in timeout_del() argument
439 if (ISSET(to->to_flags, TIMEOUT_ONQUEUE)) { in timeout_del()
440 CIRCQ_REMOVE(&to->to_list); in timeout_del()
441 CLR(to->to_flags, TIMEOUT_ONQUEUE); in timeout_del()
445 CLR(to->to_flags, TIMEOUT_TRIGGERED); in timeout_del()
453 timeout_del_barrier(struct timeout *to) in timeout_del_barrier() argument
457 timeout_sync_order(ISSET(to->to_flags, TIMEOUT_PROC)); in timeout_del_barrier()
459 removed = timeout_del(to); in timeout_del_barrier()
460 timeout_barrier(to); in timeout_del_barrier()
466 timeout_barrier(struct timeout *to) in timeout_barrier() argument
472 flags = to->to_flags & (TIMEOUT_PROC | TIMEOUT_MPSAFE); in timeout_barrier()
518 timeout_bucket(const struct timeout *to) in timeout_bucket() argument
524 KASSERT(to->to_kclock == KCLOCK_UPTIME); in timeout_bucket()
525 kc = &timeout_kclock[to->to_kclock]; in timeout_bucket()
527 KASSERT(timespeccmp(&kc->kc_lastscan, &to->to_abstime, <)); in timeout_bucket()
528 timespecsub(&to->to_abstime, &kc->kc_lastscan, &diff); in timeout_bucket()
533 timespecadd(&to->to_abstime, &kc->kc_offset, &shifted_abstime); in timeout_bucket()
637 timeout_run(struct timeout *to) in timeout_run() argument
645 CLR(to->to_flags, TIMEOUT_ONQUEUE); in timeout_run()
646 SET(to->to_flags, TIMEOUT_TRIGGERED); in timeout_run()
648 fn = to->to_func; in timeout_run()
649 arg = to->to_arg; in timeout_run()
650 needsproc = ISSET(to->to_flags, TIMEOUT_PROC); in timeout_run()
652 struct process *kcov_process = to->to_process; in timeout_run()
669 softclock_process_kclock_timeout(struct timeout *to, int new) in softclock_process_kclock_timeout() argument
671 struct kclock *kc = &timeout_kclock[to->to_kclock]; in softclock_process_kclock_timeout()
673 if (timespeccmp(&to->to_abstime, &kc->kc_lastscan, >)) { in softclock_process_kclock_timeout()
677 CIRCQ_INSERT_TAIL(&timeout_wheel_kc[timeout_bucket(to)], in softclock_process_kclock_timeout()
678 &to->to_list); in softclock_process_kclock_timeout()
681 if (!new && timespeccmp(&to->to_abstime, &kc->kc_late, <=)) in softclock_process_kclock_timeout()
683 if (ISSET(to->to_flags, TIMEOUT_PROC)) { in softclock_process_kclock_timeout()
685 if (ISSET(to->to_flags, TIMEOUT_MPSAFE)) in softclock_process_kclock_timeout()
686 CIRCQ_INSERT_TAIL(&timeout_proc_mp, &to->to_list); in softclock_process_kclock_timeout()
689 CIRCQ_INSERT_TAIL(&timeout_proc, &to->to_list); in softclock_process_kclock_timeout()
692 timeout_run(to); in softclock_process_kclock_timeout()
697 softclock_process_tick_timeout(struct timeout *to, int new) in softclock_process_tick_timeout() argument
699 int delta = to->to_time - ticks; in softclock_process_tick_timeout()
705 CIRCQ_INSERT_TAIL(&BUCKET(delta, to->to_time), &to->to_list); in softclock_process_tick_timeout()
710 if (ISSET(to->to_flags, TIMEOUT_PROC)) { in softclock_process_tick_timeout()
712 if (ISSET(to->to_flags, TIMEOUT_MPSAFE)) in softclock_process_tick_timeout()
713 CIRCQ_INSERT_TAIL(&timeout_proc_mp, &to->to_list); in softclock_process_tick_timeout()
716 CIRCQ_INSERT_TAIL(&timeout_proc, &to->to_list); in softclock_process_tick_timeout()
719 timeout_run(to); in softclock_process_tick_timeout()
732 struct timeout *first_new, *to; in softclock() local
746 to = timeout_from_circq(CIRCQ_FIRST(&timeout_todo)); in softclock()
747 CIRCQ_REMOVE(&to->to_list); in softclock()
748 if (to == first_new) in softclock()
750 if (to->to_kclock == KCLOCK_NONE) in softclock()
751 softclock_process_tick_timeout(to, new); in softclock()
752 else if (to->to_kclock == KCLOCK_UPTIME) in softclock()
753 softclock_process_kclock_timeout(to, new); in softclock()
756 __func__, to->to_kclock); in softclock()
790 struct timeout *to; in softclock_thread() local
807 to = timeout_from_circq(CIRCQ_FIRST(&timeout_proc)); in softclock_thread()
808 CIRCQ_REMOVE(&to->to_list); in softclock_thread()
809 timeout_run(to); in softclock_thread()
823 struct timeout *to; in softclock_thread_mp() local
831 to = timeout_from_circq(CIRCQ_FIRST(&timeout_proc_mp)); in softclock_thread_mp()
832 CIRCQ_REMOVE(&to->to_list); in softclock_thread_mp()
833 timeout_run(to); in softclock_thread_mp()
847 struct timeout *to; in timeout_adjust_ticks() local
860 to = timeout_from_circq(p); in timeout_adjust_ticks()
864 if (to->to_time - ticks < adj) in timeout_adjust_ticks()
865 to->to_time = new_ticks; in timeout_adjust_ticks()
866 CIRCQ_REMOVE(&to->to_list); in timeout_adjust_ticks()
867 CIRCQ_INSERT_TAIL(&timeout_todo, &to->to_list); in timeout_adjust_ticks()
932 db_show_timeout(struct timeout *to, struct circq *bucket) in db_show_timeout() argument
942 db_find_sym_and_offset((vaddr_t)to->to_func, &name, &offset); in db_show_timeout()
955 if (to->to_kclock == KCLOCK_UPTIME) in db_show_timeout()
957 else if (to->to_kclock == KCLOCK_NONE) in db_show_timeout()
966 if (to->to_kclock == KCLOCK_UPTIME) { in db_show_timeout()
967 kc = &timeout_kclock[to->to_kclock]; in db_show_timeout()
968 timespecsub(&to->to_abstime, &kc->kc_lastscan, &remaining); in db_show_timeout()
970 db_timespec(&remaining), db_kclock(to->to_kclock), where, in db_show_timeout()
971 width, (ulong)to->to_arg, name); in db_show_timeout()
972 } else if (to->to_kclock == KCLOCK_NONE) { in db_show_timeout()
974 to->to_time - ticks, "ticks", where, in db_show_timeout()
975 width, (ulong)to->to_arg, name); in db_show_timeout()
982 __func__, to, to->to_kclock); in db_show_timeout()