Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 15 Jun 2004 03:59:22 GMT
From:      Robert Watson <rwatson@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 54985 for review
Message-ID:  <200406150359.i5F3xMrs017618@repoman.freebsd.org>

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

Change 54985 by rwatson@rwatson_tislabs on 2004/06/15 03:59:11

	Integrate netperf_socket; among other things, loop back some
	initial locking of sb_state.

Affected files ...

.. //depot/projects/netperf_socket/sys/contrib/altq/altq/altq_subr.c#3 integrate
.. //depot/projects/netperf_socket/sys/contrib/altq/altq/if_altq.h#3 integrate
.. //depot/projects/netperf_socket/sys/fs/fifofs/fifo_vnops.c#7 integrate
.. //depot/projects/netperf_socket/sys/i386/acpica/acpi_toshiba.c#7 integrate
.. //depot/projects/netperf_socket/sys/i386/i386/bios.c#5 integrate
.. //depot/projects/netperf_socket/sys/kern/link_elf_obj.c#3 integrate
.. //depot/projects/netperf_socket/sys/kern/uipc_socket2.c#15 integrate
.. //depot/projects/netperf_socket/sys/net/if.c#10 integrate
.. //depot/projects/netperf_socket/sys/net/if_var.h#13 integrate
.. //depot/projects/netperf_socket/sys/netinet/tcp_input.c#9 integrate
.. //depot/projects/netperf_socket/sys/netipx/spx_usrreq.c#5 integrate
.. //depot/projects/netperf_socket/sys/sparc64/sbus/lsi64854.c#1 branch
.. //depot/projects/netperf_socket/sys/sparc64/sbus/lsi64854reg.h#1 branch
.. //depot/projects/netperf_socket/sys/sparc64/sbus/lsi64854var.h#1 branch
.. //depot/projects/netperf_socket/sys/sys/socketvar.h#15 integrate
.. //depot/projects/netperf_socket/sys/vm/vm_contig.c#7 integrate

Differences ...

==== //depot/projects/netperf_socket/sys/contrib/altq/altq/altq_subr.c#3 (text+ko) ====

@@ -1,4 +1,4 @@
-/*	$FreeBSD: src/sys/contrib/altq/altq/altq_subr.c,v 1.3 2004/06/13 22:52:38 mlaier Exp $	*/
+/*	$FreeBSD: src/sys/contrib/altq/altq/altq_subr.c,v 1.4 2004/06/15 01:45:19 mlaier Exp $	*/
 /*	$KAME: altq_subr.c,v 1.21 2003/11/06 06:32:53 kjc Exp $	*/
 
 /*
@@ -91,6 +91,7 @@
  */
 static void	tbr_timeout(void *);
 int (*altq_input)(struct mbuf *, int) = NULL;
+static struct mbuf *tbr_dequeue(struct ifaltq *, int);
 static int tbr_timer = 0;	/* token bucket regulator timer */
 static struct callout tbr_callout = CALLOUT_INITIALIZER;
 
@@ -312,7 +313,7 @@
 #define	TBR_SCALE(x)	((int64_t)(x) << TBR_SHIFT)
 #define	TBR_UNSCALE(x)	((x) >> TBR_SHIFT)
 
-struct mbuf *
+static struct mbuf *
 tbr_dequeue(ifq, op)
 	struct ifaltq *ifq;
 	int op;
