vkernel - Change how VPTE_M works to fix seg-faults during paging
commitc50e690bc7b0d735c80bd022c73ba8ec2eeadda0
authorMatthew Dillon <dillon@apollo.backplane.com>
Mon, 30 Jan 2017 20:13:58 +0000 (30 12:13 -0800)
committerMatthew Dillon <dillon@apollo.backplane.com>
Mon, 30 Jan 2017 22:11:24 +0000 (30 14:11 -0800)
tree05480737de0e5693ccf765232e1f10efc36b8714
parente989b548a6dd474e7809e205bab50d123198cf57
vkernel - Change how VPTE_M works to fix seg-faults during paging

* Properly set and clear PG_WRITEABLE

* TAILQ_FOREACH() iterations on m->md.pv_list must be restarted
  if we ever drop the spin-lock.

* Change VPAGETABLE semantics and operation, cleaning up some things
  and fixing others.

  Have the real-kernel only conditionally downgrade the real pte to
  read-only for a VPTE_RW vpte.  It only downgrades it if VPTE_M is
  not set, improving performance.

  Fix the virtual kernel to properly invalidate the real-kernel pte's
  when clearing VPTE_M.  This improves issues that crop up when the
  vkernel is paging heavily.

* Replace the linear pv_plist with a RB tree.  Also have pmap_remove_pages()
  simply call pmap_remove().

  Note that pmap_remove_pages()'s old code was broken because it only
  scanned the pv_entry list and missed unmanaged pages.  Fixing this
  also fixes a vmspace reuse issue where the real-host pmap still
  contained stale PTEs from prior use.
sys/platform/vkernel64/include/pmap.h
sys/platform/vkernel64/platform/pmap.c
sys/platform/vkernel64/platform/pmap_inval.c
sys/vm/vm_fault.c