Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src pmap_remove_all(): Return a boolean value to indicate the be...



details:   https://anonhg.NetBSD.org/src/rev/4a16152b6773
branches:  trunk
changeset: 970157:4a16152b6773
user:      ad <ad%NetBSD.org@localhost>
date:      Sat Mar 14 14:05:42 2020 +0000

description:
pmap_remove_all(): Return a boolean value to indicate the behaviour.  If
true, all mappings have been removed, the pmap is totally cleared out, and
UVM can then avoid doing the work to call pmap_remove() for each map entry.
If false, either nothing has been done, or some helpful arch-specific voodoo
has taken place.

diffstat:

 share/man/man9/pmap.9                  |  25 ++++++++++++++++++++-----
 sys/arch/aarch64/aarch64/pmap.c        |   7 ++++---
 sys/arch/alpha/include/pmap.h          |   5 +++--
 sys/arch/arm/arm32/pmap.c              |   7 ++++---
 sys/arch/arm/include/arm32/pmap.h      |   4 ++--
 sys/arch/hppa/include/pmap.h           |   5 +++--
 sys/arch/ia64/ia64/pmap.c              |   7 ++++---
 sys/arch/m68k/include/pmap_motorola.h  |   5 +++--
 sys/arch/powerpc/include/ibm4xx/pmap.h |   5 +++--
 sys/arch/powerpc/include/oea/pmap.h    |   5 +++--
 sys/arch/sh3/include/pmap.h            |   5 +++--
 sys/arch/sparc/include/pmap.h          |   4 ++--
 sys/arch/sparc/sparc/pmap.c            |   9 +++++----
 sys/arch/sparc64/sparc64/pmap.c        |   9 +++++----
 sys/arch/sun2/include/pmap.h           |   5 +++--
 sys/arch/sun3/include/pmap3.h          |   5 +++--
 sys/arch/sun3/include/pmap3x.h         |   5 +++--
 sys/arch/usermode/usermode/pmap.c      |   9 +++++----
 sys/arch/vax/include/pmap.h            |   5 +++--
 sys/arch/x86/include/pmap.h            |   4 ++--
 sys/arch/x86/x86/pmap.c                |   7 ++++---
 sys/uvm/pmap/pmap.c                    |   7 ++++---
 sys/uvm/uvm_pmap.h                     |   4 ++--
 23 files changed, 93 insertions(+), 60 deletions(-)

diffs (truncated from 648 to 300 lines):

diff -r 4e5079ed11c5 -r 4a16152b6773 share/man/man9/pmap.9
--- a/share/man/man9/pmap.9     Sat Mar 14 13:53:26 2020 +0000
+++ b/share/man/man9/pmap.9     Sat Mar 14 14:05:42 2020 +0000
@@ -1,6 +1,6 @@
-.\"    $NetBSD: pmap.9,v 1.46 2019/01/14 15:56:06 wiz Exp $
+.\"    $NetBSD: pmap.9,v 1.47 2020/03/14 14:05:42 ad Exp $
 .\"
-.\" Copyright (c) 2000, 2001, 2002 The NetBSD Foundation, Inc.
+.\" Copyright (c) 2000, 2001, 2002, 2020 The NetBSD Foundation, Inc.
 .\" All rights reserved.
 .\"
 .\" This code is derived from software contributed to The NetBSD Foundation
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd January 13, 2019
+.Dd March 14, 2020
 .Dt PMAP 9
 .Os
 .Sh NAME
@@ -63,7 +63,7 @@
     "u_int flags"
 .Ft void
 .Fn "pmap_remove" "pmap_t pmap" "vaddr_t sva" "vaddr_t eva"
-.Ft void
+.Ft bool
 .Fn "pmap_remove_all" "pmap_t pmap"
 .Ft void
 .Fn "pmap_protect" "pmap_t pmap" "vaddr_t sva" "vaddr_t eva" "vm_prot_t prot"
@@ -549,7 +549,7 @@
 to
 .Fa eva
 from the specified physical map.
-.It void Fn "pmap_remove_all" "pmap_t pmap"
+.It bool Fn "pmap_remove_all" "pmap_t pmap"
 This function is a hint to the
 .Nm pmap
 implementation that all entries in
@@ -581,6 +581,21 @@
 or to use the knowledge of the upcoming
 .Fn pmap_remove
 calls to optimize the removals (or to just ignore this call).
+.Pp
+If  all mappings in the address space have been removed,
+.Fn pmap_remove_all
+should return
+.Dv true
+to indicate that that the pmap is now empty.
+In this case UVM will skip all subsequent calls to
+.Fn pmap_remove
+and
+.Fn pmap_update
+for the pmap, that would otherwise be required to clean it out.
+If any mappings could possibly remain,
+.Fn pmap_remove_all
+must return
+.Dv false .
 .It void Fn "pmap_protect" "pmap_t pmap" "vaddr_t sva" "vaddr_t eva" \
     "vm_prot_t prot"
 Set the protection of the mappings in the virtual address range
