Forcibly turn off all PMCs at module unload time.

MFC after:	1 week
This commit is contained in:
Joseph Koshy 2006-03-28 14:09:21 +00:00
parent fe12457335
commit 9282fe9cdb

View File

@ -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.