Sun Aug 16 16:48:08 2020 UTC ()
Be explcit that all calls to pmap_activate() and pmap_deactivate()
from MI code are made with preemption disabled and with l == curlwp.


(thorpej)
diff -r1.47 -r1.48 src/share/man/man9/pmap.9

cvs diff -r1.47 -r1.48 src/share/man/man9/pmap.9 (expand / switch to unified diff)

--- src/share/man/man9/pmap.9 2020/03/14 14:05:42 1.47
+++ src/share/man/man9/pmap.9 2020/08/16 16:48:08 1.48
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1.\" $NetBSD: pmap.9,v 1.47 2020/03/14 14:05:42 ad Exp $ 1.\" $NetBSD: pmap.9,v 1.48 2020/08/16 16:48:08 thorpej Exp $
2.\" 2.\"
3.\" Copyright (c) 2000, 2001, 2002, 2020 The NetBSD Foundation, Inc. 3.\" Copyright (c) 2000, 2001, 2002, 2020 The NetBSD Foundation, Inc.
4.\" All rights reserved. 4.\" All rights reserved.
5.\" 5.\"
6.\" This code is derived from software contributed to The NetBSD Foundation 6.\" This code is derived from software contributed to The NetBSD Foundation
7.\" by Jason R. Thorpe. 7.\" by Jason R. Thorpe.
8.\" 8.\"
9.\" Redistribution and use in source and binary forms, with or without 9.\" Redistribution and use in source and binary forms, with or without
10.\" modification, are permitted provided that the following conditions 10.\" modification, are permitted provided that the following conditions
11.\" are met: 11.\" are met:
12.\" 1. Redistributions of source code must retain the above copyright 12.\" 1. Redistributions of source code must retain the above copyright
13.\" notice, this list of conditions and the following disclaimer. 13.\" notice, this list of conditions and the following disclaimer.
14.\" 2. Redistributions in binary form must reproduce the above copyright 14.\" 2. Redistributions in binary form must reproduce the above copyright
@@ -17,27 +17,27 @@ @@ -17,27 +17,27 @@
17.\" 17.\"
18.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 18.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
19.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 19.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 20.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 21.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
22.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28.\" POSSIBILITY OF SUCH DAMAGE. 28.\" POSSIBILITY OF SUCH DAMAGE.
29.\" 29.\"
30.Dd March 14, 2020 30.Dd August 16, 2020
31.Dt PMAP 9 31.Dt PMAP 9
32.Os 32.Os
33.Sh NAME 33.Sh NAME
34.Nm pmap 34.Nm pmap
35.Nd machine-dependent portion of the virtual memory system 35.Nd machine-dependent portion of the virtual memory system
36.Sh SYNOPSIS 36.Sh SYNOPSIS
37.In sys/param.h 37.In sys/param.h
38.In uvm/uvm_extern.h 38.In uvm/uvm_extern.h
39.Ft void 39.Ft void
40.Fn "pmap_init" "void" 40.Fn "pmap_init" "void"
41.Ft void 41.Ft void
42.Fn "pmap_virtual_space" "vaddr_t *vstartp" "vaddr_t *vendp" 42.Fn "pmap_virtual_space" "vaddr_t *vstartp" "vaddr_t *vendp"
43.Ft vaddr_t 43.Ft vaddr_t
@@ -756,55 +756,53 @@ and @@ -756,55 +756,53 @@ and
756.Fn pmap_kremove 756.Fn pmap_kremove
757in order to ensure correct operation of the virtual memory system. 757in order to ensure correct operation of the virtual memory system.
758.Pp 758.Pp
759If a 759If a
760.Nm 760.Nm
761implementation does not delay virtual-to-physical mapping updates, 761implementation does not delay virtual-to-physical mapping updates,
762.Fn pmap_update 762.Fn pmap_update
763has no operation. 763has no operation.
764In this case, the call may be deleted using a C pre-processor macro in 764In this case, the call may be deleted using a C pre-processor macro in
765.In machine/pmap.h . 765.In machine/pmap.h .
766.It void Fn "pmap_activate" "struct lwp *l" 766.It void Fn "pmap_activate" "struct lwp *l"
767Activate the physical map used by the process behind lwp 767Activate the physical map used by the process behind lwp
768.Fa l . 768.Fa l .
 769on the current CPU.
769This is called by the virtual memory system when the 770This is called by the virtual memory system when the
770virtual memory context for a process is changed, and is also 771virtual memory context for a process is changed, and is also
771often used by machine-dependent context switch code to program 772used by the context switch code to program the memory management hardware
772the memory management hardware with the process's page table 773with the process's page table base, etc.
773base, etc. 774All calls to
774Note that 
775.Fn pmap_activate 775.Fn pmap_activate
776may not always be called when 776from machine-independent code are made with preemption disabled and with
777.Fa l 777.Fa l
778is the current lwp. 778as the current lwp.
779.Fn pmap_activate 
780must be able to handle this scenario. 
781.Pp 779.Pp
782The 780The
783.Fn pmap_activate 781.Fn pmap_activate
784call, like 782call, like
785.Fn pmap_deactivate , 783.Fn pmap_deactivate ,
786must never block, as it is used for context switching. 784must never block, as it is used for context switching.
787.It void Fn "pmap_deactivate" "struct lwp *l" 785.It void Fn "pmap_deactivate" "struct lwp *l"
788Deactivate the physical map used by the process behind lwp 786Deactivate the physical map used by the process behind lwp
789.Fa l . 787.Fa l .
790It is generally used in conjunction with 788It is generally used in conjunction with
791.Fn pmap_activate . 789.Fn pmap_activate .
792Like 790Like
793.Fn pmap_activate , 791.Fn pmap_activate ,
794.Fn pmap_deactivate 792.Fn pmap_deactivate
795may not always be called when 793is called by machine-independent code with preemption disabled and with
796.Fa l 794.Fa l
797is the current lwp. 795as the current lwp.
798.Pp 796.Pp
799As above, 797As above,
800.Fn pmap_deactivate 798.Fn pmap_deactivate
801must never block. 799must never block.
802.It void Fn "pmap_zero_page" "paddr_t pa" 800.It void Fn "pmap_zero_page" "paddr_t pa"
803Zero the PAGE_SIZE sized region starting at physical address 801Zero the PAGE_SIZE sized region starting at physical address
804.Fa pa . 802.Fa pa .
805The 803The
806.Nm 804.Nm
807implementation must take whatever steps are necessary to map the 805implementation must take whatever steps are necessary to map the
808page to a kernel-accessible address and zero the page. 806page to a kernel-accessible address and zero the page.
809It is suggested that implementations use an optimized zeroing algorithm, 807It is suggested that implementations use an optimized zeroing algorithm,
810as the performance of this function directly impacts page fault performance. 808as the performance of this function directly impacts page fault performance.