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/7b88f32d63b5
branches:  trunk
changeset: 450705:7b88f32d63b5
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 3f33bcf706fb -r 7b88f32d63b5 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