1 .\" Copyright (c) 2000-2001 John H. Baldwin <jhb@FreeBSD.org>
2 .\" All rights reserved.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\" notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\" notice, this list of conditions and the following disclaimer in the
11 .\" documentation and/or other materials provided with the distribution.
13 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 .Nd register and schedule software interrupt handlers
38 .Vt "extern struct ithd *tty_ithd" ;
39 .Vt "extern struct ithd *clk_ithd" ;
40 .Vt "extern void *net_ih" ;
41 .Vt "extern void *softclock_ih" ;
42 .Vt "extern void *vm_ih" ;
45 .Fa "struct ithd **ithdp"
46 .Fa "const char *name"
47 .Fa "driver_intr_t handler"
50 .Fa "enum intr_type flags"
54 .Fn swi_sched "void *handler" "int flags"
56 These functions are used to register and schedule software interrupt handlers.
57 Software interrupt handlers are attached to a software interrupt thread, just
58 as hardware interrupt handlers are attached to a hardware interrupt thread.
59 Multiple handlers can be attached to the same thread.
60 Software interrupt handlers can be used to queue up less critical processing
61 inside of hardware interrupt handlers so that the work can be done at a later
63 Software interrupt threads are different from other kernel threads in that they
64 are treated as an interrupt thread.
65 This means that time spent executing these threads is counted as interrupt
66 time, and that they can be run via a lightweight context switch.
70 function is used to register a new software interrupt handler.
73 argument is an optional pointer to a
76 If this argument points to an existing software interrupt thread, then this
77 handler will be attached to that thread.
78 Otherwise a new thread will be created, and if
82 then the pointer at that address to will be modified to point to the
86 argument is used to associate a name with a specific handler.
87 This name is appended to the name of the software interrupt thread that this
88 handler is attached to.
91 argument is the function that will be executed when the handler is scheduled
95 parameter will be passed in as the only parameter to
97 when the function is executed.
100 value specifies the priority of this interrupt handler relative to other
101 software interrupt handlers.
102 If an interrupt thread is created, then this value is used as the vector,
105 argument is used to specify the attributes of a handler such as
112 This cookie will be set to a value that uniquely identifies this handler,
113 and is used to schedule the handler for execution later on.
117 function is used to schedule an interrupt handler and its associated thread to
121 argument specifies which software interrupt handler should be scheduled to run.
124 argument specifies how and when the handler should be run and is a mask of one
125 or more of the following flags:
126 .Bl -tag -width SWI_DELAY
128 Specifies that the kernel should mark the specified handler as needing to run,
129 but the kernel should not schedule the software interrupt thread to run.
132 will be executed the next time that the software interrupt thread runs after
133 being scheduled by another event.
134 Attaching a handler to the clock software interrupt thread and using this flag
135 when scheduling a software interrupt handler can be used to implement the
136 functionality performed by
138 in earlier versions of
146 variables contain pointers to the software interrupt threads for the tty and
147 clock software interrupts, respectively.
149 is used to hang tty software interrupt handlers off of the same thread.
151 is used to hang delayed handlers off of the clock software interrupt thread so
152 that the functionality of
154 can be obtained in conjunction with
161 handler cookies are used to schedule software interrupt threads to run for the
162 networking stack, clock interrupt, and VM subsystem respectively.
166 function returns zero on success and non-zero on failure.
170 function will fail if:
173 The system-imposed limit on the total
174 number of processes under execution would be exceeded.
175 The limit is given by the
182 argument specifies either
189 argument points to a hardware interrupt thread.
200 flag is specified and the interrupt thread pointed to by
202 already has at least one handler, or the interrupt thread already has an
213 functions first appeared in
217 function which appeared in
223 functions which date back to at least
226 Most of the global variables described in this manual page should not be
227 global, or at the very least should not be declared in
228 .In sys/interrupt.h .