Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/x86 add a pmap_kremove_local() that doesn't do TLB ...
details: https://anonhg.NetBSD.org/src/rev/5eaa95b70ae2
branches: trunk
changeset: 782667:5eaa95b70ae2
user: chs <chs%NetBSD.org@localhost>
date: Tue Nov 13 14:07:42 2012 +0000
description:
add a pmap_kremove_local() that doesn't do TLB invalidations
on other CPUs. this is only intended for use while writing
kernel crash dumps. remove unused pmap_map().
diffstat:
sys/arch/x86/include/pmap.h | 3 +-
sys/arch/x86/x86/pmap.c | 58 +++++++++++++++++++++++---------------------
2 files changed, 32 insertions(+), 29 deletions(-)
diffs (120 lines):
diff -r 971bc2e2618c -r 5eaa95b70ae2 sys/arch/x86/include/pmap.h
--- a/sys/arch/x86/include/pmap.h Tue Nov 13 11:03:50 2012 +0000
+++ b/sys/arch/x86/include/pmap.h Tue Nov 13 14:07:42 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.h,v 1.52 2012/04/20 22:23:24 rmind Exp $ */
+/* $NetBSD: pmap.h,v 1.53 2012/11/13 14:07:42 chs Exp $ */
/*
* Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -255,6 +255,7 @@
paddr_t pmap_init_tmp_pgtbl(paddr_t);
void pmap_remove_all(struct pmap *);
void pmap_ldt_sync(struct pmap *);
+void pmap_kremove_local(vaddr_t, vsize_t);
void pmap_emap_enter(vaddr_t, paddr_t, vm_prot_t);
void pmap_emap_remove(vaddr_t, vsize_t);
diff -r 971bc2e2618c -r 5eaa95b70ae2 sys/arch/x86/x86/pmap.c
--- a/sys/arch/x86/x86/pmap.c Tue Nov 13 11:03:50 2012 +0000
+++ b/sys/arch/x86/x86/pmap.c Tue Nov 13 14:07:42 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.178 2012/06/15 13:53:40 yamt Exp $ */
+/* $NetBSD: pmap.c,v 1.179 2012/11/13 14:07:42 chs Exp $ */
/*-
* Copyright (c) 2008, 2010 The NetBSD Foundation, Inc.
@@ -171,7 +171,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.178 2012/06/15 13:53:40 yamt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.179 2012/11/13 14:07:42 chs Exp $");
#include "opt_user_ldt.h"
#include "opt_lockdebug.h"
@@ -1118,8 +1118,8 @@
* => must be followed by call to pmap_update() before reuse of page
*/
-void
-pmap_kremove(vaddr_t sva, vsize_t len)
+static inline void
+pmap_kremove1(vaddr_t sva, vsize_t len, bool localonly)
{
pt_entry_t *pte, opte;
vaddr_t va, eva;
@@ -1128,21 +1128,42 @@
kpreempt_disable();
for (va = sva; va < eva; va += PAGE_SIZE) {
- if (va < VM_MIN_KERNEL_ADDRESS)
- pte = vtopte(va);
- else
- pte = kvtopte(va);
+ pte = kvtopte(va);
opte = pmap_pte_testset(pte, 0); /* zap! */
- if ((opte & (PG_V | PG_U)) == (PG_V | PG_U)) {
+ if ((opte & (PG_V | PG_U)) == (PG_V | PG_U) && !localonly) {
pmap_tlb_shootdown(pmap_kernel(), va, opte,
TLBSHOOT_KREMOVE);
}
KASSERT((opte & PG_PS) == 0);
KASSERT((opte & PG_PVLIST) == 0);
}
+ if (localonly) {
+ tlbflushg();
+ }
kpreempt_enable();
}
+void
+pmap_kremove(vaddr_t sva, vsize_t len)
+{
+
+ pmap_kremove1(sva, len, false);
+}
+
+/*
+ * pmap_kremove_local: like pmap_kremove(), but only worry about
+ * TLB invalidations on the current CPU. this is only intended
+ * for use while writing kernel crash dumps.
+ */
+
+void
+pmap_kremove_local(vaddr_t sva, vsize_t len)
+{
+
+ KASSERT(panicstr != NULL);
+ pmap_kremove1(sva, len, true);
+}
+
/*
* p m a p i n i t f u n c t i o n s
*
@@ -2984,25 +3005,6 @@
}
/*
- * pmap_map: map a range of PAs into kvm.
- *
- * => used during crash dump
- * => XXX: pmap_map() should be phased out?
- */
-
-vaddr_t
-pmap_map(vaddr_t va, paddr_t spa, paddr_t epa, vm_prot_t prot)
-{
- while (spa < epa) {
- pmap_kenter_pa(va, spa, prot, 0);
- va += PAGE_SIZE;
- spa += PAGE_SIZE;
- }
- pmap_update(pmap_kernel());
- return va;
-}
-
-/*
* pmap_zero_page: zero a page
*/
Home |
Main Index |
Thread Index |
Old Index