Fix some pmap races in pc32 and vkernel, and other vkernel issues.
commitd319def226252a83d122f541f35535d0d74c58c9
authorMatthew Dillon <dillon@dragonflybsd.org>
Mon, 28 Apr 2008 07:05:09 +0000 (28 07:05 +0000)
committerMatthew Dillon <dillon@dragonflybsd.org>
Mon, 28 Apr 2008 07:05:09 +0000 (28 07:05 +0000)
tree74400642823e9b456c0738846ae882458c5b78b6
parent8e1df6c9dbbfc7916de949c26821663aef5f09c4
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