FreeBSD kernel kern code
|
#include <sys/cdefs.h>
#include "opt_ddb.h"
#include <sys/param.h>
#include <sys/bus.h>
#include <sys/conf.h>
#include <sys/cpuset.h>
#include <sys/rtprio.h>
#include <sys/systm.h>
#include <sys/interrupt.h>
#include <sys/kernel.h>
#include <sys/kthread.h>
#include <sys/ktr.h>
#include <sys/limits.h>
#include <sys/lock.h>
#include <sys/malloc.h>
#include <sys/mutex.h>
#include <sys/priv.h>
#include <sys/proc.h>
#include <sys/random.h>
#include <sys/resourcevar.h>
#include <sys/sched.h>
#include <sys/smp.h>
#include <sys/sysctl.h>
#include <sys/syslog.h>
#include <sys/unistd.h>
#include <sys/vmmeter.h>
#include <machine/atomic.h>
#include <machine/cpu.h>
#include <machine/md_var.h>
#include <machine/stdarg.h>
Go to the source code of this file.
Data Structures | |
struct | intr_thread |
struct | intr_entropy |
Macros | |
#define | IT_DEAD 0x000001 /* Thread is waiting to exit. */ |
#define | IT_WAIT 0x000002 /* Thread is waiting for completion. */ |
Functions | |
__FBSDID ("$BSDSUniX$") | |
static | MALLOC_DEFINE (M_ITHREAD,"ithread","Interrupt Threads") |
TUNABLE_INT ("hw.intr_storm_threshold",&intr_storm_threshold) | |
SYSCTL_INT (_hw, OID_AUTO, intr_storm_threshold, CTLFLAG_RW,&intr_storm_threshold, 0,"Number of consecutive interrupts before storm protection is enabled") | |
static | TAILQ_HEAD (intr_event) |
static void | ithread_update (struct intr_thread *ithd) |
static void | intr_event_update (struct intr_event *ie) |
int | intr_event_create (struct intr_event **event, void *source, int flags, int irq, void(*pre_ithread)(void *), void(*post_ithread)(void *), void(*post_filter)(void *), int(*assign_cpu)(void *, u_char), const char *fmt,...) |
int | intr_event_bind (struct intr_event *ie, u_char cpu) |
static struct intr_event * | intr_lookup (int irq) |
int | intr_setaffinity (int irq, void *m) |
int | intr_getaffinity (int irq, void *m) |
int | intr_event_destroy (struct intr_event *ie) |
static struct intr_thread * | ithread_create (const char *name) |
static void | ithread_destroy (struct intr_thread *ithread) |
int | intr_event_add_handler (struct intr_event *ie, const char *name, driver_filter_t filter, driver_intr_t handler, void *arg, u_char pri, enum intr_type flags, void **cookiep) |
int | intr_event_describe_handler (struct intr_event *ie, void *cookie, const char *descr) |
void * | intr_handler_source (void *cookie) |
void | _intr_drain (int irq) |
int | intr_event_remove_handler (void *cookie) |
static int | intr_event_schedule_thread (struct intr_event *ie) |
static int | swi_assign_cpu (void *arg, u_char cpu) |
int | swi_add (struct intr_event **eventp, const char *name, driver_intr_t handler, void *arg, int pri, enum intr_type flags, void **cookiep) |
void | swi_sched (void *cookie, int flags) |
int | swi_remove (void *cookie) |
void | intr_event_execute_handlers (struct proc *p, struct intr_event *ie) |
static void | ithread_execute_handlers (struct proc *p, struct intr_event *ie) |
static void | ithread_loop (void *arg) |
int | intr_event_handle (struct intr_event *ie, struct trapframe *frame) |
static void | start_softintr (void *dummy) |
SYSINIT (start_softintr, SI_SUB_SOFTINTR, SI_ORDER_FIRST, start_softintr, NULL) | |
static int | sysctl_intrnames (SYSCTL_HANDLER_ARGS) |
SYSCTL_PROC (_hw, OID_AUTO, intrnames, CTLTYPE_OPAQUE|CTLFLAG_RD, NULL, 0, sysctl_intrnames,"","Interrupt Names") | |
static int | sysctl_intrcnt (SYSCTL_HANDLER_ARGS) |
SYSCTL_PROC (_hw, OID_AUTO, intrcnt, CTLTYPE_OPAQUE|CTLFLAG_RD, NULL, 0, sysctl_intrcnt,"","Interrupt Counts") | |
Variables | |
struct intr_event * | clk_intr_event |
struct intr_event * | tty_intr_event |
void * | vm_ih |
struct proc * | intrproc |
static int | intr_storm_threshold = 1000 |
#define IT_DEAD 0x000001 /* Thread is waiting to exit. */ |
Definition at line 76 of file kern_intr.c.
Referenced by ithread_destroy(), and ithread_loop().
#define IT_WAIT 0x000002 /* Thread is waiting for completion. */ |
Definition at line 77 of file kern_intr.c.
Referenced by _intr_drain(), and ithread_loop().
__FBSDID | ( | "$BSDSUniX$" | ) |
void _intr_drain | ( | int | irq | ) |
Definition at line 752 of file kern_intr.c.
References intr_lookup(), intr_thread::it_flags, intr_thread::it_thread, IT_WAIT, and pause().
int intr_event_add_handler | ( | struct intr_event * | ie, |
const char * | name, | ||
driver_filter_t | filter, | ||
driver_intr_t | handler, | ||
void * | arg, | ||
u_char | pri, | ||
enum intr_type | flags, | ||
void ** | cookiep | ||
) |
Definition at line 512 of file kern_intr.c.
References free(), intr_event_update(), intr_thread::it_event, ithread_create(), ithread_update(), malloc(), and wakeup().
Referenced by swi_add().
int intr_event_bind | ( | struct intr_event * | ie, |
u_char | cpu | ||
) |
Definition at line 296 of file kern_intr.c.
References cpuset_root, cpuset_setthread(), mask, and priv_check().
Referenced by intr_setaffinity().
int intr_event_create | ( | struct intr_event ** | event, |
void * | source, | ||
int | flags, | ||
int | irq, | ||
void(*)(void *) | pre_ithread, | ||
void(*)(void *) | post_ithread, | ||
void(*)(void *) | post_filter, | ||
int(*)(void *, u_char) | assign_cpu, | ||
const char * | fmt, | ||
... | |||
) |
Definition at line 251 of file kern_intr.c.
References malloc(), mtx_init(), and vsnprintf().
Referenced by swi_add().
int intr_event_describe_handler | ( | struct intr_event * | ie, |
void * | cookie, | ||
const char * | descr | ||
) |
Definition at line 674 of file kern_intr.c.
References intr_event_update(), panic(), and start.
int intr_event_destroy | ( | struct intr_event * | ie | ) |
Definition at line 420 of file kern_intr.c.
References free(), ithread_destroy(), and mtx_destroy().
void intr_event_execute_handlers | ( | struct proc * | p, |
struct intr_event * | ie | ||
) |
Definition at line 1231 of file kern_intr.c.
References Giant, and wakeup().
Referenced by ithread_execute_handlers().
int intr_event_handle | ( | struct intr_event * | ie, |
struct trapframe * | frame | ||
) |
Definition at line 1410 of file kern_intr.c.
References critical_enter(), critical_exit(), intr_event_schedule_thread(), and log().
int intr_event_remove_handler | ( | void * | cookie | ) |
Definition at line 786 of file kern_intr.c.
References free(), intr_event_update(), ithread_destroy(), and panic().
Referenced by swi_remove().
|
static |
Definition at line 875 of file kern_intr.c.
References intr_entropy::event, intr_thread::it_need, intr_thread::it_thread, sched_add(), and intr_entropy::td.
Referenced by intr_event_handle(), and swi_sched().
|
static |
Definition at line 195 of file kern_intr.c.
References ithread_update().
Referenced by intr_event_add_handler(), intr_event_describe_handler(), and intr_event_remove_handler().
int intr_getaffinity | ( | int | irq, |
void * | m | ||
) |
Definition at line 400 of file kern_intr.c.
References cpuset_root, intr_lookup(), and mask.
void* intr_handler_source | ( | void * | cookie | ) |
Definition at line 729 of file kern_intr.c.
|
static |
Definition at line 356 of file kern_intr.c.
Referenced by _intr_drain(), intr_getaffinity(), and intr_setaffinity().
int intr_setaffinity | ( | int | irq, |
void * | m | ||
) |
Definition at line 371 of file kern_intr.c.
References cpuset_root, intr_event_bind(), intr_lookup(), and mask.
|
static |
Definition at line 446 of file kern_intr.c.
References intrproc, intr_thread::it_thread, ithread_loop(), kproc_kthread_add(), malloc(), panic(), and sched_class().
Referenced by intr_event_add_handler().
|
static |
Definition at line 495 of file kern_intr.c.
References IT_DEAD, intr_thread::it_event, intr_thread::it_flags, intr_thread::it_thread, and sched_add().
Referenced by intr_event_destroy(), and intr_event_remove_handler().
|
static |
Definition at line 1279 of file kern_intr.c.
References intr_event_execute_handlers(), intr_storm_threshold, pause(), ppsratecheck(), and printf().
Referenced by ithread_loop().
|
static |
Definition at line 1324 of file kern_intr.c.
References free(), Giant, IT_DEAD, intr_thread::it_event, intr_thread::it_flags, intr_thread::it_need, intr_thread::it_thread, IT_WAIT, ithread_execute_handlers(), kthread_exit(), mi_switch(), and wakeup().
Referenced by ithread_create().
|
static |
Definition at line 166 of file kern_intr.c.
References intr_thread::it_event, intr_thread::it_thread, and sched_prio().
Referenced by intr_event_add_handler(), and intr_event_update().
|
static |
|
static |
Definition at line 1877 of file kern_intr.c.
References panic(), swi_add(), and vm_ih.
int swi_add | ( | struct intr_event ** | eventp, |
const char * | name, | ||
driver_intr_t | handler, | ||
void * | arg, | ||
int | pri, | ||
enum intr_type | flags, | ||
void ** | cookiep | ||
) |
Definition at line 1103 of file kern_intr.c.
References intr_event_add_handler(), intr_event_create(), and swi_assign_cpu().
Referenced by start_softclock(), and start_softintr().
|
static |
Definition at line 1092 of file kern_intr.c.
Referenced by swi_add().
int swi_remove | ( | void * | cookie | ) |
Definition at line 1187 of file kern_intr.c.
References intr_event_remove_handler().
void swi_sched | ( | void * | cookie, |
int | flags | ||
) |
Definition at line 1143 of file kern_intr.c.
References intr_entropy::event, intr_event_schedule_thread(), and intr_entropy::td.
Referenced by callout_tick(), taskqueue_fast_enqueue(), taskqueue_swi_enqueue(), and taskqueue_swi_giant_enqueue().
SYSCTL_INT | ( | _hw | , |
OID_AUTO | , | ||
intr_storm_threshold | , | ||
CTLFLAG_RW | , | ||
& | intr_storm_threshold, | ||
0 | , | ||
"Number of consecutive interrupts before storm protection is enabled" | |||
) |
|
static |
Definition at line 1905 of file kern_intr.c.
References sysctl_handle_opaque().
|
static |
Definition at line 1896 of file kern_intr.c.
References sysctl_handle_opaque().
SYSCTL_PROC | ( | _hw | , |
OID_AUTO | , | ||
intrnames | , | ||
CTLTYPE_OPAQUE| | CTLFLAG_RD, | ||
NULL | , | ||
0 | , | ||
sysctl_intrnames | , | ||
"" | , | ||
"Interrupt Names" | |||
) |
SYSCTL_PROC | ( | _hw | , |
OID_AUTO | , | ||
intrcnt | , | ||
CTLTYPE_OPAQUE| | CTLFLAG_RD, | ||
NULL | , | ||
0 | , | ||
sysctl_intrcnt | , | ||
"" | , | ||
"Interrupt Counts" | |||
) |
SYSINIT | ( | start_softintr | , |
SI_SUB_SOFTINTR | , | ||
SI_ORDER_FIRST | , | ||
start_softintr | , | ||
NULL | |||
) |
|
static |
Definition at line 96 of file kern_intr.c.
TUNABLE_INT | ( | "hw.intr_storm_threshold" | , |
& | intr_storm_threshold | ||
) |
struct intr_event* clk_intr_event |
Definition at line 84 of file kern_intr.c.
Referenced by start_softclock().
|
static |
Definition at line 91 of file kern_intr.c.
Referenced by ithread_execute_handlers().
struct proc* intrproc |
Definition at line 87 of file kern_intr.c.
Referenced by ithread_create().
struct intr_event* tty_intr_event |
Definition at line 85 of file kern_intr.c.
void* vm_ih |
Definition at line 86 of file kern_intr.c.
Referenced by start_softintr().