Cleanup comment. Change panic to KASSERTMSG.

Use kernel_map->misc_lock to make sure we don't call pmap_growkernel
concurrently and possibly mess up uvm_maxkaddr.
This commit is contained in:
matt 2012-09-03 17:30:04 +00:00
parent f5caa65c66
commit f98c747f9e
2 changed files with 13 additions and 10 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: uvm_km.c,v 1.131 2012/09/03 16:07:17 matt Exp $ */
/* $NetBSD: uvm_km.c,v 1.132 2012/09/03 17:30:04 matt Exp $ */
/*
* Copyright (c) 1997 Charles D. Cranor and Washington University.
@ -152,7 +152,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: uvm_km.c,v 1.131 2012/09/03 16:07:17 matt Exp $");
__KERNEL_RCSID(0, "$NetBSD: uvm_km.c,v 1.132 2012/09/03 17:30:04 matt Exp $");
#include "opt_uvmhist.h"
@ -782,16 +782,17 @@ again:
#ifdef PMAP_GROWKERNEL
/*
* Since we just set kernel_map, the check in uvm_map_prepare to grow the
* kernel's VA space never happened so we must do it here. If the kernel
* pmap can't map the requested space, then allocate more resources for it.
* These VA allocations happen independently of uvm_map so if this allocation
* extends beyond the current limit, then allocate more resources for it.
*/
mutex_enter(&kernel_map->misc_lock);
if (uvm_maxkaddr < va + size) {
uvm_maxkaddr = pmap_growkernel(va + size);
if (uvm_maxkaddr < va + size)
panic("%s: pmap_growkernel(%#"PRIxVADDR") failed",
__func__, (vaddr_t) (va + size));
KASSERTMSG(uvm_maxkaddr >= va + size,
"%#"PRIxVADDR" %#"PRIxPTR" %#zx",
uvm_maxkaddr, va, size);
}
mutex_exit(&kernel_map->misc_lock);
#endif
loopva = va;

View File

@ -1,4 +1,4 @@
/* $NetBSD: uvm_map.c,v 1.319 2012/08/18 14:28:04 chs Exp $ */
/* $NetBSD: uvm_map.c,v 1.320 2012/09/03 17:30:04 matt Exp $ */
/*
* Copyright (c) 1997 Charles D. Cranor and Washington University.
@ -66,7 +66,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: uvm_map.c,v 1.319 2012/08/18 14:28:04 chs Exp $");
__KERNEL_RCSID(0, "$NetBSD: uvm_map.c,v 1.320 2012/09/03 17:30:04 matt Exp $");
#include "opt_ddb.h"
#include "opt_uvmhist.h"
@ -1182,8 +1182,10 @@ retry:
* If the kernel pmap can't map the requested space,
* then allocate more resources for it.
*/
mutex_enter(&map->misc_lock);
if (map == kernel_map && uvm_maxkaddr < (start + size))
uvm_maxkaddr = pmap_growkernel(start + size);
mutex_exit(&map->misc_lock);
#endif
UVMMAP_EVCNT_INCR(map_call);