summaryrefslogtreecommitdiffstats
path: root/sys/dev/hwpmc/hwpmc_core.c
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2009-08-14 21:05:08 +0000
committerjhb <jhb@FreeBSD.org>2009-08-14 21:05:08 +0000
commitd51166f15e1c08fdaa3df0992553ad5127da220c (patch)
tree1e489c7e0c2d17d61d5e2834cc3640b7fd564688 /sys/dev/hwpmc/hwpmc_core.c
parent0bf7e62afcd04d831d3e938d18021d02451fd181 (diff)
downloadFreeBSD-src-d51166f15e1c08fdaa3df0992553ad5127da220c.zip
FreeBSD-src-d51166f15e1c08fdaa3df0992553ad5127da220c.tar.gz
Adjust the handling of the local APIC PMC interrupt vector:
- Provide lapic_disable_pmc(), lapic_enable_pmc(), and lapic_reenable_pmc() routines in the local APIC code that the hwpmc(4) driver can use to manage the local APIC PMC interrupt vector. - Do not enable the local APIC PMC interrupt vector by default when HWPMC_HOOKS is enabled. Instead, the hwpmc(4) driver explicitly enables the interrupt when it is succesfully initialized and disables the interrupt when it is unloaded. This avoids enabling the interrupt on unsupported CPUs which may result in spurious NMIs. Reported by: rnoland Reviewed by: jkoshy Approved by: re (kib) MFC after: 2 weeks
Diffstat (limited to 'sys/dev/hwpmc/hwpmc_core.c')
-rw-r--r--sys/dev/hwpmc/hwpmc_core.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/sys/dev/hwpmc/hwpmc_core.c b/sys/dev/hwpmc/hwpmc_core.c
index 214e42c..f84e0f1 100644
--- a/sys/dev/hwpmc/hwpmc_core.c
+++ b/sys/dev/hwpmc/hwpmc_core.c
@@ -32,10 +32,13 @@
__FBSDID("$FreeBSD$");
#include <sys/param.h>
+#include <sys/bus.h>
#include <sys/pmc.h>
#include <sys/pmckern.h>
#include <sys/systm.h>
+#include <machine/intr_machdep.h>
+#include <machine/apicvar.h>
#include <machine/cpu.h>
#include <machine/cpufunc.h>
#include <machine/specialreg.h>
@@ -1771,7 +1774,7 @@ core_intr(int cpu, struct trapframe *tf)
}
if (found_interrupt)
- pmc_x86_lapic_enable_pmc_interrupt();
+ lapic_reenable_pmc();
atomic_add_int(found_interrupt ? &pmc_stats.pm_intr_processed :
&pmc_stats.pm_intr_ignored, 1);
@@ -1895,7 +1898,7 @@ core2_intr(int cpu, struct trapframe *tf)
(uintmax_t) rdmsr(IA_GLOBAL_OVF_CTRL));
if (found_interrupt)
- pmc_x86_lapic_enable_pmc_interrupt();
+ lapic_reenable_pmc();
atomic_add_int(found_interrupt ? &pmc_stats.pm_intr_processed :
&pmc_stats.pm_intr_ignored, 1);
OpenPOWER on IntegriCloud