remove unused share map code from UVM:
- simplify uvm_faultinfo in uvm_fault.h (parent map tracking no longer needed) - adjust locking and lookup functions in uvm_fault_i.h to reflect the above - replace ufi.rvaddr with ufi.orig_rvaddr in uvm_fault.c since rvaddr is no longer needed. - no need to worry about share map translations in uvm_fault(). simplify.
This commit is contained in:
parent
8ffef382dd
commit
1b59a238c4
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: uvm_fault.c,v 1.12 1998/08/13 02:11:00 eeh Exp $ */
|
||||
/* $NetBSD: uvm_fault.c,v 1.13 1998/10/11 23:07:42 chuck Exp $ */
|
||||
|
||||
/*
|
||||
* XXXCDC: "ROUGH DRAFT" QUALITY UVM PRE-RELEASE FILE!
|
||||
@ -257,8 +257,8 @@ uvmfault_amapcopy(ufi)
|
||||
*/
|
||||
|
||||
if (UVM_ET_ISNEEDSCOPY(ufi->entry))
|
||||
amap_copy(ufi->map, ufi->entry, M_NOWAIT, TRUE, ufi->rvaddr,
|
||||
ufi->rvaddr + 1);
|
||||
amap_copy(ufi->map, ufi->entry, M_NOWAIT, TRUE,
|
||||
ufi->orig_rvaddr, ufi->orig_rvaddr + 1);
|
||||
|
||||
/*
|
||||
* didn't work? must be out of RAM. unlock and sleep.
|
||||
@ -331,7 +331,7 @@ int uvmfault_anonget(ufi, amap, anon)
|
||||
*/
|
||||
|
||||
if (pg && pg->loan_count)
|
||||
pg = uvm_anon_lockloanpg(anon);
|
||||
pg = uvm_anon_lockloanpg(anon);
|
||||
|
||||
/*
|
||||
* page there? make sure it is not busy/released.
|
||||
@ -513,7 +513,7 @@ int uvmfault_anonget(ufi, amap, anon)
|
||||
*/
|
||||
|
||||
if (amap_lookup(&ufi->entry->aref,
|
||||
ufi->rvaddr - ufi->entry->start) != anon) {
|
||||
ufi->orig_rvaddr - ufi->entry->start) != anon) {
|
||||
|
||||
uvmfault_unlockall(ufi, amap, NULL, anon);
|
||||
UVMHIST_LOG(maphist, "<- REFAULT", 0,0,0,0);
|
||||
@ -558,7 +558,7 @@ uvm_fault(orig_map, vaddr, fault_type, access_type)
|
||||
vm_prot_t enter_prot;
|
||||
boolean_t wired, narrow, promote, locked, shadowed;
|
||||
int npages, nback, nforw, centeridx, result, lcv, gotpages;
|
||||
vaddr_t orig_startva, startva, objaddr, currva, offset;
|
||||
vaddr_t startva, objaddr, currva, offset;
|
||||
paddr_t pa;
|
||||
struct vm_amap *amap;
|
||||
struct uvm_object *uobj;
|
||||
@ -687,11 +687,10 @@ ReFault:
|
||||
panic("fault: advice mismatch!");
|
||||
#endif
|
||||
nback = min(uvmadvice[ufi.entry->advice].nback,
|
||||
(ufi.rvaddr - ufi.entry->start) / PAGE_SIZE);
|
||||
startva = ufi.rvaddr - (nback * PAGE_SIZE);
|
||||
orig_startva = ufi.orig_rvaddr - (nback * PAGE_SIZE);
|
||||
(ufi.orig_rvaddr - ufi.entry->start) / PAGE_SIZE);
|
||||
startva = ufi.orig_rvaddr - (nback * PAGE_SIZE);
|
||||
nforw = min(uvmadvice[ufi.entry->advice].nforw,
|
||||
((ufi.entry->end - ufi.rvaddr) / PAGE_SIZE) - 1);
|
||||
((ufi.entry->end - ufi.orig_rvaddr) / PAGE_SIZE) - 1);
|
||||
/*
|
||||
* note: "-1" because we don't want to count the
|
||||
* faulting page as forw
|
||||
@ -705,16 +704,15 @@ ReFault:
|
||||
|
||||
/* narrow fault! */
|
||||
nback = nforw = 0;
|
||||
startva = ufi.rvaddr;
|
||||
orig_startva = ufi.orig_rvaddr;
|
||||
startva = ufi.orig_rvaddr;
|
||||
npages = 1;
|
||||
centeridx = 0;
|
||||
|
||||
}
|
||||
|
||||
/* locked: maps(read) */
|
||||
UVMHIST_LOG(maphist, " narrow=%d, back=%d, forw=%d, orig_startva=0x%x",
|
||||
narrow, nback, nforw, orig_startva);
|
||||
UVMHIST_LOG(maphist, " narrow=%d, back=%d, forw=%d, startva=0x%x",
|
||||
narrow, nback, nforw, startva);
|
||||
UVMHIST_LOG(maphist, " entry=0x%x, amap=0x%x, obj=0x%x", ufi.entry,
|
||||
amap, uobj, 0);
|
||||
|
||||
@ -760,7 +758,6 @@ ReFault:
|
||||
if (amap)
|
||||
anons += nback;
|
||||
startva = startva + (nback * PAGE_SIZE);
|
||||
orig_startva = orig_startva + (nback * PAGE_SIZE);
|
||||
npages -= nback;
|
||||
nback = centeridx = 0;
|
||||
}
|
||||
@ -773,13 +770,13 @@ ReFault:
|
||||
* we go.
|
||||
*/
|
||||
|
||||
currva = orig_startva;
|
||||
currva = startva;
|
||||
shadowed = FALSE;
|
||||
for (lcv = 0 ; lcv < npages ; lcv++, currva += PAGE_SIZE) {
|
||||
|
||||
/*
|
||||
* dont play with VAs that are already mapped
|
||||
* *except for center)
|
||||
* except for center)
|
||||
* XXX: return value of pmap_extract disallows PA 0
|
||||
*/
|
||||
if (lcv != centeridx) {
|
||||
@ -844,9 +841,6 @@ ReFault:
|
||||
* prefer to handle the fault itself (rather than letting us do it
|
||||
* with the usual pgo_get hook). the backing object signals this by
|
||||
* providing a pgo_fault routine.
|
||||
*
|
||||
* note: pgo_fault can obtain the correct VA for pmap_enter by using:
|
||||
* real_va = [ ufi->orig_rvaddr + (startva - ufi->rvaddr)]
|
||||
*/
|
||||
|
||||
if (uobj && shadowed == FALSE && uobj->pgops->pgo_fault != NULL) {
|
||||
@ -901,7 +895,7 @@ ReFault:
|
||||
uobjpage = NULL;
|
||||
|
||||
if (gotpages) {
|
||||
currva = orig_startva;
|
||||
currva = startva;
|
||||
for (lcv = 0 ; lcv < npages ;
|
||||
lcv++, currva += PAGE_SIZE) {
|
||||
|
||||
@ -1169,7 +1163,7 @@ ReFault:
|
||||
uvm_pagecopy(oanon->u.an_page, pg); /* pg now !PG_CLEAN */
|
||||
pg->flags &= ~(PG_BUSY|PG_FAKE); /* un-busy! new page */
|
||||
UVM_PAGE_OWN(pg, NULL);
|
||||
amap_add(&ufi.entry->aref, ufi.rvaddr - ufi.entry->start,
|
||||
amap_add(&ufi.entry->aref, ufi.orig_rvaddr - ufi.entry->start,
|
||||
anon, 1);
|
||||
|
||||
/* deref: can not drop to zero here by defn! */
|
||||
@ -1280,7 +1274,7 @@ Case2:
|
||||
uvmexp.fltget++;
|
||||
gotpages = 1;
|
||||
result = uobj->pgops->pgo_get(uobj,
|
||||
(ufi.rvaddr - ufi.entry->start) + ufi.entry->offset,
|
||||
(ufi.orig_rvaddr - ufi.entry->start) + ufi.entry->offset,
|
||||
&uobjpage, &gotpages, 0,
|
||||
UVM_ET_ISCOPYONWRITE(ufi.entry) ?
|
||||
VM_PROT_READ : access_type,
|
||||
@ -1334,7 +1328,7 @@ Case2:
|
||||
if ((uobjpage->flags & PG_RELEASED) != 0 ||
|
||||
(locked && amap &&
|
||||
amap_lookup(&ufi.entry->aref,
|
||||
ufi.rvaddr - ufi.entry->start))) {
|
||||
ufi.orig_rvaddr - ufi.entry->start))) {
|
||||
if (locked)
|
||||
uvmfault_unlockall(&ufi, amap, NULL, NULL);
|
||||
locked = FALSE;
|
||||
@ -1603,7 +1597,7 @@ Case2:
|
||||
anon, pg, 0, 0);
|
||||
}
|
||||
|
||||
amap_add(&ufi.entry->aref, ufi.rvaddr - ufi.entry->start,
|
||||
amap_add(&ufi.entry->aref, ufi.orig_rvaddr - ufi.entry->start,
|
||||
anon, 0);
|
||||
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: uvm_fault.h,v 1.6 1998/08/13 02:11:00 eeh Exp $ */
|
||||
/* $NetBSD: uvm_fault.h,v 1.7 1998/10/11 23:07:42 chuck Exp $ */
|
||||
|
||||
/*
|
||||
* XXXCDC: "ROUGH DRAFT" QUALITY UVM PRE-RELEASE FILE!
|
||||
@ -60,15 +60,12 @@
|
||||
|
||||
|
||||
struct uvm_faultinfo {
|
||||
vm_map_t orig_map; /* original map (IN) */
|
||||
vaddr_t orig_rvaddr; /* original rounded VA (IN) */
|
||||
vsize_t orig_size; /* original size of interest (IN) */
|
||||
vaddr_t rvaddr; /* rounded virtual address */
|
||||
vm_map_t parent_map; /* parent map */
|
||||
unsigned int parentv; /* parent map version number */
|
||||
vm_map_t map; /* map */
|
||||
unsigned int mapv; /* map version number */
|
||||
vm_map_entry_t entry; /* map entry of rvaddr */
|
||||
vm_map_t orig_map; /* IN: original map */
|
||||
vaddr_t orig_rvaddr; /* IN: original rounded VA */
|
||||
vsize_t orig_size; /* IN: original size of interest */
|
||||
vm_map_t map; /* map (could be a submap) */
|
||||
unsigned int mapv; /* map's version number */
|
||||
vm_map_entry_t entry; /* map entry (from 'map') */
|
||||
vsize_t size; /* size of interest */
|
||||
};
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: uvm_fault_i.h,v 1.5 1998/03/09 00:58:56 mrg Exp $ */
|
||||
/* $NetBSD: uvm_fault_i.h,v 1.6 1998/10/11 23:07:42 chuck Exp $ */
|
||||
|
||||
/*
|
||||
* XXXCDC: "ROUGH DRAFT" QUALITY UVM PRE-RELEASE FILE!
|
||||
@ -57,10 +57,8 @@ uvmfault_unlockmaps(ufi, write_locked)
|
||||
|
||||
if (write_locked) {
|
||||
vm_map_unlock(ufi->map);
|
||||
if (ufi->parent_map) vm_map_unlock(ufi->parent_map);
|
||||
} else {
|
||||
vm_map_unlock_read(ufi->map);
|
||||
if (ufi->parent_map) vm_map_unlock_read(ufi->parent_map);
|
||||
}
|
||||
}
|
||||
|
||||
@ -90,24 +88,16 @@ uvmfault_unlockall(ufi, amap, uobj, anon)
|
||||
/*
|
||||
* uvmfault_lookup: lookup a virtual address in a map
|
||||
*
|
||||
* => caller must provide a uvm_faultinfo structure with the (IN)
|
||||
* => caller must provide a uvm_faultinfo structure with the IN
|
||||
* params properly filled in
|
||||
* => we will lookup the map entry and fill in parent_map, etc, as we go
|
||||
* => we will lookup the map entry (handling submaps) as we go
|
||||
* => if the lookup is a success we will return with the maps locked
|
||||
* => if "write_lock" is TRUE, we write_lock the map, otherwise we only
|
||||
* get a read lock.
|
||||
* => currently we require sharemaps to have the same virtual addresses
|
||||
* as the main maps they are attached to. in other words, the share
|
||||
* map starts at zero and goes to the map user address. the main
|
||||
* map references it by setting its offset to be the same as the
|
||||
* starting virtual address. if we ever wanted to have sharemaps
|
||||
* have different virtual addresses than main maps we would calculate
|
||||
* it like:
|
||||
* share_va = (rvaddr - entry->start) + entry->offset
|
||||
* [i.e. offset from start of map entry plus offset of mapping]
|
||||
* since (entry->start == entry->offset), share_va must equal rvaddr.
|
||||
* if we need to change this we should store share_va in rvaddr
|
||||
* and move rvaddr to orig_rvaddr.
|
||||
* => note that submaps can only appear in the kernel and they are
|
||||
* required to use the same virtual addresses as the map they
|
||||
* are referenced by (thus address translation between the main
|
||||
* map and the submap is unnecessary).
|
||||
*/
|
||||
|
||||
static __inline boolean_t
|
||||
@ -122,8 +112,6 @@ uvmfault_lookup(ufi, write_lock)
|
||||
*/
|
||||
|
||||
ufi->map = ufi->orig_map;
|
||||
ufi->rvaddr = ufi->orig_rvaddr;
|
||||
ufi->parent_map = NULL;
|
||||
ufi->size = ufi->orig_size;
|
||||
|
||||
/*
|
||||
@ -145,7 +133,8 @@ uvmfault_lookup(ufi, write_lock)
|
||||
/*
|
||||
* lookup
|
||||
*/
|
||||
if (!uvm_map_lookup_entry(ufi->map, ufi->rvaddr, &ufi->entry)) {
|
||||
if (!uvm_map_lookup_entry(ufi->map, ufi->orig_rvaddr,
|
||||
&ufi->entry)) {
|
||||
uvmfault_unlockmaps(ufi, write_lock);
|
||||
return(FALSE);
|
||||
}
|
||||
@ -153,17 +142,14 @@ uvmfault_lookup(ufi, write_lock)
|
||||
/*
|
||||
* reduce size if necessary
|
||||
*/
|
||||
if (ufi->entry->end - ufi->rvaddr < ufi->size)
|
||||
ufi->size = ufi->entry->end - ufi->rvaddr;
|
||||
if (ufi->entry->end - ufi->orig_rvaddr < ufi->size)
|
||||
ufi->size = ufi->entry->end - ufi->orig_rvaddr;
|
||||
|
||||
/*
|
||||
* submap? replace map with the submap and lookup again.
|
||||
* note: VAs in submaps must match VAs in main map.
|
||||
*/
|
||||
if (UVM_ET_ISSUBMAP(ufi->entry)) {
|
||||
if (ufi->parent_map)
|
||||
panic("uvmfault_lookup: submap inside a "
|
||||
"sharemap (illegal)");
|
||||
tmpmap = ufi->entry->object.sub_map;
|
||||
if (write_lock) {
|
||||
vm_map_unlock(ufi->map);
|
||||
@ -174,26 +160,6 @@ uvmfault_lookup(ufi, write_lock)
|
||||
continue;
|
||||
}
|
||||
|
||||
/*
|
||||
* share map? drop down a level. already taken care of
|
||||
* submap case.
|
||||
*/
|
||||
if (UVM_ET_ISMAP(ufi->entry)) {
|
||||
if (ufi->parent_map)
|
||||
panic("uvmfault_lookup: sharemap inside a "
|
||||
"sharemap (illegal)");
|
||||
ufi->parent_map = ufi->map;
|
||||
ufi->parentv = ufi->parent_map->timestamp;
|
||||
ufi->map = ufi->entry->object.share_map;
|
||||
#ifdef DIAGNOSTIC
|
||||
/* see note above */
|
||||
if (ufi->entry->offset != ufi->entry->start)
|
||||
panic("uvmfault_lookup: sharemap VA != "
|
||||
"mainmap VA (not supported)");
|
||||
#endif
|
||||
continue;
|
||||
}
|
||||
|
||||
/*
|
||||
* got it!
|
||||
*/
|
||||
@ -220,22 +186,12 @@ uvmfault_relock(ufi)
|
||||
|
||||
uvmexp.fltrelck++;
|
||||
/*
|
||||
* simply relock parent (if any) then map in order. fail if version
|
||||
* mismatch (in which case nothing gets locked).
|
||||
* relock map. fail if version mismatch (in which case nothing
|
||||
* gets locked).
|
||||
*/
|
||||
|
||||
if (ufi->parent_map) {
|
||||
vm_map_lock_read(ufi->parent_map);
|
||||
if (ufi->parentv != ufi->parent_map->timestamp) {
|
||||
vm_map_unlock_read(ufi->parent_map);
|
||||
return(FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
vm_map_lock_read(ufi->map);
|
||||
if (ufi->mapv != ufi->map->timestamp) {
|
||||
if (ufi->parent_map)
|
||||
vm_map_unlock_read(ufi->parent_map);
|
||||
vm_map_unlock_read(ufi->map);
|
||||
return(FALSE);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user