version 1.163, 2010/02/05 02:27:15 |
version 1.164, 2010/02/07 23:25:07 |
Line 848 uvm_fault_check( |
|
Line 848 uvm_fault_check( |
|
struct uvm_object *uobj; |
struct uvm_object *uobj; |
vm_prot_t check_prot; |
vm_prot_t check_prot; |
int nback, nforw; |
int nback, nforw; |
|
UVMHIST_FUNC("uvm_fault_check"); UVMHIST_CALLED(maphist); |
|
|
/* |
/* |
* lookup and lock the maps |
* lookup and lock the maps |
*/ |
*/ |
|
|
if (uvmfault_lookup(ufi, false) == false) { |
if (uvmfault_lookup(ufi, false) == false) { |
UVMHIST_LOG(maphist, "<- no mapping @ 0x%x", vaddr, 0,0,0); |
UVMHIST_LOG(maphist, "<- no mapping @ 0x%x", ufi->orig_rvaddr, 0,0,0); |
return EFAULT; |
return EFAULT; |
} |
} |
/* locked: maps(read) */ |
/* locked: maps(read) */ |
Line 1059 uvm_fault_upper_lookup( |
|
Line 1060 uvm_fault_upper_lookup( |
|
int lcv; |
int lcv; |
vaddr_t currva; |
vaddr_t currva; |
bool shadowed; |
bool shadowed; |
|
UVMHIST_FUNC("uvm_fault_upper_lookup"); UVMHIST_CALLED(maphist); |
|
|
/* locked: maps(read), amap(if there) */ |
/* locked: maps(read), amap(if there) */ |
KASSERT(amap == NULL || mutex_owned(&amap->am_l)); |
KASSERT(amap == NULL || mutex_owned(&amap->am_l)); |
Line 1111 uvm_fault_upper_lookup( |
|
Line 1113 uvm_fault_upper_lookup( |
|
KASSERT(amap == NULL || mutex_owned(&amap->am_l)); |
KASSERT(amap == NULL || mutex_owned(&amap->am_l)); |
/* (shadowed == true) if there is an anon at the faulting address */ |
/* (shadowed == true) if there is an anon at the faulting address */ |
UVMHIST_LOG(maphist, " shadowed=%d, will_get=%d", shadowed, |
UVMHIST_LOG(maphist, " shadowed=%d, will_get=%d", shadowed, |
(uobj && shadowed != false),0,0); |
(ufi->entry->object.uvm_obj && shadowed != false),0,0); |
|
|
/* |
/* |
* note that if we are really short of RAM we could sleep in the above |
* note that if we are really short of RAM we could sleep in the above |
Line 1129 uvm_fault_upper_neighbor( |
|
Line 1131 uvm_fault_upper_neighbor( |
|
struct uvm_faultinfo *ufi, struct uvm_faultctx *flt, |
struct uvm_faultinfo *ufi, struct uvm_faultctx *flt, |
vaddr_t currva, struct vm_page *pg, bool readonly) |
vaddr_t currva, struct vm_page *pg, bool readonly) |
{ |
{ |
|
UVMHIST_FUNC("uvm_fault_upper_neighbor"); UVMHIST_CALLED(maphist); |
|
|
/* ignore loaned and busy pages */ |
/* ignore loaned and busy pages */ |
if (pg == NULL || pg->loan_count != 0 || |
if (pg == NULL || pg->loan_count != 0 || |
Line 1269 uvm_fault_lower_lookup( |
|
Line 1272 uvm_fault_lower_lookup( |
|
struct uvm_object *uobj = ufi->entry->object.uvm_obj; |
struct uvm_object *uobj = ufi->entry->object.uvm_obj; |
int lcv, gotpages; |
int lcv, gotpages; |
vaddr_t currva; |
vaddr_t currva; |
|
UVMHIST_FUNC("uvm_fault_lower_lookup"); UVMHIST_CALLED(maphist); |
|
|
mutex_enter(&uobj->vmobjlock); |
mutex_enter(&uobj->vmobjlock); |
/* locked (!shadowed): maps(read), amap (if there), uobj */ |
/* locked (!shadowed): maps(read), amap (if there), uobj */ |
Line 1330 uvm_fault_lower_neighbor( |
|
Line 1334 uvm_fault_lower_neighbor( |
|
struct uvm_faultinfo *ufi, struct uvm_faultctx *flt, |
struct uvm_faultinfo *ufi, struct uvm_faultctx *flt, |
vaddr_t currva, struct vm_page *pg, bool readonly) |
vaddr_t currva, struct vm_page *pg, bool readonly) |
{ |
{ |
|
UVMHIST_FUNC("uvm_fault_lower_neighor"); UVMHIST_CALLED(maphist); |
|
|
/* |
/* |
* calling pgo_get with PGO_LOCKED returns us pages which |
* calling pgo_get with PGO_LOCKED returns us pages which |
Line 1381 uvm_fault_upper( |
|
Line 1386 uvm_fault_upper( |
|
struct vm_anon * const anon = anons[flt->centeridx]; |
struct vm_anon * const anon = anons[flt->centeridx]; |
struct uvm_object *uobj; |
struct uvm_object *uobj; |
int error; |
int error; |
|
UVMHIST_FUNC("uvm_fault_upper"); UVMHIST_CALLED(maphist); |
|
|
/* locked: maps(read), amap */ |
/* locked: maps(read), amap */ |
KASSERT(mutex_owned(&amap->am_l)); |
KASSERT(mutex_owned(&amap->am_l)); |
Line 1523 uvm_fault_upper_promote( |
|
Line 1529 uvm_fault_upper_promote( |
|
struct vm_anon * const oanon = anon; |
struct vm_anon * const oanon = anon; |
struct vm_page *pg; |
struct vm_page *pg; |
int error; |
int error; |
|
UVMHIST_FUNC("uvm_fault_upper_promote"); UVMHIST_CALLED(maphist); |
|
|
UVMHIST_LOG(maphist, " case 1B: COW fault",0,0,0,0); |
UVMHIST_LOG(maphist, " case 1B: COW fault",0,0,0,0); |
uvmexp.flt_acow++; |
uvmexp.flt_acow++; |
Line 1580 uvm_fault_upper_enter( |
|
Line 1587 uvm_fault_upper_enter( |
|
struct vm_anon *oanon) |
struct vm_anon *oanon) |
{ |
{ |
struct vm_amap * const amap = ufi->entry->aref.ar_amap; |
struct vm_amap * const amap = ufi->entry->aref.ar_amap; |
|
UVMHIST_FUNC("uvm_fault_upper_enter"); UVMHIST_CALLED(maphist); |
|
|
/* locked: maps(read), amap, oanon, anon (if different from oanon) */ |
/* locked: maps(read), amap, oanon, anon (if different from oanon) */ |
KASSERT(mutex_owned(&amap->am_l)); |
KASSERT(mutex_owned(&amap->am_l)); |
Line 1672 uvm_fault_lower1( |
|
Line 1680 uvm_fault_lower1( |
|
#endif |
#endif |
bool promote; |
bool promote; |
int error; |
int error; |
|
UVMHIST_FUNC("uvm_fault_lower1"); UVMHIST_CALLED(maphist); |
|
|
/* |
/* |
* handle case 2: faulting on backing object or zero fill |
* handle case 2: faulting on backing object or zero fill |
Line 1760 uvm_fault_lower_io( |
|
Line 1769 uvm_fault_lower_io( |
|
int gotpages; |
int gotpages; |
int error; |
int error; |
voff_t uoff; |
voff_t uoff; |
|
UVMHIST_FUNC("uvm_fault_lower_io"); UVMHIST_CALLED(maphist); |
|
|
/* update rusage counters */ |
/* update rusage counters */ |
curlwp->l_ru.ru_majflt++; |
curlwp->l_ru.ru_majflt++; |
Line 1775 uvm_fault_lower_io( |
|
Line 1785 uvm_fault_lower_io( |
|
0, flt->access_type & MASK(ufi->entry), ufi->entry->advice, |
0, flt->access_type & MASK(ufi->entry), ufi->entry->advice, |
PGO_SYNCIO); |
PGO_SYNCIO); |
/* locked: pg(if no error) */ |
/* locked: pg(if no error) */ |
|
#if 0 |
KASSERT(error != 0 || (pg->flags & PG_BUSY) != 0); |
KASSERT(error != 0 || (pg->flags & PG_BUSY) != 0); |
|
#else |
|
if (error == 0) |
|
KASSERT((pg->flags & PG_BUSY) != 0); |
|
#endif |
|
|
/* |
/* |
* recover from I/O |
* recover from I/O |
Line 1920 uvm_fault_lower_direct_loan( |
|
Line 1935 uvm_fault_lower_direct_loan( |
|
struct vm_amap * const amap = ufi->entry->aref.ar_amap; |
struct vm_amap * const amap = ufi->entry->aref.ar_amap; |
struct vm_page *pg; |
struct vm_page *pg; |
struct vm_page *uobjpage = *ruobjpage; |
struct vm_page *uobjpage = *ruobjpage; |
|
UVMHIST_FUNC("uvm_fault_lower_direct_loan"); UVMHIST_CALLED(maphist); |
|
|
if (!flt->cow_now) { |
if (!flt->cow_now) { |
/* read fault: cap the protection at readonly */ |
/* read fault: cap the protection at readonly */ |
Line 1963 uvm_fault_lower_promote( |
|
Line 1979 uvm_fault_lower_promote( |
|
struct vm_anon *anon; |
struct vm_anon *anon; |
struct vm_page *pg; |
struct vm_page *pg; |
int error; |
int error; |
|
UVMHIST_FUNC("uvm_fault_lower_promote"); UVMHIST_CALLED(maphist); |
|
|
/* |
/* |
* if we are going to promote the data to an anon we |
* if we are going to promote the data to an anon we |
Line 2045 uvm_fault_lower_enter( |
|
Line 2062 uvm_fault_lower_enter( |
|
{ |
{ |
struct vm_amap * const amap = ufi->entry->aref.ar_amap; |
struct vm_amap * const amap = ufi->entry->aref.ar_amap; |
int error; |
int error; |
|
UVMHIST_FUNC("uvm_fault_lower_enter"); UVMHIST_CALLED(maphist); |
|
|
/* |
/* |
* locked: |
* locked: |
Line 2065 uvm_fault_lower_enter( |
|
Line 2083 uvm_fault_lower_enter( |
|
*/ |
*/ |
|
|
UVMHIST_LOG(maphist, |
UVMHIST_LOG(maphist, |
" MAPPING: case2: pm=0x%x, va=0x%x, pg=0x%x, promote=%d", |
" MAPPING: case2: pm=0x%x, va=0x%x, pg=0x%x, promote=XXX", |
ufi->orig_map->pmap, ufi->orig_rvaddr, pg, promote); |
ufi->orig_map->pmap, ufi->orig_rvaddr, pg, 0); |
KASSERT((flt->access_type & VM_PROT_WRITE) == 0 || |
KASSERT((flt->access_type & VM_PROT_WRITE) == 0 || |
(pg->flags & PG_RDONLY) == 0); |
(pg->flags & PG_RDONLY) == 0); |
if (pmap_enter(ufi->orig_map->pmap, ufi->orig_rvaddr, VM_PAGE_TO_PHYS(pg), |
if (pmap_enter(ufi->orig_map->pmap, ufi->orig_rvaddr, VM_PAGE_TO_PHYS(pg), |
Line 2114 uvm_fault_lower_done( |
|
Line 2132 uvm_fault_lower_done( |
|
struct uvm_object *uobj, struct vm_anon *anon, struct vm_page *pg) |
struct uvm_object *uobj, struct vm_anon *anon, struct vm_page *pg) |
{ |
{ |
struct vm_amap * const amap = ufi->entry->aref.ar_amap; |
struct vm_amap * const amap = ufi->entry->aref.ar_amap; |
|
UVMHIST_FUNC("uvm_fault_lower_done"); UVMHIST_CALLED(maphist); |
|
|
mutex_enter(&uvm_pageqlock); |
mutex_enter(&uvm_pageqlock); |
if (flt->wire_paging) { |
if (flt->wire_paging) { |