@@ -370,6 +371,9 @@
 	struct tb_profile *profile;
 {
 	struct tb_regulator *tbr, *otbr;
+	
+	if (tbr_dequeue_ptr == NULL)
+		tbr_dequeue_ptr = tbr_dequeue;
 
 	if (machclk_freq == 0)
 		init_machclk();

==== //depot/projects/netperf_socket/sys/contrib/altq/altq/if_altq.h#3 (text+ko) ====

@@ -1,4 +1,4 @@
-/*	$FreeBSD: src/sys/contrib/altq/altq/if_altq.h,v 1.2 2004/06/12 18:47:24 mlaier Exp $	*/
+/*	$FreeBSD: src/sys/contrib/altq/altq/if_altq.h,v 1.3 2004/06/15 01:45:19 mlaier Exp $	*/
 /*	$KAME: if_altq.h,v 1.11 2003/07/10 12:07:50 kjc Exp $	*/
 
 /*
@@ -181,9 +181,9 @@
 extern int altq_detach(struct ifaltq *);
 extern int altq_enable(struct ifaltq *);
 extern int altq_disable(struct ifaltq *);
-extern struct mbuf *tbr_dequeue(struct ifaltq *, int);
+extern struct mbuf *(*tbr_dequeue_ptr)(struct ifaltq *, int);
 extern int (*altq_input)(struct mbuf *, int);
-#if 1 /* ALTQ3_CLFIER_COMPAT */
+#if 0 /* ALTQ3_CLFIER_COMPAT */
 void altq_etherclassify(struct ifaltq *, struct mbuf *, struct altq_pktattr *);
 #endif
 #endif /* _KERNEL */

==== //depot/projects/netperf_socket/sys/fs/fifofs/fifo_vnops.c#7 (text+ko) ====

@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)fifo_vnops.c	8.10 (Berkeley) 5/27/95
- * $FreeBSD: src/sys/fs/fifofs/fifo_vnops.c,v 1.96 2004/06/14 18:16:20 rwatson Exp $
+ * $FreeBSD: src/sys/fs/fifofs/fifo_vnops.c,v 1.97 2004/06/15 03:51:43 rwatson Exp $
  */
 
 #include <sys/param.h>
@@ -211,7 +211,9 @@
 		}
 		fip->fi_readers = fip->fi_writers = 0;
 		wso->so_snd.sb_lowat = PIPE_BUF;
+		SOCKBUF_LOCK(&rso->so_rcv);
 		rso->so_rcv.sb_state |= SBS_CANTRCVMORE;
+		SOCKBUF_UNLOCK(&rso->so_rcv);
 		vp->v_fifoinfo = fip;
 	}
 
