convert sparc "intrcnt" counters to evcnt(9) style. XXX some of the names

could be better, but i just copied them from the old intrnames in locore.

i benchmarked this with a simple test of ircii ./configure && make, to see
if the additional load/store & arith would cause any noticeable degradation
as the change also converts 32 bit counters to 64 bits.  amusingly, the
only trend i saw in this was that for both portions, i see a consistent
(across at least 8 runs) benefit of about 0.8% improvement.  ie, the newer
larger code size / counter size code actually runs faster for some reason..
maybe there's a cacheline effect in the size of the code?


XXX the current implementation depends on a couple of things:
XXX   - ev_count member of evcnt{} is first and has offset 0
XXX   - that sizeof(struct evcnt) equals 32
XXX if these are not true, locore.s has #error's to catch it
This commit is contained in:
mrg 2009-06-05 01:36:07 +00:00
parent 4c8893bb2f
commit 8d43cfc54d
3 changed files with 65 additions and 41 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: genassym.cf,v 1.56 2008/09/20 18:29:05 tsutsui Exp $
# $NetBSD: genassym.cf,v 1.57 2009/06/05 01:36:07 mrg Exp $
#
# Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -129,6 +129,7 @@ define V_INTR offsetof(struct uvmexp, intrs)
define V_SOFT offsetof(struct uvmexp, softs)
define V_FAULTS offsetof(struct uvmexp, faults)
define EV_COUNT offsetof(struct evcnt, ev_count)
define EV_STRUCTSIZE sizeof(struct evcnt)
# CPU info structure
define CPUINFO_STRUCTSIZE sizeof(struct cpu_info)

View File

