summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgnn <gnn@FreeBSD.org>2012-03-06 17:17:03 +0000
committergnn <gnn@FreeBSD.org>2012-03-06 17:17:03 +0000
commit6ce0b47b5ab938df003706c90f9e0de436e36132 (patch)
treed690e6a6794ad0663df3268b8fe35cc87259d21c
parent45db1d7f59d9cb7fae12cc9d0f786dec2b7a7a08 (diff)
downloadFreeBSD-src-6ce0b47b5ab938df003706c90f9e0de436e36132.zip
FreeBSD-src-6ce0b47b5ab938df003706c90f9e0de436e36132.tar.gz
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
-rw-r--r--sys/dev/hwpmc/hwpmc_core.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sys/dev/hwpmc/hwpmc_core.c b/sys/dev/hwpmc/hwpmc_core.c
index a3e3cb9..7bef548 100644
--- a/sys/dev/hwpmc/hwpmc_core.c
+++ b/sys/dev/hwpmc/hwpmc_core.c
@@ -2021,7 +2021,7 @@ iap_read_pmc(int cpu, int ri, pmc_value_t *v)
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);
OpenPOWER on IntegriCloud