From owner-freebsd-arch@FreeBSD.ORG Thu Mar 13 19:16:54 2008 Return-Path: Delivered-To: freebsd-arch@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5DB8D1065673 for ; Thu, 13 Mar 2008 19:16:54 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from speedfactory.net (mail.speedfactory.net [66.23.216.219]) by mx1.freebsd.org (Postfix) with ESMTP id A04068FC12 for ; Thu, 13 Mar 2008 19:16:53 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from server.baldwin.cx (unverified [66.23.211.162]) by speedfactory.net (SurgeMail 3.8s) with ESMTP id 235372110-1834499 for multiple; Thu, 13 Mar 2008 15:14:52 -0400 Received: from localhost.corp.yahoo.com (john@localhost [127.0.0.1]) (authenticated bits=0) by server.baldwin.cx (8.14.2/8.14.2) with ESMTP id m2DJGS7t031052; Thu, 13 Mar 2008 15:16:40 -0400 (EDT) (envelope-from jhb@FreeBSD.org) From: John Baldwin To: freebsd-arch@FreeBSD.org, obrien@FreeBSD.org Date: Thu, 13 Mar 2008 15:16:12 -0400 User-Agent: KMail/1.9.7 References: <20080313180805.GA83406@dragon.NUXI.org> In-Reply-To: <20080313180805.GA83406@dragon.NUXI.org> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200803131516.12284.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.0.2 (server.baldwin.cx [127.0.0.1]); Thu, 13 Mar 2008 15:16:41 -0400 (EDT) X-Virus-Scanned: ClamAV 0.91.2/6225/Thu Mar 13 10:52:37 2008 on server.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=4.2 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.1.3 X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on server.baldwin.cx Cc: Subject: Re: [PATCH] hwpmc(4) changes to use 'mp_maxid' instead of 'mp_ncpus'. X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Mar 2008 19:16:54 -0000 On Thursday 13 March 2008 02:08:05 pm David O'Brien wrote: > Hi folks, > Some folks at Juniper have submitted these changes to hwpmc(4). > I am sending them here for public review. > > Their thoughts are: > The mp_ncpus refers to the count of the active CPU's. Where as > mp_maxid refers to the count of all the cpus on the SMP. Using > mp_ncpus in the cpu_id range-check of hwpmc module would lead to the > assumption that all the active CPU's in the SMP are not interleaved. > But for running on some platforms, the active and inactive cpus could > be interleaved making hwpmc not work for the cpus whose cpu_id is > greater than the active-cpu count. This is correct, but you need to handle CPUs that are absent. It might be sufficient to update pmc_cpu_is_disabled() in kern_pmc.c to check CPU_ABSENT(cpu) and claim the CPU is disabled if it is absent, but I'm not sure that will catch everything as that seems aimed at handling having a non-absent CPU halted (such as disabling HTT on i386). > -- > -- David (obrien@FreeBSD.org) > > Index: sys/dev/hwpmc/hwpmc_amd.c > =================================================================== > RCS file: /cvs/junos-2001/src/sys/dev/hwpmc/hwpmc_amd.c,v > retrieving revision 1.1.1.1 > retrieving revision 1.4 > diff -u -p -r1.1.1.1 -r1.4 > --- sys/dev/hwpmc/hwpmc_amd.c 21 Jun 2006 03:30:02 -0000 1.1.1.1 > +++ sys/dev/hwpmc/hwpmc_amd.c 30 Oct 2007 18:00:43 -0000 1.4 > @@ -265,7 +265,7 @@ amd_read_pmc(int cpu, int ri, pmc_value_ > const struct pmc_hw *phw; > pmc_value_t tmp; > > - KASSERT(cpu >= 0 && cpu < mp_ncpus, > + KASSERT(cpu >= 0 && cpu <= mp_maxid, > ("[amd,%d] illegal CPU value %d", __LINE__, cpu)); > KASSERT(ri >= 0 && ri < AMD_NPMCS, > ("[amd,%d] illegal row-index %d", __LINE__, ri)); > @@ -320,7 +320,7 @@ amd_write_pmc(int cpu, int ri, pmc_value > const struct pmc_hw *phw; > enum pmc_mode mode; > > - KASSERT(cpu >= 0 && cpu < mp_ncpus, > + KASSERT(cpu >= 0 && cpu <= mp_maxid, > ("[amd,%d] illegal CPU value %d", __LINE__, cpu)); > KASSERT(ri >= 0 && ri < AMD_NPMCS, > ("[amd,%d] illegal row-index %d", __LINE__, ri)); > @@ -367,7 +367,7 @@ amd_config_pmc(int cpu, int ri, struct p > > PMCDBG(MDP,CFG,1, "cpu=%d ri=%d pm=%p", cpu, ri, pm); > > - KASSERT(cpu >= 0 && cpu < mp_ncpus, > + KASSERT(cpu >= 0 && cpu <= mp_maxid, > ("[amd,%d] illegal CPU value %d", __LINE__, cpu)); > KASSERT(ri >= 0 && ri < AMD_NPMCS, > ("[amd,%d] illegal row-index %d", __LINE__, ri)); > @@ -449,7 +449,7 @@ amd_allocate_pmc(int cpu, int ri, struct > > (void) cpu; > > - KASSERT(cpu >= 0 && cpu < mp_ncpus, > + KASSERT(cpu >= 0 && cpu <= mp_maxid, > ("[amd,%d] illegal CPU value %d", __LINE__, cpu)); > KASSERT(ri >= 0 && ri < AMD_NPMCS, > ("[amd,%d] illegal row index %d", __LINE__, ri)); > @@ -543,7 +543,7 @@ amd_release_pmc(int cpu, int ri, struct > > (void) pmc; > > - KASSERT(cpu >= 0 && cpu < mp_ncpus, > + KASSERT(cpu >= 0 && cpu <= mp_maxid, > ("[amd,%d] illegal CPU value %d", __LINE__, cpu)); > KASSERT(ri >= 0 && ri < AMD_NPMCS, > ("[amd,%d] illegal row-index %d", __LINE__, ri)); > @@ -575,7 +575,7 @@ amd_start_pmc(int cpu, int ri) > struct pmc_hw *phw; > const struct amd_descr *pd; > > - KASSERT(cpu >= 0 && cpu < mp_ncpus, > + KASSERT(cpu >= 0 && cpu <= mp_maxid, > ("[amd,%d] illegal CPU value %d", __LINE__, cpu)); > KASSERT(ri >= 0 && ri < AMD_NPMCS, > ("[amd,%d] illegal row-index %d", __LINE__, ri)); > @@ -624,7 +624,7 @@ amd_stop_pmc(int cpu, int ri) > const struct amd_descr *pd; > uint64_t config; > > - KASSERT(cpu >= 0 && cpu < mp_ncpus, > + KASSERT(cpu >= 0 && cpu <= mp_maxid, > ("[amd,%d] illegal CPU value %d", __LINE__, cpu)); > KASSERT(ri >= 0 && ri < AMD_NPMCS, > ("[amd,%d] illegal row-index %d", __LINE__, ri)); > @@ -676,7 +676,7 @@ amd_intr(int cpu, uintptr_t eip, int use > struct pmc_hw *phw; > pmc_value_t v; > > - KASSERT(cpu >= 0 && cpu < mp_ncpus, > + KASSERT(cpu >= 0 && cpu <= mp_maxid, > ("[amd,%d] out of range CPU %d", __LINE__, cpu)); > > PMCDBG(MDP,INT,1, "cpu=%d eip=%p um=%d", cpu, (void *) eip, > @@ -756,7 +756,7 @@ amd_describe(int cpu, int ri, struct pmc > const struct amd_descr *pd; > struct pmc_hw *phw; > > - KASSERT(cpu >= 0 && cpu < mp_ncpus, > + KASSERT(cpu >= 0 && cpu <= mp_maxid, > ("[amd,%d] illegal CPU %d", __LINE__, cpu)); > KASSERT(ri >= 0 && ri < AMD_NPMCS, > ("[amd,%d] row-index %d out of range", __LINE__, ri)); > @@ -825,7 +825,7 @@ amd_init(int cpu) > struct amd_cpu *pcs; > struct pmc_hw *phw; > > - KASSERT(cpu >= 0 && cpu < mp_ncpus, > + KASSERT(cpu >= 0 && cpu <= mp_maxid, > ("[amd,%d] insane cpu number %d", __LINE__, cpu)); > > PMCDBG(MDP,INI,1,"amd-init cpu=%d", cpu); > @@ -868,7 +868,7 @@ amd_cleanup(int cpu) > uint32_t evsel; > struct pmc_cpu *pcs; > > - KASSERT(cpu >= 0 && cpu < mp_ncpus, > + KASSERT(cpu >= 0 && cpu <= mp_maxid, > ("[amd,%d] insane cpu number (%d)", __LINE__, cpu)); > > PMCDBG(MDP,INI,1,"amd-cleanup cpu=%d", cpu); > Index: sys/dev/hwpmc/hwpmc_mod.c > =================================================================== > RCS file: /cvs/junos-2001/src/sys/dev/hwpmc/hwpmc_mod.c,v > retrieving revision 1.1.1.1 > retrieving revision 1.4 > diff -u -p -r1.1.1.1 -r1.4 > --- sys/dev/hwpmc/hwpmc_mod.c 21 Jun 2006 03:30:03 -0000 1.1.1.1 > +++ sys/dev/hwpmc/hwpmc_mod.c 30 Oct 2007 18:00:43 -0000 1.4 > @@ -615,7 +615,7 @@ pmc_restore_cpu_binding(struct pmc_bindi > static void > pmc_select_cpu(int cpu) > { > - KASSERT(cpu >= 0 && cpu < mp_ncpus, > + KASSERT(cpu >= 0 && cpu <= mp_maxid, > ("[pmc,%d] bad cpu number %d", __LINE__, cpu)); > > /* never move to a disabled CPU */ > @@ -1167,7 +1167,7 @@ pmc_process_csw_in(struct thread *td) > PMCDBG(CSW,SWI,1, "cpu=%d proc=%p (%d, %s) pp=%p", cpu, p, > p->p_pid, p->p_comm, pp); > > - KASSERT(cpu >= 0 && cpu < mp_ncpus, > + KASSERT(cpu >= 0 && cpu <= mp_maxid, > ("[pmc,%d] wierd CPU id %d", __LINE__, cpu)); > > pc = pmc_pcpu[cpu]; > @@ -1292,7 +1292,7 @@ pmc_process_csw_out(struct thread *td) > PMCDBG(CSW,SWO,1, "cpu=%d proc=%p (%d, %s) pp=%p", cpu, p, > p->p_pid, p->p_comm, pp); > > - KASSERT(cpu >= 0 && cpu < mp_ncpus, > + KASSERT(cpu >= 0 && cpu <= mp_maxid, > ("[pmc,%d wierd CPU id %d", __LINE__, cpu)); > > pc = pmc_pcpu[cpu]; > @@ -2313,7 +2313,7 @@ pmc_stop(struct pmc *pm) > > cpu = PMC_TO_CPU(pm); > > - KASSERT(cpu >= 0 && cpu < mp_ncpus, > + KASSERT(cpu >= 0 && cpu <= mp_maxid, > ("[pmc,%d] illegal cpu=%d", __LINE__, cpu)); > > if (pmc_cpu_is_disabled(cpu)) > @@ -2478,7 +2478,7 @@ pmc_syscall_handler(struct thread *td, v > struct pmc_op_getcpuinfo gci; > > gci.pm_cputype = md->pmd_cputype; > - gci.pm_ncpu = mp_ncpus; > + gci.pm_ncpu = mp_maxid + 1; > gci.pm_npmc = md->pmd_npmc; > gci.pm_nclass = md->pmd_nclass; > bcopy(md->pmd_classes, &gci.pm_classes, > @@ -2546,7 +2546,7 @@ pmc_syscall_handler(struct thread *td, v > if ((error = copyin(&gpi->pm_cpu, &cpu, sizeof(cpu))) != 0) > break; > > - if (cpu >= (unsigned int) mp_ncpus) { > + if (cpu > (unsigned int) mp_maxid) { > error = EINVAL; > break; > } > @@ -2641,7 +2641,7 @@ pmc_syscall_handler(struct thread *td, v > > cpu = pma.pm_cpu; > > - if (cpu < 0 || cpu >= mp_ncpus) { > + if (cpu < 0 || cpu > mp_maxid) { > error = EINVAL; > break; > } > @@ -2734,7 +2734,7 @@ pmc_syscall_handler(struct thread *td, v > > if ((mode != PMC_MODE_SS && mode != PMC_MODE_SC && > mode != PMC_MODE_TS && mode != PMC_MODE_TC) || > - (cpu != (u_int) PMC_CPU_ANY && cpu >= (u_int) mp_ncpus)) { > + (cpu != (u_int) PMC_CPU_ANY && cpu > (u_int) mp_maxid)) { > error = EINVAL; > break; > } > @@ -3973,16 +3973,16 @@ pmc_initialize(void) > return ENOSYS; > > /* allocate space for the per-cpu array */ > - MALLOC(pmc_pcpu, struct pmc_cpu **, mp_ncpus * sizeof(struct pmc_cpu *), > - M_PMC, M_WAITOK|M_ZERO); > + MALLOC(pmc_pcpu, struct pmc_cpu **, > + (mp_maxid + 1) * sizeof(struct pmc_cpu *), M_PMC, M_WAITOK|M_ZERO); > > /* per-cpu 'saved values' for managing process-mode PMCs */ > MALLOC(pmc_pcpu_saved, pmc_value_t *, > - sizeof(pmc_value_t) * mp_ncpus * md->pmd_npmc, M_PMC, M_WAITOK); > + sizeof(pmc_value_t) * (mp_maxid + 1) * md->pmd_npmc, M_PMC, M_WAITOK); > > /* perform cpu dependent initialization */ > pmc_save_cpu_binding(&pb); > - for (cpu = 0; cpu < mp_ncpus; cpu++) { > + for (cpu = 0; cpu <= mp_maxid; cpu++) { > if (pmc_cpu_is_disabled(cpu)) > continue; > pmc_select_cpu(cpu); > @@ -3995,7 +3995,7 @@ pmc_initialize(void) > return error; > > /* allocate space for the sample array */ > - for (cpu = 0; cpu < mp_ncpus; cpu++) { > + for (cpu = 0; cpu <= mp_maxid; cpu++) { > if (pmc_cpu_is_disabled(cpu)) > continue; > MALLOC(sb, struct pmc_samplebuffer *, > @@ -4156,7 +4156,7 @@ pmc_cleanup(void) > ("[pmc,%d] Global SS count not empty", __LINE__)); > > /* free the per-cpu sample buffers */ > - for (cpu = 0; cpu < mp_ncpus; cpu++) { > + for (cpu = 0; cpu <= mp_maxid; cpu++) { > if (pmc_cpu_is_disabled(cpu)) > continue; > KASSERT(pmc_pcpu[cpu]->pc_sb != NULL, > @@ -4170,7 +4170,7 @@ pmc_cleanup(void) > PMCDBG(MOD,INI,3, "%s", "md cleanup"); > if (md) { > pmc_save_cpu_binding(&pb); > - for (cpu = 0; cpu < mp_ncpus; cpu++) { > + for (cpu = 0; cpu <= mp_maxid; cpu++) { > PMCDBG(MOD,INI,1,"pmc-cleanup cpu=%d pcs=%p", > cpu, pmc_pcpu[cpu]); > if (pmc_cpu_is_disabled(cpu)) > Index: sys/dev/hwpmc/hwpmc_piv.c > =================================================================== > RCS file: /cvs/junos-2001/src/sys/dev/hwpmc/hwpmc_piv.c,v > retrieving revision 1.1.1.1 > retrieving revision 1.4 > diff -u -p -r1.1.1.1 -r1.4 > --- sys/dev/hwpmc/hwpmc_piv.c 21 Jun 2006 03:30:03 -0000 1.1.1.1 > +++ sys/dev/hwpmc/hwpmc_piv.c 30 Oct 2007 18:00:43 -0000 1.4 > @@ -585,7 +585,7 @@ p4_init(int cpu) > struct p4_logicalcpu *plcs; > struct pmc_hw *phw; > > - KASSERT(cpu >= 0 && cpu < mp_ncpus, > + KASSERT(cpu >= 0 && cpu <= mp_maxid, > ("[p4,%d] insane cpu number %d", __LINE__, cpu)); > > PMCDBG(MDP,INI,0, "p4-init cpu=%d logical=%d", cpu, > @@ -737,7 +737,7 @@ p4_read_pmc(int cpu, int ri, pmc_value_t > struct pmc_hw *phw; > pmc_value_t tmp; > > - KASSERT(cpu >= 0 && cpu < mp_ncpus, > + KASSERT(cpu >= 0 && cpu <= mp_maxid, > ("[p4,%d] illegal CPU value %d", __LINE__, cpu)); > KASSERT(ri >= 0 && ri < P4_NPMCS, > ("[p4,%d] illegal row-index %d", __LINE__, ri)); > @@ -815,7 +815,7 @@ p4_write_pmc(int cpu, int ri, pmc_value_ > const struct pmc_hw *phw; > const struct p4pmc_descr *pd; > > - KASSERT(cpu >= 0 && cpu < mp_ncpus, > + KASSERT(cpu >= 0 && cpu <= mp_maxid, > ("[amd,%d] illegal CPU value %d", __LINE__, cpu)); > KASSERT(ri >= 0 && ri < P4_NPMCS, > ("[amd,%d] illegal row-index %d", __LINE__, ri)); > @@ -889,7 +889,7 @@ p4_config_pmc(int cpu, int ri, struct pm > struct p4_cpu *pc; > int cfgflags, cpuflag; > > - KASSERT(cpu >= 0 && cpu < mp_ncpus, > + KASSERT(cpu >= 0 && cpu <= mp_maxid, > ("[p4,%d] illegal CPU %d", __LINE__, cpu)); > KASSERT(ri >= 0 && ri < P4_NPMCS, > ("[p4,%d] illegal row-index %d", __LINE__, ri)); > @@ -1026,7 +1026,7 @@ p4_allocate_pmc(int cpu, int ri, struct > struct p4_event_descr *pevent; > const struct p4pmc_descr *pd; > > - KASSERT(cpu >= 0 && cpu < mp_ncpus, > + KASSERT(cpu >= 0 && cpu <= mp_maxid, > ("[p4,%d] illegal CPU %d", __LINE__, cpu)); > KASSERT(ri >= 0 && ri < P4_NPMCS, > ("[p4,%d] illegal row-index value %d", __LINE__, ri)); > @@ -1273,7 +1273,7 @@ p4_start_pmc(int cpu, int ri) > struct pmc_hw *phw; > struct p4pmc_descr *pd; > > - KASSERT(cpu >= 0 && cpu < mp_ncpus, > + KASSERT(cpu >= 0 && cpu <= mp_maxid, > ("[p4,%d] illegal CPU value %d", __LINE__, cpu)); > KASSERT(ri >= 0 && ri < P4_NPMCS, > ("[p4,%d] illegal row-index %d", __LINE__, ri)); > @@ -1425,7 +1425,7 @@ p4_stop_pmc(int cpu, int ri) > struct p4pmc_descr *pd; > pmc_value_t tmp; > > - KASSERT(cpu >= 0 && cpu < mp_ncpus, > + KASSERT(cpu >= 0 && cpu <= mp_maxid, > ("[p4,%d] illegal CPU value %d", __LINE__, cpu)); > KASSERT(ri >= 0 && ri < P4_NPMCS, > ("[p4,%d] illegal row index %d", __LINE__, ri)); > @@ -1694,7 +1694,7 @@ p4_describe(int cpu, int ri, struct pmc_ > struct pmc_hw *phw; > const struct p4pmc_descr *pd; > > - KASSERT(cpu >= 0 && cpu < mp_ncpus, > + KASSERT(cpu >= 0 && cpu <= mp_maxid, > ("[p4,%d] illegal CPU %d", __LINE__, cpu)); > KASSERT(ri >= 0 && ri < P4_NPMCS, > ("[p4,%d] row-index %d out of range", __LINE__, ri)); > Index: sys/dev/hwpmc/hwpmc_ppro.c > =================================================================== > RCS file: /cvs/junos-2001/src/sys/dev/hwpmc/hwpmc_ppro.c,v > retrieving revision 1.1.1.1 > retrieving revision 1.4 > diff -u -p -r1.1.1.1 -r1.4 > --- sys/dev/hwpmc/hwpmc_ppro.c 21 Jun 2006 03:30:03 -0000 1.1.1.1 > +++ sys/dev/hwpmc/hwpmc_ppro.c 30 Oct 2007 18:00:43 -0000 1.4 > @@ -331,7 +331,7 @@ p6_init(int cpu) > struct p6_cpu *pcs; > struct pmc_hw *phw; > > - KASSERT(cpu >= 0 && cpu < mp_ncpus, > + KASSERT(cpu >= 0 && cpu <= mp_maxid, > ("[p6,%d] bad cpu %d", __LINE__, cpu)); > > PMCDBG(MDP,INI,0,"p6-init cpu=%d", cpu); > @@ -361,7 +361,7 @@ p6_cleanup(int cpu) > { > struct pmc_cpu *pcs; > > - KASSERT(cpu >= 0 && cpu < mp_ncpus, > + KASSERT(cpu >= 0 && cpu <= mp_maxid, > ("[p6,%d] bad cpu %d", __LINE__, cpu)); > > PMCDBG(MDP,INI,0,"p6-cleanup cpu=%d", cpu); > @@ -507,7 +507,7 @@ p6_allocate_pmc(int cpu, int ri, struct > > (void) cpu; > > - KASSERT(cpu >= 0 && cpu < mp_ncpus, > + KASSERT(cpu >= 0 && cpu <= mp_maxid, > ("[p4,%d] illegal CPU %d", __LINE__, cpu)); > KASSERT(ri >= 0 && ri < P6_NPMCS, > ("[p4,%d] illegal row-index value %d", __LINE__, ri)); > @@ -611,7 +611,7 @@ p6_release_pmc(int cpu, int ri, struct p > > PMCDBG(MDP,REL,1, "p6-release cpu=%d ri=%d pm=%p", cpu, ri, pm); > > - KASSERT(cpu >= 0 && cpu < mp_ncpus, > + KASSERT(cpu >= 0 && cpu <= mp_maxid, > ("[p6,%d] illegal CPU value %d", __LINE__, cpu)); > KASSERT(ri >= 0 && ri < P6_NPMCS, > ("[p6,%d] illegal row-index %d", __LINE__, ri)); > @@ -633,7 +633,7 @@ p6_start_pmc(int cpu, int ri) > struct pmc_hw *phw; > const struct p6pmc_descr *pd; > > - KASSERT(cpu >= 0 && cpu < mp_ncpus, > + KASSERT(cpu >= 0 && cpu <= mp_maxid, > ("[p6,%d] illegal CPU value %d", __LINE__, cpu)); > KASSERT(ri >= 0 && ri < P6_NPMCS, > ("[p6,%d] illegal row-index %d", __LINE__, ri)); > @@ -677,7 +677,7 @@ p6_stop_pmc(int cpu, int ri) > struct pmc_hw *phw; > struct p6pmc_descr *pd; > > - KASSERT(cpu >= 0 && cpu < mp_ncpus, > + KASSERT(cpu >= 0 && cpu <= mp_maxid, > ("[p6,%d] illegal cpu value %d", __LINE__, cpu)); > KASSERT(ri >= 0 && ri < P6_NPMCS, > ("[p6,%d] illegal row index %d", __LINE__, ri)); > @@ -719,7 +719,7 @@ p6_intr(int cpu, uintptr_t eip, int user > struct pmc_hw *phw; > pmc_value_t v; > > - KASSERT(cpu >= 0 && cpu < mp_ncpus, > + KASSERT(cpu >= 0 && cpu <= mp_maxid, > ("[p6,%d] CPU %d out of range", __LINE__, cpu)); > > retval = 0; > Index: usr.sbin/pmccontrol/pmccontrol.c > =================================================================== > RCS file: /cvs/junos-2001/src/usr.sbin/pmccontrol/pmccontrol.c,v > retrieving revision 1.1.1.1 > retrieving revision 1.4 > diff -u -p -r1.1.1.1 -r1.4 > --- usr.sbin/pmccontrol/pmccontrol.c 3 Nov 2006 01:43:32 -0000 1.1.1.1 > +++ usr.sbin/pmccontrol/pmccontrol.c 29 Nov 2007 22:47:14 -0000 1.4 > @@ -207,10 +207,16 @@ pmcc_do_enable_disable(struct pmcc_op_li > else if (b == PMCC_OP_DISABLE) > error = pmc_disable(i, j); > > - if (error < 0) > + if (error < 0) { > + if (errno == ENXIO) { > + /* This cpu wasn't configured. */ > + error = 0; > + continue; > + } > err(EX_OSERR, "%s of PMC %d on CPU %d failed", > b == PMCC_OP_ENABLE ? "Enable" : > "Disable", j, i); > + } > } > > return error; > @@ -242,9 +248,14 @@ pmcc_do_list_state(void) > (logical_cpus_mask & (1 << cpu))) > continue; /* skip P4-style 'logical' cpus */ > #endif > - if (pmc_pmcinfo(cpu, &pi) < 0) > + if (pmc_pmcinfo(cpu, &pi) < 0) { > + if (errno == ENXIO) { > + /* This cpu wasn't enabled. */ > + continue; > + } > err(EX_OSERR, "Unable to get PMC status for CPU %d", > cpu); > + } > > printf("#CPU %d:\n", c++); > npmc = pmc_npmc(cpu); > Index: usr.sbin/pmcstat/pmcstat.c > =================================================================== > RCS file: /cvs/junos-2001/src/usr.sbin/pmcstat/pmcstat.c,v > retrieving revision 1.1.1.1 > retrieving revision 1.4 > diff -u -p -r1.1.1.1 -r1.4 > --- usr.sbin/pmcstat/pmcstat.c 3 Nov 2006 01:43:32 -0000 1.1.1.1 > +++ usr.sbin/pmcstat/pmcstat.c 30 Aug 2007 15:03:02 -0000 1.4 > @@ -692,6 +692,7 @@ main(int argc, char **argv) > if ((args.pa_logparser = pmclog_open(args.pa_logfd)) == NULL) > err(EX_OSERR, "ERROR: Cannot create parser"); > pmcstat_process_log(&args); > + pmcstat_shutdown_logging(); > exit(EX_OK); > } > > > -- > -- David (obrien@FreeBSD.org) > Q: Because it reverses the logical flow of conversation. > A: Why is top-posting (putting a reply at the top of the message) frowned upon? > Let's not play "Jeopardy-style quoting" > _______________________________________________ > freebsd-arch@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-arch > To unsubscribe, send any mail to "freebsd-arch-unsubscribe@freebsd.org" > -- John Baldwin