Index: sys/sys/sx.h =================================================================== --- sys/sys/sx.h (revision 243581) +++ sys/sys/sx.h (working copy) @@ -276,7 +276,7 @@ __sx_sunlock(struct sx *sx, const char *file, int #define sx_sleep(chan, sx, pri, wmesg, timo) \ _sleep((chan), &(sx)->lock_object, (pri), (wmesg), (timo), \ - NULL, 0) + NULL, NULL, 0) /* * Options passed to sx_init_flags(). Index: sys/sys/rwlock.h =================================================================== --- sys/sys/rwlock.h (revision 243581) +++ sys/sys/rwlock.h (working copy) @@ -211,7 +211,8 @@ void __rw_assert(const volatile uintptr_t *c, int rw_runlock(rw); \ } while (0) #define rw_sleep(chan, rw, pri, wmesg, timo) \ - _sleep((chan), &(rw)->lock_object, (pri), (wmesg), (timo), NULL, 0) + _sleep((chan), &(rw)->lock_object, (pri), (wmesg), (timo), \ + NULL, NULL, 0) #define rw_initialized(rw) lock_initalized(&(rw)->lock_object) Index: sys/sys/mutex.h =================================================================== --- sys/sys/mutex.h (revision 243581) +++ sys/sys/mutex.h (working copy) @@ -377,7 +377,7 @@ extern struct mtx_pool *mtxpool_sleep; #define mtx_sleep(chan, mtx, pri, wmesg, timo) \ _sleep((chan), &(mtx)->lock_object, (pri), (wmesg), (timo), \ - NULL, 0) + NULL, NULL, 0) #define mtx_initialized(m) lock_initalized(&(m)->lock_object) Index: sys/sys/sleepqueue.h =================================================================== --- sys/sys/sleepqueue.h (revision 243581) +++ sys/sys/sleepqueue.h (working copy) @@ -108,14 +108,14 @@ struct sleepqueue *sleepq_lookup(void *wchan); void sleepq_release(void *wchan); void sleepq_remove(struct thread *td, void *wchan); int sleepq_signal(void *wchan, int flags, int pri, int queue); -void _sleepq_set_timeout(void *wchan, struct bintime *bt, int timo, - int flags); +void _sleepq_set_timeout(void *wchan, struct bintime *bt, + struct bintime *precision, int timo, int flags); #define sleepq_set_timeout(wchan, timo) \ - _sleepq_set_timeout((wchan), NULL, (timo), 0) + _sleepq_set_timeout((wchan), NULL, NULL, (timo), 0) #define sleepq_set_timeout_flags(wchan, timo, flags) \ - _sleepq_set_timeout((wchan), NULL, (timo), (flags)) -#define sleepq_set_timeout_bt(wchan, bt, flags) \ - _sleepq_set_timeout((wchan), (bt), 0, (flags)) + _sleepq_set_timeout((wchan), NULL, NULL, (timo), (flags)) +#define sleepq_set_timeout_bt(wchan, bt, precision, flags) \ + _sleepq_set_timeout((wchan), (bt), (precision), 0, (flags)) u_int sleepq_sleepcnt(void *wchan, int queue); int sleepq_timedwait(void *wchan, int pri); int sleepq_timedwait_sig(void *wchan, int pri); Index: sys/sys/callout.h =================================================================== --- sys/sys/callout.h (revision 243581) +++ sys/sys/callout.h (working copy) @@ -51,25 +51,11 @@ #define CALLOUT_DIRECT 0x0100 /* allow exec from hw int context */ #define C_DIRECT_EXEC 0x0001 /* direct execution of callout */ -#define C_PABSBITS 24 -#define C_PABSMASK (~((1 << (32 - C_PABSBITS)) - 1)) -#define C_PABSRANGE ((1 << C_PABSBITS) - 1) -#define C_BT2PABS(x) ((x) >> 40) -#define C_SETPABS(x) (((x) & C_PABSRANGE) << 8) -#define C_US2PABS(x) (((x) * 4294) & ~C_PABSMASK) -#define C_PABS2BT(x) ((uint64_t)(flags & C_PABSMASK) << 32) -#define C_PRELBITS 5 -#define C_PRELRANGE ((1 << C_PRELBITS) - 1) -#define C_PRELSET(x) (((x) & C_PRELRANGE) << 1) +#define C_PRELBITS 7 +#define C_PRELRANGE 100 +#define C_PRELSET(x) ((x) << 1) #define C_PRELGET(x) (((x) >> 1) & C_PRELRANGE) -/* - * Common values specified for precision. - */ -#define C_P1MS C_US2PABS(1000) -#define C_P10MS C_US2PABS(10000) -#define C_P100MS C_US2PABS(100000) - struct callout_handle { struct callout *callout; }; @@ -89,16 +75,16 @@ void _callout_init_lock(struct callout *, struct l _callout_init_lock((c), ((rw) != NULL) ? &(rw)->lock_object : \ NULL, (flags)) #define callout_pending(c) ((c)->c_flags & CALLOUT_PENDING) -int _callout_reset_on(struct callout *, struct bintime *, int, - void (*)(void *), void *, int, int); +int _callout_reset_on(struct callout *, struct bintime *, + struct bintime *, int, void (*)(void *), void *, int, int); #define callout_reset_on(c, to_ticks, fn, arg, cpu) \ - _callout_reset_on((c), (NULL), (to_ticks), (fn), (arg), (cpu), \ - (0)) + _callout_reset_on((c), NULL, NULL, (to_ticks), (fn), (arg), \ + (cpu), 0) #define callout_reset_flags_on(c, to_ticks, fn, arg, cpu, flags) \ - _callout_reset_on((c), (NULL), (to_ticks), (fn), (arg), (cpu), \ - (flags)) -#define callout_reset_bt_on(c, bt, fn, arg, cpu, flags) \ - _callout_reset_on((c), (bt), (0), (fn), (arg), (cpu), (flags)) + _callout_reset_on((c), NULL, NULL, (to_ticks), (fn), (arg), (cpu), \ + (flags)) +#define callout_reset_bt_on(c, bt, pr, fn, arg, cpu, flags) \ + _callout_reset_on((c), (bt), (pr), 0, (fn), (arg), (cpu), (flags)) #define callout_reset(c, on_tick, fn, arg) \ callout_reset_on((c), (on_tick), (fn), (arg), (c)->c_cpu) #define callout_reset_curcpu(c, on_tick, fn, arg) \ Index: sys/sys/condvar.h =================================================================== --- sys/sys/condvar.h (revision 243581) +++ sys/sys/condvar.h (working copy) @@ -56,9 +56,11 @@ void _cv_wait(struct cv *cvp, struct lock_object * void _cv_wait_unlock(struct cv *cvp, struct lock_object *lock); int _cv_wait_sig(struct cv *cvp, struct lock_object *lock); int _cv_timedwait(struct cv *cvp, struct lock_object *lock, - struct bintime *bt, int timo, int flags); + struct bintime *bt, struct bintime *precision, int timo, + int flags); int _cv_timedwait_sig(struct cv *cvp, struct lock_object *lock, - struct bintime *bt, int timo, int flags); + struct bintime *bt, struct bintime *precision, int timo, + int flags); void cv_signal(struct cv *cvp); void cv_broadcastpri(struct cv *cvp, int pri); @@ -70,20 +72,23 @@ void cv_broadcastpri(struct cv *cvp, int pri); #define cv_wait_sig(cvp, lock) \ _cv_wait_sig((cvp), &(lock)->lock_object) #define cv_timedwait(cvp, lock, timo) \ - _cv_timedwait((cvp), &(lock)->lock_object, NULL, (timo), 0) + _cv_timedwait((cvp), &(lock)->lock_object, NULL, NULL, \ + (timo), 0) #define cv_timedwait_bt(cvp, lock, bt, flags) \ - _cv_timedwait_sig((cvp), &(lock)->lock_object, (bt), 0, 0) + _cv_timedwait_sig((cvp), &(lock)->lock_object, (bt), \ + (precision), 0, 0) #define cv_timedwait_sig_bt(cvp, lock, bt, flags) \ - _cv_timedwait_sig((cvp), &(lock)->lock_object, (bt), 0, \ + _cv_timedwait_sig((cvp), &(lock)->lock_object, (bt), NULL, 0, \ (flags)) #define cv_timedwait_flags(cvp, lock, timo, flags) \ - _cv_timedwait((cvp), &(lock)->lock_object, NULL, (timo), \ + _cv_timedwait((cvp), &(lock)->lock_object, NULL, NULL, (timo), \ (flags)) #define cv_timedwait_sig(cvp, lock, timo) \ - _cv_timedwait_sig((cvp), &(lock)->lock_object, NULL, (timo), 0) + _cv_timedwait_sig((cvp), &(lock)->lock_object, NULL, NULL, \ + (timo), 0) #define cv_timedwait_sig_flags(cvp, lock, timo, flags) \ - _cv_timedwait_sig((cvp), &(lock)->lock_object, NULL, (timo), \ - (flags)) + _cv_timedwait_sig((cvp), &(lock)->lock_object, NULL, NULL, \ + (timo), (flags)) #define cv_broadcast(cvp) cv_broadcastpri(cvp, 0) Index: sys/sys/systm.h =================================================================== --- sys/sys/systm.h (revision 243581) +++ sys/sys/systm.h (working copy) @@ -341,23 +341,24 @@ static __inline void splx(intrmask_t ipl __unused * less often. */ int _sleep(void *chan, struct lock_object *lock, int pri, const char *wmesg, - int timo, struct bintime *bt, int flags) __nonnull(1); + int timo, struct bintime *bt, struct bintime *precision, + int flags) __nonnull(1); #define msleep(chan, mtx, pri, wmesg, timo) \ _sleep((chan), &(mtx)->lock_object, (pri), (wmesg), (timo), \ - NULL, 0) + NULL, NULL, 0) #define msleep_flags(chan, mtx, pri, wmesg, timo, flags) \ _sleep((chan), &(mtx)->lock_object, (pri), (wmesg), (timo), \ - NULL, (flags)) -#define msleep_bt(chan, mtx, pri, wmesg, bt, flags) \ + NULL, NULL, (flags)) +#define msleep_bt(chan, mtx, pri, wmesg, bt, pr, flags) \ _sleep((chan), &(mtx)->lock_object, (pri), (wmesg) 0, (bt), \ - (flags)) + (pr), (flags)) int msleep_spin(void *chan, struct mtx *mtx, const char *wmesg, int timo) __nonnull(1); int pause(const char *wmesg, int timo); #define tsleep(chan, pri, wmesg, timo) \ - _sleep((chan), NULL, (pri), (wmesg), (timo), NULL, 0) -#define tsleep_bt(chan, pri, wmesg, bt, flags) \ - _sleep((chan), NULL, (pri), (wmesg), 0, (bt), (flags)) + _sleep((chan), NULL, (pri), (wmesg), (timo), NULL, NULL, 0) +#define tsleep_bt(chan, pri, wmesg, bt, pr, flags) \ + _sleep((chan), NULL, (pri), (wmesg), 0, (bt), (pr), (flags)) void wakeup(void *chan) __nonnull(1); void wakeup_one(void *chan) __nonnull(1); Index: sys/kern/kern_time.c =================================================================== --- sys/kern/kern_time.c (revision 243581) +++ sys/kern/kern_time.c (working copy) @@ -494,7 +494,8 @@ kern_nanosleep(struct thread *td, struct timespec timespec2bintime(rqt, &tmp); bintime_add(&bt,&tmp); for (;;) { - error = tsleep_bt(&nanowait, PWAIT | PCATCH, "nanslp", &bt, 0); + error = tsleep_bt(&nanowait, PWAIT | PCATCH, "nanslp", &bt, + NULL, 0); binuptime(&bt2); if (error != EWOULDBLOCK) { if (error == ERESTART) Index: sys/kern/subr_sleepqueue.c =================================================================== --- sys/kern/subr_sleepqueue.c (revision 243581) +++ sys/kern/subr_sleepqueue.c (working copy) @@ -363,7 +363,8 @@ sleepq_add(void *wchan, struct lock_object *lock, * sleep queue after timo ticks if the thread has not already been awakened. */ void -_sleepq_set_timeout(void *wchan, struct bintime *bt, int timo, int flags) +_sleepq_set_timeout(void *wchan, struct bintime *bt, struct bintime *precision, + int timo, int flags) { struct sleepqueue_chain *sc; @@ -379,7 +380,7 @@ void callout_reset_flags_on(&td->td_slpcallout, timo, sleepq_timeout, td, PCPU_GET(cpuid), flags | C_DIRECT_EXEC); else - callout_reset_bt_on(&td->td_slpcallout, bt, + callout_reset_bt_on(&td->td_slpcallout, bt, precision, sleepq_timeout, td, PCPU_GET(cpuid), flags | C_DIRECT_EXEC); } Index: sys/kern/kern_condvar.c =================================================================== --- sys/kern/kern_condvar.c (revision 243581) +++ sys/kern/kern_condvar.c (working copy) @@ -275,7 +275,7 @@ _cv_wait_sig(struct cv *cvp, struct lock_object *l */ int _cv_timedwait(struct cv *cvp, struct lock_object *lock, struct bintime *bt, - int timo, int flags) + struct bintime *precision, int timo, int flags) { WITNESS_SAVE_DECL(lock_witness); struct lock_class *class; @@ -314,7 +314,7 @@ _cv_timedwait(struct cv *cvp, struct lock_object * if (bt == NULL) sleepq_set_timeout_flags(cvp, timo, flags); else - sleepq_set_timeout_bt(cvp, bt, flags); + sleepq_set_timeout_bt(cvp, bt, precision, flags); if (lock != &Giant.lock_object) { if (class->lc_flags & LC_SLEEPABLE) sleepq_release(cvp); @@ -346,7 +346,7 @@ _cv_timedwait(struct cv *cvp, struct lock_object * */ int _cv_timedwait_sig(struct cv *cvp, struct lock_object *lock, - struct bintime *bt, int timo, int flags) + struct bintime *bt, struct bintime *precision, int timo, int flags) { WITNESS_SAVE_DECL(lock_witness); struct lock_class *class; @@ -386,7 +386,7 @@ _cv_timedwait_sig(struct cv *cvp, struct lock_obje if (bt == NULL) sleepq_set_timeout_flags(cvp, timo, flags); else - sleepq_set_timeout_bt(cvp, bt, flags); + sleepq_set_timeout_bt(cvp, bt, precision, flags); if (lock != &Giant.lock_object) { if (class->lc_flags & LC_SLEEPABLE) sleepq_release(cvp); Index: sys/kern/kern_timeout.c =================================================================== --- sys/kern/kern_timeout.c (revision 243581) +++ sys/kern/kern_timeout.c (working copy) @@ -565,11 +565,10 @@ callout_lock(struct callout *c) static void callout_cc_add(struct callout *c, struct callout_cpu *cc, - struct bintime to_bintime, void (*func)(void *), void *arg, int cpu, - int flags) + struct bintime to_bintime, struct bintime *precision, void (*func)(void *), + void *arg, int cpu, int flags) { struct bintime bt; - uint64_t r_val; int bucket; CC_LOCK_ASSERT(cc); @@ -582,11 +581,12 @@ callout_cc_add(struct callout *c, struct callout_c c->c_flags &= ~CALLOUT_PROCESSED; c->c_func = func; c->c_time = to_bintime; - bintime_clear(&c->c_precision); - r_val = C_PABS2BT(flags); - c->c_precision.frac = r_val; - CTR3(KTR_CALLOUT, "precision set for %p: 0.%08x%08", - c, (u_int) (r_val >> 32), (u_int) (r_val & 0xffffffff)); + bintime_clear(&(c->c_precision)); + if (precision != NULL) + c->c_precision = *precision; + CTR4(KTR_CALLOUT, "precision set for %p: %d.%08x%08x", + c, c->precision.sec, (u_int) (c->c_precision.frac >> 32), + (u_int) (c->c_precision.frac & 0xffffffff)); bucket = get_bucket(&c->c_time); TAILQ_INSERT_TAIL(&cc->cc_callwheel[bucket], c, c_links.tqe); /* @@ -779,8 +779,8 @@ skip: */ new_cc = callout_cpu_switch(c, cc, new_cpu); flags = (direct) ? C_DIRECT_EXEC : 0; - callout_cc_add(c, new_cc, new_time, new_func, new_arg, - new_cpu, flags); + callout_cc_add(c, new_cc, new_time, &(c->c_precision), new_func, + new_arg, new_cpu, flags); CC_UNLOCK(new_cc); CC_LOCK(cc); #else @@ -924,9 +924,10 @@ callout_handle_init(struct callout_handle *handle) * callout_pending() - returns truth if callout is still waiting for timeout * callout_deactivate() - marks the callout as having been serviced */ -int -_callout_reset_on(struct callout *c, struct bintime *bt, int to_ticks, - void (*ftn)(void *), void *arg, int cpu, int flags) +int +_callout_reset_on(struct callout *c, struct bintime *bt, + struct bintime *precision, int to_ticks, void (*ftn)(void *), + void *arg, int cpu, int flags) { struct bintime now, to_bt; struct callout_cpu *cc; @@ -1013,7 +1014,7 @@ callout_handle_init(struct callout_handle *handle) } #endif - callout_cc_add(c, cc, to_bt, ftn, arg, cpu, flags); + callout_cc_add(c, cc, to_bt, precision, ftn, arg, cpu, flags); CTR6(KTR_CALLOUT, "%sscheduled %p func %p arg %p in %d.%08x", cancelled ? "re" : "", c, c->c_func, c->c_arg, (int)(to_bt.sec), (u_int)(to_bt.frac >> 32)); Index: sys/kern/kern_synch.c =================================================================== --- sys/kern/kern_synch.c (revision 243581) +++ sys/kern/kern_synch.c (working copy) @@ -146,7 +146,8 @@ sleepinit(void) */ int _sleep(void *ident, struct lock_object *lock, int priority, - const char *wmesg, int timo, struct bintime *bt, int flags) + const char *wmesg, int timo, struct bintime *bt, + struct bintime *precision, int flags) { struct thread *td; struct proc *p; @@ -233,7 +234,7 @@ _sleep(void *ident, struct lock_object *lock, int */ sleepq_add(ident, lock, wmesg, sleepq_flags, 0); if (bt) - sleepq_set_timeout_bt(ident, bt, flags); + sleepq_set_timeout_bt(ident, bt, precision, flags); else if (timo) sleepq_set_timeout_flags(ident, timo, flags); if (lock != NULL && class->lc_flags & LC_SLEEPABLE) { Index: sys/kern/kern_event.c =================================================================== --- sys/kern/kern_event.c (revision 243581) +++ sys/kern/kern_event.c (working copy) @@ -550,8 +550,8 @@ filt_timerexpire(void *knx) if ((kn->kn_flags & EV_ONESHOT) != EV_ONESHOT) { bt = timer2bintime(kn->kn_sdata); calloutp = (struct callout *)kn->kn_hook; - callout_reset_bt_on(calloutp, &bt, filt_timerexpire, kn, - PCPU_GET(cpuid), C_P1MS); + callout_reset_bt_on(calloutp, &bt, NULL, filt_timerexpire, kn, + PCPU_GET(cpuid), 0); } } @@ -577,8 +577,8 @@ filt_timerattach(struct knote *kn) callout_init(calloutp, CALLOUT_MPSAFE); kn->kn_hook = calloutp; bt = timer2bintime(kn->kn_sdata); - callout_reset_bt_on(calloutp, &bt, filt_timerexpire, kn, - PCPU_GET(cpuid), C_P1MS); + callout_reset_bt_on(calloutp, &bt, NULL, filt_timerexpire, kn, + PCPU_GET(cpuid), 0); return (0); } Index: sys/ofed/include/linux/timer.h =================================================================== --- sys/ofed/include/linux/timer.h (revision 243581) +++ sys/ofed/include/linux/timer.h (working copy) @@ -38,10 +38,9 @@ struct timer_list { struct callout timer_callout; void (*function)(unsigned long); unsigned long data; + int expires; }; -#define expires timer_callout.c_time - static inline void _timer_fn(void *context) { @@ -71,7 +70,7 @@ do { \ #define add_timer(timer) \ callout_reset(&(timer)->timer_callout, \ - (timer)->timer_callout.c_time - jiffies, _timer_fn, (timer)) + (timer)->expires - jiffies, _timer_fn, (timer)) #define del_timer(timer) callout_stop(&(timer)->timer_callout) #define del_timer_sync(timer) callout_drain(&(timer)->timer_callout) Index: sys/dev/sound/pci/hda/hdaa.c =================================================================== --- sys/dev/sound/pci/hda/hdaa.c (revision 243581) +++ sys/dev/sound/pci/hda/hdaa.c (working copy) @@ -5553,7 +5553,7 @@ hdaa_dump_ctls(struct hdaa_pcm_devinfo *pdevinfo, struct hdaa_devinfo *devinfo = pdevinfo->devinfo; struct hdaa_audio_ctl *ctl; char buf[64]; - int i, j, printed; + int i, j, printed = 0; if (flag == 0) { flag = ~(SOUND_MASK_VOLUME | SOUND_MASK_PCM |