FreeBSD kernel kern code
|
#include <sys/cdefs.h>
#include "opt_device_polling.h"
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/bus.h>
#include <sys/limits.h>
#include <sys/lock.h>
#include <sys/kdb.h>
#include <sys/ktr.h>
#include <sys/mutex.h>
#include <sys/proc.h>
#include <sys/kernel.h>
#include <sys/sched.h>
#include <sys/smp.h>
#include <sys/sysctl.h>
#include <sys/timeet.h>
#include <sys/timetc.h>
#include <machine/atomic.h>
#include <machine/clock.h>
#include <machine/cpu.h>
#include <machine/smp.h>
#include "opt_ddb.h"
Go to the source code of this file.
Data Structures | |
struct | pcpu_state |
Macros | |
#define | ET_HW_LOCK(state) |
#define | ET_HW_UNLOCK(state) |
Functions | |
__FBSDID ("$FreeBSD$") | |
static void | setuptimer (void) |
static void | loadtimer (sbintime_t now, int first) |
static int | doconfigtimer (void) |
static void | configtimer (int start) |
static int | round_freq (struct eventtimer *et, int freq) |
static sbintime_t | getnextcpuevent (int idle) |
static sbintime_t | getnextevent (void) |
static int | handleevents (sbintime_t now, int fake) |
TUNABLE_STR ("kern.eventtimer.timer", timername, sizeof(timername)) | |
SYSCTL_INT (_kern_eventtimer, OID_AUTO, singlemul, CTLFLAG_RWTUN, &singlemul, 0, "Multiplier for periodic mode") | |
SYSCTL_UINT (_kern_eventtimer, OID_AUTO, idletick, CTLFLAG_RWTUN, &idletick, 0, "Run periodic events when idle") | |
TUNABLE_INT ("kern.eventtimer.periodic", &want_periodic) | |
DPCPU_DEFINE_STATIC (struct pcpu_state, timerstate) | |
DPCPU_DEFINE (sbintime_t, hardclocktime) | |
int | hardclockintr (void) |
static void | timercb (struct eventtimer *et, void *arg) |
void | cpu_initclocks_bsp (void) |
void | cpu_initclocks_ap (void) |
void | suspendclock (void) |
void | resumeclock (void) |
void | cpu_startprofclock (void) |
void | cpu_stopprofclock (void) |
sbintime_t | cpu_idleclock (void) |
void | cpu_activeclock (void) |
void | cpu_et_frequency (struct eventtimer *et, uint64_t newfreq) |
void | cpu_new_callout (int cpu, sbintime_t bt, sbintime_t bt_opt) |
static int | sysctl_kern_eventtimer_timer (SYSCTL_HANDLER_ARGS) |
SYSCTL_PROC (_kern_eventtimer, OID_AUTO, timer, CTLTYPE_STRING|CTLFLAG_RW|CTLFLAG_MPSAFE, 0, 0, sysctl_kern_eventtimer_timer, "A", "Chosen event timer") | |
static int | sysctl_kern_eventtimer_periodic (SYSCTL_HANDLER_ARGS) |
SYSCTL_PROC (_kern_eventtimer, OID_AUTO, periodic, CTLTYPE_INT|CTLFLAG_RW|CTLFLAG_MPSAFE, 0, 0, sysctl_kern_eventtimer_periodic, "I", "Enable event timer periodic mode") | |
Variables | |
int | cpu_disable_c2_sleep = 0 |
int | cpu_disable_c3_sleep = 0 |
static struct mtx | et_hw_mtx |
static struct eventtimer * | timer = NULL |
static sbintime_t | timerperiod |
static sbintime_t | statperiod |
static sbintime_t | profperiod |
static sbintime_t | nexttick |
static u_int | busy = 1 |
static int | profiling |
static char | timername [32] |
static int | singlemul |
static u_int | idletick |
static int | periodic |
static int | want_periodic |
#define ET_HW_LOCK | ( | state | ) |
Definition at line 74 of file kern_clocksource.c.
#define ET_HW_UNLOCK | ( | state | ) |
Definition at line 82 of file kern_clocksource.c.
__FBSDID | ( | "$FreeBSD$" | ) |
|
static |
Definition at line 481 of file kern_clocksource.c.
References pcpu_state::action, busy, ET_HW_LOCK, ET_HW_UNLOCK, et_stop(), hardclock_sync(), loadtimer(), mp_ncpus, pcpu_state::nextcall, pcpu_state::nextcallopt, pcpu_state::nextevent, pcpu_state::nexthard, pcpu_state::nextprof, pcpu_state::nextstat, nexttick, pcpu_state::nexttick, pcpu_state::now, periodic, setuptimer(), smp_started, start, timer, and timerperiod.
Referenced by cpu_et_frequency(), cpu_initclocks_bsp(), cpu_startprofclock(), cpu_stopprofclock(), resumeclock(), suspendclock(), sysctl_kern_eventtimer_periodic(), and sysctl_kern_eventtimer_timer().
void cpu_activeclock | ( | void | ) |
Definition at line 795 of file kern_clocksource.c.
References busy, handleevents(), pcpu_state::idle, pcpu_state::now, and periodic.
void cpu_et_frequency | ( | struct eventtimer * | et, |
uint64_t | newfreq | ||
) |
Definition at line 824 of file kern_clocksource.c.
References configtimer(), and timer.
Referenced by et_change_frequency().
sbintime_t cpu_idleclock | ( | void | ) |
Definition at line 762 of file kern_clocksource.c.
References busy, ET_HW_LOCK, ET_HW_UNLOCK, getnextcpuevent(), pcpu_state::idle, idletick, loadtimer(), pcpu_state::nextevent, pcpu_state::now, periodic, and timer.
void cpu_initclocks_ap | ( | void | ) |
Definition at line 682 of file kern_clocksource.c.
References ET_HW_LOCK, ET_HW_UNLOCK, handleevents(), hardclock_sync(), and pcpu_state::now.
void cpu_initclocks_bsp | ( | void | ) |
Definition at line 594 of file kern_clocksource.c.
References configtimer(), cpu_disable_c3_sleep, et_find(), et_hw_mtx, pcpu_state::et_hw_mtx, et_init(), hz, pcpu_state::nextcall, pcpu_state::nextcallopt, panic(), periodic, profhz, profperiod, round_freq(), singlemul, stathz, statperiod, tick, tick_bt, tick_sbt, timer, timercb(), timername, and want_periodic.
void cpu_new_callout | ( | int | cpu, |
sbintime_t | bt, | ||
sbintime_t | bt_opt | ||
) |
Definition at line 838 of file kern_clocksource.c.
References bt, busy, ET_HW_LOCK, ET_HW_UNLOCK, pcpu_state::handle, loadtimer(), pcpu_state::nextcall, pcpu_state::nextcallopt, pcpu_state::nextevent, periodic, and timer.
Referenced by callout_cc_add(), and callout_process().
void cpu_startprofclock | ( | void | ) |
Definition at line 722 of file kern_clocksource.c.
References configtimer(), periodic, and profiling.
Referenced by startprofclock().
void cpu_stopprofclock | ( | void | ) |
Definition at line 742 of file kern_clocksource.c.
References configtimer(), periodic, and profiling.
Referenced by stopprofclock().
|
static |
Definition at line 445 of file kern_clocksource.c.
References pcpu_state::action, busy, ET_HW_LOCK, ET_HW_UNLOCK, et_stop(), pcpu_state::handle, handleevents(), loadtimer(), pcpu_state::now, and timer.
Referenced by hardclockintr().
DPCPU_DEFINE | ( | sbintime_t | , |
hardclocktime | |||
) |
DPCPU_DEFINE_STATIC | ( | struct pcpu_state | , |
timerstate | |||
) |
|
static |
Definition at line 232 of file kern_clocksource.c.
References hz, pcpu_state::idle, pcpu_state::nextcall, pcpu_state::nexthard, pcpu_state::nextprof, pcpu_state::nextstat, profiling, tc_min_ticktock_freq, and tick_sbt.
Referenced by cpu_idleclock(), and handleevents().
|
static |
Definition at line 269 of file kern_clocksource.c.
References pcpu_state::nextevent, and timer.
Referenced by loadtimer().
|
static |
Definition at line 156 of file kern_clocksource.c.
References busy, callout_process(), ET_HW_LOCK, ET_HW_UNLOCK, getnextcpuevent(), hardclock(), pcpu_state::idle, loadtimer(), pcpu_state::nextcall, pcpu_state::nextcallopt, pcpu_state::nextevent, pcpu_state::nexthard, pcpu_state::nextprof, pcpu_state::nextstat, pcpu_state::now, profclock(), profiling, profperiod, statclock(), statperiod, tick_sbt, and timer.
Referenced by cpu_activeclock(), cpu_initclocks_ap(), doconfigtimer(), hardclockintr(), and timercb().
int hardclockintr | ( | void | ) |
Definition at line 136 of file kern_clocksource.c.
References busy, doconfigtimer(), handleevents(), and pcpu_state::now.
|
static |
Definition at line 380 of file kern_clocksource.c.
References et_start(), getnextevent(), nexttick, pcpu_state::nexttick, pcpu_state::now, periodic, start, timer, and timerperiod.
Referenced by configtimer(), cpu_idleclock(), cpu_new_callout(), doconfigtimer(), and handleevents().
void resumeclock | ( | void | ) |
Definition at line 711 of file kern_clocksource.c.
References configtimer().
|
static |
Definition at line 570 of file kern_clocksource.c.
References panic().
Referenced by cpu_initclocks_bsp(), and setuptimer().
|
static |
Definition at line 425 of file kern_clocksource.c.
References hz, periodic, profhz, profiling, round_freq(), singlemul, stathz, timer, and timerperiod.
Referenced by configtimer().
void suspendclock | ( | void | ) |
Definition at line 703 of file kern_clocksource.c.
References configtimer().
SYSCTL_INT | ( | _kern_eventtimer | , |
OID_AUTO | , | ||
singlemul | , | ||
CTLFLAG_RWTUN | , | ||
& | singlemul, | ||
0 | , | ||
"Multiplier for periodic mode" | |||
) |
|
static |
Definition at line 934 of file kern_clocksource.c.
References configtimer(), periodic, sysctl_handle_int(), and want_periodic.
|
static |
Definition at line 890 of file kern_clocksource.c.
References buf, configtimer(), cpu_disable_c3_sleep, et_find(), et_free(), et_init(), periodic, snprintf(), sysctl_handle_string(), timer, timercb(), and want_periodic.
SYSCTL_PROC | ( | _kern_eventtimer | , |
OID_AUTO | , | ||
periodic | , | ||
CTLTYPE_INT|CTLFLAG_RW| | CTLFLAG_MPSAFE, | ||
0 | , | ||
0 | , | ||
sysctl_kern_eventtimer_periodic | , | ||
"I" | , | ||
"Enable event timer periodic mode" | |||
) |
SYSCTL_PROC | ( | _kern_eventtimer | , |
OID_AUTO | , | ||
timer | , | ||
CTLTYPE_STRING|CTLFLAG_RW| | CTLFLAG_MPSAFE, | ||
0 | , | ||
0 | , | ||
sysctl_kern_eventtimer_timer | , | ||
"A" | , | ||
"Chosen event timer" | |||
) |
SYSCTL_UINT | ( | _kern_eventtimer | , |
OID_AUTO | , | ||
idletick | , | ||
CTLFLAG_RWTUN | , | ||
& | idletick, | ||
0 | , | ||
"Run periodic events when idle" | |||
) |
|
static |
Definition at line 303 of file kern_clocksource.c.
References busy, ET_HW_LOCK, ET_HW_UNLOCK, handleevents(), pcpu_state::ipi, mp_ncpus, pcpu_state::nextevent, nexttick, pcpu_state::nexttick, pcpu_state::now, periodic, smp_started, and timerperiod.
Referenced by cpu_initclocks_bsp(), and sysctl_kern_eventtimer_timer().
TUNABLE_INT | ( | "kern.eventtimer.periodic" | , |
& | want_periodic | ||
) |
|
static |
Definition at line 95 of file kern_clocksource.c.
Referenced by configtimer(), cpu_activeclock(), cpu_idleclock(), cpu_new_callout(), doconfigtimer(), handleevents(), hardclockintr(), timercb(), tty_alloc_mutex(), and vflush().
int cpu_disable_c2_sleep = 0 |
Definition at line 59 of file kern_clocksource.c.
Referenced by tc_windup().
int cpu_disable_c3_sleep = 0 |
Definition at line 60 of file kern_clocksource.c.
Referenced by cpu_initclocks_bsp(), and sysctl_kern_eventtimer_timer().
|
static |
Definition at line 72 of file kern_clocksource.c.
Referenced by cpu_initclocks_bsp().
|
static |
Definition at line 105 of file kern_clocksource.c.
Referenced by cpu_idleclock().
|
static |
Definition at line 94 of file kern_clocksource.c.
Referenced by configtimer(), loadtimer(), and timercb().
|
static |
Definition at line 109 of file kern_clocksource.c.
Referenced by configtimer(), cpu_activeclock(), cpu_idleclock(), cpu_initclocks_bsp(), cpu_new_callout(), cpu_startprofclock(), cpu_stopprofclock(), loadtimer(), setuptimer(), sysctl_kern_eventtimer_periodic(), sysctl_kern_eventtimer_timer(), and timercb().
|
static |
Definition at line 96 of file kern_clocksource.c.
Referenced by cpu_startprofclock(), cpu_stopprofclock(), getnextcpuevent(), handleevents(), and setuptimer().
|
static |
Definition at line 93 of file kern_clocksource.c.
Referenced by cpu_initclocks_bsp(), and handleevents().
|
static |
Definition at line 101 of file kern_clocksource.c.
Referenced by cpu_initclocks_bsp(), and setuptimer().
|
static |
Definition at line 92 of file kern_clocksource.c.
Referenced by cpu_initclocks_bsp(), and handleevents().
|
static |
Definition at line 90 of file kern_clocksource.c.
Referenced by configtimer(), cpu_et_frequency(), cpu_idleclock(), cpu_initclocks_bsp(), cpu_new_callout(), doconfigtimer(), getnextevent(), handleevents(), loadtimer(), setuptimer(), and sysctl_kern_eventtimer_timer().
|
static |
Definition at line 98 of file kern_clocksource.c.
Referenced by cpu_initclocks_bsp().
|
static |
Definition at line 91 of file kern_clocksource.c.
Referenced by configtimer(), loadtimer(), setuptimer(), and timercb().
|
static |
Definition at line 110 of file kern_clocksource.c.
Referenced by cpu_initclocks_bsp(), sysctl_kern_eventtimer_periodic(), and sysctl_kern_eventtimer_timer().