Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/arm/arm32 Update the pmap following some comments f...
details: https://anonhg.NetBSD.org/src/rev/bbf14cdb1bbc
branches: trunk
changeset: 514816:bbf14cdb1bbc
user: chris <chris%NetBSD.org@localhost>
date: Mon Sep 10 23:40:02 2001 +0000
description:
Update the pmap following some comments from Chuck Silvers:
Remove some overzealous locking of HEAD_TO_MAP
Remove a potential deadlock in pmap_copy_page
Change alloc and free l1pt to use kenter/kremove.
Update pmap_map to use kenter (only actually used by dumpsys, so no matching kremove)
diffstat:
sys/arch/arm/arm32/pmap.c | 37 +++++++++++++++----------------------
1 files changed, 15 insertions(+), 22 deletions(-)
diffs (102 lines):
diff -r ce7772742724 -r bbf14cdb1bbc sys/arch/arm/arm32/pmap.c
--- a/sys/arch/arm/arm32/pmap.c Mon Sep 10 23:32:29 2001 +0000
+++ b/sys/arch/arm/arm32/pmap.c Mon Sep 10 23:40:02 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.19 2001/09/10 21:19:35 chris Exp $ */
+/* $NetBSD: pmap.c,v 1.20 2001/09/10 23:40:02 chris Exp $ */
/*
* Copyright (c) 2001 Richard Earnshaw
@@ -142,7 +142,7 @@
#include <machine/param.h>
#include <machine/katelib.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.19 2001/09/10 21:19:35 chris Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.20 2001/09/10 23:40:02 chris Exp $");
#ifdef PMAP_DEBUG
#define PDEBUG(_lev_,_stat_) \
if (pmap_debug_level >= (_lev_)) \
@@ -984,7 +984,7 @@
int prot;
{
while (spa < epa) {
- pmap_enter(pmap_kernel(), va, spa, prot, 0);
+ pmap_kenter_pa(va, spa, prot);
va += NBPG;
spa += NBPG;
}
@@ -1378,8 +1378,7 @@
while (m && va < (pt->pt_va + PD_SIZE)) {
pa = VM_PAGE_TO_PHYS(m);
- pmap_enter(pmap_kernel(), va, pa,
- VM_PROT_READ | VM_PROT_WRITE, PMAP_WIRED);
+ pmap_kenter_pa(va, pa, VM_PROT_READ | VM_PROT_WRITE);
/* Revoke cacheability and bufferability */
/* XXX should be done better than this */
@@ -1408,7 +1407,7 @@
struct l1pt *pt;
{
/* Separate the physical memory for the virtual space */
- pmap_remove(pmap_kernel(), pt->pt_va, pt->pt_va + PD_SIZE);
+ pmap_kremove(pt->pt_va, PD_SIZE);
pmap_update(pmap_kernel());
/* Return the physical memory */
@@ -1809,11 +1808,6 @@
int bank, off;
struct pv_head *pvh;
-#ifdef DIAGNOSTIC
- if (!pmap_initialized)
- panic("pmap_find_pv: !pmap_initialized");
-#endif
-
if ((bank = vm_physseg_find(atop(phys), &off)) == -1)
panic("pmap_find_pv: not a real page, phys=%lx\n", phys);
pvh = &vm_physmem[bank].pmseg.pvhead[off];
@@ -1835,12 +1829,10 @@
struct pv_head *pvh;
/* Get an entry for this page, and clean it it. */
- PMAP_HEAD_TO_MAP_LOCK();
pvh = pmap_find_pvh(phys);
simple_lock(&pvh->pvh_lock);
pmap_clean_page(pvh->pvh_list, FALSE);
simple_unlock(&pvh->pvh_lock);
- PMAP_HEAD_TO_MAP_UNLOCK();
/*
* Hook in the page, zero it, and purge the cache for that
@@ -1917,20 +1909,21 @@
paddr_t dest;
{
struct pv_head *src_pvh, *dest_pvh;
+ boolean_t cleanedcache;
- PMAP_HEAD_TO_MAP_LOCK();
/* Get PV entries for the pages, and clean them if needed. */
src_pvh = pmap_find_pvh(src);
+
simple_lock(&src_pvh->pvh_lock);
- dest_pvh = pmap_find_pvh(dest);
- simple_lock(&dest_pvh->pvh_lock);
- if (!pmap_clean_page(src_pvh->pvh_list, TRUE))
+ cleanedcache = pmap_clean_page(src_pvh->pvh_list, TRUE);
+ simple_unlock(&src_pvh->pvh_lock);
+
+ if (cleanedcache == 0) {
+ dest_pvh = pmap_find_pvh(dest);
+ simple_lock(&dest_pvh->pvh_lock);
pmap_clean_page(dest_pvh->pvh_list, FALSE);
-
- simple_unlock(&dest_pvh->pvh_lock);
- simple_unlock(&src_pvh->pvh_lock);
- PMAP_HEAD_TO_MAP_UNLOCK();
-
+ simple_unlock(&dest_pvh->pvh_lock);
+ }
/*
* Map the pages into the page hook points, copy them, and purge
* the cache for the appropriate page. Invalidate the TLB
Home |
Main Index |
Thread Index |
Old Index