Module Name: src Committed By: bouyer Date: Thu Nov 27 16:29:44 UTC 2014
Modified Files: src/sys/arch/x86/x86: pmap.c src/sys/arch/xen/x86: cpu.c Log Message: 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()). To generate a diff of this commit: cvs rdiff -u -r1.186 -r1.187 src/sys/arch/x86/x86/pmap.c cvs rdiff -u -r1.99 -r1.100 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.186 src/sys/arch/x86/x86/pmap.c:1.187 --- src/sys/arch/x86/x86/pmap.c:1.186 Thu Nov 27 14:22:09 2014 +++ src/sys/arch/x86/x86/pmap.c Thu Nov 27 16:29:44 2014 @@ -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_alloc_level(pd_entry_t * const *pde 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 { Index: src/sys/arch/xen/x86/cpu.c diff -u src/sys/arch/xen/x86/cpu.c:1.99 src/sys/arch/xen/x86/cpu.c:1.100 --- src/sys/arch/xen/x86/cpu.c:1.99 Sat Oct 18 08:33:27 2014 +++ src/sys/arch/xen/x86/cpu.c Thu Nov 27 16:29:44 2014 @@ -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 @@ cpu_attach_common(device_t parent, devic } 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 @@ cpu_init(struct cpu_info *ci) 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); }