Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 10 Jun 2007 02:23:01 GMT
From:      Andrew Thompson <thompsa@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 121322 for review
Message-ID:  <200706100223.l5A2N1me093311@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=121322

Change 121322 by thompsa@thompsa_heff on 2007/06/10 02:22:00

	IFC

Affected files ...

.. //depot/projects/wifi/share/misc/committers-ports.dot#5 integrate
.. //depot/projects/wifi/sys/amd64/include/kdb.h#4 integrate
.. //depot/projects/wifi/sys/arm/include/kdb.h#4 integrate
.. //depot/projects/wifi/sys/compat/linux/linux_misc.c#19 integrate
.. //depot/projects/wifi/sys/compat/svr4/svr4_misc.c#14 integrate
.. //depot/projects/wifi/sys/dev/usb/umct.c#5 integrate
.. //depot/projects/wifi/sys/dev/usb/usb_subr.c#12 integrate
.. //depot/projects/wifi/sys/fs/procfs/procfs_status.c#8 integrate
.. //depot/projects/wifi/sys/gdb/gdb_packet.c#4 integrate
.. //depot/projects/wifi/sys/i386/include/kdb.h#4 integrate
.. //depot/projects/wifi/sys/ia64/ia64/db_machdep.c#3 integrate
.. //depot/projects/wifi/sys/ia64/include/kdb.h#5 integrate
.. //depot/projects/wifi/sys/kern/init_main.c#20 integrate
.. //depot/projects/wifi/sys/kern/kern_acct.c#15 integrate
.. //depot/projects/wifi/sys/kern/kern_clock.c#15 integrate
.. //depot/projects/wifi/sys/kern/kern_exit.c#22 integrate
.. //depot/projects/wifi/sys/kern/kern_mutex.c#16 integrate
.. //depot/projects/wifi/sys/kern/kern_proc.c#17 integrate
.. //depot/projects/wifi/sys/kern/kern_resource.c#15 integrate
.. //depot/projects/wifi/sys/kern/kern_sig.c#22 integrate
.. //depot/projects/wifi/sys/kern/kern_thread.c#20 integrate
.. //depot/projects/wifi/sys/kern/kern_time.c#14 integrate
.. //depot/projects/wifi/sys/kern/tty.c#14 integrate
.. //depot/projects/wifi/sys/kern/vfs_aio.c#18 integrate
.. //depot/projects/wifi/sys/kern/vfs_bio.c#27 integrate
.. //depot/projects/wifi/sys/modules/bge/Makefile#5 integrate
.. //depot/projects/wifi/sys/netinet/tcp_input.c#27 integrate
.. //depot/projects/wifi/sys/netinet/tcp_output.c#17 integrate
.. //depot/projects/wifi/sys/powerpc/include/cpu.h#5 integrate
.. //depot/projects/wifi/sys/powerpc/include/kdb.h#3 integrate
.. //depot/projects/wifi/sys/powerpc/include/md_var.h#3 integrate
.. //depot/projects/wifi/sys/powerpc/powerpc/db_interface.c#3 integrate
.. //depot/projects/wifi/sys/powerpc/powerpc/syncicache.c#3 integrate
.. //depot/projects/wifi/sys/powerpc/powerpc/uio_machdep.c#4 integrate
.. //depot/projects/wifi/sys/sparc64/include/kdb.h#4 integrate
.. //depot/projects/wifi/sys/sun4v/include/kdb.h#2 integrate
.. //depot/projects/wifi/sys/sys/proc.h#31 integrate
.. //depot/projects/wifi/sys/sys/resourcevar.h#7 integrate
.. //depot/projects/wifi/sys/sys/systm.h#23 integrate
.. //depot/projects/wifi/sys/vm/vm_phys.c#1 branch
.. //depot/projects/wifi/sys/vm/vm_phys.h#1 branch
.. //depot/projects/wifi/usr.bin/calendar/calendars/calendar.freebsd#23 integrate

Differences ...

==== //depot/projects/wifi/share/misc/committers-ports.dot#5 (text+ko) ====

@@ -1,4 +1,4 @@
-# $FreeBSD: src/share/misc/committers-ports.dot,v 1.56 2007/05/04 14:51:56 fjoe Exp $
+# $FreeBSD: src/share/misc/committers-ports.dot,v 1.57 2007/06/09 21:43:52 beech Exp $
 
 # This file is meant to list all FreeBSD ports committers and describe the
 # mentor-mentee relationships between them.
@@ -49,6 +49,7 @@
 araujo [label="Marcelo Araujo\naraujo@FreeBSD.org\n2007/04/26"]
 arved [label="Tilman Linneweh\narved@FreeBSD.org\n2002/10/15"]
 az [label="Andrej Zverev\naz@FreeBSD.org\n2005/10/03"]
