Subject: Re: "out of space kmem_map" panic on sun3x
To: None <jeremy@baymoo.org>
From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
List: port-sun3
Date: 10/18/2000 20:13:06
In <Pine.BSF.4.21.0010170945410.71687-100000@simon.baymoo.org>
jeremy@baymoo.org wrote:
> Can someone do a test for me and anyone uncomment the 'pmap_lock(pmap);'
> and 'pmap_unlock(pmap);' lines that occur in both the sun3x
> pmap_reference() and pmap_dereference()? As usual, a full make build of
> the source tree should suffice as a stress test.
It looks some more macros and initialization are needed.
Is the attached patch correct?
---
Izumi Tsutsui
tsutsui@ceres.dti.ne.jp
Index: pmap.c
===================================================================
RCS file: /cvs/cvsroot/syssrc/sys/arch/sun3/sun3x/pmap.c,v
retrieving revision 1.52
diff -u -r1.52 pmap.c
--- pmap.c 1999/12/17 08:10:59 1.52
+++ pmap.c 2000/10/18 11:01:28
@@ -367,6 +367,12 @@
#define PMAP_LOCK() ; /* Nothing, for now */
#define PMAP_UNLOCK() ; /* same. */
#define NULL 0
+
+#define pmap_lock(pmap) simple_lock(&pmap->pm_lock)
+#define pmap_unlock(pmap) simple_unlock(&pmap->pm_lock)
+#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 vm_offset_t mmu_vtop __P((void * va));
@@ -829,6 +835,7 @@
kernel_pmap.pm_a_tmgr = NULL;
kernel_pmap.pm_a_phys = kernAphys;
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_addr = kernAphys;
@@ -2633,9 +2640,9 @@
if (pmap == NULL)
return;
- /* pmap_lock(pmap); */
- pmap->pm_refcount++;
- /* pmap_unlock(pmap); */
+ pmap_lock(pmap);
+ pmap_add_ref(pmap);
+ pmap_unlock(pmap);
}
/* pmap_dereference INTERNAL
@@ -2652,9 +2659,9 @@
if (pmap == NULL)
return 0;
- /* pmap_lock(pmap); */
- rtn = --pmap->pm_refcount;
- /* pmap_unlock(pmap); */
+ pmap_lock(pmap);
+ rtn = pmap_del_ref(pmap);
+ pmap_unlock(pmap);
return rtn;
}