svn commit: r249539 - projects/amd64_xen_pv/sys/amd64/xen
Cherry G. Mathew
cherry at FreeBSD.org
Tue Apr 16 07:45:28 UTC 2013
Author: cherry
Date: Tue Apr 16 07:45:27 2013
New Revision: 249539
URL: http://svnweb.freebsd.org/changeset/base/249539
Log:
- change pmap_put_pv_entry() to return false on duplicates.
- Do not track kernel pv entries.
Approved by: gibbs(implicit)
Modified:
projects/amd64_xen_pv/sys/amd64/xen/pmap_pv.c
projects/amd64_xen_pv/sys/amd64/xen/pmap_pv.h
Modified: projects/amd64_xen_pv/sys/amd64/xen/pmap_pv.c
==============================================================================
--- projects/amd64_xen_pv/sys/amd64/xen/pmap_pv.c Tue Apr 16 07:11:52 2013 (r249538)
+++ projects/amd64_xen_pv/sys/amd64/xen/pmap_pv.c Tue Apr 16 07:45:27 2013 (r249539)
@@ -239,6 +239,8 @@ pmap_get_pv_entry(pmap_t pmap)
struct pv_chunk *pc;
vm_page_t m;
+ KASSERT(pmap != kernel_pmap,
+ ("Trying to track kernel va"));
rw_assert(&pvh_global_lock, RA_LOCKED);
PMAP_LOCK_ASSERT(pmap, MA_OWNED);
PV_STAT(atomic_add_long(&pv_entry_allocs, 1));
@@ -310,7 +312,7 @@ pmap_get_pv_entry(pmap_t pmap)
return (pv);
}
-void
+bool
pmap_put_pv_entry(pmap_t pmap, vm_offset_t va, vm_page_t m)
{
pv_entry_t pv;
@@ -320,11 +322,18 @@ pmap_put_pv_entry(pmap_t pmap, vm_offset
("Tried to manage an unmanaged page!"));
PMAP_LOCK_ASSERT(pmap, MA_OWNED);
+ if (pmap_find_pv_entry(pmap, va, m)) {
+ return false; /* Duplicate */
+ }
+
rw_rlock(&pvh_global_lock);
- pv = pmap_get_pv_entry(pmap);
- pv->pv_va = va;
- TAILQ_INSERT_TAIL(&m->md.pv_list, pv, pv_next);
+ if (pmap != kernel_pmap) {
+ pv = pmap_get_pv_entry(pmap);
+ pv->pv_va = va;
+ TAILQ_INSERT_TAIL(&m->md.pv_list, pv, pv_next);
+ }
rw_runlock(&pvh_global_lock);
+ return true;
}
@@ -335,6 +344,8 @@ pmap_free_pv_entry(pmap_t pmap, vm_offse
pv_entry_t pv;
PMAP_LOCK_ASSERT(pmap, MA_OWNED);
+ if (pmap == kernel_pmap) return true;
+
rw_rlock(&pvh_global_lock);
TAILQ_FOREACH(pv, &m->md.pv_list, pv_next) {
@@ -357,6 +368,7 @@ pmap_find_pv_entry(pmap_t pmap, vm_offse
pv_entry_t pv = NULL;
PMAP_LOCK_ASSERT(pmap, MA_OWNED);
+ if (pmap == kernel_pmap) return NULL;
rw_rlock(&pvh_global_lock);
TAILQ_FOREACH(pv, &m->md.pv_list, pv_next) {
@@ -439,6 +451,7 @@ pmap_pv_vm_page_to_v(pmap_t pmap, vm_pag
bool
pmap_pv_vm_page_mapped(pmap_t pmap, vm_page_t m)
{
+ if (pmap == kernel_pmap) return true;
return (pmap_pv_vm_page_to_v(pmap, m) ==
(VM_MAX_KERNEL_ADDRESS + 1)) ? false : true;
Modified: projects/amd64_xen_pv/sys/amd64/xen/pmap_pv.h
==============================================================================
--- projects/amd64_xen_pv/sys/amd64/xen/pmap_pv.h Tue Apr 16 07:11:52 2013 (r249538)
+++ projects/amd64_xen_pv/sys/amd64/xen/pmap_pv.h Tue Apr 16 07:45:27 2013 (r249539)
@@ -48,7 +48,7 @@ void pmap_pv_vm_page_init(vm_page_t m);
vm_offset_t pmap_pv_vm_page_to_v(pmap_t pmap, vm_page_t m);
bool pmap_pv_vm_page_mapped(pmap_t pmap, vm_page_t m);
pv_entry_t pmap_get_pv_entry(pmap_t pmap);
-void pmap_put_pv_entry(pmap_t pmap, vm_offset_t va, vm_page_t m);
+bool pmap_put_pv_entry(pmap_t pmap, vm_offset_t va, vm_page_t m);
bool pmap_free_pv_entry(pmap_t pmap, vm_offset_t va, vm_page_t m);
pv_entry_t pmap_find_pv_entry(pmap_t pmap, vm_offset_t va, vm_page_t m);
int pmap_pv_iterate(vm_page_t m, pv_cb_t cb);
More information about the svn-src-projects
mailing list