Source-Changes-HG archive

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

[src/trunk]: src/sys/arch Remap the pages with G until kern_end, and not just...



details:   https://anonhg.NetBSD.org/src/rev/b6d43cb311ae
branches:  trunk
changeset: 819097:b6d43cb311ae
user:      maxv <maxv%NetBSD.org@localhost>
date:      Thu Nov 17 16:26:07 2016 +0000

description:
Remap the pages with G until kern_end, and not just the preloaded modules.
This way the bootstrap tables, proc0's stack and the I/O mem area don't get
flushed each time userland needs a TLB shootdown.

diffstat:

 sys/arch/amd64/amd64/machdep.c |  10 +++++-----
 sys/arch/x86/x86/pmap.c        |  17 ++++++++---------
 2 files changed, 13 insertions(+), 14 deletions(-)

diffs (79 lines):

diff -r 59db1c716860 -r b6d43cb311ae sys/arch/amd64/amd64/machdep.c
--- a/sys/arch/amd64/amd64/machdep.c    Thu Nov 17 14:20:25 2016 +0000
+++ b/sys/arch/amd64/amd64/machdep.c    Thu Nov 17 16:26:07 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: machdep.c,v 1.232 2016/11/15 15:26:59 maxv Exp $       */
+/*     $NetBSD: machdep.c,v 1.233 2016/11/17 16:26:08 maxv Exp $       */
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2000, 2006, 2007, 2008, 2011
@@ -111,7 +111,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.232 2016/11/15 15:26:59 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.233 2016/11/17 16:26:08 maxv Exp $");
 
 /* #define XENDEBUG_LOW  */
 
@@ -1607,15 +1607,15 @@
            pmap_pa_start, avail_start, avail_end));
 #endif /* !XEN */
 
+       /* End of the virtual space we have created so far. */
+       kern_end = KERNBASE + first_avail;
+
        /*
         * Call pmap initialization to make new kernel address space.
         * We must do this before loading pages into the VM system.
         */
        pmap_bootstrap(VM_MIN_KERNEL_ADDRESS);
 
-       /* End of the virtual space we have created so far. */
-       kern_end = KERNBASE + first_avail;
-
 #ifndef XEN
        /* Internalize the physical pages into the VM system. */
        init_x86_vm(first_avail);
diff -r 59db1c716860 -r b6d43cb311ae sys/arch/x86/x86/pmap.c
--- a/sys/arch/x86/x86/pmap.c   Thu Nov 17 14:20:25 2016 +0000
+++ b/sys/arch/x86/x86/pmap.c   Thu Nov 17 16:26:07 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap.c,v 1.225 2016/11/11 11:34:51 maxv Exp $  */
+/*     $NetBSD: pmap.c,v 1.226 2016/11/17 16:26:07 maxv Exp $  */
 
 /*-
  * Copyright (c) 2008, 2010, 2016 The NetBSD Foundation, Inc.
@@ -171,7 +171,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.225 2016/11/11 11:34:51 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.226 2016/11/17 16:26:07 maxv Exp $");
 
 #include "opt_user_ldt.h"
 #include "opt_lockdebug.h"
@@ -1288,17 +1288,16 @@
                pmap_pg_g = PG_G;               /* enable software */
 
                /* add PG_G attribute to already mapped kernel pages */
+
                if (KERNBASE == VM_MIN_KERNEL_ADDRESS) {
+                       /* i386 only */
                        kva_end = virtual_avail;
                } else {
-                       extern vaddr_t eblob, esym;
-                       kva_end = (vaddr_t)&end;
-                       if (esym > kva_end)
-                               kva_end = esym;
-                       if (eblob > kva_end)
-                               kva_end = eblob;
-                       kva_end = roundup(kva_end, PAGE_SIZE);
+                       /* amd64 only */
+                       extern vaddr_t kern_end;
+                       kva_end = kern_end;
                }
+
                for (kva = KERNBASE; kva < kva_end; kva += PAGE_SIZE) {
                        p1i = pl1_i(kva);
                        if (pmap_valid_entry(PTE_BASE[p1i]))



Home | Main Index | Thread Index | Old Index