From owner-svn-src-all@FreeBSD.ORG Tue Dec 16 11:04:03 2008 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 12FFB1065677; Tue, 16 Dec 2008 11:04:03 +0000 (UTC) (envelope-from jkoshy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 071DB8FC1E; Tue, 16 Dec 2008 11:04:03 +0000 (UTC) (envelope-from jkoshy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mBGB42uH035977; Tue, 16 Dec 2008 11:04:02 GMT (envelope-from jkoshy@svn.freebsd.org) Received: (from jkoshy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBGB429L035976; Tue, 16 Dec 2008 11:04:02 GMT (envelope-from jkoshy@svn.freebsd.org) Message-Id: <200812161104.mBGB429L035976@svn.freebsd.org> From: Joseph Koshy Date: Tue, 16 Dec 2008 11:04:02 +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: r186177 - 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, 16 Dec 2008 11:04:03 -0000 Author: jkoshy Date: Tue Dec 16 11:04:02 2008 New Revision: 186177 URL: http://svn.freebsd.org/changeset/base/186177 Log: Bug fixes: - Initialize variables before use. - Remove a KASSERT() that could falsely trigger if there are other sources of NMIs in the system. Efficiency tweak: - When checking PMCs that overflowed, ignore PMCs that were not configured for sampling. Modified: head/sys/dev/hwpmc/hwpmc_core.c Modified: head/sys/dev/hwpmc/hwpmc_core.c ============================================================================== --- head/sys/dev/hwpmc/hwpmc_core.c Tue Dec 16 11:01:36 2008 (r186176) +++ head/sys/dev/hwpmc/hwpmc_core.c Tue Dec 16 11:04:02 2008 (r186177) @@ -1491,17 +1491,18 @@ core_intr(int cpu, struct trapframe *tf) PMCDBG(MDP,INT, 1, "cpu=%d tf=0x%p um=%d", cpu, (void *) tf, TRAPF_USERMODE(tf)); + found_interrupt = 0; cc = core_pcpu[cpu]; for (ri = 0; ri < core_iap_npmc; ri++) { - if (!iap_pmc_has_overflowed(ri)) - continue; - if ((pm = cc->pc_corepmcs[ri].phw_pmc) == NULL || !PMC_IS_SAMPLING_MODE(PMC_TO_MODE(pm))) continue; + if (!iap_pmc_has_overflowed(ri)) + continue; + found_interrupt = 1; if (pm->pm_state != PMC_STATE_RUNNING) @@ -1560,7 +1561,9 @@ core2_intr(int cpu, struct trapframe *tf PMCDBG(MDP,INT, 1, "cpu=%d intrstatus=%jx", cpu, (uintmax_t) intrstatus); + found_interrupt = 0; cc = core_pcpu[cpu]; + KASSERT(cc != NULL, ("[core,%d] null pcpu", __LINE__)); cc->pc_globalctrl &= ~intrenable; @@ -1574,7 +1577,6 @@ core2_intr(int cpu, struct trapframe *tf IA_GLOBAL_STATUS_FLAG_OVFBUF | IA_GLOBAL_STATUS_FLAG_CONDCHG); - /* * Look for interrupts from fixed function PMCs. */ @@ -1634,9 +1636,6 @@ core2_intr(int cpu, struct trapframe *tf wrmsr(IAP_PMC0 + n, v); } - KASSERT(found_interrupt, - ("[core,%d] no interrupting PMCs were found", __LINE__)); - /* * Reenable all non-stalled PMCs. */