Date: Sat, 5 Jun 2010 23:05:08 +0000 (UTC) From: Fabien Thomas <fabient@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r208861 - in head/sys: dev/hwpmc sys Message-ID: <201006052305.o55N58av064663@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: fabient Date: Sat Jun 5 23:05:08 2010 New Revision: 208861 URL: http://svn.freebsd.org/changeset/base/208861 Log: Convert pm_runcount to int to correctly check for negative value. Remove uncessary check for error. Found with: Coverity Prevent(tm) MFC after: 1 month Modified: head/sys/dev/hwpmc/hwpmc_mod.c head/sys/sys/pmc.h Modified: head/sys/dev/hwpmc/hwpmc_mod.c ============================================================================== --- head/sys/dev/hwpmc/hwpmc_mod.c Sat Jun 5 23:00:02 2010 (r208860) +++ head/sys/dev/hwpmc/hwpmc_mod.c Sat Jun 5 23:05:08 2010 (r208861) @@ -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: head/sys/sys/pmc.h ============================================================================== --- head/sys/sys/pmc.h Sat Jun 5 23:00:02 2010 (r208860) +++ head/sys/sys/pmc.h Sat Jun 5 23:05:08 2010 (r208861) @@ -680,7 +680,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 */ /*
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201006052305.o55N58av064663>