PERFORCE change 167353 for review

Edward Tomasz Napierala trasz at FreeBSD.org
Sat Aug 15 08:02:36 UTC 2009


http://perforce.freebsd.org/chv.cgi?CH=167353

Change 167353 by trasz at trasz_anger on 2009/08/15 08:01:52

	IFC and a small world build fix.

Affected files ...

.. //depot/projects/soc2009/trasz_limits/release/Makefile#3 integrate
.. //depot/projects/soc2009/trasz_limits/release/svnbranch.awk#1 branch
.. //depot/projects/soc2009/trasz_limits/sys/amd64/amd64/local_apic.c#5 integrate
.. //depot/projects/soc2009/trasz_limits/sys/amd64/include/apicvar.h#3 integrate
.. //depot/projects/soc2009/trasz_limits/sys/amd64/include/pmc_mdep.h#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/conf/options#10 integrate
.. //depot/projects/soc2009/trasz_limits/sys/dev/hwpmc/hwpmc_core.c#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/dev/hwpmc/hwpmc_piv.c#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/dev/hwpmc/hwpmc_ppro.c#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/dev/hwpmc/hwpmc_x86.c#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/i386/i386/local_apic.c#5 integrate
.. //depot/projects/soc2009/trasz_limits/sys/i386/include/apicvar.h#5 integrate
.. //depot/projects/soc2009/trasz_limits/sys/i386/include/pmc_mdep.h#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/kern/kern_mutex.c#4 integrate
.. //depot/projects/soc2009/trasz_limits/sys/kern/kern_rwlock.c#4 integrate
.. //depot/projects/soc2009/trasz_limits/sys/kern/kern_sx.c#4 integrate
.. //depot/projects/soc2009/trasz_limits/sys/kern/vfs_cache.c#5 integrate
.. //depot/projects/soc2009/trasz_limits/sys/net/if.c#10 integrate
.. //depot/projects/soc2009/trasz_limits/sys/net/vnet.h#10 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netinet/ip_output.c#9 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netinet/ipfw/ip_fw2.c#6 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netinet/sctp_os_bsd.h#5 integrate
.. //depot/projects/soc2009/trasz_limits/sys/nfsclient/nfs_subs.c#4 integrate
.. //depot/projects/soc2009/trasz_limits/sys/sys/lock.h#4 integrate
.. //depot/projects/soc2009/trasz_limits/sys/sys/systm.h#4 integrate
.. //depot/projects/soc2009/trasz_limits/sys/ufs/ffs/ffs_softdep.c#4 integrate
.. //depot/projects/soc2009/trasz_limits/usr.bin/id/id.c#5 edit
.. //depot/projects/soc2009/trasz_limits/usr.sbin/Makefile#7 integrate
.. //depot/projects/soc2009/trasz_limits/usr.sbin/arp/arp.c#3 integrate
.. //depot/projects/soc2009/trasz_limits/usr.sbin/mfiutil/mfi_drive.c#2 integrate
.. //depot/projects/soc2009/trasz_limits/usr.sbin/mptutil/Makefile#1 branch
.. //depot/projects/soc2009/trasz_limits/usr.sbin/mptutil/mpt_cam.c#1 branch
.. //depot/projects/soc2009/trasz_limits/usr.sbin/mptutil/mpt_cmd.c#1 branch
.. //depot/projects/soc2009/trasz_limits/usr.sbin/mptutil/mpt_config.c#1 branch
.. //depot/projects/soc2009/trasz_limits/usr.sbin/mptutil/mpt_drive.c#1 branch
.. //depot/projects/soc2009/trasz_limits/usr.sbin/mptutil/mpt_evt.c#1 branch
.. //depot/projects/soc2009/trasz_limits/usr.sbin/mptutil/mpt_show.c#1 branch
.. //depot/projects/soc2009/trasz_limits/usr.sbin/mptutil/mpt_volume.c#1 branch
.. //depot/projects/soc2009/trasz_limits/usr.sbin/mptutil/mptutil.8#1 branch
.. //depot/projects/soc2009/trasz_limits/usr.sbin/mptutil/mptutil.c#1 branch
.. //depot/projects/soc2009/trasz_limits/usr.sbin/mptutil/mptutil.h#1 branch
.. //depot/projects/soc2009/trasz_limits/usr.sbin/sysinstall/devices.c#4 integrate

Differences ...

==== //depot/projects/soc2009/trasz_limits/release/Makefile#3 (text+ko) ====

@@ -1,7 +1,8 @@
-# $FreeBSD: src/release/Makefile,v 1.943 2009/06/28 08:59:46 blackend Exp $
+# $FreeBSD: src/release/Makefile,v 1.944 2009/08/14 20:35:42 jhb Exp $
 #
 # make release [BUILDNAME=somename] CHROOTDIR=/some/dir CVSROOT=/cvs/dir \
-#     [RELEASETAG=tag]
+#     [RELEASETAG=tag] [SVNROOT=svn://svn.freebsd.org/base] \
+#     [SVNBRANCH=some/branch]
 #
 # Where "/some/dir" is the pathname of a directory on a some filesystem with
 # at least 1000MB of free space, "somename" is what you want the release to
@@ -9,6 +10,11 @@
 # which CVS "tag" name should be used when checking out the sources to build
 # the release (default is HEAD).
 #
