svn commit: r232612 - head/sys/dev/hwpmc

George V. Neville-Neil gnn at FreeBSD.org
Tue Mar 6 17:17:04 UTC 2012


Author: gnn
Date: Tue Mar  6 17:17:03 2012
New Revision: 232612
URL: http://svn.freebsd.org/changeset/base/232612

Log:
  Properly mask off bits that are not supported in the IAP counters.
  This fixes a bug where users would see massively large counts, near
  to 2**64 -1, due to the bits not being cleared.
  
  MFC after:	3 weeks

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

Modified: head/sys/dev/hwpmc/hwpmc_core.c
==============================================================================
--- head/sys/dev/hwpmc/hwpmc_core.c	Tue Mar  6 15:05:59 2012	(r232611)
+++ head/sys/dev/hwpmc/hwpmc_core.c	Tue Mar  6 17:17:03 2012	(r232612)
@@ -2021,7 +2021,7 @@ iap_read_pmc(int cpu, int ri, pmc_value_
 	if (PMC_IS_SAMPLING_MODE(PMC_TO_MODE(pm)))
 		*v = iap_perfctr_value_to_reload_count(tmp);
 	else
-		*v = tmp;
+		*v = tmp & ((1ULL << core_iap_width) - 1);
 
 	PMCDBG(MDP,REA,1, "iap-read cpu=%d ri=%d msr=0x%x -> v=%jx", cpu, ri,
 	    ri, *v);


More information about the svn-src-head mailing list