svn commit: r200234 - stable/7/sys/dev/hwpmc
Fabien Thomas
fabient at FreeBSD.org
Mon Dec 7 20:46:22 UTC 2009
Author: fabient
Date: Mon Dec 7 20:46:22 2009
New Revision: 200234
URL: http://svn.freebsd.org/changeset/base/200234
Log:
MFC 198432:
Only claim that the PMC_CLASS_IAF PMCs are supported by a CPU if
there are PMCs on the CPU that belong to the class.
Modified:
stable/7/sys/dev/hwpmc/hwpmc_core.c
Directory Properties:
stable/7/sys/ (props changed)
stable/7/sys/contrib/pf/ (props changed)
Modified: stable/7/sys/dev/hwpmc/hwpmc_core.c
==============================================================================
--- stable/7/sys/dev/hwpmc/hwpmc_core.c Mon Dec 7 20:44:43 2009 (r200233)
+++ stable/7/sys/dev/hwpmc/hwpmc_core.c Mon Dec 7 20:46:22 2009 (r200234)
@@ -1954,11 +1954,21 @@ pmc_core_initialize(struct pmc_mdep *md,
core_iaf_npmc = cpuid[CORE_CPUID_EDX] & 0x1F;
core_iaf_width = (cpuid[CORE_CPUID_EDX] >> 5) & 0xFF;
- iaf_initialize(md, maxcpu, core_iaf_npmc, core_iaf_width);
-
- core_pmcmask |= ((1ULL << core_iaf_npmc) - 1) <<
- IAF_OFFSET;
-
+ if (core_iaf_npmc > 0) {
+ iaf_initialize(md, maxcpu, core_iaf_npmc,
+ core_iaf_width);
+ core_pmcmask |= ((1ULL << core_iaf_npmc) - 1) <<
+ IAF_OFFSET;
+ } else {
+ /*
+ * Adjust the number of classes exported to
+ * user space.
+ */
+ md->pmd_nclass--;
+ KASSERT(md->pmd_nclass == 2,
+ ("[core,%d] unexpected nclass %d", __LINE__,
+ md->pmd_nclass));
+ }
}
PMCDBG(MDP,INI,1,"core-init pmcmask=0x%jx iafri=%d", core_pmcmask,
More information about the svn-src-stable-7
mailing list