@ -1,4 +1,4 @@
/* $NetBSD: intr.c,v 1.104 2009/05/27 02:19:50 mrg Exp $ */
/* $NetBSD: intr.c,v 1.105 2009/06/05 01:36:07 mrg Exp $ */
/*
* Copyright (c) 1992, 1993
@ -41,7 +41,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.104 2009/05/27 02:19:50 mrg Exp $");
__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.105 2009/06/05 01:36:07 mrg Exp $");
#include "opt_multiprocessor.h"
#include "opt_sparc_arch.h"
@ -80,6 +80,39 @@ EVCNT_ATTACH_STATIC(lev13_evcnt);
EVCNT_ATTACH_STATIC(lev14_evcnt);
#endif
struct evcnt intrcnt[15] = {
EVCNT_INITIALIZER(EVCNT_TYPE_INTR, 0, "spur", "hard"),
EVCNT_INITIALIZER(EVCNT_TYPE_INTR, 0, "lev1", "hard"),
EVCNT_INITIALIZER(EVCNT_TYPE_INTR, 0, "lev2", "hard"),
EVCNT_INITIALIZER(EVCNT_TYPE_INTR, 0, "lev3", "hard"),
EVCNT_INITIALIZER(EVCNT_TYPE_INTR, 0, "lev4", "hard"),
EVCNT_INITIALIZER(EVCNT_TYPE_INTR, 0, "lev5", "hard"),
EVCNT_INITIALIZER(EVCNT_TYPE_INTR, 0, "lev6", "hard"),
EVCNT_INITIALIZER(EVCNT_TYPE_INTR, 0, "lev7", "hard"),
EVCNT_INITIALIZER(EVCNT_TYPE_INTR, 0, "lev8", "hard"),
EVCNT_INITIALIZER(EVCNT_TYPE_INTR, 0, "lev9", "hard"),
EVCNT_INITIALIZER(EVCNT_TYPE_INTR, 0, "clock", "hard"),
EVCNT_INITIALIZER(EVCNT_TYPE_INTR, 0, "lev11", "hard"),
EVCNT_INITIALIZER(EVCNT_TYPE_INTR, 0, "lev12", "hard"),
EVCNT_INITIALIZER(EVCNT_TYPE_INTR, 0, "lev13", "hard"),
EVCNT_INITIALIZER(EVCNT_TYPE_INTR, 0, "prof", "hard"),
};
EVCNT_ATTACH_STATIC2(intrcnt, 0);
EVCNT_ATTACH_STATIC2(intrcnt, 1);
EVCNT_ATTACH_STATIC2(intrcnt, 2);
EVCNT_ATTACH_STATIC2(intrcnt, 3);
EVCNT_ATTACH_STATIC2(intrcnt, 4);
EVCNT_ATTACH_STATIC2(intrcnt, 5);
EVCNT_ATTACH_STATIC2(intrcnt, 6);
EVCNT_ATTACH_STATIC2(intrcnt, 7);
EVCNT_ATTACH_STATIC2(intrcnt, 8);
EVCNT_ATTACH_STATIC2(intrcnt, 9);
EVCNT_ATTACH_STATIC2(intrcnt, 10);
EVCNT_ATTACH_STATIC2(intrcnt, 11);
EVCNT_ATTACH_STATIC2(intrcnt, 12);
EVCNT_ATTACH_STATIC2(intrcnt, 13);
EVCNT_ATTACH_STATIC2(intrcnt, 14);
void strayintr(struct clockframe *);
#ifdef DIAGNOSTIC

View File

@ -1,4 +1,4 @@
/* $NetBSD: locore.s,v 1.246 2009/05/29 22:06:55 mrg Exp $ */
/* $NetBSD: locore.s,v 1.247 2009/06/05 01:36:07 mrg Exp $ */
/*
* Copyright (c) 1996 Paul Kranenburg
@ -118,6 +118,15 @@ BARF
inc %o1; \
st %o1, [%o0 + %lo(what)]
#if EV_COUNT != 0
# error "this code does not work with EV_COUNT != 0"
#endif
#if EV_STRUCTSIZE != 32
# error "this code does not work with EV_STRUCTSIZE != 32"
#else
# define EV_STRUCTSHIFT 5
#endif
/*
* Another handy macro: load one register window, given `base' address.
* This can be either a simple register (e.g., %sp) or include an initial
@ -2518,11 +2527,13 @@ softintr_common:
wr %l4, PSR_ET, %psr ! song and dance is necessary
std %l0, [%sp + CCFSZ + 0] ! set up intrframe/clockframe
sll %l3, 2, %l5
set _C_LABEL(intrcnt), %l4 ! intrcnt[intlev]++;
ld [%l4 + %l5], %o0
set intrcnt, %l4 ! intrcnt[intlev].ev_count++;
sll %l3, EV_STRUCTSHIFT, %o2
ldd [%l4 + %o2], %o0
std %l2, [%sp + CCFSZ + 8]
inc %o0
st %o0, [%l4 + %l5]
inccc %o1
addx %o0, 0, %o0
std %o0, [%l4 + %o2]
set _C_LABEL(sintrhand), %l4! %l4 = sintrhand[intlev];
ld [%l4 + %l5], %l4
@ -2670,11 +2681,13 @@ sparc_interrupt4m_bogus:
wr %l4, PSR_ET, %psr ! song and dance is necessary
std %l0, [%sp + CCFSZ + 0] ! set up intrframe/clockframe
sll %l3, 2, %l5
set _C_LABEL(intrcnt), %l4 ! intrcnt[intlev]++;
ld [%l4 + %l5], %o0
set intrcnt, %l4 ! intrcnt[intlev].ev_count++;
sll %l3, EV_STRUCTSHIFT, %o2
ldd [%l4 + %o2], %o0
std %l2, [%sp + CCFSZ + 8] ! set up intrframe/clockframe
inc %o0
st %o0, [%l4 + %l5]
inccc %o1
addx %o0, 0, %o0
std %o0, [%l4 + %o2]
st %fp, [%sp + CCFSZ + 16]
@ -2715,11 +2728,13 @@ sparc_interrupt_common:
wr %l4, PSR_ET, %psr ! song and dance is necessary
std %l0, [%sp + CCFSZ + 0] ! set up intrframe/clockframe
sll %l3, 2, %l5
set _C_LABEL(intrcnt), %l4 ! intrcnt[intlev]++;
ld [%l4 + %l5], %o0
set intrcnt, %l4 ! intrcnt[intlev].ev_count++;
sll %l3, EV_STRUCTSHIFT, %o2
ldd [%l4 + %o2], %o0
std %l2, [%sp + CCFSZ + 8] ! set up intrframe/clockframe
inc %o0
st %o0, [%l4 + %l5]
inccc %o1
addx %o0, 0, %o0
std %o0, [%l4 + %o2]
set _C_LABEL(intrhand), %l4 ! %l4 = intrhand[intlev];
ld [%l4 + %l5], %l4
@ -6320,30 +6335,5 @@ _C_LABEL(bootinfo):
_C_LABEL(proc0paddr):
.word _C_LABEL(u0) ! KVA of proc0 uarea
/* interrupt counters XXX THESE BELONG ELSEWHERE (if anywhere) */
.globl _C_LABEL(intrcnt), _C_LABEL(eintrcnt)
.globl _C_LABEL(intrnames), _C_LABEL(eintrnames)
_C_LABEL(intrnames):
.asciz "spur"
.asciz "lev1"
.asciz "lev2"
.asciz "lev3"
.asciz "lev4"
.asciz "lev5"
.asciz "lev6"
.asciz "lev7"
.asciz "lev8"
.asciz "lev9"
.asciz "clock"
.asciz "lev11"
.asciz "lev12"
.asciz "lev13"
.asciz "prof"
_C_LABEL(eintrnames):
_ALIGN
_C_LABEL(intrcnt):
.skip 4*15
_C_LABEL(eintrcnt):
.comm _C_LABEL(nwindows), 4
.comm _C_LABEL(romp), 4