Fix some pmap races in pc32 and vkernel, and other vkernel issues.
authorMatthew Dillon <dillon@dragonflybsd.org>
Mon, 28 Apr 2008 07:05:09 +0000 (07:05 +0000)
committerMatthew Dillon <dillon@dragonflybsd.org>
Mon, 28 Apr 2008 07:05:09 +0000 (07:05 +0000)
commiteec2b734b51509ee7b14d52ef248bdb1985ac5d4
treefc1583fde2048f07074da836825771a5e04f9b08
parenta5fddc1677b54e4c545d264f9ea3a38e20e81e3d
Fix some pmap races in pc32 and vkernel, and other vkernel issues.

* Fix a case where a vm_page_sleep_busy() loop can cause a page's hold_count
  to go stale, potentially resulting in a double action being taken on
  the page.  This can only occur during very heavy paging loads.  Fix
  the issue by doing the vm_page_unhold() after the blocking condition
  instead of before.  This fix applies to both the vkernel and pc32.

* The pmap_allocpte() call in in pmap_copy() can block, causing the cached
  page directory page to become stale.  Detect the case and take appropriate
  action.  This fix applies to both the vkernel and pc32.

* Add numerous KKASSERT()s to assert that the pmap tracking counters are
  correct, to try to detect races in the future.

* Fix a bug in the vkernel's signal handling. We have to catch SIGBUS as
  well as SIGSEGV.  We also have to tell the signal handler to not
  block the signal on entry or a page fault in the vkernel itself can
  cause the signal to be masked, the vkernel may then block and switch
  threads, and another page fault in the vkernel itself would wind up
  being masked.  The result is an endless loop in the vkernel retrying the
  same faulting instruction forever (until you kill the vkernel).
sys/platform/pc32/i386/pmap.c
sys/platform/vkernel/i386/exception.c
sys/platform/vkernel/include/globaldata.h
sys/platform/vkernel/platform/globaldata.c
sys/platform/vkernel/platform/pmap.c