|
FreeBSD kernel kern code
|
#include <sys/cdefs.h>#include "opt_device_polling.h"#include <sys/param.h>#include <sys/systm.h>#include <sys/kernel.h>#include <sys/kthread.h>#include <sys/proc.h>#include <sys/eventhandler.h>#include <sys/resourcevar.h>#include <sys/socket.h>#include <sys/sockio.h>#include <sys/sysctl.h>#include <sys/syslog.h>#include <net/if.h>#include <net/netisr.h>#include <net/vnet.h>
Go to the source code of this file.
Data Structures | |
| struct | pollrec |
Macros | |
| #define | MIN_POLL_BURST_MAX 10 |
| #define | MAX_POLL_BURST_MAX 1000 |
| #define | POLL_LIST_LEN 128 |
Functions | |
| __FBSDID ("$BSDSUniX$") | |
| void | hardclock_device_poll (void) |
| static | SYSCTL_NODE (_kern, OID_AUTO, polling, CTLFLAG_RW, 0,"Device polling parameters") |
| SYSCTL_UINT (_kern_polling, OID_AUTO, burst, CTLFLAG_RD,&poll_burst, 0,"Current polling burst size") | |
| static int | poll_burst_max_sysctl (SYSCTL_HANDLER_ARGS) |
| SYSCTL_PROC (_kern_polling, OID_AUTO, burst_max, CTLTYPE_UINT|CTLFLAG_RW, 0, sizeof(uint32_t), poll_burst_max_sysctl,"I","Max Polling burst size") | |
| static int | poll_each_burst_sysctl (SYSCTL_HANDLER_ARGS) |
| SYSCTL_PROC (_kern_polling, OID_AUTO, each_burst, CTLTYPE_UINT|CTLFLAG_RW, 0, sizeof(uint32_t), poll_each_burst_sysctl,"I","Max size of each burst") | |
| SYSCTL_UINT (_kern_polling, OID_AUTO, idle_poll, CTLFLAG_RW,&poll_in_idle_loop, 0,"Enable device polling in idle loop") | |
| static int | user_frac_sysctl (SYSCTL_HANDLER_ARGS) |
| SYSCTL_PROC (_kern_polling, OID_AUTO, user_frac, CTLTYPE_UINT|CTLFLAG_RW, 0, sizeof(uint32_t), user_frac_sysctl,"I","Desired user fraction of cpu time") | |
| static int | reg_frac_sysctl (SYSCTL_HANDLER_ARGS) |
| SYSCTL_PROC (_kern_polling, OID_AUTO, reg_frac, CTLTYPE_UINT|CTLFLAG_RW, 0, sizeof(uint32_t), reg_frac_sysctl,"I","Every this many cycles check registers") | |
| SYSCTL_UINT (_kern_polling, OID_AUTO, short_ticks, CTLFLAG_RD,&short_ticks, 0,"Hardclock ticks shorter than they should be") | |
| SYSCTL_UINT (_kern_polling, OID_AUTO, lost_polls, CTLFLAG_RD,&lost_polls, 0,"How many times we would have lost a poll tick") | |
| SYSCTL_UINT (_kern_polling, OID_AUTO, pending_polls, CTLFLAG_RD,&pending_polls, 0,"Do we need to poll again") | |
| SYSCTL_INT (_kern_polling, OID_AUTO, residual_burst, CTLFLAG_RD,&residual_burst, 0,"# of residual cycles in burst") | |
| SYSCTL_UINT (_kern_polling, OID_AUTO, handlers, CTLFLAG_RD,&poll_handlers, 0,"Number of registered poll handlers") | |
| SYSCTL_UINT (_kern_polling, OID_AUTO, phase, CTLFLAG_RD,&phase, 0,"Polling phase") | |
| SYSCTL_UINT (_kern_polling, OID_AUTO, suspect, CTLFLAG_RD,&suspect, 0,"suspect event") | |
| SYSCTL_UINT (_kern_polling, OID_AUTO, stalled, CTLFLAG_RD,&stalled, 0,"potential stalls") | |
| SYSCTL_UINT (_kern_polling, OID_AUTO, idlepoll_sleeping, CTLFLAG_RD,&idlepoll_sleeping, 0,"idlepoll is sleeping") | |
| static void | poll_shutdown (void *arg, int howto) |
| static void | init_device_poll (void) |
| SYSINIT (device_poll, SI_SUB_CLOCKS, SI_ORDER_MIDDLE, init_device_poll, NULL) | |
| static void | ether_poll (int count) |
| void | netisr_pollmore () |
| void | netisr_poll (void) |
| int | ether_poll_register (poll_handler_t *h, struct ifnet *ifp) |
| int | ether_poll_deregister (struct ifnet *ifp) |
| static void | poll_idle (void) |
| SYSINIT (idlepoll, SI_SUB_KTHREAD_VM, SI_ORDER_ANY, kproc_start,&idlepoll_kp) | |
Variables | |
| static struct mtx | poll_mtx |
| static uint32_t | poll_burst = 5 |
| static uint32_t | poll_burst_max = 150 |
| static uint32_t | poll_each_burst = 5 |
| static int | netisr_poll_scheduled |
| static int | netisr_pollmore_scheduled |
| static int | poll_shutting_down |
| static uint32_t | poll_in_idle_loop =0 |
| static uint32_t | user_frac = 50 |
| static uint32_t | reg_frac_count = 0 |
| static uint32_t | reg_frac = 20 |
| static uint32_t | short_ticks |
| static uint32_t | lost_polls |
| static uint32_t | pending_polls |
| static int | residual_burst = 0 |
| static uint32_t | poll_handlers |
| static uint32_t | phase |
| static uint32_t | suspect |
| static uint32_t | stalled |
| static uint32_t | idlepoll_sleeping |
| static struct pollrec | pr [POLL_LIST_LEN] |
| static struct timeval | poll_start_t |
| static struct proc * | idlepoll |
| static struct kproc_desc | idlepoll_kp |
| #define MAX_POLL_BURST_MAX 1000 |
Definition at line 95 of file kern_poll.c.
Referenced by poll_burst_max_sysctl().
| #define MIN_POLL_BURST_MAX 10 |
Definition at line 94 of file kern_poll.c.
Referenced by poll_burst_max_sysctl().
| #define POLL_LIST_LEN 128 |
Definition at line 248 of file kern_poll.c.
Referenced by ether_poll_register().
| __FBSDID | ( | "$BSDSUniX$" | ) |
|
static |
Definition at line 331 of file kern_poll.c.
References poll_each_burst, poll_handlers, poll_mtx, and pr.
Referenced by poll_idle().

