Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/aarch64/aarch64 fix KASSERT panic. pv_...



details:   https://anonhg.NetBSD.org/src/rev/9fdb6f4b7e04
branches:  trunk
changeset: 318563:9fdb6f4b7e04
user:      ryo <ryo%NetBSD.org@localhost>
date:      Sun Apr 29 12:07:05 2018 +0000
description:
fix KASSERT panic. pv_entry may not be exists in pvlist when pmap_remove().

diffstat:

 sys/arch/aarch64/aarch64/pmap.c |  17 ++++++++++-------
 1 files changed, 10 insertions(+), 7 deletions(-)

diffs (50 lines):

diff -r 31eb6d401147 -r 9fdb6f4b7e04 sys/arch/aarch64/aarch64/pmap.c
--- a/sys/arch/aarch64/aarch64/pmap.c   Sun Apr 29 12:05:39 2018 +0000
+++ b/sys/arch/aarch64/aarch64/pmap.c   Sun Apr 29 12:07:05 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap.c,v 1.4 2018/04/29 12:05:39 ryo Exp $     */
+/*     $NetBSD: pmap.c,v 1.5 2018/04/29 12:07:05 ryo Exp $     */
 
 /*
  * Copyright (c) 2017 Ryo Shimizu <ryo%nerv.org@localhost>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.4 2018/04/29 12:05:39 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.5 2018/04/29 12:07:05 ryo Exp $");
 
 #include "opt_arm_debug.h"
 #include "opt_ddb.h"
@@ -91,6 +91,7 @@
 
 PMAP_COUNTER(pv_enter, "pv_entry allocate and link");
 PMAP_COUNTER(pv_remove, "pv_entry free and unlink");
+PMAP_COUNTER(pv_remove_nopv, "no pv_entry found when removing pv");
 
 PMAP_COUNTER(activate, "pmap_activate call");
 PMAP_COUNTER(deactivate, "pmap_deactivate call");
@@ -867,16 +868,18 @@
 
        pmap_pv_lock(md);
 
-       /* find pv */
        TAILQ_FOREACH(pv, &md->mdpg_pvhead, pv_link) {
                if ((pm == pv->pv_pmap) && (va == pv->pv_va)) {
+                       TAILQ_REMOVE(&md->mdpg_pvhead, pv, pv_link);
+                       PMAP_COUNT(pv_remove);
                        break;
                }
        }
-       KASSERT(pv != NULL);
-
-       TAILQ_REMOVE(&md->mdpg_pvhead, pv, pv_link);
-       PMAP_COUNT(pv_remove);
+#ifdef PMAPCOUNTERS
+       if (pv == NULL) {
+               PMAP_COUNT(pv_remove_nopv);
+       }
+#endif
 
        pmap_pv_unlock(md);
 



Home | Main Index | Thread Index | Old Index