@@ -229,7 +231,9 @@
 	if (ap->a_mode & FREAD) {
 		fip->fi_readers++;
 		if (fip->fi_readers == 1) {
+			SOCKBUF_LOCK(&fip->fi_writesock->so_snd);
 			fip->fi_writesock->so_snd.sb_state &= ~SBS_CANTSENDMORE;
+			SOCKBUF_UNLOCK(&fip->fi_writesock->so_snd);
 			if (fip->fi_writers > 0) {
 				wakeup(&fip->fi_writers);
 				sowwakeup(fip->fi_writesock);
@@ -243,7 +247,9 @@
 		}
 		fip->fi_writers++;
 		if (fip->fi_writers == 1) {
+			SOCKBUF_LOCK(&fip->fi_writesock->so_rcv);
 			fip->fi_readsock->so_rcv.sb_state &= ~SBS_CANTRCVMORE;
+			SOCKBUF_UNLOCK(&fip->fi_writesock->so_rcv);
 			if (fip->fi_readers > 0) {
 				wakeup(&fip->fi_readers);
 				sorwakeup(fip->fi_writesock);

==== //depot/projects/netperf_socket/sys/i386/acpica/acpi_toshiba.c#7 (text+ko) ====

@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/i386/acpica/acpi_toshiba.c,v 1.9 2004/06/14 03:40:56 njl Exp $");
+__FBSDID("$FreeBSD: src/sys/i386/acpica/acpi_toshiba.c,v 1.10 2004/06/15 02:17:23 njl Exp $");
 
 #include "opt_acpi.h"
 #include <sys/param.h>
@@ -529,7 +529,7 @@
 	if (!acpi_disabled("toshiba") &&
 	    acpi_get_type(dev) == ACPI_TYPE_DEVICE &&
 	    device_get_unit(dev) == 0 &&
-	     acpi_MatchHid(dev, "TOS6201")) {
+	     acpi_MatchHid(device_get_handle(dev), "TOS6201")) {
 		device_quiet(dev);
 		device_set_desc(dev, "Toshiba Video");
 		ret = 0;

==== //depot/projects/netperf_socket/sys/i386/i386/bios.c#5 (text+ko) ====

@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/i386/i386/bios.c,v 1.67 2004/06/10 20:43:03 jhb Exp $");
+__FBSDID("$FreeBSD: src/sys/i386/i386/bios.c,v 1.68 2004/06/15 02:12:12 njl Exp $");
 
 /*
  * Code for dealing with the BIOS in x86 PC systems.
@@ -556,7 +556,7 @@
 	return;
 
     /* ACPI already active */
-    if (devclass_get_softc(devclass_find("acpi"), 0) != NULL)
+    if (devclass_find("acpi") != NULL)
 	return;
 
     /* get count of PnP devices */

==== //depot/projects/netperf_socket/sys/kern/link_elf_obj.c#3 (text+ko) ====

@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/link_elf_obj.c,v 1.81 2004/05/18 05:15:43 peter Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/link_elf_obj.c,v 1.83 2004/06/15 01:35:57 peter Exp $");
 
 #include "opt_ddb.h"
 #include "opt_mac.h"
@@ -747,12 +747,16 @@
 link_elf_symbol_values(linker_file_t lf, c_linker_sym_t sym,
     linker_symval_t *symval)
 {
+	Elf_Addr base;
 	elf_file_t ef = (elf_file_t) lf;
 	const Elf_Sym *es = (const Elf_Sym*) sym;
 
 	if (es >= ef->ddbsymtab && es < (ef->ddbsymtab + ef->ddbsymcnt)) {
+		base = findbase(ef, es->st_shndx);
+		if (base == 0)
+			base = (Elf_Addr)ef->address;
 		symval->name = ef->ddbstrtab + es->st_name;
-		symval->value = (caddr_t) ef->address + es->st_value;
+		symval->value = (caddr_t)base + es->st_value;
 		symval->size = es->st_size;
 		return 0;
 	}
@@ -878,6 +882,8 @@
 				break;
 			}
 		}
+		if (ret == 0)
+			return (0);
 		return ret + sym->st_value;
 	}
 

==== //depot/projects/netperf_socket/sys/kern/uipc_socket2.c#15 (text+ko) ====

@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/uipc_socket2.c,v 1.130 2004/06/14 18:16:19 rwatson Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/uipc_socket2.c,v 1.131 2004/06/15 03:51:44 rwatson Exp $");
 
 #include "opt_mac.h"
 #include "opt_param.h"
@@ -167,8 +167,12 @@
 		SOCK_LOCK(so);
 	so->so_state &= ~SS_ISCONNECTING;
 	so->so_state |= SS_ISDISCONNECTING;
+	SOCKBUF_LOCK(&so->so_rcv);
 	so->so_rcv.sb_state |= SBS_CANTRCVMORE;
+	SOCKBUF_UNLOCK(&so->so_rcv);
+	SOCKBUF_LOCK(&so->so_snd);
 	so->so_snd.sb_state |= SBS_CANTSENDMORE;
+	SOCKBUF_UNLOCK(&so->so_snd);
 	wakeup(&so->so_timeo);
 	SOCK_UNLOCK(so);
 	sowwakeup(so);
@@ -187,8 +191,12 @@
 		SOCK_LOCK(so);
 	so->so_state &= ~(SS_ISCONNECTING|SS_ISCONNECTED|SS_ISDISCONNECTING);
 	so->so_state |= SS_ISDISCONNECTED;
+	SOCKBUF_LOCK(&so->so_rcv);
 	so->so_rcv.sb_state |= SBS_CANTRCVMORE;
+	SOCKBUF_UNLOCK(&so->so_rcv);
+	SOCKBUF_LOCK(&so->so_snd);
 	so->so_snd.sb_state |= SBS_CANTSENDMORE;
+	SOCKBUF_UNLOCK(&so->so_snd);
 	wakeup(&so->so_timeo);
 	SOCK_UNLOCK(so);
 	sbdrop(&so->so_snd, so->so_snd.sb_cc);

==== //depot/projects/netperf_socket/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.192 2004/06/13 17:29:08 mlaier Exp $
+ * $FreeBSD: src/sys/net/if.c,v 1.193 2004/06/15 01:45:18 mlaier Exp $
  */
 
 #include "opt_compat.h"
@@ -75,6 +75,8 @@
 #include <netinet/if_ether.h>
 #endif
 
+struct mbuf *(*tbr_dequeue_ptr)(struct ifaltq *, int) = NULL;
+
 static void	if_attachdomain(void *);
 static void	if_attachdomain1(struct ifnet *);
 static int	ifconf(u_long, caddr_t);
@@ -441,13 +443,11 @@
 	ifa->ifa_refcnt = 1;
 	TAILQ_INSERT_HEAD(&ifp->if_addrhead, ifa, ifa_link);
 	ifp->if_broadcastaddr = 0; /* reliably crash if used uninitialized */
-#ifdef ALTQ
 	ifp->if_snd.altq_type = 0;
 	ifp->if_snd.altq_disc = NULL;
 	ifp->if_snd.altq_flags &= ALTQF_CANTCHANGE;
 	ifp->if_snd.altq_tbr  = NULL;
 	ifp->if_snd.altq_ifp  = ifp;
-#endif
 
 	if (domains)
 		if_attachdomain1(ifp);

==== //depot/projects/netperf_socket/sys/net/if_var.h#13 (text+ko) ====

@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  *
  *	From: @(#)if.h	8.1 (Berkeley) 6/10/93
- * $FreeBSD: src/sys/net/if_var.h,v 1.76 2004/06/14 03:55:09 mlaier Exp $
+ * $FreeBSD: src/sys/net/if_var.h,v 1.78 2004/06/15 03:40:39 mlaier Exp $
  */
 
 #ifndef	_NET_IF_VAR_H_
@@ -356,7 +356,7 @@
 		(*ifp->if_start)(ifp);
 	return (1);
 }
-#ifdef ALTQ
+#if 1 /* ALTQ */
 #define	IFQ_ENQUEUE(ifq, m, err)					\
 do {									\
 	IF_LOCK(ifq);							\
@@ -379,7 +379,7 @@
 #define	IFQ_DEQUEUE_NOLOCK(ifq, m)					\
 do {									\
 	if (TBR_IS_ENABLED(ifq))					\
-		(m) = tbr_dequeue(ifq, ALTDQ_REMOVE);			\
+		(m) = tbr_dequeue_ptr(ifq, ALTDQ_REMOVE);		\
 	else if (ALTQ_IS_ENABLED(ifq))					\
 		ALTQ_DEQUEUE(ifq, m);					\
 	else								\
@@ -396,7 +396,7 @@
 #define	IFQ_POLL_NOLOCK(ifq, m)						\
 do {									\
 	if (TBR_IS_ENABLED(ifq))					\
-		(m) = tbr_dequeue(ifq, ALTDQ_POLL);			\
+		(m) = tbr_dequeue_ptr(ifq, ALTDQ_POLL);			\
 	else if (ALTQ_IS_ENABLED(ifq))					\
 		ALTQ_POLL(ifq, m);					\
 	else								\
@@ -482,7 +482,7 @@
 } while (0)
 
 #define	IFQ_HANDOFF(ifp, m, err)					\
-	IFQ_HANDOFF_ADJ(ifq, m, 0, err)
+	IFQ_HANDOFF_ADJ(ifp, m, 0, err)
 
 #define	IFQ_DRV_DEQUEUE(ifq, m)						\
 do {									\

==== //depot/projects/netperf_socket/sys/netinet/tcp_input.c#9 (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.239 2004/06/14 18:16:21 rwatson Exp $
+ * $FreeBSD: src/sys/netinet/tcp_input.c,v 1.240 2004/06/15 03:51:44 rwatson Exp $
  */
 
 #include "opt_ipfw.h"		/* for ipfw_fwd		*/
@@ -2253,8 +2253,11 @@
 			tp->rcv_up = th->th_seq + th->th_urp;
 			so->so_oobmark = so->so_rcv.sb_cc +
 			    (tp->rcv_up - tp->rcv_nxt) - 1;
-			if (so->so_oobmark == 0)
+			if (so->so_oobmark == 0) {
+				SOCKBUF_LOCK(&so->so_rcv);
 				so->so_rcv.sb_state |= SBS_RCVATMARK;
+				SOCKBUF_UNLOCK(&so->so_rcv);
+			}
 			sohasoutofband(so);
 			tp->t_oobflags &= ~(TCPOOB_HAVEDATA | TCPOOB_HADDATA);
 		}

==== //depot/projects/netperf_socket/sys/netipx/spx_usrreq.c#5 (text+ko) ====

@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/netipx/spx_usrreq.c,v 1.42 2004/06/14 18:16:22 rwatson Exp $");
+__FBSDID("$FreeBSD: src/sys/netipx/spx_usrreq.c,v 1.43 2004/06/15 03:51:44 rwatson Exp $");
 
 #include <sys/param.h>
 #include <sys/lock.h>
@@ -566,8 +566,11 @@
 				cb->s_oobflags &= ~SF_IOOB;
 				if (so->so_rcv.sb_cc)
 					so->so_oobmark = so->so_rcv.sb_cc;
-				else
+				else {
+					SOCKBUF_LOCK(&so->so_rcv);
 					so->so_rcv.sb_state |= SBS_RCVATMARK;
+					SOCKBUF_UNLOCK(&so->so_rcv);
+				}
 			}
 			q = q->si_prev;
 			remque(q->si_next);
@@ -597,7 +600,9 @@
 					MCHTYPE(m, MT_OOBDATA);
 					spx_newchecks[1]++;
 					so->so_oobmark = 0;
+					SOCKBUF_LOCK(&so->so_rcv);
 					so->so_rcv.sb_state &= ~SBS_RCVATMARK;
+					SOCKBUF_UNLOCK(&so->so_rcv);
 				}
 				if (packetp == 0) {
 					m->m_data += SPINC;

==== //depot/projects/netperf_socket/sys/sys/socketvar.h#15 (text+ko) ====

@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)socketvar.h	8.3 (Berkeley) 2/19/95
- * $FreeBSD: src/sys/sys/socketvar.h,v 1.122 2004/06/14 18:16:18 rwatson Exp $
+ * $FreeBSD: src/sys/sys/socketvar.h,v 1.123 2004/06/14 22:03:14 rwatson Exp $
  */
 
 #ifndef _SYS_SOCKETVAR_H_
@@ -194,7 +194,7 @@
 #define	SOCK_UNLOCK(_so)		SOCKBUF_UNLOCK(&(_so)->so_rcv)
 #define	SOCK_LOCK_ASSERT(_so)		SOCKBUF_LOCK_ASSERT(&(_so)->so_rcv)
 
-/*-
+/*
  * Socket state bits.
  *
  * Historically, this bits were all kept in the so_state field.  For

==== //depot/projects/netperf_socket/sys/vm/vm_contig.c#7 (text+ko) ====

@@ -60,7 +60,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/vm/vm_contig.c,v 1.34 2004/04/06 20:15:36 imp Exp $");
+__FBSDID("$FreeBSD: src/sys/vm/vm_contig.c,v 1.35 2004/06/15 01:02:00 green Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -119,7 +119,7 @@
 			} else if (object->type == OBJT_SWAP ||
 				   object->type == OBJT_DEFAULT) {
 				m_tmp = m;
-				vm_pageout_flush(&m_tmp, 1, 0);
+				vm_pageout_flush(&m_tmp, 1, VM_PAGER_PUT_SYNC);
 				VM_OBJECT_UNLOCK(object);
 				return (TRUE);
 			}
@@ -152,6 +152,7 @@
 	vm_object_t object;
 	vm_offset_t addr, tmp_addr;
 	int pass, pqtype;
+	int inactl, actl, inactmax, actmax;
 	vm_page_t pga = vm_page_array;
 
 	size = round_page(size);
@@ -163,7 +164,7 @@
 		panic("contigmalloc1: boundary must be a power of 2");
 
 	start = 0;
-	for (pass = 0; pass <= 1; pass++) {
+	for (pass = 2; pass >= 0; pass--) {
 		vm_page_lock_queues();
 again0:
 		mtx_lock_spin(&vm_page_queue_free_mtx);
@@ -188,11 +189,29 @@
 		if ((i == cnt.v_page_count) ||
 			((VM_PAGE_TO_PHYS(&pga[i]) + size) > high)) {
 			mtx_unlock_spin(&vm_page_queue_free_mtx);
+			/*
+			 * Instead of racing to empty the inactive/active
+			 * queues, give up, even with more left to free,
+			 * if we try more than the initial amount of pages.
+			 *
+			 * There's no point attempting this on the last pass.
+			 */
+			if (pass > 0) {
+				inactl = actl = 0;
+				inactmax = vm_page_queues[PQ_INACTIVE].lcnt;
+				actmax = vm_page_queues[PQ_ACTIVE].lcnt;
 again1:
-			if (vm_contig_launder(PQ_INACTIVE))
-				goto again1;
-			if (vm_contig_launder(PQ_ACTIVE))
-				goto again1;
+				if (inactl < inactmax &&
+				    vm_contig_launder(PQ_INACTIVE)) {
+					inactl++;
+					goto again1;
+				}
+				if (actl < actmax &&
+				    vm_contig_launder(PQ_ACTIVE)) {
+					actl++;
+					goto again1;
+				}
+			}
 			vm_page_unlock_queues();
 			continue;
 		}



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