kernel - Augment vm_fault_page() for vkernel operations
commitb443039b5d8fa7246ce7be3e04756121508c48eb
authorMatthew Dillon <dillon@apollo.backplane.com>
Wed, 1 Feb 2017 01:10:44 +0000 (31 17:10 -0800)
committerMatthew Dillon <dillon@apollo.backplane.com>
Wed, 1 Feb 2017 02:32:39 +0000 (31 18:32 -0800)
tree3869ce4773e3f0768de2dfcee412b0bd6a77bf9c
parent00eb801e04b51d944dc04cbaf40ceab14ec2347f
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.
sys/platform/pc64/x86_64/pmap.c
sys/platform/vkernel64/platform/pmap.c
sys/platform/vkernel64/platform/pmap_inval.c
sys/vm/vm_fault.c