Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 1 Sep 2018 09:59:46 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r338419 - in stable/11/sys: amd64/amd64 i386/i386 i386/include x86/x86
Message-ID:  <201809010959.w819xkVH038212@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Sat Sep  1 09:59:46 2018
New Revision: 338419
URL: https://svnweb.freebsd.org/changeset/base/338419

Log:
  MFC r338312:
  Unify amd64 and i386 vmspace0 pmap activation.

Modified:
  stable/11/sys/amd64/amd64/mp_machdep.c
  stable/11/sys/i386/i386/pmap.c
  stable/11/sys/i386/include/pmap.h
  stable/11/sys/x86/x86/mp_x86.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/amd64/amd64/mp_machdep.c
==============================================================================
--- stable/11/sys/amd64/amd64/mp_machdep.c	Sat Sep  1 02:23:45 2018	(r338418)
+++ stable/11/sys/amd64/amd64/mp_machdep.c	Sat Sep  1 09:59:46 2018	(r338419)
@@ -56,7 +56,6 @@ __FBSDID("$FreeBSD$");
 #include <vm/vm_param.h>
 #include <vm/pmap.h>
 #include <vm/vm_kern.h>
-#include <vm/vm_map.h>
 #include <vm/vm_extern.h>
 
 #include <x86/apicreg.h>
@@ -309,7 +308,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: stable/11/sys/i386/i386/pmap.c
==============================================================================
--- stable/11/sys/i386/i386/pmap.c	Sat Sep  1 02:23:45 2018	(r338418)
+++ stable/11/sys/i386/i386/pmap.c	Sat Sep  1 09:59:46 2018	(r338419)
@@ -1857,9 +1857,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);
 }
 
 /*
@@ -5595,6 +5595,20 @@ pmap_activate(struct thread *td)
 	load_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: stable/11/sys/i386/include/pmap.h
==============================================================================
--- stable/11/sys/i386/include/pmap.h	Sat Sep  1 02:23:45 2018	(r338418)
+++ stable/11/sys/i386/include/pmap.h	Sat Sep  1 09:59:46 2018	(r338419)
@@ -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(int mode, boolean_t is_pde);
 int	pmap_change_attr(vm_offset_t, vm_size_t, int);

Modified: stable/11/sys/x86/x86/mp_x86.c
==============================================================================
--- stable/11/sys/x86/x86/mp_x86.c	Sat Sep  1 02:23:45 2018	(r338418)
+++ stable/11/sys/x86/x86/mp_x86.c	Sat Sep  1 09:59:46 2018	(r338419)
@@ -61,6 +61,7 @@ __FBSDID("$FreeBSD$");
 #include <vm/pmap.h>
 #include <vm/vm_kern.h>
 #include <vm/vm_extern.h>
+#include <vm/vm_map.h>
 
 #include <x86/apicreg.h>
 #include <machine/clock.h>
@@ -863,6 +864,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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201809010959.w819xkVH038212>