From owner-svn-src-all@FreeBSD.ORG Sun Sep 5 13:31:14 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A587810656CB; Sun, 5 Sep 2010 13:31:14 +0000 (UTC) (envelope-from fabient@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7A8B28FC0C; Sun, 5 Sep 2010 13:31:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o85DVECi080880; Sun, 5 Sep 2010 13:31:14 GMT (envelope-from fabient@svn.freebsd.org) Received: (from fabient@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o85DVE0g080877; Sun, 5 Sep 2010 13:31:14 GMT (envelope-from fabient@svn.freebsd.org) Message-Id: <201009051331.o85DVE0g080877@svn.freebsd.org> From: Fabien Thomas Date: Sun, 5 Sep 2010 13:31:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212224 - in head: lib/libpmc sys/dev/hwpmc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Sep 2010 13:31:14 -0000 Author: fabient Date: Sun Sep 5 13:31:14 2010 New Revision: 212224 URL: http://svn.freebsd.org/changeset/base/212224 Log: 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 Modified: head/lib/libpmc/libpmc.c head/sys/dev/hwpmc/hwpmc_core.c Modified: head/lib/libpmc/libpmc.c ============================================================================== --- head/lib/libpmc/libpmc.c Sun Sep 5 06:16:04 2010 (r212223) +++ head/lib/libpmc/libpmc.c Sun Sep 5 13:31:14 2010 (r212224) @@ -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; \ Modified: head/sys/dev/hwpmc/hwpmc_core.c ============================================================================== --- head/sys/dev/hwpmc/hwpmc_core.c Sun Sep 5 06:16:04 2010 (r212223) +++ head/sys/dev/hwpmc/hwpmc_core.c Sun Sep 5 13:31:14 2010 (r212224) @@ -2234,21 +2234,8 @@ pmc_core_initialize(struct pmc_mdep *md, 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,