Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 24 Oct 2009 01:58:10 +0000 (UTC)
From:      Joseph Koshy <jkoshy@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r198432 - head/sys/dev/hwpmc
Message-ID:  <200910240158.n9O1wANG077985@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jkoshy
Date: Sat Oct 24 01:58:10 2009
New Revision: 198432
URL: http://svn.freebsd.org/changeset/base/198432

Log:
  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.
  
  Review and testing by:	fabient

Modified:
  head/sys/dev/hwpmc/hwpmc_core.c

Modified: head/sys/dev/hwpmc/hwpmc_core.c
==============================================================================
--- head/sys/dev/hwpmc/hwpmc_core.c	Fri Oct 23 22:53:01 2009	(r198431)
+++ head/sys/dev/hwpmc/hwpmc_core.c	Sat Oct 24 01:58:10 2009	(r198432)
@@ -1977,11 +1977,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,



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200910240158.n9O1wANG077985>