Give up on calling tc_ticktock() from a timeout, we have timeout

functions which run for several milliseconds at a time and getting
in queue behind one or more of those makes us miss our rewind.

Instead call it from hardclock() like we used to do, but retain the
prescaler so we still cope with high HZ values.
This commit is contained in:
phk 2002-09-04 10:15:19 +00:00
parent f230fa27fb
commit 8ceeefb3da
3 changed files with 9 additions and 4 deletions

View File

@ -59,6 +59,7 @@
#include <sys/sysctl.h>
#include <sys/bus.h>
#include <sys/interrupt.h>
#include <sys/timetc.h>
#include <machine/cpu.h>
#include <machine/limits.h>
@ -208,6 +209,7 @@ hardclock(frame)
hardclock_process(curthread, CLKF_USERMODE(frame));
mtx_unlock_spin_flags(&sched_lock, MTX_QUIET);
tc_ticktock();
/*
* If no separate statistics clock is available, run it from here.
*

View File

@ -647,12 +647,15 @@ pps_event(struct pps_state *pps, int event)
static int tc_tick;
SYSCTL_INT(_kern_timecounter, OID_AUTO, tick, CTLFLAG_RD, &tick, 0, "");
static void
tc_ticktock(void *dummy)
void
tc_ticktock(void)
{
static int count;
if (++count < tc_tick)
return;
count = 0;
tc_windup();
timeout(tc_ticktock, NULL, tc_tick);
}
static void
@ -678,7 +681,6 @@ inittimecounter(void *dummy)
/* warm up new timecounter (again) and get rolling. */
(void)timecounter->tc_get_timecount(timecounter);
(void)timecounter->tc_get_timecount(timecounter);
tc_ticktock(NULL);
}
SYSINIT(timecounter, SI_SUB_CLOCKS, SI_ORDER_FIRST, inittimecounter, NULL)

View File

@ -62,5 +62,6 @@ extern struct timecounter *timecounter;
u_int32_t tc_getfrequency(void);
void tc_init(struct timecounter *tc);
void tc_setclock(struct timespec *ts);
void tc_ticktock(void);
#endif /* !_SYS_TIMETC_H_ */