PMAP_LOCK_DESTROY() vs. vmspace UMA_ZONE_NOFREE

Konstantin Belousov kostikbel at gmail.com
Fri Aug 15 14:02:30 UTC 2014


On Fri, Aug 15, 2014 at 03:20:29PM +0200, Svatopluk Kraus wrote:
> Hi,
> 
> I was playing with ports/benchmarks/forkbomb while testing my and Michal's
> armv6 pmap based on i386 one when I found - IMHO - sketelot in the closet.
> 
> i386, xen, and sparc64 pmaps call PMAP_LOCK_DESTROY() in pmap_pinit() if
> some allocation failed. As vmspace (struct pmap is part of it) uma zone is
> created with UMA_ZONE_NOFREE flag and PMAP_LOCK_INIT() is called from
> vmspace_zinit() initiator, PMAP_LOCK_DESTROY() should be called from
> nowhere.
> 
> The pmap_c_patch.txt is attached to solve it.
> 
> IMHO, I think that definition of PMAP_LOCK_DESTROY() is misleading a little
> as PMAP_LOCK_DESTROY() cannot be used anywhere as long as UMA_ZONE_NOFREE
> flag is used.
> 
> The pmap_all_patch.txt is attach to wipe PMAP_LOCK_DESTROY() out of source
> tree.
> 
> Svata

> Index: sys/i386/i386/pmap.c
> ===================================================================
> --- sys/i386/i386/pmap.c	(revision 270020)
> +++ sys/i386/i386/pmap.c	(working copy)
> @@ -1755,10 +1755,8 @@
>  	 */
>  	if (pmap->pm_pdir == NULL) {
>  		pmap->pm_pdir = (pd_entry_t *)kva_alloc(NBPTD);
> -		if (pmap->pm_pdir == NULL) {
> -			PMAP_LOCK_DESTROY(pmap);
> +		if (pmap->pm_pdir == NULL)
>  			return (0);
> -		}
>  #ifdef PAE
>  		pmap->pm_pdpt = uma_zalloc(pdptzone, M_WAITOK | M_ZERO);
>  		KASSERT(((vm_offset_t)pmap->pm_pdpt &
> Index: sys/i386/xen/pmap.c
> ===================================================================
> --- sys/i386/xen/pmap.c	(revision 270020)
> +++ sys/i386/xen/pmap.c	(working copy)
> @@ -1459,7 +1459,6 @@
>  	if (pmap->pm_pdir == NULL) {
>  		pmap->pm_pdir = (pd_entry_t *)kva_alloc(NBPTD);
>  		if (pmap->pm_pdir == NULL) {
> -			PMAP_LOCK_DESTROY(pmap);
>  #ifdef HAMFISTED_LOCKING
>  			mtx_unlock(&createdelete_lock);
>  #endif
> Index: sys/sparc64/sparc64/pmap.c
> ===================================================================
> --- sys/sparc64/sparc64/pmap.c	(revision 270020)
> +++ sys/sparc64/sparc64/pmap.c	(working copy)
> @@ -1211,11 +1211,9 @@
>  	 */
>  	if (pm->pm_tsb == NULL) {
>  		pm->pm_tsb = (struct tte *)kva_alloc(TSB_BSIZE);
> -		if (pm->pm_tsb == NULL) {
> -			PMAP_LOCK_DESTROY(pm);
> +		if (pm->pm_tsb == NULL)
>  			return (0);
>  		}
> -	}
>  
>  	/*
>  	 * Allocate an object for it.

Yes, I think this is result of incomplete r254667.
Still, I prefer to keep the PMAP_LOCK_DESTROY() macro around.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-arch/attachments/20140815/d7a2989d/attachment.sig>


More information about the freebsd-arch mailing list