git: kernel - Augment vm_fault_page() for vkernel operations

Matthew Dillon dillon at
Tue Jan 31 18:33:16 PST 2017

commit b443039b5d8fa7246ce7be3e04756121508c48eb
Author: Matthew Dillon <dillon at>
Date:   Tue Jan 31 17:10:44 2017 -0800

    kernel - Augment vm_fault_page() for vkernel operations
    * Augment vm_fault_page(), adding required elements from vm_fault() that
      were missing.
    * In particular, this fixes a bug in any copyout to a growable stack segment
      (including the copyouts the exec code does), where the stack was not being
      properly grown and the copyout/suword64/etc calls were failing when they
      shouldn't have.
    * Note optimization in pmap_clean_pte().  When turning off VPTE_RW, we
      do not have to MADV_INVAL to the real host if we determine that VPTE_M
      is not set.  Due to the way the vkernel works and host works, the host
      will utilize a read-only real PTE for read faults on VPTE_RW entries,
      in order to be able to detect writes by forcing a write fault when the
      write occurs.
    * Fix a race between pmap_enter() and pmap_page_protect().  The vkernel
      doesn't have a convenient pv-lock like the read kernel pmap code, so
      use the vm_page spinlock instead.
    * Generally use atomic ops for other operations on ptes that should be
      using atomic ops.
    * Only clear PG_WRITEABLE while holding the vm_page spinlock.

Summary of changes:
 sys/platform/pc64/x86_64/pmap.c              |   9 +-
 sys/platform/vkernel64/platform/pmap.c       |  49 +++++++----
 sys/platform/vkernel64/platform/pmap_inval.c |  37 ++++++--
 sys/vm/vm_fault.c                            | 124 ++++++++++++++++++++-------
 4 files changed, 157 insertions(+), 62 deletions(-)

DragonFly BSD source repository

More information about the Commits mailing list