aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2023-05-04 06:17:30 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2023-05-04 15:39:22 +0000
commite704f88f3d924202e60e37c82dd50a5022c89dd4 (patch)
treed5810262945ca1b5c3ae0b4f23c03d7eb9acd6bb
parent5fd34912b4a51f6ebe55d0d832fab4f3c60228e7 (diff)
downloadsrc-e704f88f3d924202e60e37c82dd50a5022c89dd4.tar.gz
src-e704f88f3d924202e60e37c82dd50a5022c89dd4.zip
amd64: initialize APs kpmap_store in init_secondary()
The APs pcpu area is zeroed in init_secondary() by pcpu_init(), so the early initialization in pmap_bootstrap() is nop. Fixes: 42f722e721cd010ae5759a4b0d3b7b93c2b9cad2ESC Reviewed by: markj Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D39945
-rw-r--r--sys/amd64/amd64/mp_machdep.c2
-rw-r--r--sys/amd64/amd64/pmap.c8
2 files changed, 4 insertions, 6 deletions
diff --git a/sys/amd64/amd64/mp_machdep.c b/sys/amd64/amd64/mp_machdep.c
index 94589f736637..f6c3446e9981 100644
--- a/sys/amd64/amd64/mp_machdep.c
+++ b/sys/amd64/amd64/mp_machdep.c
@@ -215,6 +215,8 @@ init_secondary(void)
/* See comment in pmap_bootstrap(). */
pc->pc_pcid_next = PMAP_PCID_KERN + 2;
pc->pc_pcid_gen = 1;
+ pc->pc_kpmap_store.pm_pcid = PMAP_PCID_KERN;
+ pc->pc_kpmap_store.pm_gen = 1;
pc->pc_smp_tlb_gen = 1;
diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c
index a09920d62961..55086125fbb9 100644
--- a/sys/amd64/amd64/pmap.c
+++ b/sys/amd64/amd64/pmap.c
@@ -2036,13 +2036,9 @@ pmap_bootstrap(vm_paddr_t *firstaddr)
if (pmap_pcid_enabled) {
kernel_pmap->pm_pcidp = (void *)(uintptr_t)
offsetof(struct pcpu, pc_kpmap_store);
- for (i = 0; i < MAXCPU; i++) {
- struct pmap_pcid *pcidp;
- pcidp = zpcpu_get_cpu(kernel_pmap->pm_pcidp, i);
- pcidp->pm_pcid = PMAP_PCID_KERN;
- pcidp->pm_gen = 1;
- }
+ PCPU_SET(kpmap_store.pm_pcid, PMAP_PCID_KERN);
+ PCPU_SET(kpmap_store.pm_gen, 1);
/*
* PMAP_PCID_KERN + 1 is used for initialization of