+# Please note the support for building from SVN is preliminary and there
+# are still questions about things like how to handle updates of
+# /usr/src on production systems (csup(1) replacement).  It is a work
+# in progress and may change as the other issues get worked out.
+#
 # Please note: the md(4) driver must be present in the kernel
 # (either by being compiled in or available as a kld(4) module),
 # otherwise the target 'release.8' and possibly others will fail.
@@ -49,12 +55,25 @@
 # To add other options to the CVS command, set
 #CVSARGS="-lfq"
 #
-# To prefix the cvs command
+# To prefix the CVS command
 #CVSPREFIX="/usr/bin/time"
 #
 # Where the CVS repository is
 #CVSROOT="/home/ncvs"
 #
+# To add other options to the Subversion subcommands (co,up), set
+#SVNCMDARGS="-r '{ 01/01/2002 00:00:00 UTC }'"
+#
+# To prefix the Subversion command
+#SVNPREFIX="/usr/bin/time"
+#
+# Where the Subversion repository is
+#SVNROOT=svn://svn.freebsd.org/base
+#
+# Subversion branch to build for src.  If this is not set then it is
+# automatically computed from RELEASETAG.
+#SVNBRANCH=stable/7
+#
 # Non-zero if ${RELEASETAG} is in the form "RELENG_ver_RELEASE"; we
 # are building an official release.  Otherwise, we are building for
 # a branch.
@@ -68,6 +87,16 @@
 .endif
 .endif
 
+# Determine the Subversion source branch that corresponds to the requested
+# RELEASETAG.
+.if !defined(SVNBRANCH)
+.if defined(RELEASETAG)
+SVNBRANCH!=	echo "${RELEASETAG}" | awk -f ${.CURDIR}/svnbranch.awk
+.else
+SVNBRANCH=	head
+.endif
+.endif
+
 # If you want to pass flags to the world build such as -j X, use
 # WORLD_FLAGS.  Similarly, you can specify make flags for kernel
 # builds via KERNEL_FLAGS.
@@ -341,8 +370,17 @@
 WORLDDIR?=	${.CURDIR}/..
 
 release rerelease:
-.if !defined(CHROOTDIR) || !defined(BUILDNAME) || !defined(CVSROOT)
-	@echo "To make a release you must set CHROOTDIR, BUILDNAME and CVSROOT" && false
+.if !defined(CHROOTDIR) || !defined(BUILDNAME)
+	@echo "To make a release you must set CHROOTDIR and BUILDNAME" && false
+.endif
+.if !defined(NOPORTSATALL) && !defined(EXTPORTSDIR) && !defined(CVSROOT)
+	@echo "Building ports requires CVSROOT or EXTPORTSDIR" && false
+.endif
+.if !defined(NODOC) && !defined(EXTDOCDIR) && !defined(CVSROOT)
+	@echo "Building docs requires CVSROOT or EXTDOCDIR" && false
+.endif
+.if !defined(EXTSRCDIR) && !defined(CVSROOT) && !defined(SVNROOT)
+	@echo "The source tree requires SVNROOT, CVSROOT, or EXTSRCDIR" && false
 .endif
 .if defined(NOPORTSATALL) && !defined(NODOC)
 	@echo "Ports are required for building the release docs.  Either set NODOC or"
@@ -387,6 +425,10 @@
 .if defined(EXTSRCDIR)
 	cd ${CHROOTDIR}/usr && \
 	    cp -R -H ${EXTSRCDIR} src
+.elif defined(SVNROOT)
+	cd ${CHROOTDIR}/usr && \
+	    ${SVNPREFIX} svn co ${SVNCMDARGS} ${SVNROOT}/${SVNBRANCH} \
+	    ${RELEASESRCMODULE} 
 .else
 	cd ${CHROOTDIR}/usr && \
 	    ${CVSPREFIX} cvs -R ${CVSARGS} -d ${CVSROOT} \
@@ -432,7 +474,10 @@
 .endif
 .if make(rerelease)
 .if !defined(RELEASENOUPDATE) && !defined(EXTSRCDIR)
-.if !defined(RELEASETAG)
+.if defined(SVNROOT)
+	cd ${CHROOTDIR}/usr/src && ${SVNPREFIX} svn switch ${SVNCMDARGS} \
+	    ${SVNROOT}/${SVNBRANCH}
+.elif !defined(RELEASETAG)
 	cd ${CHROOTDIR}/usr/src && ${CVSPREFIX} cvs -R ${CVSARGS} -q \
 	    update ${CVSCMDARGS} -P -d -A
 .else

==== //depot/projects/soc2009/trasz_limits/sys/amd64/amd64/local_apic.c#5 (text+ko) ====

@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/amd64/amd64/local_apic.c,v 1.59 2009/08/13 17:09:45 attilio Exp $");
+__FBSDID("$FreeBSD: src/sys/amd64/amd64/local_apic.c,v 1.60 2009/08/14 21:05:08 jhb Exp $");
 
 #include "opt_hwpmc_hooks.h"
 #include "opt_kdtrace.h"
@@ -123,7 +123,7 @@
 	{ 1, 1, 0, 1, APIC_LVT_DM_NMI, 0 },	/* LINT1: NMI */
 	{ 1, 1, 1, 1, APIC_LVT_DM_FIXED, APIC_TIMER_INT },	/* Timer */
 	{ 1, 1, 1, 1, APIC_LVT_DM_FIXED, APIC_ERROR_INT },	/* Error */
