Index: kern_timeout.c =================================================================== RCS file: /cvs/src/sys/kern/kern_timeout.c,v retrieving revision 1.83 diff -u -p -r1.83 kern_timeout.c --- kern_timeout.c 8 Feb 2021 08:18:45 -0000 1.83 +++ kern_timeout.c 4 May 2021 11:49:46 -0000 @@ -175,7 +175,7 @@ void softclock_thread(void *); uint32_t timeout_bucket(const struct timeout *); uint32_t timeout_maskwheel(uint32_t, const struct timespec *); void timeout_run(struct timeout *); -void timeout_proc_barrier(void *); +void timeout_barrier_signal(void *); /* * The first thing in a struct timeout is its struct circq, so we @@ -490,34 +490,33 @@ timeout_del_barrier(struct timeout *to) void timeout_barrier(struct timeout *to) { - int needsproc = ISSET(to->to_flags, TIMEOUT_PROC); + int proc = ISSET(to->to_flags, TIMEOUT_PROC); + struct cond c = COND_INITIALIZER(); + struct timeout barrier; - timeout_sync_order(needsproc); - - if (!needsproc) { - KERNEL_LOCK(); - splx(splsoftclock()); - KERNEL_UNLOCK(); - } else { - struct cond c = COND_INITIALIZER(); - struct timeout barrier; + timeout_sync_order(proc); - timeout_set_proc(&barrier, timeout_proc_barrier, &c); - barrier.to_process = curproc->p_p; + _timeout_set(&barrier, timeout_barrier_signal, &c, proc, KCLOCK_NONE); +#if NKCOV > 0 + barrier.to_process = curproc->p_p; +#endif - mtx_enter(&timeout_mutex); - SET(barrier.to_flags, TIMEOUT_ONQUEUE); - CIRCQ_INSERT_TAIL(&timeout_proc, &barrier.to_list); - mtx_leave(&timeout_mutex); + mtx_enter(&timeout_mutex); + SET(barrier.to_flags, TIMEOUT_ONQUEUE); + CIRCQ_INSERT_TAIL(proc ? &timeout_proc : &timeout_todo, + &barrier.to_list); + mtx_leave(&timeout_mutex); + if (proc) wakeup_one(&timeout_proc); + else + softintr_schedule(softclock_si); - cond_wait(&c, "tmobar"); - } + cond_wait(&c, "tmobar"); } void -timeout_proc_barrier(void *arg) +timeout_barrier_signal(void *arg) { struct cond *c = arg;