Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/aarch64 Use MUTEX_NODEBUG for PV locks as is common...
details: https://anonhg.NetBSD.org/src/rev/e37293ccc81c
branches: trunk
changeset: 972036:e37293ccc81c
user: skrll <skrll%NetBSD.org@localhost>
date: Thu May 14 07:59:03 2020 +0000
description:
Use MUTEX_NODEBUG for PV locks as is commonly done. OK ryo.
diffstat:
sys/arch/aarch64/aarch64/pmap.c | 31 ++++++++-----------------------
sys/arch/aarch64/include/pmap.h | 11 ++++++-----
2 files changed, 14 insertions(+), 28 deletions(-)
diffs (103 lines):
diff -r 21cd3593b7a4 -r e37293ccc81c sys/arch/aarch64/aarch64/pmap.c
--- a/sys/arch/aarch64/aarch64/pmap.c Thu May 14 06:13:39 2020 +0000
+++ b/sys/arch/aarch64/aarch64/pmap.c Thu May 14 07:59:03 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.72 2020/05/13 10:13:29 jmcneill Exp $ */
+/* $NetBSD: pmap.c,v 1.73 2020/05/14 07:59:03 skrll 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.72 2020/05/13 10:13:29 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.73 2020/05/14 07:59:03 skrll Exp $");
#include "opt_arm_debug.h"
#include "opt_ddb.h"
@@ -503,32 +503,12 @@
void
pmap_init(void)
{
- struct vm_page *pg;
- struct vm_page_md *md;
- uvm_physseg_t i;
- paddr_t pfn;
pool_cache_bootstrap(&_pmap_cache, sizeof(struct pmap),
0, 0, 0, "pmappl", NULL, IPL_NONE, _pmap_pmap_ctor, NULL, NULL);
pool_cache_bootstrap(&_pmap_pv_pool, sizeof(struct pv_entry),
0, 0, 0, "pvpl", NULL, IPL_VM, _pmap_pv_ctor, NULL, NULL);
- /*
- * initialize mutex in vm_page_md at this time.
- * When LOCKDEBUG, mutex_init() calls km_alloc,
- * but VM_MDPAGE_INIT() is called before initialized kmem_vm_arena.
- */
- for (i = uvm_physseg_get_first();
- uvm_physseg_valid_p(i);
- i = uvm_physseg_get_next(i)) {
- for (pfn = uvm_physseg_get_start(i);
- pfn < uvm_physseg_get_end(i);
- pfn++) {
- pg = PHYS_TO_VM_PAGE(ptoa(pfn));
- md = VM_PAGE_TO_MD(pg);
- PMAP_PAGE_INIT(&md->mdpg_pp);
- }
- }
}
void
@@ -616,6 +596,9 @@
VM_PAGE_TO_MD(pg)->mdpg_ptep_parent = NULL;
+ struct pmap_page *pp = VM_PAGE_TO_PP(pg);
+ pp->pp_flags = 0;
+
} else {
/* uvm_pageboot_alloc() returns AARCH64 KSEG address */
pg = NULL;
@@ -638,7 +621,9 @@
LIST_REMOVE(pg, mdpage.mdpg_vmlist);
pg->flags |= PG_BUSY;
pg->wire_count = 0;
- VM_MDPAGE_INIT(pg);
+
+ struct pmap_page *pp = VM_PAGE_TO_PP(pg);
+ KASSERT(LIST_EMPTY(&pp->pp_pvhead));
uvm_pagefree(pg);
PMAP_COUNT(pdp_free);
diff -r 21cd3593b7a4 -r e37293ccc81c sys/arch/aarch64/include/pmap.h
--- a/sys/arch/aarch64/include/pmap.h Thu May 14 06:13:39 2020 +0000
+++ b/sys/arch/aarch64/include/pmap.h Thu May 14 07:59:03 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.h,v 1.38 2020/05/13 06:08:51 ryo Exp $ */
+/* $NetBSD: pmap.h,v 1.39 2020/05/14 07:59:03 skrll Exp $ */
/*-
* Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -101,16 +101,17 @@
struct pmap_page mdpg_pp;
};
-/* each mdpg_pp.pp_pvlock will be initialized in pmap_init() */
#define VM_MDPAGE_INIT(pg) \
do { \
- LIST_INIT(&(pg)->mdpage.mdpg_pp.pp_pvhead); \
- (pg)->mdpage.mdpg_pp.pp_flags = 0; \
+ (pg)->mdpage.mdpg_ptep_parent = NULL; \
+ PMAP_PAGE_INIT(&(pg)->mdpage.mdpg_pp); \
} while (/*CONSTCOND*/ 0)
#define PMAP_PAGE_INIT(pp) \
do { \
- mutex_init(&(pp)->pp_pvlock, MUTEX_SPIN, IPL_VM); \
+ mutex_init(&(pp)->pp_pvlock, MUTEX_NODEBUG, IPL_VM); \
+ LIST_INIT(&(pp)->pp_pvhead); \
+ (pp)->pp_flags = 0; \
} while (/*CONSTCOND*/ 0)
/* saved permission bit for referenced/modified emulation */
Home |
Main Index |
Thread Index |
Old Index