-	{ 1, 1, 0, 1, APIC_LVT_DM_NMI, 0 },	/* PMC */
+	{ 1, 1, 1, 1, APIC_LVT_DM_NMI, 0 },	/* PMC */
 	{ 1, 1, 1, 1, APIC_LVT_DM_FIXED, APIC_THERMAL_INT },	/* Thermal */
 };
 
@@ -305,11 +305,9 @@
 	lapic->lvt_lint0 = lvt_mode(la, LVT_LINT0, lapic->lvt_lint0);
 	lapic->lvt_lint1 = lvt_mode(la, LVT_LINT1, lapic->lvt_lint1);
 
-#ifdef	HWPMC_HOOKS
 	/* Program the PMC LVT entry if present. */
 	if (maxlvt >= LVT_PMC)
 		lapic->lvt_pcint = lvt_mode(la, LVT_PMC, lapic->lvt_pcint);
-#endif
 
 	/* Program timer LVT and setup handler. */
 	lapic->lvt_timer = lvt_mode(la, LVT_TIMER, lapic->lvt_timer);
@@ -332,6 +330,88 @@
 	intr_restore(eflags);
 }
 
+void
+lapic_reenable_pmc(void)
+{
+#ifdef HWPMC_HOOKS
+	uint32_t value;
+
+	value =  lapic->lvt_pcint;
+	value &= ~APIC_LVT_M;
+	lapic->lvt_pcint = value;
+#endif
+}
+
+#ifdef HWPMC_HOOKS
+static void
+lapic_update_pmc(void *dummy)
+{
+	struct lapic *la;
+
+	la = &lapics[lapic_id()];
+	lapic->lvt_pcint = lvt_mode(la, LVT_PMC, lapic->lvt_pcint);
+}
+#endif
+
+int
+lapic_enable_pmc(void)
+{
+#ifdef HWPMC_HOOKS
+	u_int32_t maxlvt;
+
+	/* Fail if the local APIC is not present. */
+	if (lapic == NULL)
+		return (0);
+
+	/* Fail if the PMC LVT is not present. */
+	maxlvt = (lapic->version & APIC_VER_MAXLVT) >> MAXLVTSHIFT;
+	if (maxlvt < LVT_PMC)
+		return (0);
+
+	lvts[LVT_PMC].lvt_masked = 0;
+
+#ifdef SMP
+	/*
+	 * If hwpmc was loaded at boot time then the APs may not be
+	 * started yet.  In that case, don't forward the request to
+	 * them as they will program the lvt when they start.
+	 */
+	if (smp_started)
+		smp_rendezvous(NULL, lapic_update_pmc, NULL, NULL);
+	else
+#endif
+		lapic_update_pmc(NULL);
+	return (1);
+#else
+	return (0);
+#endif
+}
+
+void
+lapic_disable_pmc(void)
+{
+#ifdef HWPMC_HOOKS
+	u_int32_t maxlvt;
+
+	/* Fail if the local APIC is not present. */
+	if (lapic == NULL)
+		return;
+
+	/* Fail if the PMC LVT is not present. */
+	maxlvt = (lapic->version & APIC_VER_MAXLVT) >> MAXLVTSHIFT;
+	if (maxlvt < LVT_PMC)
+		return;
+
+	lvts[LVT_PMC].lvt_masked = 1;
+
+#ifdef SMP
+	/* The APs should always be started when hwpmc is unloaded. */
+	KASSERT(mp_ncpus == 1 || smp_started, ("hwpmc unloaded too early"));
+#endif
+	smp_rendezvous(NULL, lapic_update_pmc, NULL, NULL);
+#endif
+}
+
 /*
  * Called by cpu_initclocks() on the BSP to setup the local APIC timer so
  * that it can drive hardclock, statclock, and profclock.  This function

==== //depot/projects/soc2009/trasz_limits/sys/amd64/include/apicvar.h#3 (text+ko) ====

@@ -26,7 +26,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/amd64/include/apicvar.h,v 1.30 2009/08/13 17:09:45 attilio Exp $
+ * $FreeBSD: src/sys/amd64/include/apicvar.h,v 1.31 2009/08/14 21:05:08 jhb Exp $
  */
 
 #ifndef _MACHINE_APICVAR_H_
@@ -201,7 +201,9 @@
 int	ioapic_set_smi(void *cookie, u_int pin);
 void	lapic_create(u_int apic_id, int boot_cpu);
 void	lapic_disable(void);
+void	lapic_disable_pmc(void);
 void	lapic_dump(const char *str);
+int	lapic_enable_pmc(void);
 void	lapic_eoi(void);
 u_int	lapic_error(void);
 int	lapic_id(void);
@@ -212,6 +214,7 @@
 int	lapic_ipi_wait(int delay);
 void	lapic_handle_intr(int vector, struct trapframe *frame);
 void	lapic_handle_timer(struct trapframe *frame);
+void	lapic_reenable_pmc(void);
 void	lapic_set_logical_id(u_int apic_id, u_int cluster, u_int cluster_id);
 int	lapic_set_lvt_mask(u_int apic_id, u_int lvt, u_char masked);
 int	lapic_set_lvt_mode(u_int apic_id, u_int lvt, u_int32_t mode);

==== //depot/projects/soc2009/trasz_limits/sys/amd64/include/pmc_mdep.h#2 (text+ko) ====

@@ -27,7 +27,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/amd64/include/pmc_mdep.h,v 1.8 2008/11/27 09:00:47 jkoshy Exp $
+ * $FreeBSD: src/sys/amd64/include/pmc_mdep.h,v 1.9 2009/08/14 21:05:08 jhb Exp $
  */
 
 /* Machine dependent interfaces */
