Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/x86/x86 Re: kern/55071 (Panic shortly after running...



details:   https://anonhg.NetBSD.org/src/rev/9b7febd66fab
branches:  trunk
changeset: 1008207:9b7febd66fab
user:      ad <ad%NetBSD.org@localhost>
date:      Sat Mar 14 20:48:40 2020 +0000

description:
Re: kern/55071 (Panic shortly after running X11 due to kernel diagnostic assertion "mutex_owned(&pp->pp_lock)")

pmap_pp_remove(): get rid of a "goto" to make it clearer what's going on.

diffstat:

 sys/arch/x86/x86/pmap.c |  22 ++++++++++++----------
 1 files changed, 12 insertions(+), 10 deletions(-)

diffs (70 lines):

diff -r 0e97cff21b48 -r 9b7febd66fab sys/arch/x86/x86/pmap.c
--- a/sys/arch/x86/x86/pmap.c   Sat Mar 14 20:45:23 2020 +0000
+++ b/sys/arch/x86/x86/pmap.c   Sat Mar 14 20:48:40 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap.c,v 1.366 2020/03/14 18:24:10 ad Exp $    */
+/*     $NetBSD: pmap.c,v 1.367 2020/03/14 20:48:40 ad Exp $    */
 
 /*
  * Copyright (c) 2008, 2010, 2016, 2017, 2019, 2020 The NetBSD Foundation, Inc.
@@ -130,7 +130,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.366 2020/03/14 18:24:10 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.367 2020/03/14 20:48:40 ad Exp $");
 
 #include "opt_user_ldt.h"
 #include "opt_lockdebug.h"
@@ -4115,15 +4115,19 @@
 
        count = SPINLOCK_BACKOFF_MIN;
        kpreempt_disable();
-startover:
-       mutex_spin_enter(&pp->pp_lock);
-       while ((pvpte = pv_pte_first(pp)) != NULL) {
+       for (;;) {
                struct pmap *pmap;
                struct pv_entry *pve;
                pt_entry_t opte;
                vaddr_t va;
                int error;
 
+               mutex_spin_enter(&pp->pp_lock);
+               if ((pvpte = pv_pte_first(pp)) == NULL) {
+                       mutex_spin_exit(&pp->pp_lock);
+                       break;
+               }
+
                /*
                 * Add a reference to the pmap before clearing the pte.
                 * Otherwise the pmap can disappear behind us.
@@ -4150,7 +4154,7 @@
                        if (ptp != NULL) {
                                pmap_destroy(pmap);
                        }
-                       goto startover;
+                       continue;
                }
 
                error = pmap_sync_pv(pvpte, pa, ~0, &oattrs, &opte);
@@ -4167,7 +4171,7 @@
                        }
                        SPINLOCK_BACKOFF(count);
                        KERNEL_LOCK(hold_count, curlwp);
-                       goto startover;
+                       continue;
                }
 
                va = pvpte->pte_va;
@@ -4196,9 +4200,7 @@
                if (ptp != NULL) {
                        pmap_destroy(pmap);
                }
-               mutex_spin_enter(&pp->pp_lock);
-       }
-       mutex_spin_exit(&pp->pp_lock);
+       }
        kpreempt_enable();
 }
 



Home | Main Index | Thread Index | Old Index