| int ether_poll_deregister | ( | struct ifnet * | ifp | ) |
Definition at line 509 of file kern_poll.c.
References pollrec::handler, pollrec::ifp, log(), poll_handlers, poll_mtx, and pr.

| int ether_poll_register | ( | poll_handler_t * | h, |
| struct ifnet * | ifp | ||
| ) |
Definition at line 462 of file kern_poll.c.
References pollrec::handler, pollrec::ifp, log(), poll_handlers, POLL_LIST_LEN, poll_mtx, pr, and wakeup().

| void hardclock_device_poll | ( | void | ) |
Definition at line 288 of file kern_poll.c.
References hz, microuptime(), netisr_poll_scheduled, netisr_pollmore_scheduled, and poll_shutting_down.
Referenced by hardclock(), and hardclock_cnt().


|
static |
Definition at line 264 of file kern_poll.c.
References mtx_init(), poll_mtx, and poll_shutdown().

| void netisr_poll | ( | void | ) |
Definition at line 422 of file kern_poll.c.
References microuptime(), netisr_poll_scheduled, poll_burst, poll_each_burst, poll_handlers, poll_mtx, poll_start_t, and pr.

| void netisr_pollmore | ( | ) |
Definition at line 365 of file kern_poll.c.
References hz, microuptime(), netisr_poll_scheduled, netisr_pollmore_scheduled, poll_burst, poll_burst_max, poll_mtx, and poll_start_t.

|
static |
Definition at line 111 of file kern_poll.c.
References MAX_POLL_BURST_MAX, MIN_POLL_BURST_MAX, poll_burst, poll_burst_max, poll_each_burst, poll_mtx, and sysctl_handle_int().

|
static |
Definition at line 135 of file kern_poll.c.
References poll_burst_max, poll_each_burst, poll_mtx, and sysctl_handle_int().

|
static |
Definition at line 536 of file kern_poll.c.
References ether_poll(), hz, mi_switch(), poll_each_burst, and rtp_to_pri().

