Date: Fri, 10 Mar 2006 08:59:27 GMT From: Kip Macy <kmacy@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 93102 for review Message-ID: <200603100859.k2A8xR6J085419@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=93102 Change 93102 by kmacy@kmacy_storage:sun4v_work on 2006/03/10 08:59:14 initialize lock for user pmap remove page references when doing unmap Affected files ... .. //depot/projects/kmacy_sun4v/src/sys/sun4v/sun4v/pmap.c#21 edit Differences ... ==== //depot/projects/kmacy_sun4v/src/sys/sun4v/sun4v/pmap.c#21 (text+ko) ==== @@ -171,7 +171,7 @@ static void pmap_insert_entry(pmap_t pmap, vm_offset_t va, vm_page_t m); static void pmap_remove_entry(struct pmap *pmap, vm_page_t m, vm_offset_t va); - +static int pmap_remove_tte(pmap_t pmap, uint64_t *tte, vm_offset_t va); /* * Quick sort callout for comparing memory regions. @@ -804,6 +804,7 @@ if (invlva) pmap_invalidate_page(pmap, va); } else { + tsb_set_tte(&pmap->pm_tsb, va, tte_data, pmap->pm_context); tte_hash_insert(pmap->pm_hash, va, tte_data); } } @@ -1180,6 +1181,7 @@ pmap->pm_tsb_ra = tsb_init(&pmap->pm_tsb, &pmap->pm_tsbscratch); pmap->pm_active = 0; TAILQ_INIT(&pmap->pm_pvlist); + PMAP_LOCK_INIT(pmap); bzero(&pmap->pm_stats, sizeof pmap->pm_stats); } @@ -1307,8 +1309,9 @@ void pmap_remove(pmap_t pmap, vm_offset_t start, vm_offset_t end) { - int invlva, tinvlva; + int invlva; vm_offset_t tva; + uint64_t *tte; /* * Perform an unsynchronized read. This is, however, safe. */ @@ -1320,8 +1323,13 @@ sched_pin(); PMAP_LOCK(pmap); for (tva = start; tva < end; tva += PAGE_SIZE) { - tinvlva = tte_hash_delete(pmap->pm_hash, tva); - invlva = tinvlva ? tinvlva : invlva; + + if ((tte = tte_hash_lookup(pmap->pm_hash, tva)) == NULL) + continue; + pmap_remove_tte(pmap, tte, tva); + tte_hash_delete(pmap->pm_hash, tva); + + invlva = 1; } sched_unpin(); vm_page_unlock_queues(); @@ -1474,6 +1482,8 @@ vm_page_unlock_queues(); } + + void pmap_scrub_pages(vm_paddr_t pa, int64_t size) { @@ -1484,6 +1494,31 @@ size -= bytes_zeroed; } } +static int +pmap_remove_tte(pmap_t pmap, uint64_t *tte, vm_offset_t va) +{ + + vm_page_t m; + + mtx_assert(&vm_page_queue_mtx, MA_OWNED); + PMAP_LOCK_ASSERT(pmap, MA_OWNED); + if (*tte & VTD_WIRED) + pmap->pm_stats.wired_count -= 1; + + pmap->pm_stats.resident_count -= 1; + + if (*tte & VTD_MANAGED) { + m = PHYS_TO_VM_PAGE(TTE_GET_PA(*tte)); + if (*tte & VTD_W) { + if (pmap_track_modified(pmap, va)) + vm_page_dirty(m); + } + if (*tte & VTD_REF) + vm_page_flag_set(m, PG_REFERENCED); + pmap_remove_entry(pmap, m, va); + } + +} /* * Set the 2 global kernel TSBs
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200603100859.k2A8xR6J085419>