From ada1ae623ea120c9bdabc0304f9b2e6f094cf62b Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Mon, 18 Aug 2014 20:28:08 +0000 Subject: [PATCH] There exists a possible sequence of page table page allocation failures starting with a superpage demotion by pmap_enter() that could result in a PV list lock being held when pmap_enter() is just about to return KERN_RESOURCE_SHORTAGE. Consequently, the KASSERT that no PV list locks are held needs to be replaced with a conditional unlock. Discussed with: kib X-MFC with: r269728 Sponsored by: EMC / Isilon Storage Division --- sys/amd64/amd64/pmap.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c index 6adc86dcb3d..8a226892b83 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -4201,9 +4201,10 @@ retry: mpte = _pmap_allocpte(pmap, pmap_pde_pindex(va), nosleep ? NULL : &lock); if (mpte == NULL && nosleep) { - KASSERT(lock == NULL, ("lock leaked for nosleep")); - PMAP_UNLOCK(pmap); + if (lock != NULL) + rw_wunlock(lock); rw_runlock(&pvh_global_lock); + PMAP_UNLOCK(pmap); return (KERN_RESOURCE_SHORTAGE); } goto retry;