Make trap counters per-cpu, like syscalls.

This commit is contained in:
ad 2008-06-01 21:24:15 +00:00
parent 42fe28f522
commit c3e93e738f
6 changed files with 21 additions and 14 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: trap.c,v 1.50 2008/05/30 12:17:11 ad Exp $ */
/* $NetBSD: trap.c,v 1.51 2008/06/01 21:25:16 ad Exp $ */
/*-
* Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@ -68,7 +68,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.50 2008/05/30 12:17:11 ad Exp $");
__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.51 2008/06/01 21:25:16 ad Exp $");
#include "opt_ddb.h"
#include "opt_kgdb.h"
@ -192,8 +192,6 @@ trap(struct trapframe *frame)
ksiginfo_t ksi;
bool pfail;
uvmexp.traps++;
if (__predict_true(l != NULL)) {
pcb = &l->l_addr->u_pcb;
p = l->l_proc;

View File

@ -1,4 +1,4 @@
/* $NetBSD: vector.S,v 1.26 2008/05/30 12:17:11 ad Exp $ */
/* $NetBSD: vector.S,v 1.27 2008/06/01 21:24:15 ad Exp $ */
/*-
* Copyright (c) 1998, 2007, 2008 The NetBSD Foundation, Inc.
@ -134,6 +134,7 @@ IDTVEC(trap02)
movw %es,TF_ES(%rsp)
movw %ds,TF_DS(%rsp)
movq %rsp,%rdi
incl CPUVAR(NTRAP)
call _C_LABEL(trap)
swapgs
movw TF_GS(%rsp),%gs
@ -143,6 +144,7 @@ IDTVEC(trap02)
jmp 2f
1:
movq %rsp,%rdi
incl CPUVAR(NTRAP)
call _C_LABEL(trap)
2:
INTR_RESTORE_GPRS
@ -283,6 +285,7 @@ calltrap:
movl CPUVAR(ILEVEL),%ebx
#endif /* DIAGNOSTIC */
movq %rsp,%rdi
incl CPUVAR(NTRAP)
call _C_LABEL(trap)
.Lalltraps_checkusr:
testb $SEL_RPL,TF_CS(%rsp)
@ -297,6 +300,7 @@ calltrap:
STI(si)
movl $T_ASTFLT,TF_TRAPNO(%rsp)
movq %rsp,%rdi
incl CPUVAR(NTRAP)
call _C_LABEL(trap)
jmp .Lalltraps_checkast /* re-check ASTs */
3: CHECK_DEFERRED_SWITCH

View File

@ -1,4 +1,4 @@
/* $NetBSD: trap.c,v 1.239 2008/05/30 10:38:21 ad Exp $ */
/* $NetBSD: trap.c,v 1.240 2008/06/01 21:25:16 ad Exp $ */
/*-
* Copyright (c) 1998, 2000, 2005, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@ -68,7 +68,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.239 2008/05/30 10:38:21 ad Exp $");
__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.240 2008/06/01 21:25:16 ad Exp $");
#include "opt_ddb.h"
#include "opt_kgdb.h"
@ -286,8 +286,6 @@ trap(frame)
uint32_t cr2;
bool pfail;
uvmexp.traps++;
if (__predict_true(l != NULL)) {
pcb = &l->l_addr->u_pcb;
p = l->l_proc;

View File

@ -1,4 +1,4 @@
/* $NetBSD: vector.S,v 1.38 2008/05/03 05:57:04 yamt Exp $ */
/* $NetBSD: vector.S,v 1.39 2008/06/01 21:24:15 ad Exp $ */
/*
* Copyright 2002 (c) Wasabi Systems, Inc.
@ -65,7 +65,7 @@
*/
#include <machine/asm.h>
__KERNEL_RCSID(0, "$NetBSD: vector.S,v 1.38 2008/05/03 05:57:04 yamt Exp $");
__KERNEL_RCSID(0, "$NetBSD: vector.S,v 1.39 2008/06/01 21:24:15 ad Exp $");
#include "opt_ddb.h"
#include "opt_multiprocessor.h"
@ -919,6 +919,7 @@ IDTVEC(trap0e)
pushl %eax
movl %esp,%eax
addl $4,%eax
incl CPUVAR(NTRAP)
pushl %eax
call _C_LABEL(trap)
addl $8,%esp
@ -940,6 +941,7 @@ trap0e_checkast:
5: CLEAR_ASTPENDING(%eax)
STI(%eax)
movl $T_ASTFLT,TF_TRAPNO(%esp)
incl CPUVAR(NTRAP)
pushl %esp
call _C_LABEL(trap)
addl $4,%esp
@ -1095,6 +1097,7 @@ calltrap:
#ifdef DIAGNOSTIC
movl CPUVAR(ILEVEL),%ebx
#endif /* DIAGNOSTIC */
incl CPUVAR(NTRAP)
pushl %esp
call _C_LABEL(trap)
addl $4,%esp
@ -1115,6 +1118,7 @@ calltrap:
5: CLEAR_ASTPENDING(%eax)
STI(%eax)
movl $T_ASTFLT,TF_TRAPNO(%esp)
incl CPUVAR(NTRAP)
pushl %esp
call _C_LABEL(trap)
addl $4,%esp

View File

@ -1,4 +1,4 @@
/* $NetBSD: kern_clock.c,v 1.123 2008/05/19 17:06:02 ad Exp $ */
/* $NetBSD: kern_clock.c,v 1.124 2008/06/01 21:24:15 ad Exp $ */
/*-
* Copyright (c) 2000, 2004, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@ -69,7 +69,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: kern_clock.c,v 1.123 2008/05/19 17:06:02 ad Exp $");
__KERNEL_RCSID(0, "$NetBSD: kern_clock.c,v 1.124 2008/06/01 21:24:15 ad Exp $");
#include "opt_ntp.h"
#include "opt_perfctrs.h"
@ -328,6 +328,8 @@ schedclock(struct lwp *l)
ci->ci_data.cpu_nswtch = 0;
atomic_add_int((unsigned *)&uvmexp.syscalls, ci->ci_data.cpu_nsyscall);
ci->ci_data.cpu_nsyscall = 0;
atomic_add_int((unsigned *)&uvmexp.traps, ci->ci_data.cpu_ntrap);
ci->ci_data.cpu_ntrap = 0;
if ((l->l_flag & LW_IDLE) != 0)
return;

View File

@ -1,4 +1,4 @@
/* $NetBSD: cpu_data.h,v 1.25 2008/05/10 14:56:13 ad Exp $ */
/* $NetBSD: cpu_data.h,v 1.26 2008/06/01 21:24:15 ad Exp $ */
/*-
* Copyright (c) 2004, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@ -84,6 +84,7 @@ struct cpu_data {
u_int cpu_lkdebug_recurse; /* LOCKDEBUG recursion */
u_int cpu_softints; /* pending (slow) softints */
u_int cpu_nsyscall; /* syscall counter */
u_int cpu_ntrap; /* trap counter */
u_int cpu_nswtch; /* context switch counter */
void *cpu_softcpu; /* soft interrupt table */
TAILQ_HEAD(,buf) cpu_biodone; /* finished block xfers */