Module Name:    src
Committed By:   macallan
Date:           Wed Jul 20 12:06:00 UTC 2011

Modified Files:
        src/sys/arch/sparc64/dev: ebus.c psycho.c sbus.c schizo.c
        src/sys/arch/sparc64/include: cpu.h
        src/sys/arch/sparc64/sparc64: genassym.cf intr.c locore.s

Log Message:
add per ivec event counters


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/sys/arch/sparc64/dev/ebus.c
cvs rdiff -u -r1.108 -r1.109 src/sys/arch/sparc64/dev/psycho.c
cvs rdiff -u -r1.88 -r1.89 src/sys/arch/sparc64/dev/sbus.c
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/sparc64/dev/schizo.c
cvs rdiff -u -r1.96 -r1.97 src/sys/arch/sparc64/include/cpu.h
cvs rdiff -u -r1.65 -r1.66 src/sys/arch/sparc64/sparc64/genassym.cf
cvs rdiff -u -r1.63 -r1.64 src/sys/arch/sparc64/sparc64/intr.c
cvs rdiff -u -r1.335 -r1.336 src/sys/arch/sparc64/sparc64/locore.s

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/sparc64/dev/ebus.c
diff -u src/sys/arch/sparc64/dev/ebus.c:1.58 src/sys/arch/sparc64/dev/ebus.c:1.59
--- src/sys/arch/sparc64/dev/ebus.c:1.58	Fri Jul  1 18:48:36 2011
+++ src/sys/arch/sparc64/dev/ebus.c	Wed Jul 20 12:06:00 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: ebus.c,v 1.58 2011/07/01 18:48:36 dyoung Exp $	*/
+/*	$NetBSD: ebus.c,v 1.59 2011/07/20 12:06:00 macallan Exp $	*/
 
 /*
  * Copyright (c) 1999, 2000, 2001 Matthew R. Green
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ebus.c,v 1.58 2011/07/01 18:48:36 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ebus.c,v 1.59 2011/07/20 12:06:00 macallan Exp $");
 
 #include "opt_ddb.h"
 
@@ -285,7 +285,7 @@
 		    ea->ea_reg[i].lo,
 		    ea->ea_reg[i].lo + ea->ea_reg[i].size - 1);
 	for (i = 0; i < ea->ea_nintr; i++)
-		aprint_normal(" ipl %d", ea->ea_intr[i]);
+		aprint_normal(" ipl %x", ea->ea_intr[i]);
 	return (UNCONF);
 }
 

Index: src/sys/arch/sparc64/dev/psycho.c
diff -u src/sys/arch/sparc64/dev/psycho.c:1.108 src/sys/arch/sparc64/dev/psycho.c:1.109
--- src/sys/arch/sparc64/dev/psycho.c:1.108	Fri Jul  1 18:48:37 2011
+++ src/sys/arch/sparc64/dev/psycho.c	Wed Jul 20 12:06:00 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: psycho.c,v 1.108 2011/07/01 18:48:37 dyoung Exp $	*/
+/*	$NetBSD: psycho.c,v 1.109 2011/07/20 12:06:00 macallan Exp $	*/
 
 /*
  * Copyright (c) 1999, 2000 Matthew R. Green
@@ -55,7 +55,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: psycho.c,v 1.108 2011/07/01 18:48:37 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: psycho.c,v 1.109 2011/07/20 12:06:00 macallan Exp $");
 
 #include "opt_ddb.h"
 
@@ -1228,6 +1228,8 @@
 	if (ih == NULL)
 		return (NULL);
 
+	ih->ih_ivec = ihandle;
+
 	/*
 	 * Hunt through all the interrupt mapping regs to look for our
 	 * interrupt vector.

Index: src/sys/arch/sparc64/dev/sbus.c
diff -u src/sys/arch/sparc64/dev/sbus.c:1.88 src/sys/arch/sparc64/dev/sbus.c:1.89
--- src/sys/arch/sparc64/dev/sbus.c:1.88	Fri Jul  1 18:48:37 2011
+++ src/sys/arch/sparc64/dev/sbus.c	Wed Jul 20 12:06:00 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: sbus.c,v 1.88 2011/07/01 18:48:37 dyoung Exp $ */
+/*	$NetBSD: sbus.c,v 1.89 2011/07/20 12:06:00 macallan Exp $ */
 
 /*
  * Copyright (c) 1999-2002 Eduardo Horvath
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sbus.c,v 1.88 2011/07/01 18:48:37 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sbus.c,v 1.89 2011/07/20 12:06:00 macallan Exp $");
 
 #include "opt_ddb.h"
 
@@ -578,6 +578,7 @@
 	ih->ih_fun = handler;
 	ih->ih_arg = arg;
 	ih->ih_number = vec;
+	ih->ih_ivec = 0;
 	ih->ih_pil = (1<<ipl);
 	intr_establish(ipl, level != IPL_VM, ih);
 	return (ih);

Index: src/sys/arch/sparc64/dev/schizo.c
diff -u src/sys/arch/sparc64/dev/schizo.c:1.24 src/sys/arch/sparc64/dev/schizo.c:1.25
--- src/sys/arch/sparc64/dev/schizo.c:1.24	Wed Jul 20 10:39:43 2011
+++ src/sys/arch/sparc64/dev/schizo.c	Wed Jul 20 12:06:00 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: schizo.c,v 1.24 2011/07/20 10:39:43 macallan Exp $	*/
+/*	$NetBSD: schizo.c,v 1.25 2011/07/20 12:06:00 macallan Exp $	*/
 /*	$OpenBSD: schizo.c,v 1.55 2008/08/18 20:29:37 brad Exp $	*/
 
 /*
@@ -768,6 +768,8 @@
 	DPRINTF(SDB_INTR, ("%s: intr %x: %p mapoff %" PRIx64 " clroff %"
 	    PRIx64 "\n", __func__, ino, intrlev[ino], mapoff, clroff));
 
+	ih->ih_ivec = ihandle;
+
 	intrregs = (uintptr_t)bus_space_vaddr(pbm->sp_regt, pbm->sp_intrh);
 	intrmapptr = (uint64_t *)(uintptr_t)(intrregs + mapoff);
 	intrclrptr = (uint64_t *)(uintptr_t)(intrregs + clroff);

Index: src/sys/arch/sparc64/include/cpu.h
diff -u src/sys/arch/sparc64/include/cpu.h:1.96 src/sys/arch/sparc64/include/cpu.h:1.97
--- src/sys/arch/sparc64/include/cpu.h:1.96	Wed Apr 13 03:40:00 2011
+++ src/sys/arch/sparc64/include/cpu.h	Wed Jul 20 12:06:00 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.h,v 1.96 2011/04/13 03:40:00 mrg Exp $ */
+/*	$NetBSD: cpu.h,v 1.97 2011/07/20 12:06:00 macallan Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -331,6 +331,9 @@
 	struct intrhand		*ih_pending;	/* interrupt queued */
 	volatile uint64_t	*ih_map;	/* Interrupt map reg */
 	volatile uint64_t	*ih_clr;	/* clear interrupt reg */
