summaryrefslogtreecommitdiffstats
path: root/sys/dev/hwpmc/hwpmc_x86.c
diff options
context:
space:
mode:
authorjkoshy <jkoshy@FreeBSD.org>2005-08-22 18:20:41 +0000
committerjkoshy <jkoshy@FreeBSD.org>2005-08-22 18:20:41 +0000
commit1fafbd1bb50e664ea2bb5c119df2e1779e16744e (patch)
tree2240230a84888031330d01c050217dd4bc58bf3d /sys/dev/hwpmc/hwpmc_x86.c
parent6720641d7ad75aaa7afe715e3f70703ffd73c3a3 (diff)
downloadFreeBSD-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/dev/hwpmc/hwpmc_x86.c')
-rw-r--r--sys/dev/hwpmc/hwpmc_x86.c16
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;
}
OpenPOWER on IntegriCloud