avoid simple_lock deadlocks with machine independent VM code (from hibler)
authorKirk McKusick <mckusick@ucbvax.Berkeley.EDU>
Wed, 17 May 1995 15:09:00 +0000 (07:09 -0800)
committerKirk McKusick <mckusick@ucbvax.Berkeley.EDU>
Wed, 17 May 1995 15:09:00 +0000 (07:09 -0800)
SCCS-vsn: sys/hp300/hp300/pmap.c 8.7

usr/src/sys/hp300/hp300/pmap.c

index 68cfb67..1c3cef1 100644 (file)
@@ -8,7 +8,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)pmap.c      8.6 (Berkeley) %G%
+ *     @(#)pmap.c      8.7 (Berkeley) %G%
  */
 
 /*
  */
 
 /*
@@ -1869,11 +1869,27 @@ pmap_remove_mapping(pmap, va, pte, flags)
         * PT page.
         */
        if (pmap != kernel_pmap) {
         * PT page.
         */
        if (pmap != kernel_pmap) {
+#if defined(DEBUG) && NCPUS == 1
+               /*
+                * XXX this recursive use of the VM won't work on a MP
+                * (or when otherwise debugging simple locks).  We might
+                * be called with the page queue lock held (e.g. from
+                * the pageout daemon) and vm_map_pageable might call
+                * vm_fault_unwire which would try to lock the page queues
+                * again.  For debugging we hack and drop the lock.
+                */
+               int hadit = !simple_lock_try(&vm_page_queue_lock);
+               simple_unlock(&vm_page_queue_lock);
+#endif
                (void) vm_map_pageable(pt_map, trunc_page(pte),
                                       round_page(pte+1), TRUE);
 #ifdef DEBUG
                if (pmapdebug & PDB_WIRING)
                        pmap_check_wiring("remove", trunc_page(pte));
                (void) vm_map_pageable(pt_map, trunc_page(pte),
                                       round_page(pte+1), TRUE);
 #ifdef DEBUG
                if (pmapdebug & PDB_WIRING)
                        pmap_check_wiring("remove", trunc_page(pte));
+#if NCPUS == 1
+               if (hadit)
+                       simple_lock(&vm_page_queue_lock);
+#endif
 #endif
        }
        /*
 #endif
        }
        /*