summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorjkoshy <jkoshy@FreeBSD.org>2006-03-28 14:09:21 +0000
committerjkoshy <jkoshy@FreeBSD.org>2006-03-28 14:09:21 +0000
commit1ad16902d3017361d09d7c25f43e5f0b09de33d2 (patch)
tree52f8ee06ed33e60e13442e94a1b1404a58ee9b74 /sys
parentb5db288bf69a4cfb9c1c4cf659bfd91b9f8052b7 (diff)
downloadFreeBSD-src-1ad16902d3017361d09d7c25f43e5f0b09de33d2.zip
FreeBSD-src-1ad16902d3017361d09d7c25f43e5f0b09de33d2.tar.gz
Forcibly turn off all PMCs at module unload time.
MFC after: 1 week
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/hwpmc/hwpmc_piv.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/sys/dev/hwpmc/hwpmc_piv.c b/sys/dev/hwpmc/hwpmc_piv.c
index f0701c8..1a98a3d 100644
--- a/sys/dev/hwpmc/hwpmc_piv.c
+++ b/sys/dev/hwpmc/hwpmc_piv.c
@@ -674,6 +674,7 @@ p4_init(int cpu)
static int
p4_cleanup(int cpu)
{
+ int i;
struct p4_cpu *pcs;
PMCDBG(MDP,INI,0, "p4-cleanup cpu=%d", cpu);
@@ -681,6 +682,11 @@ p4_cleanup(int cpu)
if ((pcs = (struct p4_cpu *) pmc_pcpu[cpu]) == NULL)
return 0;
+ /* Turn off all PMCs on this CPU */
+ for (i = 0; i < P4_NPMCS - 1; i++)
+ wrmsr(P4_CCCR_MSR_FIRST + i,
+ rdmsr(P4_CCCR_MSR_FIRST + i) & ~P4_CCCR_ENABLE);
+
/*
* If the CPU is physical we need to teardown the
* full MD state.
OpenPOWER on IntegriCloud