git: vkernel - Change how VPTE_M works to fix seg-faults during paging

Matthew Dillon dillon at
Mon Jan 30 14:32:23 PST 2017

commit c50e690bc7b0d735c80bd022c73ba8ec2eeadda0
Author: Matthew Dillon <dillon at>
Date:   Mon Jan 30 12:13:58 2017 -0800

    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.

Summary of changes:
 sys/platform/vkernel64/include/pmap.h        |   9 +-
 sys/platform/vkernel64/platform/pmap.c       | 149 +++++++++++++++------------
 sys/platform/vkernel64/platform/pmap_inval.c |   1 -
 sys/vm/vm_fault.c                            |  48 ++++++---
 4 files changed, 122 insertions(+), 85 deletions(-)

DragonFly BSD source repository

More information about the Commits mailing list