summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2018-01-31 23:23:17 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2018-01-31 23:23:17 +0000
commite00e66627360df8ab26ef8da349888c3826f34fa (patch)
tree5cbcdb6825fb5c444ad6921356db3691e7ab6920 /sys
parent8d28816b6fe65cb4e609cf6cc60278da501a3dde (diff)
Make sure each CPU uses its own set of VAs for pmap_zero_page() and
pmap_copy_page(). ok patrick@
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/arm64/arm64/machdep.c8
-rw-r--r--sys/arch/arm64/arm64/pmap.c32
2 files changed, 18 insertions, 22 deletions
diff --git a/sys/arch/arm64/arm64/machdep.c b/sys/arch/arm64/arm64/machdep.c
index 963512418ea..4fbb11c3419 100644
--- a/sys/arch/arm64/arm64/machdep.c
+++ b/sys/arch/arm64/arm64/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.27 2018/01/28 13:17:45 kettenis Exp $ */
+/* $OpenBSD: machdep.c,v 1.28 2018/01/31 23:23:16 kettenis Exp $ */
/*
* Copyright (c) 2014 Patrick Wildt <patrick@blueri.se>
*
@@ -842,11 +842,11 @@ initarm(struct arm64_bootparams *abp)
vstart += round_page(MSGBUFSIZE);
zero_page = vstart;
- vstart += PAGE_SIZE;
+ vstart += MAXCPUS * PAGE_SIZE;
copy_src_page = vstart;
- vstart += PAGE_SIZE;
+ vstart += MAXCPUS * PAGE_SIZE;
copy_dst_page = vstart;
- vstart += PAGE_SIZE;
+ vstart += MAXCPUS * PAGE_SIZE;
/* Relocate the FDT to safe memory. */
if (fdt_get_size(config) != 0) {
diff --git a/sys/arch/arm64/arm64/pmap.c b/sys/arch/arm64/arm64/pmap.c
index 56ffaf34b1f..97223f6b025 100644
--- a/sys/arch/arm64/arm64/pmap.c
+++ b/sys/arch/arm64/arm64/pmap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pmap.c,v 1.46 2018/01/17 10:22:25 kettenis Exp $ */
+/* $OpenBSD: pmap.c,v 1.47 2018/01/31 23:23:16 kettenis Exp $ */
/*
* Copyright (c) 2008-2009,2014-2016 Dale Rahn <drahn@dalerahn.com>
*
@@ -770,38 +770,34 @@ pmap_collect(pmap_t pm)
/*
* Fill the given physical page with zeros.
- * SMP: need multiple zero pages, one for each cpu.
- * XXX
*/
void
pmap_zero_page(struct vm_page *pg)
{
paddr_t pa = VM_PAGE_TO_PHYS(pg);
+ vaddr_t va = zero_page + cpu_number() * PAGE_SIZE;
- pmap_kenter_pa(zero_page, pa, PROT_READ|PROT_WRITE);
-
- pagezero_cache(zero_page);
-
- pmap_kremove_pg(zero_page);
+ pmap_kenter_pa(va, pa, PROT_READ|PROT_WRITE);
+ pagezero_cache(va);
+ pmap_kremove_pg(va);
}
/*
- * copy the given physical page with zeros.
- * SMP: need multiple copy va, one set for each cpu.
+ * Copy the given physical page.
*/
void
pmap_copy_page(struct vm_page *srcpg, struct vm_page *dstpg)
{
paddr_t srcpa = VM_PAGE_TO_PHYS(srcpg);
paddr_t dstpa = VM_PAGE_TO_PHYS(dstpg);
-
- pmap_kenter_pa(copy_src_page, srcpa, PROT_READ);
- pmap_kenter_pa(copy_dst_page, dstpa, PROT_READ|PROT_WRITE);
-
- bcopy((void *)copy_src_page, (void *)copy_dst_page, PAGE_SIZE);
-
- pmap_kremove_pg(copy_src_page);
- pmap_kremove_pg(copy_dst_page);
+ vaddr_t srcva = copy_src_page + cpu_number() * PAGE_SIZE;
+ vaddr_t dstva = copy_dst_page + cpu_number() * PAGE_SIZE;
+
+ pmap_kenter_pa(srcva, srcpa, PROT_READ);
+ pmap_kenter_pa(dstva, dstpa, PROT_READ|PROT_WRITE);
+ memcpy((void *)dstva, (void *)srcva, PAGE_SIZE);
+ pmap_kremove_pg(srcva);
+ pmap_kremove_pg(dstva);
}
void