From owner-svn-src-stable-8@FreeBSD.ORG Tue Aug 3 16:29:55 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4EF9E1065679; Tue, 3 Aug 2010 16:29:55 +0000 (UTC) (envelope-from fabient@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 330458FC12; Tue, 3 Aug 2010 16:29:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o73GTtGk098617; Tue, 3 Aug 2010 16:29:55 GMT (envelope-from fabient@svn.freebsd.org) Received: (from fabient@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o73GTthW098614; Tue, 3 Aug 2010 16:29:55 GMT (envelope-from fabient@svn.freebsd.org) Message-Id: <201008031629.o73GTthW098614@svn.freebsd.org> From: Fabien Thomas Date: Tue, 3 Aug 2010 16:29:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r210818 - in stable/8/sys: dev/hwpmc sys X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Aug 2010 16:29:55 -0000 Author: fabient Date: Tue Aug 3 16:29:54 2010 New Revision: 210818 URL: http://svn.freebsd.org/changeset/base/210818 Log: MFC r208861: Convert pm_runcount to int to correctly check for negative value. Remove uncessary check for error. Found with: Coverity Prevent(tm) Modified: stable/8/sys/dev/hwpmc/hwpmc_mod.c stable/8/sys/sys/pmc.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/hwpmc/hwpmc_mod.c ============================================================================== --- stable/8/sys/dev/hwpmc/hwpmc_mod.c Tue Aug 3 16:27:13 2010 (r210817) +++ stable/8/sys/dev/hwpmc/hwpmc_mod.c Tue Aug 3 16:29:54 2010 (r210818) @@ -1248,7 +1248,7 @@ pmc_process_csw_in(struct thread *td) continue; /* increment PMC runcount */ - atomic_add_rel_32(&pm->pm_runcount, 1); + atomic_add_rel_int(&pm->pm_runcount, 1); /* configure the HWPMC we are going to use. */ pcd = pmc_ri_to_classdep(md, ri, &adjri); @@ -1387,7 +1387,7 @@ pmc_process_csw_out(struct thread *td) pcd->pcd_stop_pmc(cpu, adjri); /* reduce this PMC's runcount */ - atomic_subtract_rel_32(&pm->pm_runcount, 1); + atomic_subtract_rel_int(&pm->pm_runcount, 1); /* * If this PMC is associated with this process, @@ -3252,9 +3252,6 @@ pmc_syscall_handler(struct thread *td, v } } - if (error) - break; - /* * Look for valid values for 'pm_flags' */ @@ -4045,7 +4042,7 @@ pmc_process_interrupt(int cpu, struct pm ("[pmc,%d] pm=%p runcount %d", __LINE__, (void *) pm, pm->pm_runcount)); - atomic_add_rel_32(&pm->pm_runcount, 1); /* hold onto PMC */ + atomic_add_rel_int(&pm->pm_runcount, 1); /* hold onto PMC */ ps->ps_pmc = pm; if ((td = curthread) && td->td_proc) ps->ps_pid = td->td_proc->p_pid; @@ -4246,7 +4243,7 @@ pmc_process_samples(int cpu) entrydone: ps->ps_nsamples = 0; /* mark entry as free */ - atomic_subtract_rel_32(&pm->pm_runcount, 1); + atomic_subtract_rel_int(&pm->pm_runcount, 1); /* increment read pointer, modulo sample size */ if (++ps == psb->ps_fence) @@ -4418,7 +4415,7 @@ pmc_process_exit(void *arg __unused, str mtx_pool_unlock_spin(pmc_mtxpool, pm); } - atomic_subtract_rel_32(&pm->pm_runcount,1); + atomic_subtract_rel_int(&pm->pm_runcount,1); KASSERT((int) pm->pm_runcount >= 0, ("[pmc,%d] runcount is %d", __LINE__, ri)); Modified: stable/8/sys/sys/pmc.h ============================================================================== --- stable/8/sys/sys/pmc.h Tue Aug 3 16:27:13 2010 (r210817) +++ stable/8/sys/sys/pmc.h Tue Aug 3 16:29:54 2010 (r210818) @@ -676,7 +676,7 @@ struct pmc { enum pmc_event pm_event; /* event being measured */ uint32_t pm_flags; /* additional flags PMC_F_... */ struct pmc_owner *pm_owner; /* owner thread state */ - uint32_t pm_runcount; /* #cpus currently on */ + int pm_runcount; /* #cpus currently on */ enum pmc_state pm_state; /* current PMC state */ /*