+	struct evcnt		ih_cnt;		/* counter for vmstat */
+	uint32_t		ih_ivec;
+	char			ih_name[32];	/* name for the above */
 };
 extern struct intrhand *intrhand[];
 extern struct intrhand *intrlev[MAXINTNUM];

Index: src/sys/arch/sparc64/sparc64/genassym.cf
diff -u src/sys/arch/sparc64/sparc64/genassym.cf:1.65 src/sys/arch/sparc64/sparc64/genassym.cf:1.66
--- src/sys/arch/sparc64/sparc64/genassym.cf:1.65	Sat Jun 18 18:51:18 2011
+++ src/sys/arch/sparc64/sparc64/genassym.cf	Wed Jul 20 12:06:00 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: genassym.cf,v 1.65 2011/06/18 18:51:18 nakayama Exp $
+#	$NetBSD: genassym.cf,v 1.66 2011/07/20 12:06:00 macallan Exp $
 
 #
 # Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -246,6 +246,7 @@
 define	IH_NEXT		offsetof(struct intrhand, ih_next)
 define	IH_MAP		offsetof(struct intrhand, ih_map)
 define	IH_CLR		offsetof(struct intrhand, ih_clr)
+define  IH_CNT		offsetof(struct intrhand, ih_cnt)
 	
 # mbuf fields of import
 define	M_NEXT		offsetof(struct mbuf, m_next)

