Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/alpha Switch to the new `evcnt' mechanism for count...
details: https://anonhg.NetBSD.org/src/rev/3f58aff8e46b
branches: trunk
changeset: 487284:3f58aff8e46b
user: thorpej <thorpej%NetBSD.org@localhost>
date: Mon Jun 05 21:47:10 2000 +0000
description:
Switch to the new `evcnt' mechanism for counting interrupts. Maintain
a per-CPU interrupt counter for clock, device, and interprocessor
interrupts.
diffstat:
sys/arch/alpha/alpha/clock.c | 8 +--
sys/arch/alpha/alpha/cpu.c | 59 +++++++++++++++++++--------
sys/arch/alpha/alpha/interrupt.c | 29 +++++++-----
sys/arch/alpha/alpha/ipifuncs.c | 12 +++--
sys/arch/alpha/alpha/locore.s | 24 ++--------
sys/arch/alpha/alpha/machdep.c | 14 +-----
sys/arch/alpha/alpha/pmap.c | 6 +-
sys/arch/alpha/common/shared_intr.c | 32 +++++++++++++-
sys/arch/alpha/include/Makefile | 4 +-
sys/arch/alpha/include/autoconf.h | 6 +--
sys/arch/alpha/include/cpu.h | 4 +-
sys/arch/alpha/include/cpuvar.h | 46 +++++++++++++++++++++
sys/arch/alpha/include/intr.h | 21 ++++++++-
sys/arch/alpha/include/intrcnt.h | 79 -------------------------------------
sys/arch/alpha/pci/a12c.c | 10 +---
sys/arch/alpha/pci/dwlpx.c | 8 +--
sys/arch/alpha/pci/mcpcia.c | 12 +----
sys/arch/alpha/pci/pci_1000.c | 36 ++++++++++------
sys/arch/alpha/pci/pci_1000a.c | 34 +++++++++------
sys/arch/alpha/pci/pci_2100_a50.c | 5 +-
sys/arch/alpha/pci/pci_550.c | 34 ++++++---------
sys/arch/alpha/pci/pci_550.h | 6 +--
sys/arch/alpha/pci/pci_6600.c | 28 +++++++-----
sys/arch/alpha/pci/pci_a12.c | 35 ++++------------
sys/arch/alpha/pci/pci_a12.h | 6 +--
sys/arch/alpha/pci/pci_alphabook1.c | 5 +-
sys/arch/alpha/pci/pci_axppci_33.c | 5 +-
sys/arch/alpha/pci/pci_eb164.c | 33 ++++++---------
sys/arch/alpha/pci/pci_eb164.h | 6 +--
sys/arch/alpha/pci/pci_eb64plus.c | 36 +++++++---------
30 files changed, 302 insertions(+), 341 deletions(-)
diffs (truncated from 1769 to 300 lines):
diff -r e45234026e88 -r 3f58aff8e46b sys/arch/alpha/alpha/clock.c
--- a/sys/arch/alpha/alpha/clock.c Mon Jun 05 21:40:34 2000 +0000
+++ b/sys/arch/alpha/alpha/clock.c Mon Jun 05 21:47:10 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: clock.c,v 1.28 2000/06/04 19:14:18 cgd Exp $ */
+/* $NetBSD: clock.c,v 1.29 2000/06/05 21:47:10 thorpej Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@@ -44,7 +44,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.28 2000/06/04 19:14:18 cgd Exp $");
+__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.29 2000/06/05 21:47:10 thorpej Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@@ -99,10 +99,6 @@
panic("clockattach: multiple clocks");
clockdev = dev;
clockfns = fns;
-#ifdef EVCNT_COUNTERS
- evcnt_attach_dynamic(&clock_intr_evcnt, EVCNT_TYPE_INTR, NULL,
- dev->dv_xname, "intr");
-#endif
}
/*
diff -r e45234026e88 -r 3f58aff8e46b sys/arch/alpha/alpha/cpu.c
--- a/sys/arch/alpha/alpha/cpu.c Mon Jun 05 21:40:34 2000 +0000
+++ b/sys/arch/alpha/alpha/cpu.c Mon Jun 05 21:47:10 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.c,v 1.49 2000/06/03 14:13:42 thorpej Exp $ */
+/* $NetBSD: cpu.c,v 1.50 2000/06/05 21:47:11 thorpej Exp $ */
/*-
* Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.49 2000/06/03 14:13:42 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.50 2000/06/05 21:47:11 thorpej Exp $");
#include "opt_multiprocessor.h"
@@ -81,6 +81,7 @@
#include <machine/atomic.h>
#include <machine/autoconf.h>
#include <machine/cpu.h>
+#include <machine/cpuvar.h>
#include <machine/rpb.h>
#include <machine/prom.h>
#include <machine/alpha.h>
@@ -118,7 +119,7 @@
static void cpuattach(struct device *, struct device *, void *);
struct cfattach cpu_ca = {
- sizeof(struct device), cpumatch, cpuattach
+ sizeof(struct cpu_softc), cpumatch, cpuattach
};
extern struct cfdriver cpu_cd;
@@ -206,11 +207,12 @@
}
static void
-cpuattach(parent, dev, aux)
+cpuattach(parent, self, aux)
struct device *parent;
- struct device *dev;
+ struct device *self;
void *aux;
{
+ struct cpu_softc *sc = (void *) self;
struct mainbus_attach_args *ma = aux;
int i;
char **s;
@@ -261,7 +263,7 @@
char bits[64];
printf("%s: Architecture extensions: %s\n",
- dev->dv_xname, bitmask_snprintf(cpu_amask,
+ sc->sc_dev.dv_xname, bitmask_snprintf(cpu_amask,
ALPHA_AMASK_BITS, bits, sizeof(bits)));
}
}
@@ -293,7 +295,8 @@
if (ma->ma_slot > ALPHA_WHAMI_MAXID) {
if (ma->ma_slot == hwrpb->rpb_primary_cpu_id)
panic("cpu_attach: primary CPU ID too large");
- printf("%s: procssor ID too large, ignoring\n", dev->dv_xname);
+ printf("%s: procssor ID too large, ignoring\n",
+ sc->sc_dev.dv_xname);
return;
}
@@ -303,7 +306,6 @@
ci = &cpu_info_store;
#endif
ci->ci_cpuid = ma->ma_slot;
- ci->ci_dev = dev;
/*
* Though we could (should?) attach the LCA cpus' PCI
@@ -319,7 +321,8 @@
if ((p->pcs_flags & PCS_PA) == 0) {
if (ma->ma_slot == hwrpb->rpb_primary_cpu_id)
panic("cpu_attach: primary not available?!");
- printf("%s: processor not available for use\n", dev->dv_xname);
+ printf("%s: processor not available for use\n",
+ sc->sc_dev.dv_xname);
return;
}
@@ -327,7 +330,7 @@
if ((p->pcs_flags & PCS_PV) == 0) {
if (ma->ma_slot == hwrpb->rpb_primary_cpu_id)
panic("cpu_attach: primary has invalid PALcode?!");
- printf("%s: PALcode not valid\n", ci->ci_dev->dv_xname);
+ printf("%s: PALcode not valid\n", sc->sc_dev.dv_xname);
return;
}
@@ -342,7 +345,8 @@
panic("cpu_attach: unable to allocate idle stack for"
" primary");
}
- printf("%s: unable to allocate idle stack\n", dev->dv_xname);
+ printf("%s: unable to allocate idle stack\n",
+ sc->sc_dev.dv_xname);
return;
}
@@ -379,7 +383,24 @@
ci->ci_flags |= CPUF_PRIMARY;
atomic_setbits_ulong(&cpus_running, (1UL << ma->ma_slot));
}
+#else /* ! MULTIPROCESSOR */
+ /*
+ * Bail out now if we're not the primary CPU.
+ */
+ if (ma->ma_slot != hwrpb->rpb_primary_cpu_id)
+ return;
#endif /* MULTIPROCESSOR */
+
+ ci->ci_softc = sc;
+
+ evcnt_attach_dynamic(&sc->sc_evcnt_clock, EVCNT_TYPE_INTR,
+ NULL, sc->sc_dev.dv_xname, "clock");
+ evcnt_attach_dynamic(&sc->sc_evcnt_device, EVCNT_TYPE_INTR,
+ NULL, sc->sc_dev.dv_xname, "device");
+#if defined(MULTIPROCESSOR)
+ evcnt_attach_dynamic(&sc->sc_evcnt_ipi, EVCNT_TYPE_INTR,
+ NULL, sc->sc_dev.dv_xname, "ipi");
+#endif
}
#if defined(MULTIPROCESSOR)
@@ -454,7 +475,7 @@
/* Send a "START" command to the secondary CPU's console. */
if (cpu_iccb_send(ci->ci_cpuid, "START\r\n")) {
printf("%s: unable to issue `START' command\n",
- ci->ci_dev->dv_xname);
+ ci->ci_softc->sc_dev.dv_xname);
return;
}
@@ -466,7 +487,8 @@
delay(1000);
}
if (timeout == 0)
- printf("%s: processor failed to boot\n", ci->ci_dev->dv_xname);
+ printf("%s: processor failed to boot\n",
+ ci->ci_softc->sc_dev.dv_xname);
/*
* ...and now wait for verification that it's running kernel
@@ -479,7 +501,8 @@
delay(1000);
}
if (timeout == 0)
- printf("%s: processor failed to hatch\n", ci->ci_dev->dv_xname);
+ printf("%s: processor failed to hatch\n",
+ ci->ci_softc->sc_dev.dv_xname);
}
void
@@ -491,7 +514,7 @@
#ifdef DIAGNOSTIC
if (cpu_id >= hwrpb->rpb_pcs_cnt ||
- cpu_info[cpu_id].ci_dev == NULL)
+ cpu_info[cpu_id].ci_softc == NULL)
panic("cpu_halt_secondary: bogus cpu_id");
#endif
@@ -514,7 +537,7 @@
/* Erk, secondary failed to halt. */
printf("WARNING: %s (ID %lu) failed to halt\n",
- cpu_info[cpu_id].ci_dev->dv_xname, cpu_id);
+ cpu_info[cpu_id].ci_softc->sc_dev.dv_xname, cpu_id);
}
void
@@ -533,8 +556,8 @@
trap_init();
/* Yahoo! We're running kernel code! Announce it! */
- printf("%s: processor ID %lu running\n", ci->ci_dev->dv_xname,
- alpha_pal_whami());
+ printf("%s: processor ID %lu running\n",
+ ci->ci_softc->sc_dev.dv_xname, cpu_number());
atomic_setbits_ulong(&cpus_running, cpumask);
/*
diff -r e45234026e88 -r 3f58aff8e46b sys/arch/alpha/alpha/interrupt.c
--- a/sys/arch/alpha/alpha/interrupt.c Mon Jun 05 21:40:34 2000 +0000
+++ b/sys/arch/alpha/alpha/interrupt.c Mon Jun 05 21:47:10 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: interrupt.c,v 1.47 2000/06/04 03:40:03 thorpej Exp $ */
+/* $NetBSD: interrupt.c,v 1.48 2000/06/05 21:47:11 thorpej Exp $ */
/*-
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -79,7 +79,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: interrupt.c,v 1.47 2000/06/04 03:40:03 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: interrupt.c,v 1.48 2000/06/05 21:47:11 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -88,6 +88,8 @@
#include <sys/sched.h>
#include <sys/malloc.h>
+#include <machine/cpuvar.h>
+
/* XXX Network interrupts should be converted to new softintrs */
#include <sys/socket.h>
#include <net/netisr.h>
@@ -144,7 +146,6 @@
#include <machine/rpb.h>
#include <machine/frame.h>
#include <machine/cpuconf.h>
-#include <machine/intrcnt.h>
#include <machine/alpha.h>
#if defined(MULTIPROCESSOR)
@@ -158,6 +159,7 @@
struct trapframe *framep)
{
struct cpu_info *ci = curcpu();
+ struct cpu_softc *sc = ci->ci_softc;
struct proc *p;
switch (a0) {
@@ -166,20 +168,17 @@
{
u_long pending_ipis, bit;
- atomic_add_ulong(&ci->ci_intrdepth, 1);
-
-#if 0
- printf("CPU %lu got IPI\n", cpu_id);
-#endif
-
#ifdef DIAGNOSTIC
- if (ci->ci_dev == NULL) {
+ if (sc == NULL) {
/* XXX panic? */
- printf("WARNING: no device for ID %lu\n", ci->ci_cpuid);
+ printf("WARNING: no softc for ID %lu\n", ci->ci_cpuid);
return;
}
#endif
+ atomic_add_ulong(&ci->ci_intrdepth, 1);
+ sc->sc_evcnt_ipi.ev_count++;
+
pending_ipis = atomic_loadlatch_ulong(&ci->ci_ipis, 0);
for (bit = 0; bit < ALPHA_NIPIS; bit++)
if (pending_ipis & (1UL << bit))
@@ -207,13 +206,13 @@
* the clock interrupt, so if we did, all system
* time would be counted as interrupt time.
*/
+ sc->sc_evcnt_clock.ev_count++;
#if defined(MULTIPROCESSOR)
/* XXX XXX XXX */
if (CPU_IS_PRIMARY(ci) == 0)
return;
#endif
uvmexp.intrs++;
- intrcnt[INTRCNT_CLOCK]++;
if (platform.clockintr) {
Home |
Main Index |
Thread Index |
Old Index