Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-1-5]: src/sys/arch/sun3/sun3x Pullup 1.55 [tsutsui]:



details:   https://anonhg.NetBSD.org/src/rev/467db55804fa
branches:  netbsd-1-5
changeset: 489971:467db55804fa
user:      tv <tv%NetBSD.org@localhost>
date:      Sat Oct 21 18:10:16 2000 +0000

description:
Pullup 1.55 [tsutsui]:
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.

diffstat:

 sys/arch/sun3/sun3x/pmap.c |  25 +++++++++++++++----------
 1 files changed, 15 insertions(+), 10 deletions(-)

diffs (67 lines):

diff -r 6ab5f2165bab -r 467db55804fa sys/arch/sun3/sun3x/pmap.c
--- a/sys/arch/sun3/sun3x/pmap.c        Sat Oct 21 16:15:32 2000 +0000
+++ b/sys/arch/sun3/sun3x/pmap.c        Sat Oct 21 18:10:16 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap.c,v 1.52 1999/12/17 08:10:59 jeremy Exp $ */
+/*     $NetBSD: pmap.c,v 1.52.4.1 2000/10/21 18:10:16 tv Exp $ */
 
 /*-
  * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@@ -364,9 +364,11 @@
 #define        NUM_KERN_PTES   (KVAS_SIZE >> MMU_TIC_SHIFT)
 
 /*************************** MISCELANEOUS MACROS *************************/
-#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 +831,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;
@@ -2571,6 +2574,8 @@
        bzero(pmap, sizeof(struct pmap));
        pmap->pm_a_tmgr = NULL;
        pmap->pm_a_phys = kernAphys;
+       pmap->pm_refcount = 1;
+       simple_lock_init(&pmap->pm_lock);
 }
 
 /* pmap_release                                INTERFACE
@@ -2633,9 +2638,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 +2657,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;
 }



Home | Main Index | Thread Index | Old Index