Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/x86/x86 simplify
details: https://anonhg.NetBSD.org/src/rev/95859b844c90
branches: trunk
changeset: 358499:95859b844c90
user: maxv <maxv%NetBSD.org@localhost>
date: Wed Jan 03 09:38:23 2018 +0000
description:
simplify
diffstat:
sys/arch/x86/x86/pmap.c | 40 ++++++++++++++++++----------------------
1 files changed, 18 insertions(+), 22 deletions(-)
diffs (83 lines):
diff -r 75e6e7f4c221 -r 95859b844c90 sys/arch/x86/x86/pmap.c
--- a/sys/arch/x86/x86/pmap.c Tue Jan 02 18:54:26 2018 +0000
+++ b/sys/arch/x86/x86/pmap.c Wed Jan 03 09:38:23 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.271 2017/12/31 15:41:05 maxv Exp $ */
+/* $NetBSD: pmap.c,v 1.272 2018/01/03 09:38:23 maxv Exp $ */
/*
* Copyright (c) 2008, 2010, 2016, 2017 The NetBSD Foundation, Inc.
@@ -170,7 +170,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.271 2017/12/31 15:41:05 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.272 2018/01/03 09:38:23 maxv Exp $");
#include "opt_user_ldt.h"
#include "opt_lockdebug.h"
@@ -2002,31 +2002,26 @@
do {
index = pl_i(va, level + 1);
opde = pmap_pte_testset(&pdes[level - 1][index], 0);
-#if defined(XEN)
-# if defined(__x86_64__)
+
/*
- * If ptp is a L3 currently mapped in kernel space,
- * on any cpu, clear it before freeing
+ * On Xen-amd64, we need to sync the top level page
+ * directory on each CPU.
*/
+#if defined(XEN) && defined(__x86_64__)
if (level == PTP_LEVELS - 1) {
- /*
- * Update the per-cpu PD on all cpus the current
- * pmap is active on
- */
xen_kpm_sync(pmap, index);
}
-# endif /*__x86_64__ */
+#endif
+
invaladdr = level == 1 ? (vaddr_t)ptes :
(vaddr_t)pdes[level - 2];
pmap_tlb_shootdown(pmap, invaladdr + index * PAGE_SIZE,
opde, TLBSHOOT_FREE_PTP1);
+
+#if defined(XEN)
pmap_tlb_shootnow();
-#else /* XEN */
- invaladdr = level == 1 ? (vaddr_t)ptes :
- (vaddr_t)pdes[level - 2];
- pmap_tlb_shootdown(pmap, invaladdr + index * PAGE_SIZE,
- opde, TLBSHOOT_FREE_PTP1);
-#endif /* XEN */
+#endif
+
pmap_freepage(pmap, ptp, level);
if (level < PTP_LEVELS - 1) {
ptp = pmap_find_ptp(pmap, va, (paddr_t)-1, level + 1);
@@ -2108,16 +2103,17 @@
pa = VM_PAGE_TO_PHYS(ptp);
pmap_pte_set(&pva[index], (pd_entry_t)
(pmap_pa2pte(pa) | PG_u | PG_RW | PG_V));
+
+ /*
+ * On Xen-amd64, we need to sync the top level page
+ * directory on each CPU.
+ */
#if defined(XEN) && defined(__x86_64__)
if (i == PTP_LEVELS) {
-
- /*
- * Update the per-cpu PD on all cpus the current
- * pmap is active on
- */
xen_kpm_sync(pmap, index);
}
#endif
+
pmap_pte_flush();
pmap_stats_update(pmap, 1, 0);
Home |
Main Index |
Thread Index |
Old Index