From owner-svn-src-all@FreeBSD.ORG Tue Mar 6 17:17:04 2012 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 246C9106566C; Tue, 6 Mar 2012 17:17:04 +0000 (UTC) (envelope-from gnn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1474E8FC22; Tue, 6 Mar 2012 17:17:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q26HH3al049799; Tue, 6 Mar 2012 17:17:03 GMT (envelope-from gnn@svn.freebsd.org) Received: (from gnn@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q26HH3SK049797; Tue, 6 Mar 2012 17:17:03 GMT (envelope-from gnn@svn.freebsd.org) Message-Id: <201203061717.q26HH3SK049797@svn.freebsd.org> From: "George V. Neville-Neil" Date: Tue, 6 Mar 2012 17:17:03 +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: r232612 - head/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: Tue, 06 Mar 2012 17:17:04 -0000 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);