Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/arm/arm32 Only do UVMHIST_LOG is maphist have its e...
details: https://anonhg.NetBSD.org/src/rev/f7c9405d4030
branches: trunk
changeset: 327332:f7c9405d4030
user: matt <matt%NetBSD.org@localhost>
date: Wed Mar 05 02:10:39 2014 +0000
description:
Only do UVMHIST_LOG is maphist have its entry buffer initialized
diffstat:
sys/arch/arm/arm32/fault.c | 74 ++++++++++++++++++++++++++++++++++++---------
1 files changed, 58 insertions(+), 16 deletions(-)
diffs (155 lines):
diff -r 2f9d9c0f66ea -r f7c9405d4030 sys/arch/arm/arm32/fault.c
--- a/sys/arch/arm/arm32/fault.c Wed Mar 05 02:00:24 2014 +0000
+++ b/sys/arch/arm/arm32/fault.c Wed Mar 05 02:10:39 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fault.c,v 1.96 2014/02/26 07:48:29 skrll Exp $ */
+/* $NetBSD: fault.c,v 1.97 2014/03/05 02:10:39 matt Exp $ */
/*
* Copyright 2003 Wasabi Systems, Inc.
@@ -81,7 +81,7 @@
#include "opt_kgdb.h"
#include <sys/types.h>
-__KERNEL_RCSID(0, "$NetBSD: fault.c,v 1.96 2014/02/26 07:48:29 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fault.c,v 1.97 2014/03/05 02:10:39 matt Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -242,7 +242,12 @@
int error;
ksiginfo_t ksi;
- UVMHIST_FUNC(__func__); UVMHIST_CALLED(maphist);
+ UVMHIST_FUNC(__func__);
+#ifdef UVMHIST
+ if (__predict_true(maphist.e)) {
+ UVMHIST_CALLED(maphist);
+ }
+#endif
/* Grab FAR/FSR before enabling interrupts */
far = cpu_faultaddress();
@@ -258,10 +263,14 @@
/* Get the current lwp structure */
- UVMHIST_LOG(maphist, " (l=%#x, far=%#x, fsr=%#x",
- l, far, fsr, 0);
- UVMHIST_LOG(maphist, " tf=%#x, pc=%#x)",
- tf, tf->tf_pc, 0, 0);
+#ifdef UVMHIST
+ if (__predict_true(maphist.e)) {
+ UVMHIST_LOG(maphist, " (l=%#x, far=%#x, fsr=%#x",
+ l, far, fsr, 0);
+ UVMHIST_LOG(maphist, " tf=%#x, pc=%#x)",
+ tf, tf->tf_pc, 0, 0);
+ }
+#endif
/* Data abort came from user mode? */
bool user = (TRAP_USERMODE(tf) != 0);
@@ -461,7 +470,11 @@
last_fault_code = fsr;
#endif
if (pmap_fault_fixup(map->pmap, va, ftype, user)) {
- UVMHIST_LOG(maphist, " <- ref/mod emul", 0, 0, 0, 0);
+#ifdef UVMHIST
+ if (__predict_true(maphist.e)) {
+ UVMHIST_LOG(maphist, " <- ref/mod emul", 0, 0, 0, 0);
+ }
+#endif
goto out;
}
@@ -485,7 +498,11 @@
uvm_grow(l->l_proc, va); /* Record any stack growth */
else
ucas_ras_check(tf);
- UVMHIST_LOG(maphist, " <- uvm", 0, 0, 0, 0);
+#ifdef UVMHIST
+ if (__predict_true(maphist.e)) {
+ UVMHIST_LOG(maphist, " <- uvm", 0, 0, 0, 0);
+ }
+#endif
goto out;
}
@@ -514,7 +531,11 @@
ksi.ksi_code = (error == EACCES) ? SEGV_ACCERR : SEGV_MAPERR;
ksi.ksi_addr = (uint32_t *)(intptr_t) far;
ksi.ksi_trap = fsr;
- UVMHIST_LOG(maphist, " <- error (%d)", error, 0, 0, 0);
+#ifdef UVMHIST
+ if (__predict_true(maphist.e)) {
+ UVMHIST_LOG(maphist, " <- error (%d)", error, 0, 0, 0);
+ }
+#endif
do_trapsignal:
call_trapsignal(l, tf, &ksi);
@@ -782,7 +803,12 @@
ksiginfo_t ksi;
int error, user;
- UVMHIST_FUNC(__func__); UVMHIST_CALLED(maphist);
+ UVMHIST_FUNC(__func__);
+#ifdef UVMHIST
+ if (__predict_true(maphist.e)) {
+ UVMHIST_CALLED(maphist);
+ }
+#endif
/* Update vmmeter statistics */
curcpu()->ci_data.cpu_ntrap++;
@@ -826,8 +852,12 @@
/* Get fault address */
fault_pc = tf->tf_pc;
lwp_settrapframe(l, tf);
- UVMHIST_LOG(maphist, " (pc=0x%x, l=0x%x, tf=0x%x)", fault_pc, l, tf,
- 0);
+#ifdef UVMHIST
+ if (__predict_true(maphist.e)) {
+ UVMHIST_LOG(maphist, " (pc=0x%x, l=0x%x, tf=0x%x)",
+ fault_pc, l, tf, 0);
+ }
+#endif
/* Ok validate the address, can only execute in USER space */
if (__predict_false(fault_pc >= VM_MAXUSER_ADDRESS ||
@@ -850,7 +880,11 @@
last_fault_code = -1;
#endif
if (pmap_fault_fixup(map->pmap, va, VM_PROT_READ|VM_PROT_EXECUTE, 1)) {
- UVMHIST_LOG (maphist, " <- emulated", 0, 0, 0, 0);
+#ifdef UVMHIST
+ if (__predict_true(maphist.e)) {
+ UVMHIST_LOG (maphist, " <- emulated", 0, 0, 0, 0);
+ }
+#endif
goto out;
}
@@ -865,12 +899,20 @@
error = uvm_fault(map, va, VM_PROT_READ);
if (__predict_true(error == 0)) {
- UVMHIST_LOG (maphist, " <- uvm", 0, 0, 0, 0);
+#ifdef UVMHIST
+ if (__predict_true(maphist.e)) {
+ UVMHIST_LOG (maphist, " <- uvm", 0, 0, 0, 0);
+ }
+#endif
goto out;
}
KSI_INIT_TRAP(&ksi);
- UVMHIST_LOG (maphist, " <- fatal (%d)", error, 0, 0, 0);
+#ifdef UVMHIST
+ if (__predict_true(maphist.e)) {
+ UVMHIST_LOG (maphist, " <- fatal (%d)", error, 0, 0, 0);
+ }
+#endif
if (error == ENOMEM) {
printf("UVM: pid %d (%s), uid %d killed: "
"out of swap\n", l->l_proc->p_pid, l->l_proc->p_comm,
Home |
Main Index |
Thread Index |
Old Index