FreeBSD kernel kern code
|
#include <sys/cdefs.h>
#include "opt_device_polling.h"
#include "opt_kdtrace.h"
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/bus.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>
Go to the source code of this file.
Data Structures | |
struct | pcpu_state |
Macros | |
#define | ET_HW_LOCK(state) |
#define | ET_HW_UNLOCK(state) |
#define | FREQ2BT(freq, bt) |
#define | BT2FREQ(bt) |
Functions | |
__FBSDID ("$BSDSUniX$") | |
static void | setuptimer (void) |
static void | loadtimer (struct bintime *now, int first) |
static int | doconfigtimer (void) |
static void | configtimer (int start) |
static int | round_freq (struct eventtimer *et, int freq) |
static void | getnextcpuevent (struct bintime *event, int idle) |
static void | getnextevent (struct bintime *event) |
static int | handleevents (struct bintime *now, int fake) |
TUNABLE_STR ("kern.eventtimer.timer", timername, sizeof(timername)) | |
TUNABLE_INT ("kern.eventtimer.singlemul",&singlemul) | |
SYSCTL_INT (_kern_eventtimer, OID_AUTO, singlemul, CTLFLAG_RW,&singlemul, 0,"Multiplier for periodic mode") | |
TUNABLE_INT ("kern.eventtimer.idletick",&idletick) | |
SYSCTL_UINT (_kern_eventtimer, OID_AUTO, idletick, CTLFLAG_RW,&idletick, 0,"Run periodic events when idle") | |
TUNABLE_INT ("kern.eventtimer.activetick",&activetick) | |
SYSCTL_UINT (_kern_eventtimer, OID_AUTO, activetick, CTLFLAG_RW,&activetick, 0,"Run all periodic events when active") | |
TUNABLE_INT ("kern.eventtimer.periodic",&want_periodic) | |
static | DPCPU_DEFINE (struct pcpu_state, timerstate) |
int | hardclockintr (void) |
static void | timercb (struct eventtimer *et, void *arg) |
void | cpu_initclocks_bsp (void) |
void | cpu_initclocks_ap (void) |
void | cpu_startprofclock (void) |
void | cpu_stopprofclock (void) |
void | cpu_idleclock (void) |
void | cpu_activeclock (void) |
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_deepest_sleep = 0 |
int | cpu_disable_c2_sleep = 0 |
int | cpu_disable_c3_sleep = 0 |
static struct mtx | et_hw_mtx |
static struct eventtimer * | timer = NULL |
static struct bintime | timerperiod |
static struct bintime | hardperiod |
static struct bintime | statperiod |
static struct bintime | profperiod |
static struct bintime | nexttick |
static struct bintime | nexthard |
static u_int | busy = 0 |
static int | profiling = 0 |
static char | timername [32] |
static int | singlemul = 0 |
static u_int | idletick = 0 |
static u_int | activetick = 1 |
static int | periodic = 0 |
static int | want_periodic = 0 |
#define BT2FREQ | ( | bt | ) |
Definition at line 153 of file kern_clocksource.c.
Referenced by round_freq().
#define ET_HW_LOCK | ( | state | ) |
Definition at line 81 of file kern_clocksource.c.
Referenced by configtimer(), cpu_idleclock(), cpu_initclocks_ap(), doconfigtimer(), handleevents(), and timercb().
#define ET_HW_UNLOCK | ( | state | ) |
Definition at line 89 of file kern_clocksource.c.
Referenced by configtimer(), cpu_idleclock(), cpu_initclocks_ap(), doconfigtimer(), handleevents(), and timercb().
#define FREQ2BT | ( | freq, | |
bt | |||
) |
Definition at line 148 of file kern_clocksource.c.
Referenced by cpu_initclocks_bsp(), and setuptimer().
__FBSDID | ( | "$BSDSUniX$" | ) |
|
static |
Definition at line 520 of file kern_clocksource.c.
References pcpu_state::action, bintime(), binuptime(), busy, critical_enter(), critical_exit(), ET_HW_LOCK, ET_HW_UNLOCK, et_stop(), hardclock_sync(), loadtimer(), pcpu_state::nextevent, pcpu_state::nexthard, pcpu_state::nextprof, pcpu_state::nextstat, nexttick, pcpu_state::nexttick, pcpu_state::now, setuptimer(), smp_started, timer, and timerperiod.
Referenced by cpu_initclocks_bsp(), cpu_startprofclock(), cpu_stopprofclock(), sysctl_kern_eventtimer_periodic(), and sysctl_kern_eventtimer_timer().
void cpu_activeclock | ( | void | ) |
Definition at line 805 of file kern_clocksource.c.
References bintime(), binuptime(), busy, handleevents(), pcpu_state::idle, and pcpu_state::now.
void cpu_idleclock | ( | void | ) |
Definition at line 772 of file kern_clocksource.c.
References bintime(), binuptime(), busy, ET_HW_LOCK, ET_HW_UNLOCK, getnextcpuevent(), pcpu_state::idle, loadtimer(), pcpu_state::nextevent, pcpu_state::now, and timer.
void cpu_initclocks_ap | ( | void | ) |
Definition at line 708 of file kern_clocksource.c.
References bintime(), binuptime(), ET_HW_LOCK, ET_HW_UNLOCK, handleevents(), hardclock_sync(), loadtimer(), nexttick, pcpu_state::now, timer, and timerperiod.
void cpu_initclocks_bsp | ( | void | ) |
Definition at line 617 of file kern_clocksource.c.
References callout_new_inserted, configtimer(), cpu_disable_c3_sleep, et_find(), et_hw_mtx, pcpu_state::et_hw_mtx, et_init(), FREQ2BT, hardperiod, hz, mtx_init(), panic(), profhz, profperiod, round_freq(), stathz, statperiod, tick, timer, timercb(), timername, and want_periodic.
void cpu_startprofclock | ( | void | ) |
Definition at line 732 of file kern_clocksource.c.
References configtimer(), and profiling.
Referenced by startprofclock().
void cpu_stopprofclock | ( | void | ) |
Definition at line 752 of file kern_clocksource.c.
References configtimer(), and profiling.
Referenced by stopprofclock().
|
static |
Definition at line 484 of file kern_clocksource.c.
References pcpu_state::action, bintime(), binuptime(), busy, ET_HW_LOCK, ET_HW_UNLOCK, et_stop(), pcpu_state::handle, handleevents(), loadtimer(), and timer.
Referenced by hardclockintr().
|
static |
|
static |
Definition at line 269 of file kern_clocksource.c.
References bintime(), callout_tickstofirst(), hardperiod, hz, pcpu_state::nexthard, pcpu_state::nextprof, pcpu_state::nextstat, profiling, stathz, tc_min_ticktock_freq, and timer.
Referenced by cpu_idleclock(), and handleevents().
|
static |
Definition at line 305 of file kern_clocksource.c.
References pcpu_state::idle, pcpu_state::nextevent, nexthard, and timer.
Referenced by loadtimer().
|
static |
Definition at line 182 of file kern_clocksource.c.
References bintime(), busy, ET_HW_LOCK, ET_HW_UNLOCK, getnextcpuevent(), hardclock_cnt(), hardperiod, pcpu_state::idle, loadtimer(), pcpu_state::nextevent, nexthard, pcpu_state::nexthard, pcpu_state::nextprof, pcpu_state::nextstat, profclock_cnt(), profiling, profperiod, statclock_cnt(), statperiod, and timer.
Referenced by cpu_activeclock(), cpu_initclocks_ap(), doconfigtimer(), hardclockintr(), and timercb().
int hardclockintr | ( | void | ) |
Definition at line 161 of file kern_clocksource.c.
References bintime(), busy, doconfigtimer(), handleevents(), and pcpu_state::now.
|
static |
Definition at line 413 of file kern_clocksource.c.
References bintime(), et_start(), getnextevent(), nexttick, pcpu_state::nexttick, timer, and timerperiod.
Referenced by configtimer(), cpu_idleclock(), cpu_initclocks_ap(), doconfigtimer(), and handleevents().
|
static |
Definition at line 594 of file kern_clocksource.c.
References BT2FREQ.
Referenced by cpu_initclocks_bsp(), and setuptimer().
|
static |
Definition at line 464 of file kern_clocksource.c.
References FREQ2BT, hz, profhz, profiling, round_freq(), singlemul, stathz, timer, and timerperiod.
Referenced by configtimer().
SYSCTL_INT | ( | _kern_eventtimer | , |
OID_AUTO | , | ||
singlemul | , | ||
CTLFLAG_RW | , | ||
& | singlemul, | ||
0 | , | ||
"Multiplier for periodic mode" | |||
) |
|
static |
Definition at line 961 of file kern_clocksource.c.
References configtimer(), periodic, and sysctl_handle_int().
|
static |
Definition at line 917 of file kern_clocksource.c.
References buf, configtimer(), cpu_disable_c3_sleep, et_find(), et_free(), et_init(), snprintf(), sysctl_handle_string(), timer, timercb(), and want_periodic.
SYSCTL_PROC | ( | _kern_eventtimer | , |
OID_AUTO | , | ||
timer | , | ||
CTLTYPE_STRING|CTLFLAG_RW| | CTLFLAG_MPSAFE, | ||
0 | , | ||
0 | , | ||
sysctl_kern_eventtimer_timer | , | ||
"A" | , | ||
"Chosen event timer" | |||
) |
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_UINT | ( | _kern_eventtimer | , |
OID_AUTO | , | ||
idletick | , | ||
CTLFLAG_RW | , | ||
& | idletick, | ||
0 | , | ||
"Run periodic events when idle" | |||
) |
SYSCTL_UINT | ( | _kern_eventtimer | , |
OID_AUTO | , | ||
activetick | , | ||
CTLFLAG_RW | , | ||
& | activetick, | ||
0 | , | ||
"Run all periodic events when active" | |||
) |
|
static |
Definition at line 340 of file kern_clocksource.c.
References bintime(), binuptime(), busy, ET_HW_LOCK, ET_HW_UNLOCK, handleevents(), pcpu_state::ipi, pcpu_state::nextevent, nexttick, pcpu_state::nexttick, pcpu_state::now, smp_started, and timerperiod.
Referenced by cpu_initclocks_bsp(), and sysctl_kern_eventtimer_timer().
TUNABLE_INT | ( | "kern.eventtimer.singlemul" | , |
& | singlemul | ||
) |
TUNABLE_INT | ( | "kern.eventtimer.idletick" | , |
& | idletick | ||
) |
TUNABLE_INT | ( | "kern.eventtimer.activetick" | , |
& | activetick | ||
) |
TUNABLE_INT | ( | "kern.eventtimer.periodic" | , |
& | want_periodic | ||
) |
|
static |
Definition at line 120 of file kern_clocksource.c.
|
static |
Definition at line 104 of file kern_clocksource.c.
Referenced by configtimer(), cpu_activeclock(), cpu_idleclock(), doconfigtimer(), exec_map_first_page(), handleevents(), hardclockintr(), timercb(), and vflush().
int cpu_deepest_sleep = 0 |
Definition at line 62 of file kern_clocksource.c.
int cpu_disable_c2_sleep = 0 |
Definition at line 63 of file kern_clocksource.c.
Referenced by tc_windup().
int cpu_disable_c3_sleep = 0 |
Definition at line 64 of file kern_clocksource.c.
Referenced by cpu_initclocks_bsp(), and sysctl_kern_eventtimer_timer().
|
static |
Definition at line 79 of file kern_clocksource.c.
Referenced by cpu_initclocks_bsp().
|
static |
Definition at line 99 of file kern_clocksource.c.
Referenced by cpu_initclocks_bsp(), getnextcpuevent(), and handleevents().
|
static |
Definition at line 115 of file kern_clocksource.c.
|
static |
Definition at line 103 of file kern_clocksource.c.
Referenced by getnextevent(), and handleevents().
|
static |
Definition at line 102 of file kern_clocksource.c.
Referenced by configtimer(), cpu_initclocks_ap(), loadtimer(), and timercb().
|
static |
Definition at line 125 of file kern_clocksource.c.
Referenced by sysctl_kern_eventtimer_periodic().
|
static |
Definition at line 105 of file kern_clocksource.c.
Referenced by cpu_startprofclock(), cpu_stopprofclock(), getnextcpuevent(), handleevents(), and setuptimer().
|
static |
Definition at line 101 of file kern_clocksource.c.
Referenced by cpu_initclocks_bsp(), and handleevents().
|
static |
Definition at line 110 of file kern_clocksource.c.
Referenced by setuptimer().
|
static |
Definition at line 100 of file kern_clocksource.c.
Referenced by cpu_initclocks_bsp(), and handleevents().
|
static |
Definition at line 97 of file kern_clocksource.c.
Referenced by configtimer(), cpu_idleclock(), cpu_initclocks_ap(), cpu_initclocks_bsp(), doconfigtimer(), getnextcpuevent(), getnextevent(), handleevents(), loadtimer(), setuptimer(), and sysctl_kern_eventtimer_timer().
|
static |
Definition at line 107 of file kern_clocksource.c.
Referenced by cpu_initclocks_bsp().
|
static |
Definition at line 98 of file kern_clocksource.c.
Referenced by configtimer(), cpu_initclocks_ap(), loadtimer(), setuptimer(), and timercb().
|
static |
Definition at line 126 of file kern_clocksource.c.
Referenced by cpu_initclocks_bsp(), and sysctl_kern_eventtimer_timer().