diff options
author | jkoshy <jkoshy@FreeBSD.org> | 2005-08-22 18:20:41 +0000 |
---|---|---|
committer | jkoshy <jkoshy@FreeBSD.org> | 2005-08-22 18:20:41 +0000 |
commit | 1fafbd1bb50e664ea2bb5c119df2e1779e16744e (patch) | |
tree | 2240230a84888031330d01c050217dd4bc58bf3d /sys | |
parent | 6720641d7ad75aaa7afe715e3f70703ffd73c3a3 (diff) | |
download | FreeBSD-src-1fafbd1bb50e664ea2bb5c119df2e1779e16744e.zip FreeBSD-src-1fafbd1bb50e664ea2bb5c119df2e1779e16744e.tar.gz |
On x86 processors, turn off any 'INTERRUPT' capabilities on PMCs
if the CPU does not have its local APIC enabled.
MFC after: 3 days
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/hwpmc/hwpmc_x86.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/sys/dev/hwpmc/hwpmc_x86.c b/sys/dev/hwpmc/hwpmc_x86.c index 089a63e..a742eff 100644 --- a/sys/dev/hwpmc/hwpmc_x86.c +++ b/sys/dev/hwpmc/hwpmc_x86.c @@ -170,10 +170,20 @@ pmc_intel_initialize(void) struct pmc_mdep * pmc_md_initialize() { + int i; + struct pmc_mdep *md; + /* determine the CPU kind */ + md = NULL; if (strcmp(cpu_vendor, "AuthenticAMD") == 0) - return pmc_amd_initialize(); + md = pmc_amd_initialize(); else if (strcmp(cpu_vendor, "GenuineIntel") == 0) - return pmc_intel_initialize(); - return NULL; + md = pmc_intel_initialize(); + + /* disallow sampling if we do not have an LAPIC */ + if (md != NULL && lapic == NULL) + for (i = 1; i < md->pmd_nclass; i++) + md->pmd_classes[i].pm_caps &= ~PMC_CAP_INTERRUPT; + + return md; } |