kernel - Fix a SMP race in the 64-bit pmap code
* Some of the pmap code was assuming that pv_entry's would remain stable
under circumstance where they might not actually remain stable.
Specifically, when the vm_page spinlock is held while issuing a
pv_hold_try() call on the pv, the pv is not necessarily stable
and its pmap and pindex must be double-checked after a successful
lock is acquired. This case occurs in two places in the code.
* Do this check in all cases (when the pmap spinlock OR the vm_page spin
lock is used to access a pv_entry), just to be sure that we have covered
all the bases.
* This SMP race is virtually impossible to reproduce on 8-thread boxes
but appears to be easy to reproduce on monster (48-way opteron).
* As of this commit it is not 100% clear if the patch fixes the assertion
seen, but it probably fixes some things.
panic: bad *ptep
000000078592b425 sva
00007ffffffff000 pte_pv NULL
Reported-by: ftigeot