Module Name: src Committed By: bouyer Date: Tue Apr 23 11:21:21 UTC 2019
Modified Files: src/sys/arch/arm/arm32: pmap.c Log Message: Fix a deadlock between the pool and pmap codes: - cpu0 grabs the kernel lock (e.g. from a non-MPSAFE interrupt) and calls pool_get(). - cpu1 does a pool_get() on the same pool from MPSAFE code, which needs a pool_page_alloc(), which ends up in pmap_extract_coherency(). So cpu0 holds the kernel_lock and wants the pool lock. cpu1 holds the pool lock and wants the kernel_lock in pmap_extract_coherency(). The pmap code should not rely on kernel_lock. Intead make the pmap_kernel()->pm_obj_lock a IPL_VM lock and use it as pmap lock (thus dropping the pmap test pmap_{acquire,release}_pmap_lock()). This needs to be a IPL_VM because unlike user pmaps, this can be locked from interrupt context. Add a IPL_NONE lock for pmap_growkernel(). We can't use pmap_kernel()->pm_obj_lock here because pmap_grow_map() may sleep. Make pmap_lock (which may be locked with pm_obj_lock held) a IPL_VM lock in all case. reorder a few things to not call pool_get()/pool_put() (which may sleep) with pm_obj_lock held. Patch initially posted to port-arm@ on April 19, improved patch (per suggestions from Nick Hudson and Jason Thorpe) on April 21. To generate a diff of this commit: cvs rdiff -u -r1.372 -r1.373 src/sys/arch/arm/arm32/pmap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.