Index: src/sys/arch/sparc64/sparc64/intr.c
diff -u src/sys/arch/sparc64/sparc64/intr.c:1.63 src/sys/arch/sparc64/sparc64/intr.c:1.64
--- src/sys/arch/sparc64/sparc64/intr.c:1.63	Sat Jun 18 18:51:18 2011
+++ src/sys/arch/sparc64/sparc64/intr.c	Wed Jul 20 12:06:00 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: intr.c,v 1.63 2011/06/18 18:51:18 nakayama Exp $ */
+/*	$NetBSD: intr.c,v 1.64 2011/07/20 12:06:00 macallan Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -41,7 +41,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.63 2011/06/18 18:51:18 nakayama Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.64 2011/07/20 12:06:00 macallan Exp $");
 
 #include "opt_ddb.h"
 #include "opt_multiprocessor.h"
@@ -69,6 +69,8 @@
 void	strayintr(const struct trapframe64 *, int);
 int	intr_list_handler(void *);
 
+extern struct evcnt intr_evcnts[];
+
 /*
  * Stray interrupt handler.  Clear it if possible.
  * If not, and if we get 10 interrupts in 10 seconds, panic.
@@ -175,6 +177,20 @@
 	ih->ih_pil = level; /* XXXX caller should have done this before */
 	ih->ih_pending = 0; /* XXXX caller should have done this before */
 	ih->ih_next = NULL;
+#ifdef DEBUG
+	printf("%s: level %x ivec %x\n", __func__, level, ih->ih_ivec);
+#endif
+	/*
+	 * no need for a separate counter if ivec == 0, in that case there's
+	 * either only one device using the interrupt level and there's already
+	 * a counter for it or it's something special like psycho's error
+	 * interrupts
+	 */
+	if (ih->ih_ivec != 0) {
+		snprintf(ih->ih_name, sizeof(ih->ih_name), "%x", ih->ih_ivec);
+		evcnt_attach_dynamic(&ih->ih_cnt, EVCNT_TYPE_INTR,
+		    &intr_evcnts[level], "ivec", ih->ih_name);
+	}
 
 #ifdef MULTIPROCESSOR
 	if (!mpsafe) {

Index: src/sys/arch/sparc64/sparc64/locore.s
diff -u src/sys/arch/sparc64/sparc64/locore.s:1.335 src/sys/arch/sparc64/sparc64/locore.s:1.336
--- src/sys/arch/sparc64/sparc64/locore.s:1.335	Tue Jul 12 07:51:34 2011
+++ src/sys/arch/sparc64/sparc64/locore.s	Wed Jul 20 12:06:00 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.s,v 1.335 2011/07/12 07:51:34 mrg Exp $	*/
+/*	$NetBSD: locore.s,v 1.336 2011/07/20 12:06:00 macallan Exp $	*/
 
 /*
  * Copyright (c) 2006-2010 Matthew R. Green
@@ -3452,6 +3452,11 @@
 	 add	%l5, %o0, %l5
 	stx	%g0, [%l1]		! Clear intr source
 	membar	#Sync			! Should not be needed
+
+	! increment per-ivec counter
+	ldx	[%l2 + IH_CNT], %l1
+	add	%l1, 1, %l1
+	stx	%l1, [%l2 + IH_CNT] 
 0:
 	cmp	%l7, -1
 	bne,pn	CCCR, 2b		! 'Nother?

Reply via email to