+beech [label="Beech Rintoul\nbeech@FreeBSD.org\n2007/05/30"]
 bland [label="Alexander Nedotsukov\nbland@FreeBSD.org\n2003/08/14"]
 brooks [label="Brooks Davies\nbrooks@FreeBSD.org\n2004/05/03"]
 bsam [label="Boris Samorodov\nbsam@FreeBSD.org\n2006/07/20"]
@@ -238,6 +239,8 @@
 
 philip -> koitsu
 
+sat -> beech
+
 sem -> az
 sem -> anray
 sem -> delphij

==== //depot/projects/wifi/sys/amd64/include/kdb.h#4 (text+ko) ====

@@ -23,7 +23,7 @@
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/amd64/include/kdb.h,v 1.3 2006/04/03 22:51:46 marcel Exp $
+ * $FreeBSD: src/sys/amd64/include/kdb.h,v 1.4 2007/06/09 21:55:16 marcel Exp $
  */
 
 #ifndef _MACHINE_KDB_H_
@@ -47,6 +47,11 @@
 }
 
 static __inline void
+kdb_cpu_sync_icache(unsigned char *addr, size_t size)
+{
+}
+
+static __inline void
 kdb_cpu_trap(int type, int code)
 {
 }

==== //depot/projects/wifi/sys/arm/include/kdb.h#4 (text+ko) ====

@@ -23,7 +23,7 @@
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/arm/include/kdb.h,v 1.3 2005/01/05 21:58:48 imp Exp $
+ * $FreeBSD: src/sys/arm/include/kdb.h,v 1.4 2007/06/09 21:55:16 marcel Exp $
  */
 
 #ifndef _MACHINE_KDB_H_
@@ -44,6 +44,11 @@
 }
 
 static __inline void
