Source-Changes-HG archive

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

[src/trunk]: src/sys Avoid KASSERT(!cpu_intr_p()) when breaking into ddb and ...



details:   https://anonhg.NetBSD.org/src/rev/9e4c5a9f819b
branches:  trunk
changeset: 451189:9e4c5a9f819b
user:      skrll <skrll%NetBSD.org@localhost>
date:      Thu May 09 08:16:14 2019 +0000

description:
Avoid KASSERT(!cpu_intr_p()) when breaking into ddb and issuing

        show uvmexp

diffstat:

 sys/kern/subr_pool.c |  17 +++++++++++++----
 sys/sys/pool.h       |   3 ++-
 sys/uvm/uvm_stat.c   |   6 +++---
 3 files changed, 18 insertions(+), 8 deletions(-)

diffs (92 lines):

diff -r 0c034ed9e88f -r 9e4c5a9f819b sys/kern/subr_pool.c
--- a/sys/kern/subr_pool.c      Thu May 09 08:01:07 2019 +0000
+++ b/sys/kern/subr_pool.c      Thu May 09 08:16:14 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: subr_pool.c,v 1.249 2019/04/13 08:41:36 maxv Exp $     */
+/*     $NetBSD: subr_pool.c,v 1.250 2019/05/09 08:16:14 skrll Exp $    */
 
 /*
  * Copyright (c) 1997, 1999, 2000, 2002, 2007, 2008, 2010, 2014, 2015, 2018
@@ -33,7 +33,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_pool.c,v 1.249 2019/04/13 08:41:36 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_pool.c,v 1.250 2019/05/09 08:16:14 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -1635,10 +1635,20 @@
 int
 pool_totalpages(void)
 {
+
+       mutex_enter(&pool_head_lock);
+       int pages = pool_totalpages_locked();
+       mutex_exit(&pool_head_lock);
+
+       return pages;
+}
+
+int
+pool_totalpages_locked(void)
+{
        struct pool *pp;
        uint64_t total = 0;
 
-       mutex_enter(&pool_head_lock);
        TAILQ_FOREACH(pp, &pool_head, pr_poollist) {
                uint64_t bytes = pp->pr_npages * pp->pr_alloc->pa_pagesz;
 
@@ -1646,7 +1656,6 @@
                        bytes -= (pp->pr_nout * pp->pr_size);
                total += bytes;
        }
-       mutex_exit(&pool_head_lock);
 
        return atop(total);
 }
diff -r 0c034ed9e88f -r 9e4c5a9f819b sys/sys/pool.h
--- a/sys/sys/pool.h    Thu May 09 08:01:07 2019 +0000
+++ b/sys/sys/pool.h    Thu May 09 08:16:14 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pool.h,v 1.88 2019/04/13 08:41:37 maxv Exp $   */
+/*     $NetBSD: pool.h,v 1.89 2019/05/09 08:16:15 skrll Exp $  */
 
 /*-
  * Copyright (c) 1997, 1998, 1999, 2000, 2007 The NetBSD Foundation, Inc.
@@ -320,6 +320,7 @@
 void           pool_sethardlimit(struct pool *, int, const char *, int);
 bool           pool_drain(struct pool **);
 int            pool_totalpages(void);
+int            pool_totalpages_locked(void);
 
 /*
  * Debugging and diagnostic aides.
diff -r 0c034ed9e88f -r 9e4c5a9f819b sys/uvm/uvm_stat.c
--- a/sys/uvm/uvm_stat.c        Thu May 09 08:01:07 2019 +0000
+++ b/sys/uvm/uvm_stat.c        Thu May 09 08:16:14 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_stat.c,v 1.39 2017/12/02 08:15:43 mrg Exp $         */
+/*     $NetBSD: uvm_stat.c,v 1.40 2019/05/09 08:16:15 skrll Exp $       */
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_stat.c,v 1.39 2017/12/02 08:15:43 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_stat.c,v 1.40 2019/05/09 08:16:15 skrll Exp $");
 
 #include "opt_readahead.h"
 #include "opt_ddb.h"
@@ -61,7 +61,7 @@
        struct cpu_info *ci;
 
        uvm_estimatepageable(&active, &inactive);
-       poolpages = pool_totalpages();
+       poolpages = pool_totalpages_locked();
 
        (*pr)("Current UVM status:\n");
        (*pr)("  pagesize=%d (0x%x), pagemask=0x%x, pageshift=%d, ncolors=%d\n",



Home | Main Index | Thread Index | Old Index