Source-Changes-HG archive

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

[src/trunk]: src/sys/arch Avoid early use of xen_kpm_sync(); locks are not av...



details:   https://anonhg.NetBSD.org/src/rev/0b250bbf6477
branches:  trunk
changeset: 777524:0b250bbf6477
user:      bouyer <bouyer%NetBSD.org@localhost>
date:      Tue Feb 21 19:10:13 2012 +0000

description:
Avoid early use of xen_kpm_sync(); locks are not available at this time.
Don't call cpu_init() twice.

Makes LOCKDEBUG kernels boot again

diffstat:

 sys/arch/x86/x86/pmap.c |  28 ++++++++++++++++++++++------
 sys/arch/xen/x86/cpu.c  |   5 ++---
 2 files changed, 24 insertions(+), 9 deletions(-)

diffs (87 lines):

diff -r a23fcac27704 -r 0b250bbf6477 sys/arch/x86/x86/pmap.c
--- a/sys/arch/x86/x86/pmap.c   Tue Feb 21 18:38:32 2012 +0000
+++ b/sys/arch/x86/x86/pmap.c   Tue Feb 21 19:10:13 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap.c,v 1.166 2012/02/20 20:49:12 bouyer Exp $        */
+/*     $NetBSD: pmap.c,v 1.167 2012/02/21 19:10:13 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.166 2012/02/20 20:49:12 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.167 2012/02/21 19:10:13 bouyer Exp $");
 
 #include "opt_user_ldt.h"
 #include "opt_lockdebug.h"
@@ -4183,14 +4183,30 @@
                        pte = pmap_pa2pte(pa) | PG_k | PG_V | PG_RW;
 #ifdef XEN
                        xpq_queue_pte_update(xpmap_ptetomach(&pdep[i]), pte);
-                       if (level == PTP_LEVELS) {
 #if defined(PAE) || defined(__x86_64__)
-                               if (i >= PDIR_SLOT_KERN) {
+                       if (level == PTP_LEVELS && i >= PDIR_SLOT_KERN) {
+                               if (__predict_true(
+                                   cpu_info_primary.ci_flags & CPUF_PRESENT)) {
                                        /* update per-cpu PMDs on all cpus */
                                        xen_kpm_sync(pmap_kernel(), i);
+                               } else {
+                                       /*
+                                        * too early; update primary CPU
+                                        * PMD only (without locks)
+                                        */
+#ifdef PAE
+                                       pd_entry_t *cpu_pdep =
+                                           &cpu_info_primary.ci_kpm_pdir[l2tol2(i)];
+#endif
+#ifdef __x86_64__
+                                       pd_entry_t *cpu_pdep =
+                                               &cpu_info_primary.ci_kpm_pdir[i];
+#endif
+                                       xpq_queue_pte_update(
+                                           xpmap_ptetomach(cpu_pdep), pte);
                                }
+                       }
 #endif /* PAE || __x86_64__ */
-                       }
 #else /* XEN */
                        pdep[i] = pte;
 #endif /* XEN */
@@ -4199,7 +4215,7 @@
                        nkptp[level - 1]++;
                        va += nbpd[level - 1];
                }
-               pmap_pte_flush();
+               xpq_flush_queue();
        }
 #ifdef XEN
        splx(s);
diff -r a23fcac27704 -r 0b250bbf6477 sys/arch/xen/x86/cpu.c
--- a/sys/arch/xen/x86/cpu.c    Tue Feb 21 18:38:32 2012 +0000
+++ b/sys/arch/xen/x86/cpu.c    Tue Feb 21 19:10:13 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cpu.c,v 1.81 2012/02/17 18:40:20 bouyer Exp $  */
+/*     $NetBSD: cpu.c,v 1.82 2012/02/21 19:10:13 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.81 2012/02/17 18:40:20 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.82 2012/02/21 19:10:13 bouyer Exp $");
 
 #include "opt_ddb.h"
 #include "opt_multiprocessor.h"
@@ -487,7 +487,6 @@
        case CPU_ROLE_BP:
                atomic_or_32(&ci->ci_flags, CPUF_BSP);
                cpu_identify(ci);
-               cpu_init(ci);
 #if 0
                x86_errata();
 #endif



Home | Main Index | Thread Index | Old Index