arm pmap locking

Alan Cox alc at rice.edu
Mon Sep 3 22:54:33 UTC 2012


On 08/30/2012 13:12, Ian Lepore wrote:
> On Tue, 2012-08-28 at 13:49 -0500, Alan Cox wrote:
>> Can you please retry with the attached patch?  For the time being, I
>> decided to address the above problem by simply enabling recursion on the
>> new pmap lock.  As I mentioned in my prior message, the lock recursion
>> in the arm pmap is a mistake.  However, I'd rather not change two things
>> at once, i.e., replace the page queues lock and fix the lock recursion.
>> I'll take a look at eliminating the lock recursion later this week.
>>
>> Thanks,
>> Alan
>>
> Sorry for the delay, I finally got around to trying this today, and it
> seems to be working well initially -- it boots to multiuser and the only
> difference in the dmesg.boot with and without the patch is the compile
> date, and the kernel image is 128 bytes smaller with the patch.  I've
> got DIAGNOSTIC and INVARIANTS enabled; I'll run with the patch in place
> and let you know if anything glitches.
>

Could you please test the attached patch?  This is a small step toward 
disentangling the arm pmap locking.

Alan

-------------- next part --------------
Index: arm/arm/pmap.c
===================================================================
--- arm/arm/pmap.c	(revision 240002)
+++ arm/arm/pmap.c	(working copy)
@@ -1600,7 +1600,6 @@ static void
 pmap_enter_pv(struct vm_page *pg, struct pv_entry *pve, pmap_t pm,
     vm_offset_t va, u_int flags)
 {
-
 	int km;
 
 	rw_assert(&pvh_global_lock, RA_WLOCKED);
@@ -1617,10 +1616,8 @@ pmap_enter_pv(struct vm_page *pg, struct pv_entry
 		TAILQ_INSERT_HEAD(&pg->md.pv_list, pve, pv_list);
 		TAILQ_INSERT_HEAD(&pve->pv_pmap->pm_pvlist, pve, pv_plist);
 		PMAP_UNLOCK(pmap_kernel());
-		rw_wunlock(&pvh_global_lock);
 		if ((pve = pmap_get_pv_entry()) == NULL)
-			panic("pmap_kenter_internal: no pv entries");
-		rw_wlock(&pvh_global_lock);
+			panic("pmap_kenter_pv: no pv entries");
 		if (km)
 			PMAP_LOCK(pmap_kernel());
 	}
@@ -2835,11 +2832,8 @@ pmap_kenter_internal(vm_offset_t va, vm_offset_t p
 	if (pvzone != NULL && (m = vm_phys_paddr_to_vm_page(pa))) {
 		rw_wlock(&pvh_global_lock);
 		if (!TAILQ_EMPTY(&m->md.pv_list) || m->md.pv_kva) {
-			/* release vm_page lock for pv_entry UMA */
-			rw_wunlock(&pvh_global_lock);
 			if ((pve = pmap_get_pv_entry()) == NULL)
 				panic("pmap_kenter_internal: no pv entries");	
-			rw_wlock(&pvh_global_lock);
 			PMAP_LOCK(pmap_kernel());
 			pmap_enter_pv(m, pve, pmap_kernel(), va,
 			    PVF_WRITE | PVF_UNMAN);


More information about the freebsd-arm mailing list