Fri Jan 29 07:00:28 2021 UTC ()
More debug


(skrll)
diff -r1.423 -r1.424 src/sys/arch/arm/arm32/pmap.c

cvs diff -r1.423 -r1.424 src/sys/arch/arm/arm32/pmap.c (expand / switch to unified diff)

--- src/sys/arch/arm/arm32/pmap.c 2021/01/24 14:51:01 1.423
+++ src/sys/arch/arm/arm32/pmap.c 2021/01/29 07:00:28 1.424
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: pmap.c,v 1.423 2021/01/24 14:51:01 skrll Exp $ */ 1/* $NetBSD: pmap.c,v 1.424 2021/01/29 07:00:28 skrll Exp $ */
2 2
3/* 3/*
4 * Copyright 2003 Wasabi Systems, Inc. 4 * Copyright 2003 Wasabi Systems, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Written by Steve C. Woodford for Wasabi Systems, Inc. 7 * Written by Steve C. Woodford for Wasabi Systems, Inc.
8 * 8 *
9 * Redistribution and use in source and binary forms, with or without 9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions 10 * modification, are permitted provided that the following conditions
11 * are met: 11 * are met:
12 * 1. Redistributions of source code must retain the above copyright 12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer. 13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright 14 * 2. Redistributions in binary form must reproduce the above copyright
@@ -182,27 +182,27 @@ @@ -182,27 +182,27 @@
182/* Include header files */ 182/* Include header files */
183 183
184#include "opt_arm_debug.h" 184#include "opt_arm_debug.h"
185#include "opt_cpuoptions.h" 185#include "opt_cpuoptions.h"
186#include "opt_ddb.h" 186#include "opt_ddb.h"
187#include "opt_lockdebug.h" 187#include "opt_lockdebug.h"
188#include "opt_multiprocessor.h" 188#include "opt_multiprocessor.h"
189 189
190#ifdef MULTIPROCESSOR 190#ifdef MULTIPROCESSOR
191#define _INTR_PRIVATE 191#define _INTR_PRIVATE
192#endif 192#endif
193 193
194#include <sys/cdefs.h> 194#include <sys/cdefs.h>
195__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.423 2021/01/24 14:51:01 skrll Exp $"); 195__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.424 2021/01/29 07:00:28 skrll Exp $");
196 196
197#include <sys/param.h> 197#include <sys/param.h>
198#include <sys/types.h> 198#include <sys/types.h>
199 199
200#include <sys/asan.h> 200#include <sys/asan.h>
201#include <sys/atomic.h> 201#include <sys/atomic.h>
202#include <sys/bus.h> 202#include <sys/bus.h>
203#include <sys/cpu.h> 203#include <sys/cpu.h>
204#include <sys/intr.h> 204#include <sys/intr.h>
205#include <sys/kernel.h> 205#include <sys/kernel.h>
206#include <sys/kernhist.h> 206#include <sys/kernhist.h>
207#include <sys/kmem.h> 207#include <sys/kmem.h>
208#include <sys/pool.h> 208#include <sys/pool.h>
@@ -4413,42 +4413,43 @@ pmap_fault_fixup(pmap_t pm, vaddr_t va,  @@ -4413,42 +4413,43 @@ pmap_fault_fixup(pmap_t pm, vaddr_t va,
4413 l2b = &l2->l2_bucket[L2_BUCKET(l1slot)]; 4413 l2b = &l2->l2_bucket[L2_BUCKET(l1slot)];
4414 if (l2b->l2b_kva == NULL) { 4414 if (l2b->l2b_kva == NULL) {
4415 UVMHIST_LOG(maphist, " <-- done (no ptep for l1slot %#jx)", 4415 UVMHIST_LOG(maphist, " <-- done (no ptep for l1slot %#jx)",
4416 l1slot, 0, 0, 0); 4416 l1slot, 0, 0, 0);
4417 goto out; 4417 goto out;
4418 } 4418 }
4419 4419
4420 /* 4420 /*
4421 * Check the PTE itself. 4421 * Check the PTE itself.
4422 */ 4422 */
4423 pt_entry_t * const ptep = &l2b->l2b_kva[l2pte_index(va)]; 4423 pt_entry_t * const ptep = &l2b->l2b_kva[l2pte_index(va)];
4424 pt_entry_t const opte = *ptep; 4424 pt_entry_t const opte = *ptep;
4425 if (opte == 0 || (opte & L2_TYPE_MASK) == L2_TYPE_L) { 4425 if (opte == 0 || (opte & L2_TYPE_MASK) == L2_TYPE_L) {
4426 UVMHIST_LOG(maphist, " <-- done (empty pde for l1slot %#jx)", 4426 UVMHIST_LOG(maphist, " <-- done (empty pte)",
4427 l1slot, 0, 0, 0); 4427 0, 0, 0, 0);
4428 goto out; 4428 goto out;
4429 } 4429 }
4430 4430
4431#ifndef ARM_HAS_VBAR 4431#ifndef ARM_HAS_VBAR
4432 /* 4432 /*
4433 * Catch a userland access to the vector page mapped at 0x0 4433 * Catch a userland access to the vector page mapped at 0x0
4434 */ 4434 */
4435 if (user && (opte & L2_S_PROT_U) == 0) { 4435 if (user && (opte & L2_S_PROT_U) == 0) {
4436 UVMHIST_LOG(maphist, " <-- done (vector_page)", 0, 0, 0, 0); 4436 UVMHIST_LOG(maphist, " <-- done (vector_page)", 0, 0, 0, 0);
4437 goto out; 4437 goto out;
4438 } 4438 }
4439#endif 4439#endif
4440 4440
4441 pa = l2pte_pa(opte); 4441 pa = l2pte_pa(opte);
 4442 UVMHIST_LOG(maphist, " pa %#jx opte %#jx ", pa, opte, 0, 0);
4442 4443
4443 if ((ftype & VM_PROT_WRITE) && !l2pte_writable_p(opte)) { 4444 if ((ftype & VM_PROT_WRITE) && !l2pte_writable_p(opte)) {
4444 /* 4445 /*
4445 * This looks like a good candidate for "page modified" 4446 * This looks like a good candidate for "page modified"
4446 * emulation... 4447 * emulation...
4447 */ 4448 */
4448 struct pv_entry *pv; 4449 struct pv_entry *pv;
4449 struct vm_page *pg; 4450 struct vm_page *pg;
4450 4451
4451 /* Extract the physical address of the page */ 4452 /* Extract the physical address of the page */
4452 if ((pg = PHYS_TO_VM_PAGE(pa)) == NULL) { 4453 if ((pg = PHYS_TO_VM_PAGE(pa)) == NULL) {
4453 UVMHIST_LOG(maphist, " <-- done (mod/ref unmanaged page)", 0, 0, 0, 0); 4454 UVMHIST_LOG(maphist, " <-- done (mod/ref unmanaged page)", 0, 0, 0, 0);
4454 goto out; 4455 goto out;
@@ -4464,26 +4465,27 @@ pmap_fault_fixup(pmap_t pm, vaddr_t va,  @@ -4464,26 +4465,27 @@ pmap_fault_fixup(pmap_t pm, vaddr_t va,
4464 UVMHIST_LOG(maphist, " <-- done (mod/ref emul: no PV)", 0, 0, 0, 0); 4465 UVMHIST_LOG(maphist, " <-- done (mod/ref emul: no PV)", 0, 0, 0, 0);
4465 goto out; 4466 goto out;
4466 } 4467 }
4467 4468
4468 /* 4469 /*
4469 * Do the flags say this page is writable? If not then it 4470 * Do the flags say this page is writable? If not then it
4470 * is a genuine write fault. If yes then the write fault is 4471 * is a genuine write fault. If yes then the write fault is
4471 * our fault as we did not reflect the write access in the 4472 * our fault as we did not reflect the write access in the
4472 * PTE. Now we know a write has occurred we can correct this 4473 * PTE. Now we know a write has occurred we can correct this
4473 * and also set the modified bit 4474 * and also set the modified bit
4474 */ 4475 */
4475 if ((pv->pv_flags & PVF_WRITE) == 0) { 4476 if ((pv->pv_flags & PVF_WRITE) == 0) {
4476 pmap_release_page_lock(md); 4477 pmap_release_page_lock(md);
 4478 UVMHIST_LOG(maphist, " <-- done (write fault)", 0, 0, 0, 0);
4477 goto out; 4479 goto out;
4478 } 4480 }
4479 4481
4480 md->pvh_attrs |= PVF_REF | PVF_MOD; 4482 md->pvh_attrs |= PVF_REF | PVF_MOD;
4481 pv->pv_flags |= PVF_REF | PVF_MOD; 4483 pv->pv_flags |= PVF_REF | PVF_MOD;
4482#if defined(PMAP_CACHE_VIPT) && !defined(ARM_MMU_EXTENDED) 4484#if defined(PMAP_CACHE_VIPT) && !defined(ARM_MMU_EXTENDED)
4483 /* 4485 /*
4484 * If there are cacheable mappings for this page, mark it dirty. 4486 * If there are cacheable mappings for this page, mark it dirty.
4485 */ 4487 */
4486 if ((md->pvh_attrs & PVF_NC) == 0) 4488 if ((md->pvh_attrs & PVF_NC) == 0)
4487 md->pvh_attrs |= PVF_DIRTY; 4489 md->pvh_attrs |= PVF_DIRTY;
4488#endif 4490#endif
4489#ifdef ARM_MMU_EXTENDED 4491#ifdef ARM_MMU_EXTENDED