kernel - Fix races created by a comedy of circumstances
commit5ee06c6c187e324caf18efa964c1afedd2206031
authorMatthew Dillon <dillon@apollo.backplane.com>
Sun, 29 Jan 2017 04:02:03 +0000 (28 20:02 -0800)
committerMatthew Dillon <dillon@apollo.backplane.com>
Sun, 29 Jan 2017 05:42:31 +0000 (28 21:42 -0800)
tree42bd37353078c3fd3d76e05fcb419e27ed046188
parent07540d375a7f9dfdadc9976982dd8d0a1fd6794e
kernel - Fix races created by a comedy of circumstances

* Fix several loop iteration races in the pmap code revealed by a chain
  of events.  Initially the commit to relax locking of vm_map for
  MADV_INVAL operations (used by the vkernel) worked just fine.  The
  idea being that the pmap code was fine-grained locked and so a wider
  encompassing lock should not have been needed.

  However, a later commit to reduce the size of the zalloc pcpu caches
  caused more cycling of pv_entry structures across cpus which revealed
  a number of SMP races in the pmap code.

* A number of these races were fixed in recent commits and this commit
  fixes a few more, primarily in the vm_page_t pv_entry loop iterators.
sys/platform/pc64/x86_64/pmap.c
sys/platform/vkernel64/platform/pmap.c