Initialize pmap->pm_refcount properly in pmap_pinit() and
add simple_locks where pmap->pm_refcount are refered. This should fix a long-standing "out of space kmem_map" panic bug on sun3x.
This commit is contained in:
parent
2ebf1a0cd0
commit
e000111847
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: pmap.c,v 1.54 2000/06/29 07:19:14 mrg Exp $ */
|
/* $NetBSD: pmap.c,v 1.55 2000/10/21 14:10:25 tsutsui Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
|
* Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
|
||||||
@ -360,9 +360,11 @@ unsigned int NUM_A_TABLES, NUM_B_TABLES, NUM_C_TABLES;
|
|||||||
#define NUM_KERN_PTES (KVAS_SIZE >> MMU_TIC_SHIFT)
|
#define NUM_KERN_PTES (KVAS_SIZE >> MMU_TIC_SHIFT)
|
||||||
|
|
||||||
/*************************** MISCELANEOUS MACROS *************************/
|
/*************************** MISCELANEOUS MACROS *************************/
|
||||||
#define PMAP_LOCK() ; /* Nothing, for now */
|
#define pmap_lock(pmap) simple_lock(&pmap->pm_lock)
|
||||||
#define PMAP_UNLOCK() ; /* same. */
|
#define pmap_unlock(pmap) simple_unlock(&pmap->pm_lock)
|
||||||
#define NULL 0
|
#define pmap_add_ref(pmap) ++pmap->pm_refcount
|
||||||
|
#define pmap_del_ref(pmap) --pmap->pm_refcount
|
||||||
|
#define pmap_refcount(pmap) pmap->pm_refcount
|
||||||
|
|
||||||
static INLINE void * mmu_ptov __P((vm_offset_t pa));
|
static INLINE void * mmu_ptov __P((vm_offset_t pa));
|
||||||
static INLINE vm_offset_t mmu_vtop __P((void * va));
|
static INLINE vm_offset_t mmu_vtop __P((void * va));
|
||||||
@ -825,6 +827,7 @@ pmap_bootstrap(nextva)
|
|||||||
kernel_pmap.pm_a_tmgr = NULL;
|
kernel_pmap.pm_a_tmgr = NULL;
|
||||||
kernel_pmap.pm_a_phys = kernAphys;
|
kernel_pmap.pm_a_phys = kernAphys;
|
||||||
kernel_pmap.pm_refcount = 1; /* always in use */
|
kernel_pmap.pm_refcount = 1; /* always in use */
|
||||||
|
simple_lock_init(&kernel_pmap.pm_lock);
|
||||||
|
|
||||||
kernel_crp.rp_attr = MMU_LONG_DTE_LU | MMU_DT_LONG;
|
kernel_crp.rp_attr = MMU_LONG_DTE_LU | MMU_DT_LONG;
|
||||||
kernel_crp.rp_addr = kernAphys;
|
kernel_crp.rp_addr = kernAphys;
|
||||||
@ -2567,6 +2570,8 @@ pmap_pinit(pmap)
|
|||||||
bzero(pmap, sizeof(struct pmap));
|
bzero(pmap, sizeof(struct pmap));
|
||||||
pmap->pm_a_tmgr = NULL;
|
pmap->pm_a_tmgr = NULL;
|
||||||
pmap->pm_a_phys = kernAphys;
|
pmap->pm_a_phys = kernAphys;
|
||||||
|
pmap->pm_refcount = 1;
|
||||||
|
simple_lock_init(&pmap->pm_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* pmap_release INTERFACE
|
/* pmap_release INTERFACE
|
||||||
@ -2629,9 +2634,9 @@ pmap_reference(pmap)
|
|||||||
if (pmap == NULL)
|
if (pmap == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* pmap_lock(pmap); */
|
pmap_lock(pmap);
|
||||||
pmap->pm_refcount++;
|
pmap_add_ref(pmap);
|
||||||
/* pmap_unlock(pmap); */
|
pmap_unlock(pmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* pmap_dereference INTERNAL
|
/* pmap_dereference INTERNAL
|
||||||
@ -2648,9 +2653,9 @@ pmap_dereference(pmap)
|
|||||||
if (pmap == NULL)
|
if (pmap == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* pmap_lock(pmap); */
|
pmap_lock(pmap);
|
||||||
rtn = --pmap->pm_refcount;
|
rtn = pmap_del_ref(pmap);
|
||||||
/* pmap_unlock(pmap); */
|
pmap_unlock(pmap);
|
||||||
|
|
||||||
return rtn;
|
return rtn;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user