Source-Changes-HG archive

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

[src/trunk]: src/sys/arch Revert sys/arch/x86/x86/pmap.c 1.185; a CPU needs t...



details:   https://anonhg.NetBSD.org/src/rev/7af91781d017
branches:  trunk
changeset: 334036:7af91781d017
user:      bouyer <bouyer%NetBSD.org@localhost>
date:      Thu Nov 27 16:29:44 2014 +0000

description:
Revert sys/arch/x86/x86/pmap.c 1.185; a CPU needs to get pmap updates,
especially for pmap_kernel(), as soon as it is up.
Instead move all pmap-related cpu_info initialisations, including
initializing ci_kpm_mtx, in cpu_attach_common() from cpu_init()
(ci_pmap and ci_tlbstate as already initialized in cpu_attach_common()).

diffstat:

 sys/arch/x86/x86/pmap.c |   7 ++++---
 sys/arch/xen/x86/cpu.c  |  19 +++++++++----------
 2 files changed, 13 insertions(+), 13 deletions(-)

diffs (75 lines):

diff -r 3a0ec20a66f8 -r 7af91781d017 sys/arch/x86/x86/pmap.c
--- a/sys/arch/x86/x86/pmap.c   Thu Nov 27 15:07:23 2014 +0000
+++ b/sys/arch/x86/x86/pmap.c   Thu Nov 27 16:29:44 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap.c,v 1.186 2014/11/27 14:22:09 uebayasi Exp $      */
+/*     $NetBSD: pmap.c,v 1.187 2014/11/27 16:29:44 bouyer Exp $        */
 
 /*-
  * Copyright (c) 2008, 2010 The NetBSD Foundation, Inc.
@@ -171,7 +171,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.186 2014/11/27 14:22:09 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.187 2014/11/27 16:29:44 bouyer Exp $");
 
 #include "opt_user_ldt.h"
 #include "opt_lockdebug.h"
@@ -4187,7 +4187,8 @@
                        pmap_pte_set(&pdep[i], pte);
 #if defined(PAE) || defined(__x86_64__)
                        if (level == PTP_LEVELS && i >= PDIR_SLOT_KERN) {
-                         if (__predict_true(mp_online == true)) {
+                               if (__predict_true(
+                                   cpu_info_primary.ci_flags & CPUF_PRESENT)) {
                                        /* update per-cpu PMDs on all cpus */
                                        xen_kpm_sync(pmap_kernel(), i);
                                } else {
diff -r 3a0ec20a66f8 -r 7af91781d017 sys/arch/xen/x86/cpu.c
--- a/sys/arch/xen/x86/cpu.c    Thu Nov 27 15:07:23 2014 +0000
+++ b/sys/arch/xen/x86/cpu.c    Thu Nov 27 16:29:44 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cpu.c,v 1.99 2014/10/18 08:33:27 snj Exp $     */
+/*     $NetBSD: cpu.c,v 1.100 2014/11/27 16:29:44 bouyer Exp $ */
 /* NetBSD: cpu.c,v 1.18 2004/02/20 17:35:01 yamt Exp  */
 
 /*-
@@ -66,7 +66,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.99 2014/10/18 08:33:27 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.100 2014/11/27 16:29:44 bouyer Exp $");
 
 #include "opt_ddb.h"
 #include "opt_multiprocessor.h"
@@ -425,6 +425,13 @@
        }
 
        KASSERT(ci->ci_cpuid == ci->ci_index);
+#ifdef __x86_64__
+       /* No user PGD mapped for this CPU yet */
+       ci->ci_xen_current_user_pgd = 0;
+#endif
+#if defined(__x86_64__) || defined(PAE)
+       mutex_init(&ci->ci_kpm_mtx, MUTEX_DEFAULT, IPL_VM);
+#endif
        pmap_reference(pmap_kernel());
        ci->ci_pmap = pmap_kernel();
        ci->ci_tlbstate = TLBSTATE_STALE;
@@ -543,14 +550,6 @@
                        lcr4(rcr4() | CR4_OSXMMEXCPT);
        }
 
-#ifdef __x86_64__
-       /* No user PGD mapped for this CPU yet */
-       ci->ci_xen_current_user_pgd = 0;
-#endif
-#if defined(__x86_64__) || defined(PAE)
-       mutex_init(&ci->ci_kpm_mtx, MUTEX_DEFAULT, IPL_VM);
-#endif
-
        atomic_or_32(&ci->ci_flags, CPUF_RUNNING);
 }
 



Home | Main Index | Thread Index | Old Index