@@ -115,7 +115,6 @@
  */
 
 void	start_exceptions(void), end_exceptions(void);
-void	pmc_x86_lapic_enable_pmc_interrupt(void);
 
 struct pmc_mdep *pmc_amd_initialize(void);
 void	pmc_amd_finalize(struct pmc_mdep *_md);

==== //depot/projects/soc2009/trasz_limits/sys/conf/options#10 (text+ko) ====

@@ -1,4 +1,4 @@
-# $FreeBSD: src/sys/conf/options,v 1.687 2009/07/14 22:48:30 rwatson Exp $
+# $FreeBSD: src/sys/conf/options,v 1.688 2009/08/14 22:41:39 zec Exp $
 #
 #        On the handling of kernel options
 #
@@ -821,8 +821,9 @@
 TDMA_TXRATE_11NA_DEFAULT	opt_tdma.h
 TDMA_TXRATE_11NG_DEFAULT	opt_tdma.h
 
-# Virtualize the network stack
+# Network stack virtualization options
 VIMAGE			opt_global.h
+VNET_DEBUG		opt_global.h
 
 # Common Flash Interface (CFI) options
 CFI_SUPPORT_STRATAFLASH	opt_cfi.h

==== //depot/projects/soc2009/trasz_limits/sys/dev/hwpmc/hwpmc_core.c#2 (text+ko) ====

@@ -29,13 +29,16 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/hwpmc/hwpmc_core.c,v 1.4 2009/01/27 07:29:37 jeff Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/hwpmc/hwpmc_core.c,v 1.5 2009/08/14 21:05:08 jhb Exp $");
 
 #include <sys/param.h>
+#include <sys/bus.h>
 #include <sys/pmc.h>
 #include <sys/pmckern.h>
 #include <sys/systm.h>
 
+#include <machine/intr_machdep.h>
+#include <machine/apicvar.h>
 #include <machine/cpu.h>
 #include <machine/cpufunc.h>
 #include <machine/specialreg.h>
@@ -1771,7 +1774,7 @@
 	}
 
 	if (found_interrupt)
-		pmc_x86_lapic_enable_pmc_interrupt();
+		lapic_reenable_pmc();
 
 	atomic_add_int(found_interrupt ? &pmc_stats.pm_intr_processed :
 	    &pmc_stats.pm_intr_ignored, 1);
@@ -1895,7 +1898,7 @@
 	    (uintmax_t) rdmsr(IA_GLOBAL_OVF_CTRL));
 
 	if (found_interrupt)
-		pmc_x86_lapic_enable_pmc_interrupt();
+		lapic_reenable_pmc();
 
 	atomic_add_int(found_interrupt ? &pmc_stats.pm_intr_processed :
 	    &pmc_stats.pm_intr_ignored, 1);

==== //depot/projects/soc2009/trasz_limits/sys/dev/hwpmc/hwpmc_piv.c#2 (text+ko) ====

@@ -29,9 +29,10 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/hwpmc/hwpmc_piv.c,v 1.20 2008/11/26 19:25:13 jkim Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/hwpmc/hwpmc_piv.c,v 1.21 2009/08/14 21:05:08 jhb Exp $");
 
 #include <sys/param.h>
+#include <sys/bus.h>
 #include <sys/lock.h>
 #include <sys/mutex.h>
 #include <sys/pmc.h>
@@ -39,6 +40,8 @@
 #include <sys/smp.h>
 #include <sys/systm.h>
 
+#include <machine/intr_machdep.h>
+#include <machine/apicvar.h>
 #include <machine/cpu.h>
 #include <machine/cpufunc.h>
 #include <machine/cputypes.h>
@@ -1537,7 +1540,7 @@
 	 */
 
 	if (did_interrupt)
-		pmc_x86_lapic_enable_pmc_interrupt();
+		lapic_reenable_pmc();
 
 	atomic_add_int(did_interrupt ? &pmc_stats.pm_intr_processed :
 	    &pmc_stats.pm_intr_ignored, 1);

==== //depot/projects/soc2009/trasz_limits/sys/dev/hwpmc/hwpmc_ppro.c#2 (text+ko) ====

@@ -29,9 +29,10 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/hwpmc/hwpmc_ppro.c,v 1.16 2008/12/02 10:46:35 jkoshy Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/hwpmc/hwpmc_ppro.c,v 1.17 2009/08/14 21:05:08 jhb Exp $");
 
 #include <sys/param.h>
+#include <sys/bus.h>
 #include <sys/lock.h>
 #include <sys/mutex.h>
 #include <sys/pmc.h>
@@ -39,6 +40,8 @@
 #include <sys/smp.h>
 #include <sys/systm.h>
 
+#include <machine/intr_machdep.h>
+#include <machine/apicvar.h>
 #include <machine/cpu.h>
 #include <machine/cpufunc.h>
 #include <machine/cputypes.h>
@@ -718,7 +721,7 @@
 	 * unmasked after a PMC interrupt.
 	 */
 	if (retval)
-		pmc_x86_lapic_enable_pmc_interrupt();
+		lapic_reenable_pmc();
 
 	atomic_add_int(retval ? &pmc_stats.pm_intr_processed :
 	    &pmc_stats.pm_intr_ignored, 1);

==== //depot/projects/soc2009/trasz_limits/sys/dev/hwpmc/hwpmc_x86.c#2 (text+ko) ====

