mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
mi_switch.9: Remove cpu_switch, cpu_throw
cpu_machdep.9 was added to document cpu_*, but cpu_switch and cpu_throw
were already documented in mi_switch.9, and MLINKed. cpu_machdep.9
seems like the correct place for this, so remove them from mi_switch.9.
Some of the removed text was stale, although there are few notes that
ought to be added to cpu_machdep.9 in a future commit.
Reported by: tools/pkgbase/metalog_reader.lua
Reviewed by: jhb
Sponsored by: The FreeBSD Foundation
Fixes: 9c87cbbcaaed ("cpu_machdep.9: New manpage describing the semantics of several cpu_*")
Differential Revision: https://reviews.freebsd.org/D48360
(cherry picked from commit f73c9b5da190954a81e9e70e2caa8e9168623bfd)
This commit is contained in:
parent
dab1feb75e
commit
0cfebe47d9
2 changed files with 4 additions and 66 deletions
|
|
@ -1592,8 +1592,6 @@ MLINKS+=microuptime.9 binuptime.9 \
|
|||
microuptime.9 getsbinuptime.9 \
|
||||
microuptime.9 nanouptime.9 \
|
||||
microuptime.9 sbinuptime.9
|
||||
MLINKS+=mi_switch.9 cpu_switch.9 \
|
||||
mi_switch.9 cpu_throw.9
|
||||
MLINKS+=mod_cc.9 CCV.9 \
|
||||
mod_cc.9 DECLARE_CC_MODULE.9
|
||||
MLINKS+=mtx_pool.9 mtx_pool_alloc.9 \
|
||||
|
|
|
|||
|
|
@ -31,23 +31,17 @@
|
|||
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
.\" POSSIBILITY OF SUCH DAMAGE.
|
||||
.\"
|
||||
.Dd January 9, 2023
|
||||
.Dd January 7, 2025
|
||||
.Dt MI_SWITCH 9
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm mi_switch ,
|
||||
.Nm cpu_switch ,
|
||||
.Nm cpu_throw
|
||||
.Nm mi_switch
|
||||
.Nd switch to another thread context
|
||||
.Sh SYNOPSIS
|
||||
.In sys/param.h
|
||||
.In sys/proc.h
|
||||
.Ft void
|
||||
.Fn mi_switch "int flags"
|
||||
.Ft void
|
||||
.Fn cpu_switch "struct thread *oldtd" "struct thread *newtd" "struct mtx *lock"
|
||||
.Ft void
|
||||
.Fn cpu_throw "struct thread *oldtd" "struct thread *newtd"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fn mi_switch
|
||||
|
|
@ -168,63 +162,9 @@ running thread
|
|||
.Fa oldtd
|
||||
to the chosen thread
|
||||
.Fa newtd .
|
||||
First, it saves the context of
|
||||
.Fa oldtd
|
||||
to its Process Control Block
|
||||
.Po
|
||||
PCB,
|
||||
.Vt struct pcb
|
||||
.Pc ,
|
||||
pointed at by
|
||||
.Va oldtd->td_pcb .
|
||||
The function then updates important per-CPU state such as the
|
||||
.Dv curthread
|
||||
variable, and activates
|
||||
.Fa newtd\&'s
|
||||
virtual address space using its associated
|
||||
.Xr pmap 9
|
||||
structure.
|
||||
Finally, it reads in the saved context from
|
||||
.Fa newtd\&'s
|
||||
PCB.
|
||||
CPU instruction flow continues in the new thread context, on
|
||||
.Fa newtd\&'s
|
||||
kernel stack.
|
||||
The return from
|
||||
.Fn cpu_switch
|
||||
can be understood as a completion of the function call initiated by
|
||||
.Fa newtd
|
||||
when it was previously switched out, at some point in the distant (relative to
|
||||
CPU time) past.
|
||||
.Pp
|
||||
The
|
||||
.Fa mtx
|
||||
argument to
|
||||
.Fn cpu_switch
|
||||
is used to pass the mutex which will be stored as
|
||||
.Fa oldtd\&'s
|
||||
thread lock at the moment that
|
||||
.Fa oldtd
|
||||
is completely switched out.
|
||||
This is an implementation detail of
|
||||
.Fn sched_switch .
|
||||
.Pp
|
||||
.Fn cpu_throw
|
||||
is similar to
|
||||
.Fn cpu_switch
|
||||
except that it does not save the context of the old thread.
|
||||
This function is useful when the kernel does not have an old thread
|
||||
context to save, such as when CPUs other than the boot CPU perform their
|
||||
first task switch, or when the kernel does not care about the state of the
|
||||
old thread, such as in
|
||||
.Xr thread_exit 9
|
||||
when the kernel terminates the current thread and switches into a new
|
||||
thread,
|
||||
.Fa newtd .
|
||||
The
|
||||
.Fa oldtd
|
||||
argument is unused.
|
||||
.Sh SEE ALSO
|
||||
.Xr cpu_switch 9 ,
|
||||
.Xr cpu_throw 9 ,
|
||||
.Xr critical_exit 9 ,
|
||||
.Xr issignal 9 ,
|
||||
.Xr kern_yield 9 ,
|
||||
|
|
|
|||
Loading…
Reference in a new issue