diff -r 4e5079ed11c5 -r 4a16152b6773 sys/arch/aarch64/aarch64/pmap.c
--- a/sys/arch/aarch64/aarch64/pmap.c   Sat Mar 14 13:53:26 2020 +0000
+++ b/sys/arch/aarch64/aarch64/pmap.c   Sat Mar 14 14:05:42 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap.c,v 1.67 2020/03/02 08:39:36 ryo Exp $    */
+/*     $NetBSD: pmap.c,v 1.68 2020/03/14 14:05:42 ad Exp $     */
 
 /*
  * Copyright (c) 2017 Ryo Shimizu <ryo%nerv.org@localhost>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.67 2020/03/02 08:39:36 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.68 2020/03/14 14:05:42 ad Exp $");
 
 #include "opt_arm_debug.h"
 #include "opt_ddb.h"
@@ -1947,10 +1947,11 @@
        return _pmap_enter(pm, va, pa, prot, flags, false);
 }
 
-void
+bool
 pmap_remove_all(struct pmap *pm)
 {
        /* nothing to do */
+       return false;
 }
 
 static void
diff -r 4e5079ed11c5 -r 4a16152b6773 sys/arch/alpha/include/pmap.h
--- a/sys/arch/alpha/include/pmap.h     Sat Mar 14 13:53:26 2020 +0000
+++ b/sys/arch/alpha/include/pmap.h     Sat Mar 14 14:05:42 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.h,v 1.80 2018/05/19 20:04:41 thorpej Exp $ */
+/* $NetBSD: pmap.h,v 1.81 2020/03/14 14:05:42 ad Exp $ */
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2001, 2007 The NetBSD Foundation, Inc.
@@ -214,10 +214,11 @@
 #define        pmap_copy(dp, sp, da, l, sa)    /* nothing */
 #define        pmap_update(pmap)               /* nothing (yet) */
 
-static __inline void
+static __inline bool
 pmap_remove_all(struct pmap *pmap)
 {
        /* Nothing. */
+       return false;
 }
 
 #define        pmap_is_referenced(pg)                                          \
diff -r 4e5079ed11c5 -r 4a16152b6773 sys/arch/arm/arm32/pmap.c
--- a/sys/arch/arm/arm32/pmap.c Sat Mar 14 13:53:26 2020 +0000
+++ b/sys/arch/arm/arm32/pmap.c Sat Mar 14 14:05:42 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap.c,v 1.398 2020/03/13 16:25:19 skrll Exp $ */
+/*     $NetBSD: pmap.c,v 1.399 2020/03/14 14:05:42 ad Exp $    */
 
 /*
  * Copyright 2003 Wasabi Systems, Inc.
@@ -198,7 +198,7 @@
 #endif
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.398 2020/03/13 16:25:19 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.399 2020/03/14 14:05:42 ad Exp $");
 
 #include <sys/atomic.h>
 #include <sys/param.h>
@@ -5180,7 +5180,7 @@
        UVMHIST_LOG(maphist, "  <-- done", 0, 0, 0, 0);
 }
 
-void
+bool
 pmap_remove_all(pmap_t pm)
 {
 
@@ -5208,6 +5208,7 @@
        pmap_tlb_asid_release_all(pm);
 #endif
        pm->pm_remove_all = true;
+       return false;
 }
 
 /*
diff -r 4e5079ed11c5 -r 4a16152b6773 sys/arch/arm/include/arm32/pmap.h
--- a/sys/arch/arm/include/arm32/pmap.h Sat Mar 14 13:53:26 2020 +0000
+++ b/sys/arch/arm/include/arm32/pmap.h Sat Mar 14 14:05:42 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap.h,v 1.163 2020/02/24 20:31:56 ad Exp $    */
+/*     $NetBSD: pmap.h,v 1.164 2020/03/14 14:05:42 ad Exp $    */
 
 /*
  * Copyright (c) 2002, 2003 Wasabi Systems, Inc.
@@ -374,7 +374,7 @@
  * Functions that we need to export
  */
 void   pmap_procwr(struct proc *, vaddr_t, int);
-void   pmap_remove_all(pmap_t);
+bool   pmap_remove_all(pmap_t);
 bool   pmap_extract(pmap_t, vaddr_t, paddr_t *);
 
 #define        PMAP_NEED_PROCWR
diff -r 4e5079ed11c5 -r 4a16152b6773 sys/arch/hppa/include/pmap.h
--- a/sys/arch/hppa/include/pmap.h      Sat Mar 14 13:53:26 2020 +0000
+++ b/sys/arch/hppa/include/pmap.h      Sat Mar 14 14:05:42 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap.h,v 1.39 2020/02/24 20:42:18 ad Exp $     */
+/*     $NetBSD: pmap.h,v 1.40 2020/03/14 14:05:42 ad Exp $     */
 
 /*     $OpenBSD: pmap.h,v 1.35 2007/12/14 18:32:23 deraadt Exp $       */
 
