Source-Changes-HG archive

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

[src/sommerfeld_i386mp_1]: src/sys/arch/i386/i386 Release the pmaps_lock once...



details:   https://anonhg.NetBSD.org/src/rev/cedf03425306
branches:  sommerfeld_i386mp_1
changeset: 482370:cedf03425306
user:      enami <enami%NetBSD.org@localhost>
date:      Sun Feb 11 09:12:15 2001 +0000

description:
Release the pmaps_lock once before allocating new page for PDP cache and
reacquire it before constructing the cache.  Otherwise it will be locked
again if pmap_growkernel() is called during the page allocation.

diffstat:

 sys/arch/i386/i386/pmap.c |  29 ++++++++++++++++++++++++++---
 1 files changed, 26 insertions(+), 3 deletions(-)

diffs (58 lines):

diff -r 9b701c7db1eb -r cedf03425306 sys/arch/i386/i386/pmap.c
--- a/sys/arch/i386/i386/pmap.c Tue Jan 23 06:34:52 2001 +0000
+++ b/sys/arch/i386/i386/pmap.c Sun Feb 11 09:12:15 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap.c,v 1.83.2.29 2001/01/14 23:25:49 thorpej Exp $   */
+/*     $NetBSD: pmap.c,v 1.83.2.30 2001/02/11 09:12:15 enami Exp $     */
 
 /*
  *
@@ -415,6 +415,7 @@
 struct pool pmap_pdp_pool;
 struct pool_cache pmap_pdp_cache;
 
+void   *pmap_pdp_pool_page_alloc(unsigned long, int, int);
 int    pmap_pdp_ctor(void *, void *, int);
 
 caddr_t vmmap; /* XXX: used by mem.c... it should really uvm_map_reserve it */
@@ -1054,9 +1055,9 @@
         * initialize the PDE pool and cache.
         */
        pool_init(&pmap_pdp_pool, PAGE_SIZE, 0, 0, 0, "pdppl",
-                 0, pool_page_alloc_nointr, pool_page_free_nointr, M_VMPMAP);
+           0, pmap_pdp_pool_page_alloc, pool_page_free_nointr, M_VMPMAP);
        pool_cache_init(&pmap_pdp_cache, &pmap_pdp_pool,
-                       pmap_pdp_ctor, NULL, NULL);
+           pmap_pdp_ctor, NULL, NULL);
 
        /*
         * ensure the TLB is sync'd with reality by flushing it...
@@ -1663,6 +1664,28 @@
  */
 
 /*
+ * pmap_pdp_pool_page_alloc: allocator for the PDP pool page.
+ */
+
+void *
+pmap_pdp_pool_page_alloc(unsigned long sz, int flags, int mtype)
+{
+       void *pg;
+
+       /*
+        * There was no free items in the PDP pool.  We have to
+        * release pmaps_lock since pmap_growkernel() might be called
+        * during page allocation.  Reacquire the lock before
+        * constructing PDP cache.
+        */
+       simple_unlock(&pmaps_lock);
+       pg = pool_page_alloc_nointr(sz, flags, mtype);
+       simple_lock(&pmaps_lock);
+
+       return (pg);
+}
+
+/*
  * pmap_pdp_ctor: constructor for the PDP cache.
  */
 



Home | Main Index | Thread Index | Old Index