kernel - pc64 - Fix pv_free() race and add assertions
authorMatthew Dillon <dillon@apollo.backplane.com>
Sun, 6 Oct 2013 23:34:53 +0000 (16:34 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Sun, 6 Oct 2013 23:34:53 +0000 (16:34 -0700)
commit8e2efb11e5cbf92f0ed06258cbd1f6bfc684e5c8
treee3adb967f963ae0f29e0d8b78394371e34abf28c
parent20a6d9db3ac59096b938830420980b60114d65fa
kernel - pc64 - Fix pv_free() race and add assertions

* Continued work trying to fix the bad *ptep ... panics.  Previous commits
  did not do the job.  It is still unknown whether this one completely fixes
  the panic.

* The pmap pv_entry API was allowing pv_entry's to be retained with 0 refs
  and then doing a separate check for pv_pmap == NULL to determine if the
  pv_entry could be freed or not.  This resulted in a SMP race where multiple
  threads could pv_free() the same pv_entry.

* Change the code to supply an addition ref for pv_pmap != NULL and use the
  1->0 transition to deterministically conditionalize the pv_free().

* Change the shortcuts in pv_hold_try() and pv_drop() to use the new
  assumptions.

* Add some additional assertions and a generation count to try to check bugs.
sys/platform/pc64/include/pmap.h
sys/platform/pc64/x86_64/pmap.c
sys/vm/vm_fault.c