Fix invalid class removal when IAF is not the last class.

Keep IAF class with 0 PMC and change the alias in libpmc to IAP.

MFC after:	1 week
This commit is contained in:
Fabien Thomas 2010-09-05 13:31:14 +00:00
parent d89be9509f
commit 2aef9dd6d3
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=212224
2 changed files with 6 additions and 19 deletions

View File

@ -2695,7 +2695,8 @@ pmc_init(void)
*/
cpu_has_iaf_counters = 0;
for (t = 0; t < cpu_info.pm_nclass; t++)
if (cpu_info.pm_classes[t].pm_class == PMC_CLASS_IAF)
if (cpu_info.pm_classes[t].pm_class == PMC_CLASS_IAF &&
cpu_info.pm_classes[t].pm_num > 0)
cpu_has_iaf_counters = 1;
#endif
@ -2708,9 +2709,8 @@ pmc_init(void)
#define PMC_MDEP_INIT_INTEL_V2(C) do { \
PMC_MDEP_INIT(C); \
if (cpu_has_iaf_counters) \
pmc_class_table[n++] = &iaf_class_table_descr; \
else \
pmc_class_table[n++] = &iaf_class_table_descr; \
if (!cpu_has_iaf_counters) \
pmc_mdep_event_aliases = \
C##_aliases_without_iaf; \
pmc_class_table[n] = &C##_class_table_descr; \

View File

@ -2234,21 +2234,8 @@ pmc_core_initialize(struct pmc_mdep *md, int maxcpu)
core_iaf_npmc = cpuid[CORE_CPUID_EDX] & 0x1F;
core_iaf_width = (cpuid[CORE_CPUID_EDX] >> 5) & 0xFF;
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));
}
iaf_initialize(md, maxcpu, core_iaf_npmc, core_iaf_width);
core_pmcmask |= ((1ULL << core_iaf_npmc) - 1) << IAF_OFFSET;
}
PMCDBG(MDP,INI,1,"core-init pmcmask=0x%jx iafri=%d", core_pmcmask,