@@ -167,10 +167,11 @@
        /* Nothing. */
 }
 
-static inline void
+static inline bool
 pmap_remove_all(struct pmap *pmap)
 {
        /* Nothing. */
+       return false;
 }
 
 static inline int
diff -r 4e5079ed11c5 -r 4a16152b6773 sys/arch/ia64/ia64/pmap.c
--- a/sys/arch/ia64/ia64/pmap.c Sat Mar 14 13:53:26 2020 +0000
+++ b/sys/arch/ia64/ia64/pmap.c Sat Mar 14 14:05:42 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.39 2019/11/30 16:23:46 riastradh Exp $ */
+/* $NetBSD: pmap.c,v 1.40 2020/03/14 14:05:42 ad Exp $ */
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -81,7 +81,7 @@
 
 #include <sys/cdefs.h>
 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.39 2019/11/30 16:23:46 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.40 2020/03/14 14:05:42 ad Exp $");
 
 #include <sys/param.h>
 #include <sys/atomic.h>
@@ -1856,10 +1856,11 @@
  *     entries in pmap will be removed before any more entries are
  *     entered.
  */
-void
+bool
 pmap_remove_all(pmap_t pmap)
 {
        /* XXX do nothing */
+       return false;
 }
 
 /*
diff -r 4e5079ed11c5 -r 4a16152b6773 sys/arch/m68k/include/pmap_motorola.h
--- a/sys/arch/m68k/include/pmap_motorola.h     Sat Mar 14 13:53:26 2020 +0000
+++ b/sys/arch/m68k/include/pmap_motorola.h     Sat Mar 14 14:05:42 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap_motorola.h,v 1.35 2020/02/01 06:17:11 tsutsui Exp $       */
+/*     $NetBSD: pmap_motorola.h,v 1.36 2020/03/14 14:05:43 ad Exp $    */
 
 /* 
  * Copyright (c) 1991, 1993
@@ -204,10 +204,11 @@
 
 #define        pmap_update(pmap)               __nothing       /* nothing (yet) */
 
-static __inline void
+static __inline bool
 pmap_remove_all(struct pmap *pmap)
 {
        /* Nothing. */
+       return false;
 }
 
 extern paddr_t         Sysseg_pa;
diff -r 4e5079ed11c5 -r 4a16152b6773 sys/arch/powerpc/include/ibm4xx/pmap.h
--- a/sys/arch/powerpc/include/ibm4xx/pmap.h    Sat Mar 14 13:53:26 2020 +0000
+++ b/sys/arch/powerpc/include/ibm4xx/pmap.h    Sat Mar 14 14:05:42 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap.h,v 1.20 2020/03/05 02:14:53 rin Exp $    */
+/*     $NetBSD: pmap.h,v 1.21 2020/03/14 14:05:43 ad Exp $     */
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -172,10 +172,11 @@
 void pmap_real_memory(paddr_t *, psize_t *);
 int pmap_tlbmiss(vaddr_t va, int ctx);
 
-static __inline void
+static __inline bool
 pmap_remove_all(struct pmap *pmap)
 {
        /* Nothing. */
+       return false;
 }
 
 int    ctx_alloc(struct pmap *);
diff -r 4e5079ed11c5 -r 4a16152b6773 sys/arch/powerpc/include/oea/pmap.h
--- a/sys/arch/powerpc/include/oea/pmap.h       Sat Mar 14 13:53:26 2020 +0000
+++ b/sys/arch/powerpc/include/oea/pmap.h       Sat Mar 14 14:05:42 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap.h,v 1.29 2018/04/19 21:50:07 christos Exp $       */
+/*     $NetBSD: pmap.h,v 1.30 2020/03/14 14:05:43 ad Exp $     */
 
 /*-
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -128,10 +128,11 @@
 #define        pmap_wired_count(pmap)          ((pmap)->pm_stats.wired_count)
 
 /* ARGSUSED */
-static __inline void
+static __inline bool
 pmap_remove_all(struct pmap *pmap)
 {
        /* Nothing. */
+       return false;
 }
 
 #if (defined(PPC_OEA) + defined(PPC_OEA64) + defined(PPC_OEA64_BRIDGE)) != 1
diff -r 4e5079ed11c5 -r 4a16152b6773 sys/arch/sh3/include/pmap.h
--- a/sys/arch/sh3/include/pmap.h       Sat Mar 14 13:53:26 2020 +0000
+++ b/sys/arch/sh3/include/pmap.h       Sat Mar 14 14:05:42 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap.h,v 1.36 2016/09/03 09:07:53 christos Exp $       */
+/*     $NetBSD: pmap.h,v 1.37 2020/03/14 14:05:43 ad Exp $     */
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -61,10 +61,11 @@
 #define        pmap_resident_count(pmap)       ((pmap)->pm_stats.resident_count)
 
 /* ARGSUSED */
-static __inline void



Home | Main Index | Thread Index | Old Index