@@ -29,7 +29,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/hwpmc/hwpmc_x86.c,v 1.11 2008/11/26 19:25:13 jkim Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/hwpmc/hwpmc_x86.c,v 1.12 2009/08/14 21:05:08 jhb Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -39,7 +39,8 @@
 
 #include <machine/cpu.h>
 #include <machine/cputypes.h>
-#include <machine/apicreg.h>
+#include <machine/intr_machdep.h>
+#include <machine/apicvar.h>
 #include <machine/pmc_mdep.h>
 #include <machine/md_var.h>
 
@@ -47,18 +48,6 @@
 #include <vm/vm_param.h>
 #include <vm/pmap.h>
 
-extern volatile lapic_t *lapic;
-
-void
-pmc_x86_lapic_enable_pmc_interrupt(void)
-{
-	uint32_t value;
-
-	value =  lapic->lvt_pcint;
-	value &= ~APIC_LVT_M;
-	lapic->lvt_pcint = value;
-}
-
 /*
  * Attempt to walk a user call stack using a too-simple algorithm.
  * In the general case we need unwind information associated with
@@ -252,16 +241,15 @@
 	struct pmc_mdep *md;
 
 	/* determine the CPU kind */
-	md = NULL;
 	if (cpu_vendor_id == CPU_VENDOR_AMD)
 		md = pmc_amd_initialize();
 	else if (cpu_vendor_id == CPU_VENDOR_INTEL)
 		md = pmc_intel_initialize();
 	else
-		KASSERT(0, ("[x86,%d] Unknown vendor", __LINE__));
+		return (NULL);
 
 	/* disallow sampling if we do not have an LAPIC */
-	if (md != NULL && lapic == NULL)
+	if (!lapic_enable_pmc())
 		for (i = 1; i < md->pmd_nclass; i++)
 			md->pmd_classdep[i].pcd_caps &= ~PMC_CAP_INTERRUPT;
 
@@ -271,6 +259,8 @@
 void
 pmc_md_finalize(struct pmc_mdep *md)
 {
+
+	lapic_disable_pmc();
 	if (cpu_vendor_id == CPU_VENDOR_AMD)
 		pmc_amd_finalize(md);
 	else if (cpu_vendor_id == CPU_VENDOR_INTEL)

==== //depot/projects/soc2009/trasz_limits/sys/i386/i386/local_apic.c#5 (text+ko) ====

@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/i386/i386/local_apic.c,v 1.62 2009/08/13 17:09:45 attilio Exp $");
+__FBSDID("$FreeBSD: src/sys/i386/i386/local_apic.c,v 1.63 2009/08/14 21:05:08 jhb Exp $");
 
 #include "opt_hwpmc_hooks.h"
 #include "opt_kdtrace.h"
@@ -123,7 +123,7 @@
 	{ 1, 1, 0, 1, APIC_LVT_DM_NMI, 0 },	/* LINT1: NMI */
 	{ 1, 1, 1, 1, APIC_LVT_DM_FIXED, APIC_TIMER_INT },	/* Timer */
 	{ 1, 1, 1, 1, APIC_LVT_DM_FIXED, APIC_ERROR_INT },	/* Error */
-	{ 1, 1, 0, 1, APIC_LVT_DM_NMI, 0 },	/* PMC */
+	{ 1, 1, 1, 1, APIC_LVT_DM_NMI, 0 },	/* PMC */
 	{ 1, 1, 1, 1, APIC_LVT_DM_FIXED, APIC_THERMAL_INT },	/* Thermal */
 };
 
@@ -307,11 +307,9 @@
 	lapic->lvt_lint0 = lvt_mode(la, LVT_LINT0, lapic->lvt_lint0);
 	lapic->lvt_lint1 = lvt_mode(la, LVT_LINT1, lapic->lvt_lint1);
 
-#ifdef	HWPMC_HOOKS
 	/* Program the PMC LVT entry if present. */
 	if (maxlvt >= LVT_PMC)
 		lapic->lvt_pcint = lvt_mode(la, LVT_PMC, lapic->lvt_pcint);
-#endif
 
 	/* Program timer LVT and setup handler. */
 	lapic->lvt_timer = lvt_mode(la, LVT_TIMER, lapic->lvt_timer);
@@ -334,6 +332,88 @@
 	intr_restore(eflags);
 }
 
