kernel - pmap and vkernel work
authorMatthew Dillon <dillon@apollo.backplane.com>
Mon, 23 Jan 2017 20:20:23 +0000 (12:20 -0800)
committerMatthew Dillon <dillon@apollo.backplane.com>
Wed, 25 Jan 2017 04:13:56 +0000 (20:13 -0800)
commit76f1911e607287d1cad1cece8db8d5d9bae6ca23
tree615a719176485619fa99f69158aaed9744a4645f
parentf8e25fa773cafb8e347f5e16a94151fee90f248b
kernel - pmap and vkernel work

* Remove the pmap.pm_token entirely.  The pmap is currently protected
  primarily by fine-grained locks and the vm_map lock.  The intention
  is to eventually be able to protect it without the vm_map lock at all.

* Enhance pv_entry acquisition (representing PTE locations) to include
  a placemarker facility for non-existant PTEs, allowing the PTE location
  to be locked whether a pv_entry exists for it or not.

* Fix dev_dmmap (struct dev_mmap) (for future use), it was returning a
  page index for physical memory as a 32-bit integer instead of a 64-bit
  integer.

* Use pmap_kextract() instead of pmap_extract() where appropriate.

* Put the token contention test back in kern_clock.c for real kernels
  so token contention shows up as sys% instead of idle%.

* Modify the pmap_extract() API to also return a locked pv_entry,
  and add pmap_extract_done() to release it.  Adjust users of
  pmap_extract().

* Change madvise/mcontrol MADV_INVAL (used primarily by the vkernel)
  to use a shared vm_map lock instead of an exclusive lock.  This
  significantly improves the vkernel's performance and significantly
  reduces stalls and glitches when typing in one under heavy loads.

* The new placemarkers also have the side effect of fixing several
  difficult-to-reproduce bugs in the pmap code, by ensuring that
  shared and unmanaged pages are properly locked whereas before only
  managed pages (with pv_entry's) were properly locked.

* Adjust the vkernel's pmap code to use atomic ops in numerous places.

* Rename the pmap_change_wiring() call to pmap_unwire().  The routine
  was only being used to unwire (and could only safely be called for
  unwiring anyway).  Remove the unused 'wired' and the 'entry'
  arguments.

  Also change how pmap_unwire() works to remove a small race condition.

* Fix race conditions in the vmspace_*() system calls which could lead
  to pmap corruption.  Note that the vkernel did not trigger any of
  these conditions, I found them while looking for another bug.

* Add missing maptypes to procfs's /proc/*/map report.
27 files changed:
sys/bus/isa/vga_isa.c
sys/bus/isa/x86_64/isa_dma.c
sys/cpu/x86_64/include/types.h
sys/emulation/ndis/subr_ntoskrnl.c
sys/kern/kern_clock.c
sys/kern/kern_device.c
sys/kern/subr_sglist.c
sys/platform/pc64/include/pmap.h
sys/platform/pc64/x86_64/busdma_machdep.c
sys/platform/pc64/x86_64/pmap.c
sys/platform/pc64/x86_64/vm_machdep.c
sys/platform/vkernel64/include/pmap.h
sys/platform/vkernel64/platform/busdma_machdep.c
sys/platform/vkernel64/platform/pmap.c
sys/platform/vkernel64/x86_64/vm_machdep.c
sys/sys/device.h
sys/sys/globaldata.h
sys/sys/vkernel.h
sys/vfs/procfs/procfs_map.c
sys/vm/device_pager.c
sys/vm/pmap.h
sys/vm/vm_contig.c
sys/vm/vm_fault.c
sys/vm/vm_map.c
sys/vm/vm_object.c
sys/vm/vm_object.h
sys/vm/vm_vmspace.c