From owner-svn-src-head@freebsd.org Sat Aug 25 15:21:30 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D4FCC108D65E; Sat, 25 Aug 2018 15:21:29 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8285F747D2; Sat, 25 Aug 2018 15:21:29 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 63BFE21A18; Sat, 25 Aug 2018 15:21:29 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w7PFLTdI069210; Sat, 25 Aug 2018 15:21:29 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w7PFLS52069110; Sat, 25 Aug 2018 15:21:28 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201808251521.w7PFLS52069110@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 25 Aug 2018 15:21:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r338312 - in head/sys: amd64/amd64 i386/i386 i386/include x86/x86 X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in head/sys: amd64/amd64 i386/i386 i386/include x86/x86 X-SVN-Commit-Revision: 338312 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Aug 2018 15:21:30 -0000 Author: kib Date: Sat Aug 25 15:21:28 2018 New Revision: 338312 URL: https://svnweb.freebsd.org/changeset/base/338312 Log: Unify amd64 and i386 vmspace0 pmap activation. Add pmap_activate_boot() for i386, move the invocation on APs from MD init_secondary() to x86 init_secondary_tail(). Suggested by: alc Reviewed by: alc, markj Sponsored by: The FreeBSD Foundation Approved by: re (marius) MFC after: 1 week Differential revision: https://reviews.freebsd.org/D16893 Modified: head/sys/amd64/amd64/mp_machdep.c head/sys/i386/i386/pmap.c head/sys/i386/include/pmap.h head/sys/x86/x86/mp_x86.c Modified: head/sys/amd64/amd64/mp_machdep.c ============================================================================== --- head/sys/amd64/amd64/mp_machdep.c Sat Aug 25 10:42:44 2018 (r338311) +++ head/sys/amd64/amd64/mp_machdep.c Sat Aug 25 15:21:28 2018 (r338312) @@ -58,7 +58,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include @@ -343,7 +342,6 @@ init_secondary(void) while (atomic_load_acq_int(&aps_ready) == 0) ia32_pause(); - pmap_activate_boot(vmspace_pmap(proc0.p_vmspace)); init_secondary_tail(); } Modified: head/sys/i386/i386/pmap.c ============================================================================== --- head/sys/i386/i386/pmap.c Sat Aug 25 10:42:44 2018 (r338311) +++ head/sys/i386/i386/pmap.c Sat Aug 25 15:21:28 2018 (r338312) @@ -2000,9 +2000,9 @@ pmap_pinit0(pmap_t pmap) #endif pmap->pm_root.rt_root = 0; CPU_ZERO(&pmap->pm_active); - PCPU_SET(curpmap, pmap); TAILQ_INIT(&pmap->pm_pvchunk); bzero(&pmap->pm_stats, sizeof pmap->pm_stats); + pmap_activate_boot(pmap); } /* @@ -5802,6 +5802,20 @@ pmap_activate(struct thread *td) td->td_pcb->pcb_cr3 = cr3; PCPU_SET(curpmap, pmap); critical_exit(); +} + +void +pmap_activate_boot(pmap_t pmap) +{ + u_int cpuid; + + cpuid = PCPU_GET(cpuid); +#if defined(SMP) + CPU_SET_ATOMIC(cpuid, &pmap->pm_active); +#else + CPU_SET(cpuid, &pmap->pm_active); +#endif + PCPU_SET(curpmap, pmap); } void Modified: head/sys/i386/include/pmap.h ============================================================================== --- head/sys/i386/include/pmap.h Sat Aug 25 10:42:44 2018 (r338311) +++ head/sys/i386/include/pmap.h Sat Aug 25 15:21:28 2018 (r338312) @@ -373,6 +373,7 @@ extern vm_offset_t virtual_end; * is called: pmap_kenter(), pmap_kextract(), pmap_kremove(), vtophys(), and * vtopte(). */ +void pmap_activate_boot(pmap_t pmap); void pmap_bootstrap(vm_paddr_t); int pmap_cache_bits(pmap_t, int mode, boolean_t is_pde); int pmap_change_attr(vm_offset_t, vm_size_t, int); Modified: head/sys/x86/x86/mp_x86.c ============================================================================== --- head/sys/x86/x86/mp_x86.c Sat Aug 25 10:42:44 2018 (r338311) +++ head/sys/x86/x86/mp_x86.c Sat Aug 25 15:21:28 2018 (r338312) @@ -62,6 +62,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -966,6 +967,8 @@ void init_secondary_tail(void) { u_int cpuid; + + pmap_activate_boot(vmspace_pmap(proc0.p_vmspace)); /* * On real hardware, switch to x2apic mode if possible. Do it