+void
+lapic_reenable_pmc(void)
+{
+#ifdef HWPMC_HOOKS
+	uint32_t value;
+
+	value =  lapic->lvt_pcint;
+	value &= ~APIC_LVT_M;
+	lapic->lvt_pcint = value;
+#endif
+}
+
+#ifdef HWPMC_HOOKS
+static void
+lapic_update_pmc(void *dummy)
+{
+	struct lapic *la;
+
+	la = &lapics[lapic_id()];
+	lapic->lvt_pcint = lvt_mode(la, LVT_PMC, lapic->lvt_pcint);
+}
+#endif
+
+int
+lapic_enable_pmc(void)
+{
+#ifdef HWPMC_HOOKS
+	u_int32_t maxlvt;
+
+	/* Fail if the local APIC is not present. */
+	if (lapic == NULL)
+		return (0);
+
+	/* Fail if the PMC LVT is not present. */
+	maxlvt = (lapic->version & APIC_VER_MAXLVT) >> MAXLVTSHIFT;
+	if (maxlvt < LVT_PMC)
+		return (0);
+
+	lvts[LVT_PMC].lvt_masked = 0;
+
+#ifdef SMP
+	/*
+	 * If hwpmc was loaded at boot time then the APs may not be
+	 * started yet.  In that case, don't forward the request to
+	 * them as they will program the lvt when they start.
+	 */
+	if (smp_started)
+		smp_rendezvous(NULL, lapic_update_pmc, NULL, NULL);
+	else
+#endif
+		lapic_update_pmc(NULL);
+	return (1);
+#else
+	return (0);
+#endif
+}
+
+void
+lapic_disable_pmc(void)
+{
+#ifdef HWPMC_HOOKS
+	u_int32_t maxlvt;
+
+	/* Fail if the local APIC is not present. */
+	if (lapic == NULL)
+		return;
+
+	/* Fail if the PMC LVT is not present. */
+	maxlvt = (lapic->version & APIC_VER_MAXLVT) >> MAXLVTSHIFT;
+	if (maxlvt < LVT_PMC)
+		return;
+
+	lvts[LVT_PMC].lvt_masked = 1;
+
+#ifdef SMP
+	/* The APs should always be started when hwpmc is unloaded. */
+	KASSERT(mp_ncpus == 1 || smp_started, ("hwpmc unloaded too early"));
+#endif
+	smp_rendezvous(NULL, lapic_update_pmc, NULL, NULL);
+#endif
+}
+
 /*
  * Called by cpu_initclocks() on the BSP to setup the local APIC timer so
  * that it can drive hardclock, statclock, and profclock.  This function

==== //depot/projects/soc2009/trasz_limits/sys/i386/include/apicvar.h#5 (text+ko) ====

@@ -26,7 +26,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/i386/include/apicvar.h,v 1.33 2009/08/13 17:09:45 attilio Exp $
+ * $FreeBSD: src/sys/i386/include/apicvar.h,v 1.34 2009/08/14 21:05:08 jhb Exp $
  */
 
 #ifndef _MACHINE_APICVAR_H_
@@ -230,7 +230,9 @@
 int	ioapic_set_smi(void *cookie, u_int pin);
 void	lapic_create(u_int apic_id, int boot_cpu);
 void	lapic_disable(void);
+void	lapic_disable_pmc(void);
 void	lapic_dump(const char *str);
+int	lapic_enable_pmc(void);
 void	lapic_eoi(void);
 u_int	lapic_error(void);
 int	lapic_id(void);
@@ -241,6 +243,7 @@
 int	lapic_ipi_wait(int delay);
 void	lapic_handle_intr(int vector, struct trapframe *frame);
 void	lapic_handle_timer(struct trapframe *frame);
+void	lapic_reenable_pmc(void);
 void	lapic_set_logical_id(u_int apic_id, u_int cluster, u_int cluster_id);
 int	lapic_set_lvt_mask(u_int apic_id, u_int lvt, u_char masked);
 int	lapic_set_lvt_mode(u_int apic_id, u_int lvt, u_int32_t mode);

==== //depot/projects/soc2009/trasz_limits/sys/i386/include/pmc_mdep.h#2 (text+ko) ====

@@ -27,7 +27,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/i386/include/pmc_mdep.h,v 1.10 2008/11/27 09:00:47 jkoshy Exp $
+ * $FreeBSD: src/sys/i386/include/pmc_mdep.h,v 1.11 2009/08/14 21:05:08 jhb Exp $
  */
 
 #ifndef _MACHINE_PMC_MDEP_H
@@ -150,7 +150,6 @@
  */
 
 void	start_exceptions(void), end_exceptions(void);
-void	pmc_x86_lapic_enable_pmc_interrupt(void);
 
 struct pmc_mdep *pmc_amd_initialize(void);
 void	pmc_amd_finalize(struct pmc_mdep *_md);

==== //depot/projects/soc2009/trasz_limits/sys/kern/kern_mutex.c#4 (text+ko) ====

@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/kern_mutex.c,v 1.213 2009/05/29 14:03:34 jhb Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/kern_mutex.c,v 1.214 2009/08/14 21:46:54 bz Exp $");
 
 #include "opt_adaptive_mutexes.h"
 #include "opt_ddb.h"
@@ -783,6 +783,8 @@
 
 	MPASS((opts & ~(MTX_SPIN | MTX_QUIET | MTX_RECURSE |
 		MTX_NOWITNESS | MTX_DUPOK | MTX_NOPROFILE)) == 0);
+	ASSERT_ATOMIC_LOAD(m->mtx_lock, ("%s: mtx_lock not aligned for %s: %p",
+	    __func__, name, &m->mtx_lock));
 
 #ifdef MUTEX_DEBUG
 	/* Diagnostic and error correction */

==== //depot/projects/soc2009/trasz_limits/sys/kern/kern_rwlock.c#4 (text+ko) ====

@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/kern_rwlock.c,v 1.48 2009/06/02 13:03:35 attilio Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/kern_rwlock.c,v 1.49 2009/08/14 21:46:54 bz Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kdtrace.h"
@@ -174,6 +174,8 @@
 
 	MPASS((opts & ~(RW_DUPOK | RW_NOPROFILE | RW_NOWITNESS | RW_QUIET |
 	    RW_RECURSE)) == 0);
+	ASSERT_ATOMIC_LOAD(rw->rw_lock, ("%s: rw_lock not aligned for %s: %p",
+	    __func__, name, &rw->rw_lock));
 
 	flags = LO_UPGRADABLE;
 	if (opts & RW_DUPOK)

==== //depot/projects/soc2009/trasz_limits/sys/kern/kern_sx.c#4 (text+ko) ====