|
static |
Definition at line 257 of file kern_poll.c.
References poll_shutting_down.
Referenced by init_device_poll().

|
static |
Definition at line 188 of file kern_poll.c.
References hz, poll_mtx, reg_frac, and sysctl_handle_int().

| SYSCTL_INT | ( | _kern_polling | , |
| OID_AUTO | , | ||
| residual_burst | , | ||
| CTLFLAG_RD | , | ||
| & | residual_burst, | ||
| 0 | , | ||
| "# of residual cycles in burst" | |||
| ) |
|
static |
| SYSCTL_PROC | ( | _kern_polling | , |
| OID_AUTO | , | ||
| burst_max | , | ||
| CTLTYPE_UINT| | CTLFLAG_RW, | ||
| 0 | , | ||
| sizeof(uint32_t) | , | ||
| poll_burst_max_sysctl | , | ||
| "I" | , | ||
| "Max Polling burst size" | |||
| ) |
| SYSCTL_PROC | ( | _kern_polling | , |
| OID_AUTO | , | ||
| each_burst | , | ||
| CTLTYPE_UINT| | CTLFLAG_RW, | ||
| 0 | , | ||
| sizeof(uint32_t) | , | ||
| poll_each_burst_sysctl | , | ||
| "I" | , | ||
| "Max size of each burst" | |||
| ) |
| SYSCTL_PROC | ( | _kern_polling | , |
| OID_AUTO | , | ||
| user_frac | , | ||
| CTLTYPE_UINT| | CTLFLAG_RW, | ||
| 0 | , | ||
| sizeof(uint32_t) | , | ||
| user_frac_sysctl | , | ||
| "I" | , | ||
| "Desired user fraction of cpu time" | |||
| ) |
| SYSCTL_PROC | ( | _kern_polling | , |
| OID_AUTO | , | ||
| reg_frac | , | ||
| CTLTYPE_UINT| | CTLFLAG_RW, | ||
| 0 | , | ||
| sizeof(uint32_t) | , | ||
| reg_frac_sysctl | , | ||
| "I" | , | ||
| "Every this many cycles check registers" | |||
| ) |
| SYSCTL_UINT | ( | _kern_polling | , |
| OID_AUTO | , | ||
| burst | , | ||
| CTLFLAG_RD | , | ||
| & | poll_burst, | ||
| 0 | , | ||
| "Current polling burst size" | |||
| ) |
| SYSCTL_UINT | ( | _kern_polling | , |
| OID_AUTO | , | ||
| idle_poll | , | ||
| CTLFLAG_RW | , | ||
| & | poll_in_idle_loop, | ||
| 0 | , | ||
| "Enable device polling in idle loop" | |||
| ) |
| SYSCTL_UINT | ( | _kern_polling | , |
| OID_AUTO | , | ||
| short_ticks | , | ||
| CTLFLAG_RD | , | ||
| & | short_ticks, | ||
| 0 | , | ||
| "Hardclock ticks shorter than they should be" | |||
| ) |
| SYSCTL_UINT | ( | _kern_polling | , |
| OID_AUTO | , | ||
| lost_polls | , | ||
| CTLFLAG_RD | , | ||
| & | lost_polls, | ||
| 0 | , | ||
| "How many times we would have lost a poll tick" | |||
| ) |
| SYSCTL_UINT | ( | _kern_polling | , |
| OID_AUTO | , | ||
| pending_polls | , | ||
| CTLFLAG_RD | , | ||
| & | pending_polls, | ||
| 0 | , | ||
| "Do we need to poll again" | |||
| ) |
| SYSCTL_UINT | ( | _kern_polling | , |
| OID_AUTO | , | ||
| handlers | , | ||
| CTLFLAG_RD | , | ||
| & | poll_handlers, | ||
| 0 | , | ||
| "Number of registered poll handlers" | |||
| ) |
| SYSCTL_UINT | ( | _kern_polling | , |
| OID_AUTO | , | ||
| suspect | , | ||
| CTLFLAG_RD | , | ||
| & | suspect, | ||
| 0 | , | ||
| "suspect event" | |||
| ) |
| SYSCTL_UINT | ( | _kern_polling | , |
| OID_AUTO | , | ||
| stalled | , | ||
| CTLFLAG_RD | , | ||
| & | stalled, | ||
| 0 | , | ||
| "potential stalls" | |||
| ) |
| SYSCTL_UINT | ( | _kern_polling | , |
| OID_AUTO | , | ||
| idlepoll_sleeping | , | ||
| CTLFLAG_RD | , | ||
| & | idlepoll_sleeping, | ||
| 0 | , | ||
| "idlepoll is sleeping" | |||
| ) |
| SYSINIT | ( | device_poll | , |
| SI_SUB_CLOCKS | , | ||
| SI_ORDER_MIDDLE | , | ||
| init_device_poll | , | ||
| NULL | |||
| ) |
| SYSINIT | ( | idlepoll | , |
| SI_SUB_KTHREAD_VM | , | ||
| SI_ORDER_ANY | , | ||
| kproc_start | , | ||
| & | idlepoll_kp | ||
| ) |
|
static |
Definition at line 165 of file kern_poll.c.
References poll_mtx, sysctl_handle_int(), and user_frac.

