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

show uvmexp
This commit is contained in:
skrll 2019-05-09 08:16:14 +00:00
parent e288c0bcc9
commit f77ca71313
3 changed files with 18 additions and 8 deletions

View File

@ -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"
@ -1634,11 +1634,21 @@ pool_drain(struct pool **ppp)
*/
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 @@ pool_totalpages(void)
bytes -= (pp->pr_nout * pp->pr_size);
total += bytes;
}
mutex_exit(&pool_head_lock);
return atop(total);
}

View File

@ -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_sethiwat(struct pool *, int);
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.

View File

@ -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 @@ uvmexp_print(void (*pr)(const char *, ...)
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",