@@ -41,7 +41,7 @@
 #include "opt_no_adaptive_sx.h"
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/kern_sx.c,v 1.67 2009/06/02 13:03:35 attilio Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/kern_sx.c,v 1.68 2009/08/14 21:46:54 bz Exp $");
 
 #include <sys/param.h>
 #include <sys/ktr.h>
@@ -205,6 +205,8 @@
 
 	MPASS((opts & ~(SX_QUIET | SX_RECURSE | SX_NOWITNESS | SX_DUPOK |
 	    SX_NOPROFILE | SX_NOADAPTIVE)) == 0);
+	ASSERT_ATOMIC_LOAD(sx->sx_lock, ("%s: sx_lock not aligned for %s: %p",
+	    __func__, description, &sx->sx_lock));
 
 	flags = LO_SLEEPABLE | LO_UPGRADABLE;
 	if (opts & SX_DUPOK)

==== //depot/projects/soc2009/trasz_limits/sys/kern/vfs_cache.c#5 (text+ko) ====

@@ -33,7 +33,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/vfs_cache.c,v 1.158 2009/06/21 19:21:01 kib Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/vfs_cache.c,v 1.159 2009/08/14 10:57:28 kib Exp $");
 
 #include "opt_kdtrace.h"
 #include "opt_ktrace.h"
@@ -416,7 +416,8 @@
 				if (dvp->v_cache_dd->nc_flag & NCF_ISDOTDOT)
 					cache_zap(dvp->v_cache_dd);
 				dvp->v_cache_dd = NULL;
-				goto unlock;
+				CACHE_WUNLOCK();
+				return (0);
 			}
 			if (dvp->v_cache_dd->nc_flag & NCF_ISDOTDOT)
 				*vpp = dvp->v_cache_dd->nc_vp;

==== //depot/projects/soc2009/trasz_limits/sys/net/if.c#10 (text+ko) ====

@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)if.c	8.5 (Berkeley) 1/9/95
- * $FreeBSD: src/sys/net/if.c,v 1.359 2009/08/01 19:26:27 rwatson Exp $
+ * $FreeBSD: src/sys/net/if.c,v 1.360 2009/08/14 22:46:45 zec Exp $
  */
 
 #include "opt_compat.h"
@@ -920,7 +920,7 @@
 
 	/* Make sure the named iface does not exists in the dst. prison/vnet. */
 	/* XXX Lock interfaces to avoid races. */