+kdb_cpu_sync_icache(unsigned char *addr, size_t size)
+{
+}
+
+static __inline void
 kdb_cpu_trap(int type, int code)
 {
 	cpu_idcache_wbinv_all();

==== //depot/projects/wifi/sys/compat/linux/linux_misc.c#19 (text+ko) ====

@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/compat/linux/linux_misc.c,v 1.211 2007/05/31 22:52:11 attilio Exp $");
+__FBSDID("$FreeBSD: src/sys/compat/linux/linux_misc.c,v 1.212 2007/06/09 21:48:43 attilio Exp $");
 
 #include "opt_compat.h"
 #include "opt_mac.h"
@@ -670,7 +670,9 @@
 	if (args->buf != NULL) {
 		p = td->td_proc;
 		PROC_LOCK(p);
+		PROC_SLOCK(p);
 		calcru(p, &utime, &stime);
+		PROC_SUNLOCK(p);
 		calccru(p, &cutime, &cstime);
 		PROC_UNLOCK(p);
 

==== //depot/projects/wifi/sys/compat/svr4/svr4_misc.c#14 (text+ko) ====

@@ -33,7 +33,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/compat/svr4/svr4_misc.c,v 1.94 2007/06/05 00:00:50 jeff Exp $");
+__FBSDID("$FreeBSD: src/sys/compat/svr4/svr4_misc.c,v 1.96 2007/06/09 21:48:43 attilio Exp $");
 
 #include "opt_mac.h"
 
@@ -828,7 +828,9 @@
 
 	p = td->td_proc;
 	PROC_LOCK(p);
+	PROC_SLOCK(p);
 	calcru(p, &utime, &stime);
+	PROC_SUNLOCK(p);
 	calccru(p, &cutime, &cstime);
 	PROC_UNLOCK(p);
 
@@ -1226,20 +1228,24 @@
 
 		nfound++;
 
+		PROC_SLOCK(p);
 		/*
 		 * See if we have a zombie.  If so, WNOWAIT should be set,
 		 * as otherwise we should have called kern_wait() up above.
 		 */
 		if ((p->p_state == PRS_ZOMBIE) && 
 		    ((uap->options & (SVR4_WEXITED|SVR4_WTRAPPED)))) {
+			PROC_SUNLOCK(p);
 			KASSERT(uap->options & SVR4_WNOWAIT,
 			    ("WNOWAIT is clear"));
 
 			/* Found a zombie, so cache info in local variables. */
 			pid = p->p_pid;
 			status = p->p_xstat;
-			ru = *p->p_ru;
+			ru = p->p_ru;
+			PROC_SLOCK(p);
 			calcru(p, &ru.ru_utime, &ru.ru_stime);
+			PROC_SUNLOCK(p);
 			PROC_UNLOCK(p);
 			sx_sunlock(&proctree_lock);
 
@@ -1253,7 +1259,6 @@
 		 * See if we have a stopped or continued process.
 		 * XXX: This duplicates the same code in kern_wait().
 		 */
-		PROC_SLOCK(p);
 		if ((p->p_flag & P_STOPPED_SIG) &&
 		    (p->p_suspcount == p->p_numthreads) &&
 		    (p->p_flag & P_WAITED) == 0 &&
@@ -1264,8 +1269,10 @@
 			sx_sunlock(&proctree_lock);
 			pid = p->p_pid;
 			status = W_STOPCODE(p->p_xstat);
-			ru = *p->p_ru;
+			ru = p->p_ru;
+			PROC_SLOCK(p);
 			calcru(p, &ru.ru_utime, &ru.ru_stime);
+			PROC_SUNLOCK(p);
 			PROC_UNLOCK(p);
 
 		        if (((uap->options & SVR4_WNOWAIT)) == 0) {
@@ -1285,9 +1292,11 @@
 		        if (((uap->options & SVR4_WNOWAIT)) == 0)
 				p->p_flag &= ~P_CONTINUED;
 			pid = p->p_pid;
-			ru = *p->p_ru;
+			ru = p->p_ru;
 			status = SIGCONT;
+			PROC_SLOCK(p);
 			calcru(p, &ru.ru_utime, &ru.ru_stime);
+			PROC_SUNLOCK(p);
 			PROC_UNLOCK(p);
 
 		        if (((uap->options & SVR4_WNOWAIT)) == 0) {

==== //depot/projects/wifi/sys/dev/usb/umct.c#5 (text+ko) ====

@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/usb/umct.c,v 1.13 2007/06/09 06:42:18 imp Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/usb/umct.c,v 1.14 2007/06/10 01:28:26 mjacob Exp $");
 
 /*
  * Driver for the MCT (Magic Control Technology) USB-RS232 Converter.
@@ -180,6 +180,8 @@
 	sc->sc_intr_number = -1;
 	sc->sc_intr_pipe = NULL;
 
+	devname = device_get_nameunit(ucom->sc_dev);
+
 	err = usbd_set_config_index(dev, UMCT_CONFIG_INDEX, 1);
 	if (err) {
 		printf("%s: failed to set configuration: %s\n",

==== //depot/projects/wifi/sys/dev/usb/usb_subr.c#12 (text+ko) ====

@@ -11,7 +11,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/usb/usb_subr.c,v 1.90 2007/05/08 03:25:05 kevlo Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/usb/usb_subr.c,v 1.91 2007/06/10 01:28:55 mjacob Exp $");
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -849,6 +849,7 @@
 	uaa.vendor = UGETW(dd->idVendor);
 	uaa.product = UGETW(dd->idProduct);
 	uaa.release = UGETW(dd->bcdDevice);
+	uaa.matchlvl = 0;
 
 	/* First try with device specific drivers. */
 	DPRINTF(("usbd_probe_and_attach: trying device specific drivers\n"));

==== //depot/projects/wifi/sys/fs/procfs/procfs_status.c#8 (text+ko) ====

@@ -34,7 +34,7 @@
  *
  * From:
  *	$Id: procfs_status.c,v 3.1 1993/12/15 09:40:17 jsp Exp $
- * $FreeBSD: src/sys/fs/procfs/procfs_status.c,v 1.60 2007/06/05 00:00:51 jeff Exp $
+ * $FreeBSD: src/sys/fs/procfs/procfs_status.c,v 1.61 2007/06/09 21:48:43 attilio Exp $
  */
 
 #include <sys/param.h>
@@ -127,12 +127,12 @@
 		} else
 			wmesg = "nochan";
 	}
-	PROC_SUNLOCK(p);
 
 	if (p->p_sflag & PS_INMEM) {
 		struct timeval start, ut, st;
 
 		calcru(p, &ut, &st);
+		PROC_SUNLOCK(p);
 		start = p->p_stats->p_start;
 		timevaladd(&start, &boottime);
 		sbuf_printf(sb, " %jd,%ld %jd,%ld %jd,%ld",
@@ -140,6 +140,7 @@
 		    (intmax_t)ut.tv_sec, ut.tv_usec,
 		    (intmax_t)st.tv_sec, st.tv_usec);
 	} else {
+		PROC_SUNLOCK(p);
 		sbuf_printf(sb, " -1,-1 -1,-1 -1,-1");
 	}
 

==== //depot/projects/wifi/sys/gdb/gdb_packet.c#4 (text+ko) ====

@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/gdb/gdb_packet.c,v 1.3 2006/05/26 11:52:20 phk Exp $");
+__FBSDID("$FreeBSD: src/sys/gdb/gdb_packet.c,v 1.4 2007/06/09 21:55:17 marcel Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -33,6 +33,7 @@
 #include <sys/kdb.h>
 
 #include <machine/gdb_machdep.h>
+#include <machine/kdb.h>
 
 #include <gdb/gdb.h>
 #include <gdb/gdb_int.h>
@@ -129,8 +130,10 @@
 int
 gdb_rx_mem(unsigned char *addr, size_t size)
 {
+	unsigned char *p;
 	void *prev;
 	jmp_buf jb;
+	size_t cnt;
 	int ret;
 	unsigned char c;
 
@@ -140,13 +143,16 @@
 	prev = kdb_jmpbuf(jb);
 	ret = setjmp(jb);
 	if (ret == 0) {
-		while (size-- > 0) {
+		p = addr;
+		cnt = size;
+		while (cnt-- > 0) {
 			c = (C2N(gdb_rxp[0]) << 4) & 0xf0;
 			c |= C2N(gdb_rxp[1]) & 0x0f;
-			*addr++ = c;
+			*p++ = c;
 			gdb_rxsz -= 2;
 			gdb_rxp += 2;
 		}
+		kdb_cpu_sync_icache(addr, size);
 	}
 	(void)kdb_jmpbuf(prev);
 	return ((ret == 0) ? 1 : 0);

==== //depot/projects/wifi/sys/i386/include/kdb.h#4 (text+ko) ====

@@ -23,7 +23,7 @@
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/i386/include/kdb.h,v 1.3 2006/04/03 22:51:47 marcel Exp $
+ * $FreeBSD: src/sys/i386/include/kdb.h,v 1.4 2007/06/09 21:55:17 marcel Exp $
  */
 
 #ifndef _MACHINE_KDB_H_
@@ -47,6 +47,11 @@
 }
 
 static __inline void
+kdb_cpu_sync_icache(unsigned char *addr, size_t size)
+{
+}
+
+static __inline void
 kdb_cpu_trap(int type, int code)
 {
 }

==== //depot/projects/wifi/sys/ia64/ia64/db_machdep.c#3 (text+ko) ====

@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/ia64/ia64/db_machdep.c,v 1.2 2006/07/12 21:22:43 jhb Exp $");
+__FBSDID("$FreeBSD: src/sys/ia64/ia64/db_machdep.c,v 1.3 2007/06/09 22:15:13 marcel Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -44,6 +44,7 @@
 
 #include <machine/db_machdep.h>
 #include <machine/frame.h>
+#include <machine/kdb.h>
 #include <machine/md_var.h>
 #include <machine/mutex.h>
 #include <machine/pcb.h>
@@ -552,6 +553,7 @@
 {
 	jmp_buf jb;
 	void *prev_jb;
+	size_t cnt;
 	char *dst;
 	int ret;
 
@@ -559,8 +561,10 @@
 	ret = setjmp(jb);
 	if (ret == 0) {
 		dst = (char *)addr;
-		while (size-- > 0)
+		cnt = size;
+		while (cnt-- > 0)
 			*dst++ = *data++;
+		kdb_cpu_sync_icache((void *)addr, size);
 	}
 	(void)kdb_jmpbuf(prev_jb);
 	return (ret);

==== //depot/projects/wifi/sys/ia64/include/kdb.h#5 (text+ko) ====

@@ -23,7 +23,7 @@
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/ia64/include/kdb.h,v 1.4 2006/11/18 21:52:26 marcel Exp $
+ * $FreeBSD: src/sys/ia64/include/kdb.h,v 1.5 2007/06/09 21:55:17 marcel Exp $
  */
 
 #ifndef _MACHINE_KDB_H_
@@ -48,6 +48,21 @@
 }
 
 static __inline void
+kdb_cpu_sync_icache(unsigned char *addr, size_t size)
+{
+	vm_offset_t cacheline;
+
+	cacheline = (uintptr_t)addr & ~31;
+	size += (uintptr_t)addr - cacheline;
+	size = (size + 31) & ~31;
+	while (size > 0) {
+		__asm __volatile("fc %0;; sync.i;; srlz.i;;" :: "r"(cacheline));
+		cacheline += 32;
+		size -= 32;
+	}
+}
+
+static __inline void
 kdb_cpu_trap(int vector, int _)
 {
 	__asm __volatile("flushrs;;");

==== //depot/projects/wifi/sys/kern/init_main.c#20 (text+ko) ====

@@ -42,7 +42,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/init_main.c,v 1.280 2007/06/08 11:47:36 phk Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/init_main.c,v 1.282 2007/06/10 00:28:41 attilio Exp $");
 
 #include "opt_ddb.h"
 #include "opt_init_path.h"
@@ -500,6 +500,7 @@
 {
 	struct timespec ts;
 	struct proc *p;
+	struct rusage ru;
 
 	/*
 	 * Now we can look at the time, having had a chance to verify the
@@ -508,7 +509,13 @@
 	sx_slock(&allproc_lock);
 	FOREACH_PROC_IN_SYSTEM(p) {
 		microuptime(&p->p_stats->p_start);
+		PROC_SLOCK(p);
+		rufetch(p, &ru);	/* Clears thread stats */
+		PROC_SUNLOCK(p);
 		p->p_rux.rux_runtime = 0;
+		p->p_rux.rux_uticks = 0;
+		p->p_rux.rux_sticks = 0;
+		p->p_rux.rux_iticks = 0;
 	}
 	sx_sunlock(&allproc_lock);
 	PCPU_SET(switchtime, cpu_ticks());

==== //depot/projects/wifi/sys/kern/kern_acct.c#15 (text+ko) ====

@@ -68,7 +68,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/kern_acct.c,v 1.92 2007/06/05 00:00:53 jeff Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/kern_acct.c,v 1.93 2007/06/09 21:48:44 attilio Exp $");
 
 #include "opt_mac.h"
 
@@ -370,8 +370,7 @@
 	bcopy(p->p_comm, acct.ac_comm, sizeof acct.ac_comm);
 
 	/* (2) The amount of user and system time that was used */
-	rufetch(p, &ru);
-	calcru(p, &ut, &st);
+	rufetchcalc(p, &ru, &ut, &st);
 	acct.ac_utime = encode_timeval(ut);
 	acct.ac_stime = encode_timeval(st);
 

==== //depot/projects/wifi/sys/kern/kern_clock.c#15 (text+ko) ====

@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/kern_clock.c,v 1.200 2007/06/04 23:53:06 jeff Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/kern_clock.c,v 1.201 2007/06/09 19:41:13 attilio Exp $");
 
 #include "opt_kdb.h"
 #include "opt_device_polling.h"
@@ -85,7 +85,7 @@
 long cp_time[CPUSTATES];
 
 /* Spin-lock protecting profiling statistics. */
-struct mtx time_lock;
+static struct mtx time_lock;
 
 static int
 sysctl_kern_cp_time(SYSCTL_HANDLER_ARGS)

==== //depot/projects/wifi/sys/kern/kern_exit.c#22 (text+ko) ====

@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/kern_exit.c,v 1.301 2007/06/07 22:27:14 rwatson Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/kern_exit.c,v 1.303 2007/06/09 21:48:44 attilio Exp $");
 
 #include "opt_compat.h"
 #include "opt_ktrace.h"
@@ -116,7 +116,6 @@
 	struct ucred *tracecred;
 #endif
 	struct plimit *plim;
-	struct rusage *ru;
 	int locked;
 
 	/*
@@ -233,8 +232,6 @@
 	 */
 	EVENTHANDLER_INVOKE(process_exit, p);
 
-	MALLOC(ru, struct rusage *, sizeof(struct rusage),
-		M_ZOMBIE, M_WAITOK);
 	/*
 	 * If parent is waiting for us to exit or exec,
 	 * P_PPWAIT is set; we will wakeup the parent below.
@@ -447,16 +444,6 @@
 	p->p_xstat = rv;
 	p->p_xthread = td;
 	/*
-	 * All statistics have been aggregated into the final td_ru by
-	 * thread_exit().  Copy these into the proc here where wait*()
-	 * can find them.
-	 * XXX We will miss any statistics gathered between here and
-	 * thread_exit() except for those related to clock ticks.
-	 */
-	*ru = td->td_ru;
-	ru->ru_nvcsw++;
-	p->p_ru = ru;
-	/*
 	 * Notify interested parties of our demise.
 	 */
 	KNOTE_LOCKED(&p->p_klist, NOTE_EXIT);
@@ -537,6 +524,11 @@
 	knlist_destroy(&p->p_klist);
 
 	/*
+	 * Save our children's rusage information in our exit rusage.
+	 */
+	ruadd(&p->p_ru, &p->p_rux, &p->p_stats->p_cru, &p->p_crux);
+
+	/*
 	 * Make sure the scheduler takes this thread out of its tables etc.
 	 * This will also release this thread's reference to the ucred.
 	 * Other thread parts to release include pcb bits and such.
@@ -711,30 +703,16 @@
 		}
 
 		nfound++;
+		PROC_SLOCK(p);
 		if (p->p_state == PRS_ZOMBIE) {
-
-			/*
-			 * It is possible that the last thread of this
-			 * process is still running on another CPU
-			 * in thread_exit() after having dropped the process
-			 * lock via PROC_UNLOCK() but before it has completed
-			 * cpu_throw().  In that case, the other thread must
-			 * still hold the proc slock, so simply by acquiring
-			 * proc slock once we will wait long enough for the
-			 * thread to exit in that case.
-			 * XXX This is questionable.
-			 */
-			PROC_SLOCK(p);
+			if (rusage) {
+				*rusage = p->p_ru;
+				calcru(p, &rusage->ru_utime, &rusage->ru_stime);
+			}
 			PROC_SUNLOCK(p);
-			
 			td->td_retval[0] = p->p_pid;
 			if (status)
 				*status = p->p_xstat;	/* convert to int */
-			if (rusage) {
-				*rusage = *p->p_ru;
-				calcru(p, &rusage->ru_utime, &rusage->ru_stime);
-			}
-
 			PROC_LOCK(q);
 			sigqueue_take(p->p_ksi);
 			PROC_UNLOCK(q);
@@ -776,11 +754,9 @@
 			p->p_xstat = 0;		/* XXX: why? */
 			PROC_UNLOCK(p);
 			PROC_LOCK(q);
-			ruadd(&q->p_stats->p_cru, &q->p_crux, p->p_ru,
+			ruadd(&q->p_stats->p_cru, &q->p_crux, &p->p_ru,
 			    &p->p_rux);
 			PROC_UNLOCK(q);
-			FREE(p->p_ru, M_ZOMBIE);
-			p->p_ru = NULL;
 
 			/*
 			 * Decrement the count of procs running with this uid.
@@ -819,7 +795,6 @@
 			sx_xunlock(&allproc_lock);
 			return (0);
 		}
-		PROC_SLOCK(p);
 		if ((p->p_flag & P_STOPPED_SIG) &&
 		    (p->p_suspcount == p->p_numthreads) &&
 		    (p->p_flag & P_WAITED) == 0 &&

==== //depot/projects/wifi/sys/kern/kern_mutex.c#16 (text+ko) ====

@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/kern_mutex.c,v 1.195 2007/06/08 21:36:52 attilio Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/kern_mutex.c,v 1.196 2007/06/09 18:09:37 mjacob Exp $");
 
 #include "opt_adaptive_mutexes.h"
 #include "opt_ddb.h"
@@ -530,7 +530,7 @@
 {
 	mtx_assert(new, MA_OWNED);
 	MPASS(td->td_lock == &blocked_lock);
-	atomic_store_rel_ptr((void *)&td->td_lock, (uintptr_t)new);
+	atomic_store_rel_ptr((volatile void *)&td->td_lock, (uintptr_t)new);
 	spinlock_exit();
 }
 

==== //depot/projects/wifi/sys/kern/kern_proc.c#17 (text+ko) ====

@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/kern_proc.c,v 1.249 2007/06/05 00:00:54 jeff Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/kern_proc.c,v 1.250 2007/06/09 21:48:44 attilio Exp $");
 
 #include "opt_ktrace.h"
 #include "opt_kstack_pages.h"
@@ -700,7 +700,9 @@
 	if ((p->p_sflag & PS_INMEM) && p->p_stats != NULL) {
 		kp->ki_start = p->p_stats->p_start;
 		timevaladd(&kp->ki_start, &boottime);
+		PROC_SLOCK(p);
 		calcru(p, &kp->ki_rusage.ru_utime, &kp->ki_rusage.ru_stime);
+		PROC_SUNLOCK(p);
 		calccru(p, &kp->ki_childutime, &kp->ki_childstime);
 
 		/* Some callers want child-times in a single value */

==== //depot/projects/wifi/sys/kern/kern_resource.c#15 (text+ko) ====

@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/kern_resource.c,v 1.174 2007/06/05 00:00:54 jeff Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/kern_resource.c,v 1.176 2007/06/09 21:48:44 attilio Exp $");
 
 #include "opt_compat.h"
 
@@ -829,12 +829,11 @@
 void
 calcru(struct proc *p, struct timeval *up, struct timeval *sp)
 {
-	struct rusage_ext rux;
 	struct thread *td;
 	uint64_t u;
 
 	PROC_LOCK_ASSERT(p, MA_OWNED);
-	PROC_SLOCK(p);
+	PROC_SLOCK_ASSERT(p, MA_OWNED);
 	/*
 	 * If we are getting stats for the current process, then add in the
 	 * stats that this thread has accumulated in its current time slice.
@@ -847,14 +846,7 @@
 		p->p_rux.rux_runtime += u - PCPU_GET(switchtime);
 		PCPU_SET(switchtime, u);
 	}
-	/* Work on a copy of p_rux so we can let go of p_slock */
-	rux = p->p_rux;
-	PROC_SUNLOCK(p);
-	calcru1(p, &rux, up, sp);
-	/* Update the result from the p_rux copy */
-	p->p_rux.rux_uu = rux.rux_uu;
-	p->p_rux.rux_su = rux.rux_su;
-	p->p_rux.rux_tu = rux.rux_tu;
+	calcru1(p, &p->p_rux, up, sp);
 }
 
 static void
@@ -965,8 +957,8 @@
 	switch (who) {
 
 	case RUSAGE_SELF:
-		rufetch(p, rup);
-		calcru(p, &rup->ru_utime, &rup->ru_stime);
+		rufetchcalc(p, rup, &rup->ru_utime,
+		    &rup->ru_stime);
 		break;
 
 	case RUSAGE_CHILDREN:
@@ -1039,19 +1031,32 @@
 {
 	struct thread *td;
 
-	memset(ru, 0, sizeof(*ru));
-	PROC_SLOCK(p);
-	if (p->p_ru == NULL)  {
-		KASSERT(p->p_numthreads > 0,
-		    ("rufetch: No threads or ru in proc %p", p));
+	PROC_SLOCK_ASSERT(p, MA_OWNED);
+
+	*ru = p->p_ru;
+	if (p->p_numthreads > 0)  {
 		FOREACH_THREAD_IN_PROC(p, td) {
 			thread_lock(td);
 			ruxagg(&p->p_rux, td);
 			thread_unlock(td);
 			rucollect(ru, &td->td_ru);
 		}
-	} else
-		*ru = *p->p_ru;
+	}
+}
+
+/*
+ * Atomically perform a rufetch and a calcru together.
+ * Consumers, can safely assume the calcru is executed only once
+ * rufetch is completed.
+ */
+void
+rufetchcalc(struct proc *p, struct rusage *ru, struct timeval *up,
+    struct timeval *sp)
+{
+
+	PROC_SLOCK(p);
+	rufetch(p, ru);
+	calcru(p, up, sp);
 	PROC_SUNLOCK(p);
 }
 

==== //depot/projects/wifi/sys/kern/kern_sig.c#22 (text+ko) ====

@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/kern_sig.c,v 1.346 2007/06/04 23:52:24 jeff Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/kern_sig.c,v 1.347 2007/06/10 01:43:11 mjacob Exp $");
 
 #include "opt_compat.h"
 #include "opt_ktrace.h"
@@ -1174,6 +1174,8 @@
 	p = td->td_proc;
 	error = 0;
 	sig = 0;
+	ets.tv_sec = 0;
+	ets.tv_nsec = 0;
 	SIG_CANTMASK(waitset);
 
 	PROC_LOCK(p);

==== //depot/projects/wifi/sys/kern/kern_thread.c#20 (text+ko) ====

@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/kern_thread.c,v 1.247 2007/06/04 23:52:24 jeff Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/kern_thread.c,v 1.248 2007/06/09 18:56:11 attilio Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -391,9 +391,9 @@
 	PCPU_SET(switchtime, new_switchtime);
 	PCPU_SET(switchticks, ticks);
 	PCPU_INC(cnt.v_swtch);
-	/* Add the child usage to our own when the final thread exits. */
-	if (p->p_numthreads == 1)
-		ruadd(p->p_ru, &p->p_rux, &p->p_stats->p_cru, &p->p_crux);
+	/* Save our resource usage in our process. */
+	td->td_ru.ru_nvcsw++;
+	rucollect(&p->p_ru, &td->td_ru);
 	/*
 	 * The last thread is left attached to the process
 	 * So that the whole bundle gets recycled. Skip
@@ -411,9 +411,7 @@
 			thread_unlink(td);
 #endif
 			thread_unlock(td);
-			/* Impart our resource usage on another thread */
 			td2 = FIRST_THREAD_IN_PROC(p);
-			rucollect(&td2->td_ru, &td->td_ru);
 			sched_exit_thread(td2, td);
 
 			/*
@@ -462,7 +460,7 @@
 	} 
 	PROC_UNLOCK(p);
 	thread_lock(td);
-	/* Aggregate our tick statistics into our parents rux. */
+	/* Save our tick information with both the thread and proc locked */
 	ruxagg(&p->p_rux, td);
 	PROC_SUNLOCK(p);
 	td->td_state = TDS_INACTIVE;

==== //depot/projects/wifi/sys/kern/kern_time.c#14 (text+ko) ====

@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/kern_time.c,v 1.141 2007/06/05 00:00:54 jeff Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/kern_time.c,v 1.142 2007/06/09 21:48:44 attilio Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -213,13 +213,17 @@
 		break;
 	case CLOCK_VIRTUAL:
 		PROC_LOCK(p);
+		PROC_SLOCK(p);
 		calcru(p, &user, &sys);
+		PROC_SUNLOCK(p);
 		PROC_UNLOCK(p);
 		TIMEVAL_TO_TIMESPEC(&user, ats);
 		break;
 	case CLOCK_PROF:
 		PROC_LOCK(p);
+		PROC_SLOCK(p);
 		calcru(p, &user, &sys);
+		PROC_SUNLOCK(p);
 		PROC_UNLOCK(p);
 		timevaladd(&user, &sys);
 		TIMEVAL_TO_TIMESPEC(&user, ats);

==== //depot/projects/wifi/sys/kern/tty.c#14 (text+ko) ====

@@ -71,7 +71,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/tty.c,v 1.269 2007/06/04 23:55:32 jeff Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/tty.c,v 1.270 2007/06/10 01:49:17 mjacob Exp $");
 
 #include "opt_compat.h"
 #include "opt_tty.h"
@@ -1720,7 +1720,7 @@
 	int s, first, error = 0;
 	int has_stime = 0, last_cc = 0;
 	long slp = 0;		/* XXX this should be renamed `timo'. */
-	struct timeval stime;
+	struct timeval stime = { 0, 0 };
 	struct pgrp *pg;
 
 	td = curthread;

==== //depot/projects/wifi/sys/kern/vfs_aio.c#18 (text+ko) ====

@@ -19,7 +19,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/vfs_aio.c,v 1.231 2007/06/01 01:12:44 jeff Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/vfs_aio.c,v 1.232 2007/06/10 01:50:05 mjacob Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -791,7 +791,6 @@
 {
 	struct ucred *td_savedcred;
 	struct thread *td;
-	struct proc *mycp;
 	struct aiocb *cb;
 	struct file *fp;
 	struct socket *so;

==== //depot/projects/wifi/sys/kern/vfs_bio.c#27 (text+ko) ====

@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/vfs_bio.c,v 1.525 2007/06/08 07:05:08 delphij Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/vfs_bio.c,v 1.526 2007/06/09 23:41:14 marcel Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -48,6 +48,7 @@
 #include <sys/buf.h>
 #include <sys/devicestat.h>
 #include <sys/eventhandler.h>
+#include <sys/limits.h>
 #include <sys/lock.h>
 #include <sys/malloc.h>
 #include <sys/mount.h>
@@ -454,6 +455,7 @@
 caddr_t
 kern_vfs_bio_buffer_alloc(caddr_t v, long physmem_est)
 {
+	int maxbuf;
 
 	/*
 	 * physmem_est is in pages.  Convert it to kilobytes (assumes
@@ -483,6 +485,11 @@
 
 		if (maxbcache && nbuf > maxbcache / BKVASIZE)
 			nbuf = maxbcache / BKVASIZE;
+
+		/* XXX Avoid integer overflows later on with maxbufspace. */
+		maxbuf = (INT_MAX / 3) / BKVASIZE;
+		if (nbuf > maxbuf)
+			nbuf = maxbuf;
 	}
 
 #if 0

==== //depot/projects/wifi/sys/modules/bge/Makefile#5 (text+ko) ====

@@ -1,8 +1,12 @@
-# $FreeBSD: src/sys/modules/bge/Makefile,v 1.5 2006/11/03 21:41:19 ru Exp $
+# $FreeBSD: src/sys/modules/bge/Makefile,v 1.6 2007/06/10 00:58:41 kensmith Exp $
 
 .PATH: ${.CURDIR}/../../dev/bge
 
 KMOD=	if_bge
 SRCS=	if_bge.c miibus_if.h miidevs.h device_if.h bus_if.h pci_if.h
 
+.if ${MACHINE_ARCH} == sparc64
+SRCS+=	ofw_bus_if.h
+.endif
+
 .include <bsd.kmod.mk>

==== //depot/projects/wifi/sys/netinet/tcp_input.c#27 (text+ko) ====

@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)tcp_input.c	8.12 (Berkeley) 5/24/95
- * $FreeBSD: src/sys/netinet/tcp_input.c,v 1.355 2007/05/28 23:27:44 andre Exp $
+ * $FreeBSD: src/sys/netinet/tcp_input.c,v 1.356 2007/06/09 21:09:49 andre Exp $
  */
 
 #include "opt_ipfw.h"		/* for ipfw_fwd	*/
@@ -920,8 +920,7 @@
 
 	/*
 	 * Unscale the window into a 32-bit value.
-	 * This value is bogus for the TCPS_SYN_SENT state
-	 * and is overwritten later.
+	 * For the SYN_SENT state it is zero.
 	 */
 	tiwin = th->th_win << tp->snd_scale;
 
@@ -947,6 +946,8 @@
 	/*
 	 * Process options only when we get SYN/ACK back. The SYN case
 	 * for incoming connections is handled in tcp_syncache.
+	 * According to RFC1323 the window field in a SYN (i.e., a <SYN>
+	 * or <SYN,ACK>) segment itself is never scaled.
 	 * XXX this is traditional behavior, may need to be cleaned up.

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200706100223.l5A2N1me093311>