|
static |
Definition at line 561 of file kern_poll.c.
|
static |
Definition at line 562 of file kern_poll.c.
|
static |
Definition at line 243 of file kern_poll.c.
|
static |
Definition at line 215 of file kern_poll.c.
|
static |
Definition at line 107 of file kern_poll.c.
Referenced by hardclock_device_poll(), netisr_poll(), and netisr_pollmore().
|
static |
Definition at line 108 of file kern_poll.c.
Referenced by hardclock_device_poll(), and netisr_pollmore().
|
static |
Definition at line 219 of file kern_poll.c.
|
static |
Definition at line 231 of file kern_poll.c.
|
static |
Definition at line 97 of file kern_poll.c.
Referenced by netisr_poll(), netisr_pollmore(), and poll_burst_max_sysctl().
|
static |
Definition at line 98 of file kern_poll.c.
Referenced by netisr_pollmore(), poll_burst_max_sysctl(), and poll_each_burst_sysctl().
|
static |
Definition at line 99 of file kern_poll.c.
Referenced by ether_poll(), netisr_poll(), poll_burst_max_sysctl(), poll_each_burst_sysctl(), and poll_idle().
|
static |
Definition at line 227 of file kern_poll.c.
Referenced by ether_poll(), ether_poll_deregister(), ether_poll_register(), and netisr_poll().
|
static |
Definition at line 160 of file kern_poll.c.
|
static |
Definition at line 51 of file kern_poll.c.
Referenced by ether_poll(), ether_poll_deregister(), ether_poll_register(), init_device_poll(), netisr_poll(), netisr_pollmore(), poll_burst_max_sysctl(), poll_each_burst_sysctl(), reg_frac_sysctl(), and user_frac_sysctl().
|
static |
Definition at line 109 of file kern_poll.c.
Referenced by hardclock_device_poll(), and poll_shutdown().
|
static |
Definition at line 362 of file kern_poll.c.
Referenced by netisr_poll(), and netisr_pollmore().
|
static |
Definition at line 254 of file kern_poll.c.
Referenced by cpuset_which(), do_jail_attach(), domain_init(), ether_poll(), ether_poll_deregister(), ether_poll_register(), getcredhostname(), kern_jail_get(), kern_jail_set(), lookup(), mb_reclaim(), mountcheckdirs(), netisr_poll(), pf_proto_register(), pf_proto_unregister(), pfctlinput(), pfctlinput2(), pffasttimo(), pffindproto(), pffindtype(), pfslowtimo(), prison_canseemount(), prison_check_af(), prison_enforce_statfs(), prison_find(), prison_find_child(), prison_find_name(), sofree(), soreceive_dgram(), soreceive_generic(), soreceive_rcvoob(), sorflush(), soshutdown(), sys_jail_attach(), sys_jail_remove(), sysctl_hostid(), sysctl_hostname(), sysctl_jail_default_allow(), sysctl_jail_default_level(), sysctl_jail_list(), and sysctl_kern_securelvl().
|
static |
Definition at line 187 of file kern_poll.c.
Referenced by reg_frac_sysctl().
|
static |
Definition at line 186 of file kern_poll.c.
|
static |
Definition at line 223 of file kern_poll.c.
|
static |
Definition at line 211 of file kern_poll.c.
|
static |
Definition at line 239 of file kern_poll.c.
|
static |
Definition at line 235 of file kern_poll.c.
|
static |
Definition at line 164 of file kern_poll.c.
Referenced by user_frac_sysctl().