Module Name: src Committed By: bouyer Date: Tue Feb 21 19:10:13 UTC 2012
Modified Files: src/sys/arch/x86/x86: pmap.c src/sys/arch/xen/x86: cpu.c Log Message: 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 To generate a diff of this commit: cvs rdiff -u -r1.166 -r1.167 src/sys/arch/x86/x86/pmap.c cvs rdiff -u -r1.81 -r1.82 src/sys/arch/xen/x86/cpu.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/x86/x86/pmap.c diff -u src/sys/arch/x86/x86/pmap.c:1.166 src/sys/arch/x86/x86/pmap.c:1.167 --- src/sys/arch/x86/x86/pmap.c:1.166 Mon Feb 20 20:49:12 2012 +++ src/sys/arch/x86/x86/pmap.c Tue Feb 21 19:10:13 2012 @@ -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 @@ pmap_alloc_level(pd_entry_t * const *pde 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__ */ } +#endif /* PAE || __x86_64__ */ #else /* XEN */ pdep[i] = pte; #endif /* XEN */ @@ -4199,7 +4215,7 @@ pmap_alloc_level(pd_entry_t * const *pde nkptp[level - 1]++; va += nbpd[level - 1]; } - pmap_pte_flush(); + xpq_flush_queue(); } #ifdef XEN splx(s); Index: src/sys/arch/xen/x86/cpu.c diff -u src/sys/arch/xen/x86/cpu.c:1.81 src/sys/arch/xen/x86/cpu.c:1.82 --- src/sys/arch/xen/x86/cpu.c:1.81 Fri Feb 17 18:40:20 2012 +++ src/sys/arch/xen/x86/cpu.c Tue Feb 21 19:10:13 2012 @@ -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 @@ cpu_attach_common(device_t parent, devic case CPU_ROLE_BP: atomic_or_32(&ci->ci_flags, CPUF_BSP); cpu_identify(ci); - cpu_init(ci); #if 0 x86_errata(); #endif