Source-Changes-HG archive

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

[src/trunk]: src/sys/arch Add svs_enabled, which defaults to 'true' when SVS ...



details:   https://anonhg.NetBSD.org/src/rev/48fc4d015b8c
branches:  trunk
changeset: 829939:48fc4d015b8c
user:      maxv <maxv%NetBSD.org@localhost>
date:      Sun Feb 18 14:07:29 2018 +0000

description:
Add svs_enabled, which defaults to 'true' when SVS is compiled (no dynamic
detection yet).

diffstat:

 sys/arch/amd64/amd64/locore.S |  6 +++++-
 sys/arch/amd64/include/pmap.h |  3 ++-
 sys/arch/x86/x86/pmap.c       |  8 ++++----
 sys/arch/x86/x86/svs.c        |  7 +++++--
 4 files changed, 16 insertions(+), 8 deletions(-)

diffs (109 lines):

diff -r 3bd1aa533fad -r 48fc4d015b8c sys/arch/amd64/amd64/locore.S
--- a/sys/arch/amd64/amd64/locore.S     Sun Feb 18 12:22:16 2018 +0000
+++ b/sys/arch/amd64/amd64/locore.S     Sun Feb 18 14:07:29 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: locore.S,v 1.150 2018/01/27 17:54:13 maxv Exp $        */
+/*     $NetBSD: locore.S,v 1.151 2018/02/18 14:07:29 maxv Exp $        */
 
 /*
  * Copyright-o-rama!
@@ -1091,7 +1091,11 @@
 
 #ifdef SVS
        pushq   %rdx
+       movb    _C_LABEL(svs_enabled),%dl
+       testb   %dl,%dl
+       jz      .Lskip_svs
        callq   _C_LABEL(svs_lwp_switch)
+.Lskip_svs:
        popq    %rdx
 #endif
 
diff -r 3bd1aa533fad -r 48fc4d015b8c sys/arch/amd64/include/pmap.h
--- a/sys/arch/amd64/include/pmap.h     Sun Feb 18 12:22:16 2018 +0000
+++ b/sys/arch/amd64/include/pmap.h     Sun Feb 18 14:07:29 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap.h,v 1.42 2018/01/21 10:59:21 maxv Exp $   */
+/*     $NetBSD: pmap.h,v 1.43 2018/02/18 14:07:29 maxv Exp $   */
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -221,6 +221,7 @@
 void svs_pmap_sync(struct pmap *, int);
 void svs_lwp_switch(struct lwp *, struct lwp *);
 void svs_pdir_switch(struct pmap *);
+extern bool svs_enabled;
 
 #include <x86/pmap.h>
 
diff -r 3bd1aa533fad -r 48fc4d015b8c sys/arch/x86/x86/pmap.c
--- a/sys/arch/x86/x86/pmap.c   Sun Feb 18 12:22:16 2018 +0000
+++ b/sys/arch/x86/x86/pmap.c   Sun Feb 18 14:07:29 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap.c,v 1.280 2018/02/17 17:44:09 maxv Exp $  */
+/*     $NetBSD: pmap.c,v 1.281 2018/02/18 14:07:29 maxv Exp $  */
 
 /*
  * Copyright (c) 2008, 2010, 2016, 2017 The NetBSD Foundation, Inc.
@@ -170,7 +170,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.280 2018/02/17 17:44:09 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.281 2018/02/18 14:07:29 maxv Exp $");
 
 #include "opt_user_ldt.h"
 #include "opt_lockdebug.h"
@@ -2130,7 +2130,7 @@
                        xen_kpm_sync(pmap, index);
                }
 #elif defined(SVS)
-               if (level == PTP_LEVELS - 1) {
+               if (svs_enabled && level == PTP_LEVELS - 1) {
                        svs_pmap_sync(pmap, index);
                }
 #endif
@@ -2235,7 +2235,7 @@
                        xen_kpm_sync(pmap, index);
                }
 #elif defined(SVS)
-               if (i == PTP_LEVELS) {
+               if (svs_enabled && i == PTP_LEVELS) {
                        svs_pmap_sync(pmap, index);
                }
 #endif
diff -r 3bd1aa533fad -r 48fc4d015b8c sys/arch/x86/x86/svs.c
--- a/sys/arch/x86/x86/svs.c    Sun Feb 18 12:22:16 2018 +0000
+++ b/sys/arch/x86/x86/svs.c    Sun Feb 18 14:07:29 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: svs.c,v 1.2 2018/02/17 17:44:09 maxv Exp $     */
+/*     $NetBSD: svs.c,v 1.3 2018/02/18 14:07:29 maxv Exp $     */
 
 /*
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: svs.c,v 1.2 2018/02/17 17:44:09 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: svs.c,v 1.3 2018/02/18 14:07:29 maxv Exp $");
 
 #include "opt_svs.h"
 
@@ -90,6 +90,8 @@
  *     with USER_LDT.
  */
 
+bool svs_enabled __read_mostly = false;
+
 struct svs_utls {
        paddr_t kpdirpa;
        uint64_t scratch;
@@ -503,6 +505,7 @@
 void
 svs_init(void)
 {
+       svs_enabled = true;
        svs_pgg_update(false);
 }
 



Home | Main Index | Thread Index | Old Index