From owner-p4-projects@FreeBSD.ORG Mon Sep 22 17:13:49 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 976E91065678; Mon, 22 Sep 2008 17:13:49 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5ADD6106566B for ; Mon, 22 Sep 2008 17:13:49 +0000 (UTC) (envelope-from imp@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 491858FC14 for ; Mon, 22 Sep 2008 17:13:49 +0000 (UTC) (envelope-from imp@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id m8MHDnm7072134 for ; Mon, 22 Sep 2008 17:13:49 GMT (envelope-from imp@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id m8MHDndk072132 for perforce@freebsd.org; Mon, 22 Sep 2008 17:13:49 GMT (envelope-from imp@freebsd.org) Date: Mon, 22 Sep 2008 17:13:49 GMT Message-Id: <200809221713.m8MHDndk072132@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to imp@freebsd.org using -f From: Warner Losh To: Perforce Change Reviews Cc: Subject: PERFORCE change 150287 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Sep 2008 17:13:49 -0000 http://perforce.freebsd.org/chv.cgi?CH=150287 Change 150287 by imp@imp_paco-paco on 2008/09/22 17:13:09 IFC @150286 Affected files ... .. //depot/projects/mips2/src/etc/Makefile#10 integrate .. //depot/projects/mips2/src/lib/libpmc/pmc.3#9 integrate .. //depot/projects/mips2/src/lib/libpmc/pmc_allocate.3#2 integrate .. //depot/projects/mips2/src/lib/libpmc/pmc_capabilities.3#3 integrate .. //depot/projects/mips2/src/lib/libpmc/pmc_disable.3#2 integrate .. //depot/projects/mips2/src/lib/libpmc/pmc_start.3#2 integrate .. //depot/projects/mips2/src/sbin/ipfw/ipfw2.c#13 integrate .. //depot/projects/mips2/src/share/examples/drivers/make_pseudo_driver.sh#3 integrate .. //depot/projects/mips2/src/share/man/man4/hwpmc.4#6 integrate .. //depot/projects/mips2/src/sys/compat/freebsd32/freebsd32_ioctl.c#1 branch .. //depot/projects/mips2/src/sys/compat/freebsd32/freebsd32_ioctl.h#1 branch .. //depot/projects/mips2/src/sys/compat/freebsd32/freebsd32_proto.h#14 integrate .. //depot/projects/mips2/src/sys/compat/freebsd32/freebsd32_syscall.h#14 integrate .. //depot/projects/mips2/src/sys/compat/freebsd32/freebsd32_syscalls.c#14 integrate .. //depot/projects/mips2/src/sys/compat/freebsd32/freebsd32_sysent.c#14 integrate .. //depot/projects/mips2/src/sys/compat/freebsd32/syscalls.master#15 integrate .. //depot/projects/mips2/src/sys/conf/files.amd64#15 integrate .. //depot/projects/mips2/src/sys/conf/files.ia64#8 integrate .. //depot/projects/mips2/src/sys/dev/hwpmc/hwpmc_amd.c#4 integrate .. //depot/projects/mips2/src/sys/dev/hwpmc/hwpmc_mod.c#8 integrate .. //depot/projects/mips2/src/sys/dev/hwpmc/hwpmc_piv.c#4 integrate .. //depot/projects/mips2/src/sys/dev/hwpmc/hwpmc_ppro.c#3 integrate .. //depot/projects/mips2/src/sys/dev/jme/if_jme.c#4 integrate .. //depot/projects/mips2/src/sys/dev/jme/if_jmereg.h#3 integrate .. //depot/projects/mips2/src/sys/kern/kern_pmc.c#3 integrate .. //depot/projects/mips2/src/sys/netinet6/udp6_usrreq.c#14 integrate .. //depot/projects/mips2/src/sys/sys/pmckern.h#3 integrate Differences ... ==== //depot/projects/mips2/src/etc/Makefile#10 (text+ko) ==== @@ -1,5 +1,5 @@ # from: @(#)Makefile 5.11 (Berkeley) 5/21/91 -# $FreeBSD: src/etc/Makefile,v 1.369 2008/09/21 22:02:26 sam Exp $ +# $FreeBSD: src/etc/Makefile,v 1.370 2008/09/22 15:37:47 sam Exp $ .include @@ -84,6 +84,10 @@ BIN1+= pf.os .endif +.if ${MK_WIRELESS} != "no" +BIN1+= regdomain.xml +.endif + # -rwxr-xr-x root:wheel, for the new cron root:wheel BIN2= netstart pccard_ether rc.suspend rc.resume ==== //depot/projects/mips2/src/lib/libpmc/pmc.3#9 (text+ko) ==== @@ -21,7 +21,7 @@ .\" out of the use of this software, even if advised of the possibility of .\" such damage. .\" -.\" $FreeBSD: src/lib/libpmc/pmc.3,v 1.21 2008/09/19 13:21:23 jkoshy Exp $ +.\" $FreeBSD: src/lib/libpmc/pmc.3,v 1.22 2008/09/22 14:31:24 jkoshy Exp $ .\" .Dd September 16, 2008 .Os @@ -261,7 +261,14 @@ .It Li PMC_CAP_WRITE The ability to write to performance counters. .El -.Ss Functional Grouping +.Ss CPU Naming Conventions +CPUs are named using small integers from zero uptil, but +excluding, the value returned by function +.Fn pmc_ncpu . +On platforms supporting sparsely numbered CPUs not all the numbers in +this range will denote valid CPUs. +Operations on non-existent CPUs will return an error. +.Ss Functional Grouping of the API This section contains a brief overview of the available functionality in the PMC library. Each function listed here is described further in its own manual page. @@ -342,7 +349,7 @@ Retrieve statistics maintained by .Xr hwpmc 4 . .It Fn pmc_ncpu -Determine the number of CPUs in the system. +Determine the greatest possible CPU number on the system. .It Fn pmc_npmc Return the number of hardware PMCs present in a given CPU. .It Fn pmc_pmcinfo ==== //depot/projects/mips2/src/lib/libpmc/pmc_allocate.3#2 (text+ko) ==== @@ -1,4 +1,4 @@ -.\" Copyright (c) 2007 Joseph Koshy. All rights reserved. +.\" Copyright (c) 2007-2008 Joseph Koshy. All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions @@ -21,9 +21,9 @@ .\" out of the use of this software, even if advised of the possibility of .\" such damage. .\" -.\" $FreeBSD: src/lib/libpmc/pmc_allocate.3,v 1.1 2007/11/23 11:46:08 jkoshy Exp $ +.\" $FreeBSD: src/lib/libpmc/pmc_allocate.3,v 1.2 2008/09/22 14:31:24 jkoshy Exp $ .\" -.Dd November 20, 2007 +.Dd September 22, 2008 .Os .Dt PMC_ALLOCATE 3 .Sh NAME @@ -156,7 +156,7 @@ .It Bq Er ENXIO Function .Fn pmc_allocate -requested the use of a hardware resource that was previously +requested the use of a hardware resource that was absent or administratively disabled. .It Bq Er EOPNOTSUPP The underlying hardware does not support the capabilities needed for ==== //depot/projects/mips2/src/lib/libpmc/pmc_capabilities.3#3 (text+ko) ==== @@ -1,4 +1,4 @@ -.\" Copyright (c) 2007 Joseph Koshy. All rights reserved. +.\" Copyright (c) 2007-2008 Joseph Koshy. All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions @@ -21,9 +21,9 @@ .\" out of the use of this software, even if advised of the possibility of .\" such damage. .\" -.\" $FreeBSD: src/lib/libpmc/pmc_capabilities.3,v 1.2 2008/03/12 15:48:59 jkoshy Exp $ +.\" $FreeBSD: src/lib/libpmc/pmc_capabilities.3,v 1.3 2008/09/22 14:31:24 jkoshy Exp $ .\" -.Dd November 24, 2007 +.Dd September 22, 2008 .Os .Dt PMC_CAPABILITIES 3 .Sh NAME @@ -96,8 +96,11 @@ .Pp Function .Fn pmc_ncpu -is a convenience function that returns the number of CPUs in the -system. +is a convenience function that returns the maximum CPU number in +the system. +On systems that support sparsely numbered CPUs, not all CPUs may +be physically present. +Applications need to be prepared to deal with nonexistent CPUs. .Pp Function .Fn pmc_npmc @@ -201,11 +204,11 @@ .It Bq Er EINVAL The argument .Fa cpu -specified a non-existent CPU. +was invalid. .It Bq Er ENXIO The argument .Fa cpu -specified a disabled CPU. +specified a disabled or absent CPU. .El .Pp A call to function ==== //depot/projects/mips2/src/lib/libpmc/pmc_disable.3#2 (text+ko) ==== @@ -1,4 +1,4 @@ -.\" Copyright (c) 2007 Joseph Koshy. All rights reserved. +.\" Copyright (c) 2007-2008 Joseph Koshy. All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions @@ -21,9 +21,9 @@ .\" out of the use of this software, even if advised of the possibility of .\" such damage. .\" -.\" $FreeBSD: src/lib/libpmc/pmc_disable.3,v 1.1 2007/11/23 12:21:34 jkoshy Exp $ +.\" $FreeBSD: src/lib/libpmc/pmc_disable.3,v 1.2 2008/09/22 14:31:24 jkoshy Exp $ .\" -.Dd November 20, 2007 +.Dd September 22, 2008 .Os .Dt PMC_ENABLE 3 .Sh NAME @@ -85,7 +85,7 @@ .It Bq Er ENXIO Argument .Fa cpu -specified a disabled CPU. +specified a disabled or absent CPU. .It Bq Er EPERM The current process lacks sufficient privilege to perform this operation. @@ -96,4 +96,4 @@ .Xr pmc_pmcinfo 3 , .Xr hwpmc 4 , .Xr pmccontrol 8 , -.Xr priv_check 9+.Xr priv_check 9 ==== //depot/projects/mips2/src/lib/libpmc/pmc_start.3#2 (text+ko) ==== @@ -1,4 +1,4 @@ -.\" Copyright (c) 2007 Joseph Koshy. All rights reserved. +.\" Copyright (c) 2007-2008 Joseph Koshy. All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions @@ -21,9 +21,9 @@ .\" out of the use of this software, even if advised of the possibility of .\" such damage. .\" -.\" $FreeBSD: src/lib/libpmc/pmc_start.3,v 1.1 2007/11/25 06:38:55 jkoshy Exp $ +.\" $FreeBSD: src/lib/libpmc/pmc_start.3,v 1.2 2008/09/22 14:31:24 jkoshy Exp $ .\" -.Dd November 25, 2007 +.Dd September 22, 2008 .Os .Dt PMC_START 3 .Sh NAME @@ -69,7 +69,8 @@ .Fn pmc_stop specified a PMC that was never started. .It Bq Er ENXIO -The specified PMC had system scope and its associated CPU was disabled. +The specified PMC had system scope and its associated CPU was disabled or +absent. .El .Sh SEE ALSO .Xr pmc 3 , ==== //depot/projects/mips2/src/sbin/ipfw/ipfw2.c#13 (text+ko) ==== @@ -17,7 +17,7 @@ * * NEW command line interface for IP firewall facility * - * $FreeBSD: src/sbin/ipfw/ipfw2.c,v 1.127 2008/09/21 21:46:56 rik Exp $ + * $FreeBSD: src/sbin/ipfw/ipfw2.c,v 1.128 2008/09/22 04:12:27 keramida Exp $ */ #include @@ -5874,7 +5874,7 @@ char *p; uint32_t tables_max; - len = sizeof(a); + len = sizeof(tables_max); if (sysctlbyname("net.inet.ip.fw.tables_max", &tables_max, &len, NULL, 0) == -1) { #ifdef IPFW_TABLES_MAX ==== //depot/projects/mips2/src/share/examples/drivers/make_pseudo_driver.sh#3 (text+ko) ==== @@ -6,7 +6,7 @@ # # Trust me, RUN THIS SCRIPT :) # -# $FreeBSD: src/share/examples/drivers/make_pseudo_driver.sh,v 1.13 2006/08/23 23:51:29 rik Exp $ +# $FreeBSD: src/share/examples/drivers/make_pseudo_driver.sh,v 1.14 2008/09/22 16:10:12 ed Exp $ # #-------cut here------------------ @@ -344,7 +344,7 @@ ${1}_drvinit(void *unused) { int unit; - sc_p scp = sca[unit]; + sc_p scp; for (unit = 0; unit < N${UPPER}; unit++) { /* @@ -362,7 +362,7 @@ } SYSINIT(${1}dev, SI_SUB_DRIVERS, SI_ORDER_MIDDLE+CDEV_MAJOR, - ${1}_drvinit, NULL) + ${1}_drvinit, NULL); DONE cat >${TOP}/sys/${1}io.h < -__FBSDID("$FreeBSD: src/sys/dev/hwpmc/hwpmc_amd.c,v 1.16 2008/03/18 08:39:11 adrian Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/hwpmc/hwpmc_amd.c,v 1.17 2008/09/22 10:37:02 jkoshy Exp $"); /* Support for the AMD K7 and later processors */ @@ -39,6 +39,7 @@ #include #include #include +#include #include #include @@ -269,7 +270,7 @@ const struct pmc_hw *phw; pmc_value_t tmp; - KASSERT(cpu >= 0 && cpu < mp_ncpus, + KASSERT(cpu >= 0 && cpu < pmc_cpu_max(), ("[amd,%d] illegal CPU value %d", __LINE__, cpu)); KASSERT(ri >= 0 && ri < AMD_NPMCS, ("[amd,%d] illegal row-index %d", __LINE__, ri)); @@ -327,7 +328,7 @@ const struct pmc_hw *phw; enum pmc_mode mode; - KASSERT(cpu >= 0 && cpu < mp_ncpus, + KASSERT(cpu >= 0 && cpu < pmc_cpu_max(), ("[amd,%d] illegal CPU value %d", __LINE__, cpu)); KASSERT(ri >= 0 && ri < AMD_NPMCS, ("[amd,%d] illegal row-index %d", __LINE__, ri)); @@ -374,7 +375,7 @@ PMCDBG(MDP,CFG,1, "cpu=%d ri=%d pm=%p", cpu, ri, pm); - KASSERT(cpu >= 0 && cpu < mp_ncpus, + KASSERT(cpu >= 0 && cpu < pmc_cpu_max(), ("[amd,%d] illegal CPU value %d", __LINE__, cpu)); KASSERT(ri >= 0 && ri < AMD_NPMCS, ("[amd,%d] illegal row-index %d", __LINE__, ri)); @@ -456,7 +457,7 @@ (void) cpu; - KASSERT(cpu >= 0 && cpu < mp_ncpus, + KASSERT(cpu >= 0 && cpu < pmc_cpu_max(), ("[amd,%d] illegal CPU value %d", __LINE__, cpu)); KASSERT(ri >= 0 && ri < AMD_NPMCS, ("[amd,%d] illegal row index %d", __LINE__, ri)); @@ -550,7 +551,7 @@ (void) pmc; - KASSERT(cpu >= 0 && cpu < mp_ncpus, + KASSERT(cpu >= 0 && cpu < pmc_cpu_max(), ("[amd,%d] illegal CPU value %d", __LINE__, cpu)); KASSERT(ri >= 0 && ri < AMD_NPMCS, ("[amd,%d] illegal row-index %d", __LINE__, ri)); @@ -582,7 +583,7 @@ struct pmc_hw *phw; const struct amd_descr *pd; - KASSERT(cpu >= 0 && cpu < mp_ncpus, + KASSERT(cpu >= 0 && cpu < pmc_cpu_max(), ("[amd,%d] illegal CPU value %d", __LINE__, cpu)); KASSERT(ri >= 0 && ri < AMD_NPMCS, ("[amd,%d] illegal row-index %d", __LINE__, ri)); @@ -631,7 +632,7 @@ const struct amd_descr *pd; uint64_t config; - KASSERT(cpu >= 0 && cpu < mp_ncpus, + KASSERT(cpu >= 0 && cpu < pmc_cpu_max(), ("[amd,%d] illegal CPU value %d", __LINE__, cpu)); KASSERT(ri >= 0 && ri < AMD_NPMCS, ("[amd,%d] illegal row-index %d", __LINE__, ri)); @@ -683,7 +684,7 @@ struct pmc_hw *phw; pmc_value_t v; - KASSERT(cpu >= 0 && cpu < mp_ncpus, + KASSERT(cpu >= 0 && cpu < pmc_cpu_max(), ("[amd,%d] out of range CPU %d", __LINE__, cpu)); PMCDBG(MDP,INT,1, "cpu=%d tf=%p um=%d", cpu, (void *) tf, @@ -763,7 +764,7 @@ const struct amd_descr *pd; struct pmc_hw *phw; - KASSERT(cpu >= 0 && cpu < mp_ncpus, + KASSERT(cpu >= 0 && cpu < pmc_cpu_max(), ("[amd,%d] illegal CPU %d", __LINE__, cpu)); KASSERT(ri >= 0 && ri < AMD_NPMCS, ("[amd,%d] row-index %d out of range", __LINE__, ri)); @@ -832,7 +833,7 @@ struct amd_cpu *pcs; struct pmc_hw *phw; - KASSERT(cpu >= 0 && cpu < mp_ncpus, + KASSERT(cpu >= 0 && cpu < pmc_cpu_max(), ("[amd,%d] insane cpu number %d", __LINE__, cpu)); PMCDBG(MDP,INI,1,"amd-init cpu=%d", cpu); @@ -875,7 +876,7 @@ uint32_t evsel; struct pmc_cpu *pcs; - KASSERT(cpu >= 0 && cpu < mp_ncpus, + KASSERT(cpu >= 0 && cpu < pmc_cpu_max(), ("[amd,%d] insane cpu number (%d)", __LINE__, cpu)); PMCDBG(MDP,INI,1,"amd-cleanup cpu=%d", cpu); ==== //depot/projects/mips2/src/sys/dev/hwpmc/hwpmc_mod.c#8 (text+ko) ==== @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2003-2007 Joseph Koshy + * Copyright (c) 2003-2008 Joseph Koshy * Copyright (c) 2007 The FreeBSD Foundation * All rights reserved. * @@ -30,7 +30,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/dev/hwpmc/hwpmc_mod.c,v 1.33 2008/07/25 05:49:48 jeff Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/hwpmc/hwpmc_mod.c,v 1.34 2008/09/22 10:37:02 jkoshy Exp $"); #include #include @@ -98,8 +98,8 @@ KASSERT(pmc_pmcdisp[(R)] <= 0, ("[pmc,%d] row disposition error", \ __LINE__)); \ atomic_add_int(&pmc_pmcdisp[(R)], -1); \ - KASSERT(pmc_pmcdisp[(R)] >= (-mp_ncpus), ("[pmc,%d] row " \ - "disposition error", __LINE__)); \ + KASSERT(pmc_pmcdisp[(R)] >= (-pmc_cpu_max_active()), \ + ("[pmc,%d] row disposition error", __LINE__)); \ } while (0) #define PMC_UNMARK_ROW_STANDALONE(R) do { \ @@ -637,12 +637,12 @@ static void pmc_select_cpu(int cpu) { - KASSERT(cpu >= 0 && cpu < mp_ncpus, + KASSERT(cpu >= 0 && cpu < pmc_cpu_max(), ("[pmc,%d] bad cpu number %d", __LINE__, cpu)); - /* never move to a disabled CPU */ - KASSERT(pmc_cpu_is_disabled(cpu) == 0, ("[pmc,%d] selecting " - "disabled CPU %d", __LINE__, cpu)); + /* Never move to an inactive CPU. */ + KASSERT(pmc_cpu_is_active(cpu), ("[pmc,%d] selecting inactive " + "CPU %d", __LINE__, cpu)); PMCDBG(CPU,SEL,2, "select-cpu cpu=%d", cpu); thread_lock(curthread); @@ -1186,7 +1186,7 @@ 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 < pmc_cpu_max(), ("[pmc,%d] wierd CPU id %d", __LINE__, cpu)); pc = pmc_pcpu[cpu]; @@ -1311,7 +1311,7 @@ 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 < pmc_cpu_max(), ("[pmc,%d wierd CPU id %d", __LINE__, cpu)); pc = pmc_pcpu[cpu]; @@ -2038,7 +2038,7 @@ #ifdef DEBUG volatile int maxloop; - maxloop = 100 * mp_ncpus; + maxloop = 100 * pmc_cpu_max(); #endif /* @@ -2499,7 +2499,7 @@ cpu = PMC_TO_CPU(pm); - if (pmc_cpu_is_disabled(cpu)) + if (!pmc_cpu_is_active(cpu)) return ENXIO; pmc_select_cpu(cpu); @@ -2566,10 +2566,10 @@ cpu = PMC_TO_CPU(pm); - KASSERT(cpu >= 0 && cpu < mp_ncpus, + KASSERT(cpu >= 0 && cpu < pmc_cpu_max(), ("[pmc,%d] illegal cpu=%d", __LINE__, cpu)); - if (pmc_cpu_is_disabled(cpu)) + if (!pmc_cpu_is_active(cpu)) return ENXIO; pmc_select_cpu(cpu); @@ -2734,7 +2734,7 @@ struct pmc_op_getcpuinfo gci; gci.pm_cputype = md->pmd_cputype; - gci.pm_ncpu = mp_ncpus; + gci.pm_ncpu = pmc_cpu_max(); gci.pm_npmc = md->pmd_npmc; gci.pm_nclass = md->pmd_nclass; bcopy(md->pmd_classes, &gci.pm_classes, @@ -2802,12 +2802,12 @@ if ((error = copyin(&gpi->pm_cpu, &cpu, sizeof(cpu))) != 0) break; - if (cpu >= (unsigned int) mp_ncpus) { + if (cpu >= pmc_cpu_max()) { error = EINVAL; break; } - if (pmc_cpu_is_disabled(cpu)) { + if (!pmc_cpu_is_active(cpu)) { error = ENXIO; break; } @@ -2896,12 +2896,12 @@ cpu = pma.pm_cpu; - if (cpu < 0 || cpu >= mp_ncpus) { + if (cpu < 0 || cpu >= (int) pmc_cpu_max()) { error = EINVAL; break; } - if (pmc_cpu_is_disabled(cpu)) { + if (!pmc_cpu_is_active(cpu)) { error = ENXIO; break; } @@ -2989,7 +2989,7 @@ 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 >= pmc_cpu_max())) { error = EINVAL; break; } @@ -3006,10 +3006,10 @@ } /* - * Check that a disabled CPU is not being asked for. + * Check that an inactive CPU is not being asked for. */ - if (PMC_IS_SYSTEM_MODE(mode) && pmc_cpu_is_disabled(cpu)) { + if (PMC_IS_SYSTEM_MODE(mode) && !pmc_cpu_is_active(cpu)) { error = ENXIO; break; } @@ -3522,7 +3522,7 @@ cpu = PMC_TO_CPU(pm); ri = PMC_TO_ROWINDEX(pm); - if (pmc_cpu_is_disabled(cpu)) { + if (!pmc_cpu_is_active(cpu)) { error = ENXIO; break; } @@ -4292,6 +4292,7 @@ pmc_initialize(void) { int cpu, error, n; + unsigned int maxcpu; struct pmc_binding pb; struct pmc_sample *ps; struct pmc_samplebuffer *sb; @@ -4349,18 +4350,20 @@ if (md == NULL || md->pmd_init == NULL) return ENOSYS; + maxcpu = pmc_cpu_max(); + /* allocate space for the per-cpu array */ - MALLOC(pmc_pcpu, struct pmc_cpu **, mp_ncpus * sizeof(struct pmc_cpu *), + MALLOC(pmc_pcpu, struct pmc_cpu **, maxcpu * 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) * maxcpu * md->pmd_npmc, M_PMC, M_WAITOK); - /* perform cpu dependent initialization */ + /* Perform CPU-dependent initialization. */ pmc_save_cpu_binding(&pb); - for (cpu = 0; cpu < mp_ncpus; cpu++) { - if (pmc_cpu_is_disabled(cpu)) + for (cpu = 0; cpu < maxcpu; cpu++) { + if (!pmc_cpu_is_active(cpu)) continue; pmc_select_cpu(cpu); if ((error = md->pmd_init(cpu)) != 0) @@ -4372,8 +4375,8 @@ return error; /* allocate space for the sample array */ - for (cpu = 0; cpu < mp_ncpus; cpu++) { - if (pmc_cpu_is_disabled(cpu)) + for (cpu = 0; cpu < maxcpu; cpu++) { + if (!pmc_cpu_is_active(cpu)) continue; MALLOC(sb, struct pmc_samplebuffer *, sizeof(struct pmc_samplebuffer) + @@ -4463,6 +4466,7 @@ pmc_cleanup(void) { int cpu; + unsigned int maxcpu; struct pmc_ownerhash *ph; struct pmc_owner *po, *tmp; struct pmc_binding pb; @@ -4542,9 +4546,10 @@ KASSERT(pmc_ss_count == 0, ("[pmc,%d] Global SS count not empty", __LINE__)); - /* free the per-cpu sample buffers */ - for (cpu = 0; cpu < mp_ncpus; cpu++) { - if (pmc_cpu_is_disabled(cpu)) + /* Free the per-cpu sample buffers. */ + maxcpu = pmc_cpu_max(); + for (cpu = 0; cpu < maxcpu; cpu++) { + if (!pmc_cpu_is_active(cpu)) continue; KASSERT(pmc_pcpu[cpu]->pc_sb != NULL, ("[pmc,%d] Null cpu sample buffer cpu=%d", __LINE__, @@ -4558,14 +4563,14 @@ 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 < maxcpu; cpu++) { PMCDBG(MOD,INI,1,"pmc-cleanup cpu=%d pcs=%p", cpu, pmc_pcpu[cpu]); - if (pmc_cpu_is_disabled(cpu)) + if (!pmc_cpu_is_active(cpu) || pmc_pcpu[cpu] == NULL) continue; pmc_select_cpu(cpu); - if (pmc_pcpu[cpu]) - (void) md->pmd_cleanup(cpu); + if (md->pmd_cleanup) + md->pmd_cleanup(cpu); } FREE(md, M_PMC); md = NULL; @@ -4606,8 +4611,8 @@ error = pmc_initialize(); if (error != 0) break; - PMCDBG(MOD,INI,1, "syscall=%d ncpus=%d", - pmc_syscall_num, mp_ncpus); + PMCDBG(MOD,INI,1, "syscall=%d maxcpu=%d", + pmc_syscall_num, pmc_cpu_max()); break; ==== //depot/projects/mips2/src/sys/dev/hwpmc/hwpmc_piv.c#4 (text+ko) ==== @@ -29,7 +29,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/dev/hwpmc/hwpmc_piv.c,v 1.15 2007/12/07 08:20:15 jkoshy Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/hwpmc/hwpmc_piv.c,v 1.16 2008/09/22 10:37:02 jkoshy Exp $"); #include #include @@ -532,8 +532,8 @@ KASSERT(p4_escrdisp[(E)] <= 0, ("[p4,%d] row disposition error",\ __LINE__)); \ atomic_add_int(&p4_escrdisp[(E)], -1); \ - KASSERT(p4_escrdisp[(E)] >= (-mp_ncpus), ("[p4,%d] row " \ - "disposition error", __LINE__)); \ + KASSERT(p4_escrdisp[(E)] >= (-pmc_cpu_max_active()), \ + ("[p4,%d] row disposition error", __LINE__)); \ } while (0) #define P4_ESCR_UNMARK_ROW_STANDALONE(E) do { \ @@ -596,11 +596,11 @@ struct p4_logicalcpu *plcs; struct pmc_hw *phw; - KASSERT(cpu >= 0 && cpu < mp_ncpus, + KASSERT(cpu >= 0 && cpu < pmc_cpu_max(), ("[p4,%d] insane cpu number %d", __LINE__, cpu)); - PMCDBG(MDP,INI,0, "p4-init cpu=%d logical=%d", cpu, - pmc_cpu_is_logical(cpu) != 0); + PMCDBG(MDP,INI,0, "p4-init cpu=%d is-primary=%d", cpu, + pmc_cpu_is_primary(cpu) != 0); /* * The two CPUs in an HT pair share their per-cpu state. @@ -614,7 +614,7 @@ * secondary. */ - if (pmc_cpu_is_logical(cpu) && (cpu & 1)) { + if (!pmc_cpu_is_primary(cpu) && (cpu & 1)) { p4_system_has_htt = 1; @@ -761,7 +761,7 @@ struct pmc_hw *phw; pmc_value_t tmp; - KASSERT(cpu >= 0 && cpu < mp_ncpus, + KASSERT(cpu >= 0 && cpu < pmc_cpu_max(), ("[p4,%d] illegal CPU value %d", __LINE__, cpu)); KASSERT(ri >= 0 && ri < P4_NPMCS, ("[p4,%d] illegal row-index %d", __LINE__, ri)); @@ -839,7 +839,7 @@ const struct pmc_hw *phw; const struct p4pmc_descr *pd; - KASSERT(cpu >= 0 && cpu < mp_ncpus, + KASSERT(cpu >= 0 && cpu < pmc_cpu_max(), ("[amd,%d] illegal CPU value %d", __LINE__, cpu)); KASSERT(ri >= 0 && ri < P4_NPMCS, ("[amd,%d] illegal row-index %d", __LINE__, ri)); @@ -913,7 +913,7 @@ struct p4_cpu *pc; int cfgflags, cpuflag; - KASSERT(cpu >= 0 && cpu < mp_ncpus, + KASSERT(cpu >= 0 && cpu < pmc_cpu_max(), ("[p4,%d] illegal CPU %d", __LINE__, cpu)); KASSERT(ri >= 0 && ri < P4_NPMCS, ("[p4,%d] illegal row-index %d", __LINE__, ri)); @@ -1050,7 +1050,7 @@ struct p4_event_descr *pevent; const struct p4pmc_descr *pd; - KASSERT(cpu >= 0 && cpu < mp_ncpus, + KASSERT(cpu >= 0 && cpu < pmc_cpu_max(), ("[p4,%d] illegal CPU %d", __LINE__, cpu)); >>> TRUNCATED FOR MAIL (1000 lines) <<<