Module Name: src
Committed By: ad
Date: Sat Mar 14 20:48:40 UTC 2020
Modified Files:
src/sys/arch/x86/x86: pmap.c
Log Message:
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.
To generate a diff of this commit:
cvs rdiff -u -r1.366 -r1.367 src/sys/arch/x86/x86/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/x86/x86/pmap.c
diff -u src/sys/arch/x86/x86/pmap.c:1.366 src/sys/arch/x86/x86/pmap.c:1.367
--- src/sys/arch/x86/x86/pmap.c:1.366 Sat Mar 14 18:24:10 2020
+++ src/sys/arch/x86/x86/pmap.c Sat Mar 14 20:48:40 2020
@@ -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 @@ pmap_pp_remove(struct pmap_page *pp, pad
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 @@ startover:
if (ptp != NULL) {
pmap_destroy(pmap);
}
- goto startover;
+ continue;
}
error = pmap_sync_pv(pvpte, pa, ~0, &oattrs, &opte);
@@ -4167,7 +4171,7 @@ startover:
}
SPINLOCK_BACKOFF(count);
KERNEL_LOCK(hold_count, curlwp);
- goto startover;
+ continue;
}
va = pvpte->pte_va;
@@ -4196,9 +4200,7 @@ startover:
if (ptp != NULL) {
pmap_destroy(pmap);
}
- mutex_spin_enter(&pp->pp_lock);
}
- mutex_spin_exit(&pp->pp_lock);
kpreempt_enable();
}