Module Name:    src
Committed By:   bouyer
Date:           Tue Apr 23 11:05:15 UTC 2019

Modified Files:
        src/sys/arch/arm/arm32: pmap.c

Log Message:
Don't try to aquire/release the pmap lock when in ddb.
Avoids a deadlock when entering ddb, or on "mach cpu n" ddb command
(the pmap lock may already be held by another CPU, which is halted when
entering ddb).
Posted to port-arm@ on April 19.


To generate a diff of this commit:
cvs rdiff -u -r1.371 -r1.372 src/sys/arch/arm/arm32/pmap.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/arm32/pmap.c
diff -u src/sys/arch/arm/arm32/pmap.c:1.371 src/sys/arch/arm/arm32/pmap.c:1.372
--- src/sys/arch/arm/arm32/pmap.c:1.371	Sun Oct 28 14:59:17 2018
+++ src/sys/arch/arm/arm32/pmap.c	Tue Apr 23 11:05:14 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.371 2018/10/28 14:59:17 skrll Exp $	*/
+/*	$NetBSD: pmap.c,v 1.372 2019/04/23 11:05:14 bouyer Exp $	*/
 
 /*
  * Copyright 2003 Wasabi Systems, Inc.
@@ -217,7 +217,11 @@
 
 #include <arm/locore.h>
 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.371 2018/10/28 14:59:17 skrll Exp $");
+#ifdef DDB
+#include <arm/db_machdep.h>
+#endif
+
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.372 2019/04/23 11:05:14 bouyer Exp $");
 
 //#define PMAP_DEBUG
 #ifdef PMAP_DEBUG
@@ -538,6 +542,11 @@ vaddr_t pmap_directlimit;
 static inline void
 pmap_acquire_pmap_lock(pmap_t pm)
 {
+#if defined(MULTIPROCESSOR) && defined(DDB)
+	if (db_onproc != NULL)
+		return;
+#endif
+	
 	if (pm == pmap_kernel()) {
 #ifdef MULTIPROCESSOR
 		KERNEL_LOCK(1, NULL);
@@ -550,6 +559,10 @@ pmap_acquire_pmap_lock(pmap_t pm)
 static inline void
 pmap_release_pmap_lock(pmap_t pm)
 {
+#if defined(MULTIPROCESSOR) && defined(DDB)
+	if (db_onproc != NULL)
+		return;
+#endif
 	if (pm == pmap_kernel()) {
 #ifdef MULTIPROCESSOR
 		KERNEL_UNLOCK_ONE(NULL);

Reply via email to