Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/arm/arm32 Don't try to aquire/release the pmap lock...



details:   https://anonhg.NetBSD.org/src/rev/062562746a06
branches:  trunk
changeset: 456100:062562746a06
user:      bouyer <bouyer%NetBSD.org@localhost>
date:      Tue Apr 23 11:05:14 2019 +0000

description:
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.

diffstat:

 sys/arch/arm/arm32/pmap.c |  17 +++++++++++++++--
 1 files changed, 15 insertions(+), 2 deletions(-)

diffs (45 lines):

diff -r 3df5056d3af3 -r 062562746a06 sys/arch/arm/arm32/pmap.c
--- a/sys/arch/arm/arm32/pmap.c Tue Apr 23 07:45:06 2019 +0000
+++ b/sys/arch/arm/arm32/pmap.c Tue Apr 23 11:05:14 2019 +0000
@@ -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 @@
 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 @@
 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);



Home | Main Index | Thread Index | Old Index