diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2007-06-20 17:29:37 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2007-06-20 17:29:37 +0000 |
commit | eb665c5ca5fbea0bffcae85a3186d4fa212e3950 (patch) | |
tree | 640d10bab9da04b14672894700fa4345b3ba5213 /sys | |
parent | 98769c6ed17b76aa17508f5c952d51e63c956c96 (diff) |
In vunmapbuf(), explicitely remove mappings before invoking uvm_km_free().
Even if the latter would end up removing the mappings by itself, it would
do so using pmap_remove() because phys_map is not intrsafe; but some
platforms use pmap_kenter_pa() in vmapbuf(). By removing the mappings
ourselves, we can ensure the remove function used matches the enter function
which has been used.
Discussed and theoretical ok art@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/hppa/hppa/vm_machdep.c | 4 | ||||
-rw-r--r-- | sys/arch/hppa64/hppa64/vm_machdep.c | 4 | ||||
-rw-r--r-- | sys/arch/m88k/m88k/vm_machdep.c | 4 | ||||
-rw-r--r-- | sys/arch/mips64/mips64/vm_machdep.c | 5 | ||||
-rw-r--r-- | sys/arch/mvme68k/mvme68k/vm_machdep.c | 4 | ||||
-rw-r--r-- | sys/arch/powerpc/powerpc/vm_machdep.c | 6 | ||||
-rw-r--r-- | sys/arch/sparc/sparc/vm_machdep.c | 4 | ||||
-rw-r--r-- | sys/arch/sparc64/sparc64/vm_machdep.c | 5 | ||||
-rw-r--r-- | sys/arch/vax/vax/vm_machdep.c | 4 |
9 files changed, 29 insertions, 11 deletions
diff --git a/sys/arch/hppa/hppa/vm_machdep.c b/sys/arch/hppa/hppa/vm_machdep.c index 8403226ceeb..a4b8e0f5d5a 100644 --- a/sys/arch/hppa/hppa/vm_machdep.c +++ b/sys/arch/hppa/hppa/vm_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vm_machdep.c,v 1.60 2007/06/05 17:15:21 miod Exp $ */ +/* $OpenBSD: vm_machdep.c,v 1.61 2007/06/20 17:29:34 miod Exp $ */ /* * Copyright (c) 1999-2004 Michael Shalayeff @@ -257,6 +257,8 @@ vunmapbuf(bp, len) addr = trunc_page((vaddr_t)bp->b_data); off = (vaddr_t)bp->b_data - addr; len = round_page(off + len); + pmap_kremove(addr, len); + pmap_update(pmap_kernel()); uvm_km_free_wakeup(phys_map, addr, len); bp->b_data = bp->b_saveaddr; bp->b_saveaddr = NULL; diff --git a/sys/arch/hppa64/hppa64/vm_machdep.c b/sys/arch/hppa64/hppa64/vm_machdep.c index 5529dc094eb..61368001fe0 100644 --- a/sys/arch/hppa64/hppa64/vm_machdep.c +++ b/sys/arch/hppa64/hppa64/vm_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vm_machdep.c,v 1.6 2007/06/05 17:15:22 miod Exp $ */ +/* $OpenBSD: vm_machdep.c,v 1.7 2007/06/20 17:29:35 miod Exp $ */ /* * Copyright (c) 2005 Michael Shalayeff @@ -251,6 +251,8 @@ vunmapbuf(bp, len) addr = trunc_page((vaddr_t)bp->b_data); off = (vaddr_t)bp->b_data - addr; len = round_page(off + len); + pmap_kremove(addr, len); + pmap_update(pmap_kernel()); uvm_km_free_wakeup(phys_map, addr, len); bp->b_data = bp->b_saveaddr; bp->b_saveaddr = NULL; diff --git a/sys/arch/m88k/m88k/vm_machdep.c b/sys/arch/m88k/m88k/vm_machdep.c index 55a683f81b5..f6283b85b56 100644 --- a/sys/arch/m88k/m88k/vm_machdep.c +++ b/sys/arch/m88k/m88k/vm_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vm_machdep.c,v 1.14 2007/05/27 20:59:25 miod Exp $ */ +/* $OpenBSD: vm_machdep.c,v 1.15 2007/06/20 17:29:36 miod Exp $ */ /* * Copyright (c) 1998 Steve Murphree, Jr. @@ -271,6 +271,8 @@ vunmapbuf(bp, len) addr = trunc_page((vaddr_t)bp->b_data); off = (vaddr_t)bp->b_data & PGOFSET; len = round_page(off + len); + pmap_remove(vm_map_pmap(phys_map), addr, addr + len); + pmap_update(vm_map_pmap(phys_map)); uvm_km_free_wakeup(phys_map, addr, len); bp->b_data = bp->b_saveaddr; bp->b_saveaddr = 0; diff --git a/sys/arch/mips64/mips64/vm_machdep.c b/sys/arch/mips64/mips64/vm_machdep.c index 5ec0a987262..b3e0f4c4977 100644 --- a/sys/arch/mips64/mips64/vm_machdep.c +++ b/sys/arch/mips64/mips64/vm_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vm_machdep.c,v 1.12 2007/05/27 20:59:25 miod Exp $ */ +/* $OpenBSD: vm_machdep.c,v 1.13 2007/06/20 17:29:36 miod Exp $ */ /* * Copyright (c) 1988 University of Utah. * Copyright (c) 1992, 1993 @@ -220,6 +220,7 @@ vmapbuf(bp, len) kva += PAGE_SIZE; sz -= PAGE_SIZE; } + pmap_update(vm_map_pmap(phys_map)); } /* @@ -239,6 +240,8 @@ vunmapbuf(bp, len) } addr = trunc_page((vaddr_t)bp->b_data); sz = round_page(len + ((vaddr_t)bp->b_data - addr)); + pmap_remove(vm_map_pmap(phys_map), addr, addr + sz); + pmap_update(vm_map_pmap(phys_map)); uvm_km_free_wakeup(phys_map, addr, sz); bp->b_data = bp->b_saveaddr; bp->b_saveaddr = NULL; diff --git a/sys/arch/mvme68k/mvme68k/vm_machdep.c b/sys/arch/mvme68k/mvme68k/vm_machdep.c index 88283ddd84b..e8ac2262a05 100644 --- a/sys/arch/mvme68k/mvme68k/vm_machdep.c +++ b/sys/arch/mvme68k/mvme68k/vm_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vm_machdep.c,v 1.44 2007/05/27 20:59:25 miod Exp $ */ +/* $OpenBSD: vm_machdep.c,v 1.45 2007/06/20 17:29:36 miod Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -269,6 +269,8 @@ vunmapbuf(bp, siz) addr = bp->b_data; npf = btoc(round_page(bp->b_bcount + ((int)addr & PGOFSET))); kva = (vaddr_t)((int)addr & ~PGOFSET); + pmap_remove(vm_map_pmap(phys_map), kva, kva + ctob(npf)); + pmap_update(vm_map_pmap(phys_map)); uvm_km_free_wakeup(phys_map, kva, ctob(npf)); bp->b_data = bp->b_saveaddr; bp->b_saveaddr = NULL; diff --git a/sys/arch/powerpc/powerpc/vm_machdep.c b/sys/arch/powerpc/powerpc/vm_machdep.c index 41f91463e8c..5a7d92622de 100644 --- a/sys/arch/powerpc/powerpc/vm_machdep.c +++ b/sys/arch/powerpc/powerpc/vm_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vm_machdep.c,v 1.43 2007/05/27 20:59:26 miod Exp $ */ +/* $OpenBSD: vm_machdep.c,v 1.44 2007/06/20 17:29:36 miod Exp $ */ /* $NetBSD: vm_machdep.c,v 1.1 1996/09/30 16:34:57 ws Exp $ */ /* @@ -223,7 +223,7 @@ vmapbuf(struct buf *bp, vsize_t len) faddr += NBPG; taddr += NBPG; } - pmap_update(pmap_kernel()); + pmap_update(vm_map_pmap(phys_map)); } /* @@ -241,6 +241,8 @@ vunmapbuf(struct buf *bp, vsize_t len) addr = trunc_page((vaddr_t)bp->b_data); off = (vaddr_t)bp->b_data - addr; len = round_page(off + len); + pmap_remove(vm_map_pmap(phys_map), addr, addr + len); + pmap_update(vm_map_pmap(phys_map)); uvm_km_free_wakeup(phys_map, addr, len); bp->b_data = bp->b_saveaddr; bp->b_saveaddr = 0; diff --git a/sys/arch/sparc/sparc/vm_machdep.c b/sys/arch/sparc/sparc/vm_machdep.c index a71f30adb97..73bbdfb1b45 100644 --- a/sys/arch/sparc/sparc/vm_machdep.c +++ b/sys/arch/sparc/sparc/vm_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vm_machdep.c,v 1.48 2007/05/27 20:59:26 miod Exp $ */ +/* $OpenBSD: vm_machdep.c,v 1.49 2007/06/20 17:29:36 miod Exp $ */ /* $NetBSD: vm_machdep.c,v 1.30 1997/03/10 23:55:40 pk Exp $ */ /* @@ -329,6 +329,8 @@ vunmapbuf(bp, sz) off = (vaddr_t)bp->b_data - kva; size = round_page(sz + off); + pmap_remove(pmap_kernel(), kva, kva + size); + pmap_update(pmap_kernel()); uvm_km_free_wakeup(kernel_map, kva, size); bp->b_data = bp->b_saveaddr; bp->b_saveaddr = NULL; diff --git a/sys/arch/sparc64/sparc64/vm_machdep.c b/sys/arch/sparc64/sparc64/vm_machdep.c index f60192b2be8..5d46c9eb715 100644 --- a/sys/arch/sparc64/sparc64/vm_machdep.c +++ b/sys/arch/sparc64/sparc64/vm_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vm_machdep.c,v 1.14 2007/05/27 20:59:26 miod Exp $ */ +/* $OpenBSD: vm_machdep.c,v 1.15 2007/06/20 17:29:36 miod Exp $ */ /* $NetBSD: vm_machdep.c,v 1.38 2001/06/30 00:02:20 eeh Exp $ */ /* @@ -142,7 +142,8 @@ vunmapbuf(bp, len) off = (vaddr_t)bp->b_data - kva; len = round_page(off + len); - /* This will call pmap_remove() for us. */ + pmap_remove(pmap_kernel(), kva, kva + len); + pmap_update(pmap_kernel()); uvm_km_free_wakeup(kernel_map, kva, len); bp->b_data = bp->b_saveaddr; bp->b_saveaddr = NULL; diff --git a/sys/arch/vax/vax/vm_machdep.c b/sys/arch/vax/vax/vm_machdep.c index 545f2ccbf76..7205101225d 100644 --- a/sys/arch/vax/vax/vm_machdep.c +++ b/sys/arch/vax/vax/vm_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vm_machdep.c,v 1.33 2007/05/27 20:59:26 miod Exp $ */ +/* $OpenBSD: vm_machdep.c,v 1.34 2007/06/20 17:29:36 miod Exp $ */ /* $NetBSD: vm_machdep.c,v 1.67 2000/06/29 07:14:34 mrg Exp $ */ /* @@ -319,6 +319,8 @@ vunmapbuf(bp, len) addr = trunc_page((vaddr_t)bp->b_data); off = (vaddr_t)bp->b_data - addr; len = round_page(off + len); + pmap_remove(vm_map_pmap(phys_map), addr, addr + len); + pmap_update(vm_map_pmap(phys_map)); uvm_km_free_wakeup(phys_map, addr, len); bp->b_data = bp->b_saveaddr; bp->b_saveaddr = NULL; |