-	CURVNET_SET(pr->pr_vnet);
+	CURVNET_SET_QUIET(pr->pr_vnet);
 	difp = ifunit(ifname);
 	CURVNET_RESTORE();
 	if (difp != NULL) {

==== //depot/projects/soc2009/trasz_limits/sys/net/vnet.h#10 (text+ko) ====

@@ -32,7 +32,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/net/vnet.h,v 1.27 2009/08/13 10:26:34 bz Exp $
+ * $FreeBSD: src/sys/net/vnet.h,v 1.28 2009/08/14 22:41:39 zec Exp $
  */
 
 /*-
@@ -107,9 +107,6 @@
  * Various macros -- get and set the current network stack, but also
  * assertions.
  */
-#ifdef INVARIANTS
-#define	VNET_DEBUG
-#endif
 #ifdef VNET_DEBUG
 #define	VNET_ASSERT(condition)						\
 	if (!(condition)) {						\

==== //depot/projects/soc2009/trasz_limits/sys/netinet/ip_output.c#9 (text+ko) ====

@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/netinet/ip_output.c,v 1.314 2009/08/01 19:26:27 rwatson Exp $");
+__FBSDID("$FreeBSD: src/sys/netinet/ip_output.c,v 1.315 2009/08/14 23:44:59 qingli Exp $");
 
 #include "opt_ipfw.h"
 #include "opt_ipsec.h"
@@ -53,6 +53,7 @@
 #include <sys/ucred.h>
 
 #include <net/if.h>
+#include <net/if_llatbl.h>
 #include <net/netisr.h>
 #include <net/pfil.h>
 #include <net/route.h>
@@ -201,9 +202,12 @@
 	if (ro->ro_rt && ((ro->ro_rt->rt_flags & RTF_UP) == 0 ||
 			  dst->sin_family != AF_INET ||
 			  dst->sin_addr.s_addr != ip->ip_dst.s_addr)) {
-		if (!nortfree)
+		if (!nortfree) {
 			RTFREE(ro->ro_rt);
+			LLE_FREE(ro->ro_lle);
+		}
 		ro->ro_rt = (struct rtentry *)NULL;
+		ro->ro_lle = (struct llentry *)NULL;
 	}
 #ifdef IPFIREWALL_FORWARD
 	if (ro->ro_rt == NULL && fwd_tag == NULL) {

==== //depot/projects/soc2009/trasz_limits/sys/netinet/ipfw/ip_fw2.c#6 (text+ko) ====

@@ -24,7 +24,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/netinet/ipfw/ip_fw2.c,v 1.11 2009/08/01 19:26:27 rwatson Exp $");
+__FBSDID("$FreeBSD: src/sys/netinet/ipfw/ip_fw2.c,v 1.12 2009/08/14 10:09:45 julian Exp $");
 
 #define        DEB(x)
 #define        DDB(x) x
@@ -2057,7 +2057,7 @@
 				dst_ip, htons(dst_port),
 				wildcard, NULL);
 		if (pcb != NULL) {
-			*uc = crhold(inp->inp_cred);
+			*uc = crhold(pcb->inp_cred);
 			*ugid_lookupp = 1;
 		}
 		INP_INFO_RUNLOCK(pi);

==== //depot/projects/soc2009/trasz_limits/sys/netinet/sctp_os_bsd.h#5 (text+ko) ====

@@ -28,7 +28,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/netinet/sctp_os_bsd.h,v 1.51 2009/08/01 19:26:27 rwatson Exp $");
+__FBSDID("$FreeBSD: src/sys/netinet/sctp_os_bsd.h,v 1.52 2009/08/14 22:43:25 zec Exp $");
 #ifndef __sctp_os_bsd_h__
 #define __sctp_os_bsd_h__
 /*
@@ -78,6 +78,10 @@
 #include <netinet/ip_icmp.h>
 #include <netinet/icmp_var.h>
 
+#ifdef VIMAGE
+#error "SCTP is not yet compatible with VIMAGE."
+#endif
+
 #ifdef IPSEC
 #include <netipsec/ipsec.h>
 #include <netipsec/key.h>

==== //depot/projects/soc2009/trasz_limits/sys/nfsclient/nfs_subs.c#4 (text+ko) ====

@@ -33,7 +33,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/nfsclient/nfs_subs.c,v 1.163 2009/06/30 19:03:27 dfr Exp $");
+__FBSDID("$FreeBSD: src/sys/nfsclient/nfs_subs.c,v 1.164 2009/08/14 10:59:17 kib Exp $");
 
 /*
  * These functions support the macros and help fiddle mbuf chains for
@@ -409,28 +409,25 @@
 nfs_upgrade_vnlock(struct vnode *vp)
 {
 	int old_lock;
-	
- 	if ((old_lock = VOP_ISLOCKED(vp)) != LK_EXCLUSIVE) {
- 		if (old_lock == LK_SHARED) {
- 			/* Upgrade to exclusive lock, this might block */
- 			vn_lock(vp, LK_UPGRADE | LK_RETRY);
- 		} else {
- 			vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
- 		}
+
+	ASSERT_VOP_LOCKED(vp, "nfs_upgrade_vnlock");
+	old_lock = VOP_ISLOCKED(vp);
+	if (old_lock != LK_EXCLUSIVE) {
+		KASSERT(old_lock == LK_SHARED,
+		    ("nfs_upgrade_vnlock: wrong old_lock %d", old_lock));
+		/* Upgrade to exclusive lock, this might block */
+		vn_lock(vp, LK_UPGRADE | LK_RETRY);
   	}
-	return old_lock;
+	return (old_lock);
 }
 
 void
 nfs_downgrade_vnlock(struct vnode *vp, int old_lock)
 {
 	if (old_lock != LK_EXCLUSIVE) {
- 		if (old_lock == LK_SHARED) {
- 			/* Downgrade from exclusive lock, this might block */
- 			vn_lock(vp, LK_DOWNGRADE);
- 		} else {
- 			VOP_UNLOCK(vp, 0);
- 		}
+		KASSERT(old_lock == LK_SHARED, ("wrong old_lock %d", old_lock));
+		/* Downgrade from exclusive lock. */
+		vn_lock(vp, LK_DOWNGRADE | LK_RETRY);
   	}
 }
 

==== //depot/projects/soc2009/trasz_limits/sys/sys/lock.h#4 (text+ko) ====

@@ -26,7 +26,7 @@
  * SUCH DAMAGE.
  *
  *	from BSDI $Id: mutex.h,v 2.7.2.35 2000/04/27 03:10:26 cp Exp $
- * $FreeBSD: src/sys/sys/lock.h,v 1.78 2009/06/21 09:01:12 rdivacky Exp $
+ * $FreeBSD: src/sys/sys/lock.h,v 1.79 2009/08/14 10:57:57 kib Exp $
  */
 
 #ifndef _SYS_LOCK_H_
@@ -155,16 +155,16 @@
 
 #define	LOCK_LOG_LOCK(opname, lo, flags, recurse, file, line) do {	\
 	if (LOCK_LOG_TEST((lo), (flags)))				\
-		CTR5(KTR_LOCK, opname " (%s) %s r = %d at %s:%d",	\
+		CTR6(KTR_LOCK, opname " (%s) %s %p r = %d at %s:%d",	\
 		    LOCK_CLASS(lo)->lc_name, (lo)->lo_name,		\
-		    (u_int)(recurse), (file), (line));			\
+		    (lo), (u_int)(recurse), (file), (line));		\
 } while (0)
 
 #define	LOCK_LOG_TRY(opname, lo, flags, result, file, line) do {	\
 	if (LOCK_LOG_TEST((lo), (flags)))				\
-		CTR5(KTR_LOCK, "TRY_" opname " (%s) %s result=%d at %s:%d",\
+		CTR6(KTR_LOCK, "TRY_" opname " (%s) %s %p result=%d at %s:%d",\
 		    LOCK_CLASS(lo)->lc_name, (lo)->lo_name,		\
-		    (u_int)(result), (file), (line));			\
+		    (lo), (u_int)(result), (file), (line));		\
 } while (0)
 
 #define	LOCK_LOG_INIT(lo, flags) do {					\

==== //depot/projects/soc2009/trasz_limits/sys/sys/systm.h#4 (text+ko) ====

@@ -32,7 +32,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)systm.h	8.7 (Berkeley) 3/29/95

>>> TRUNCATED FOR MAIL (1000 lines) <<<


More information about the p4-projects mailing list