PERFORCE change 57211 for review
Robert Watson
rwatson at FreeBSD.org
Mon Jul 12 12:43:21 PDT 2004
http://perforce.freebsd.org/chv.cgi?CH=57211
Change 57211 by rwatson at rwatson_tislabs on 2004/07/12 19:42:38
Integ netperf_socket from FreeBSD CVS:
- Locking fixes for umtx.
- at_rmx prsockaddr() fixes for MPSAFEty (merged from
rwatson_netperf).
- netatalk DDP PCB locking (merged from rwatson_netperf).
- Additional tcp_input() locking state assertions (merged from
rwatson_netperf)
- Constification in rpc, spx.
Affected files ...
.. //depot/projects/netperf_socket/sys/kern/kern_thr.c#9 integrate
.. //depot/projects/netperf_socket/sys/kern/kern_umtx.c#4 integrate
.. //depot/projects/netperf_socket/sys/netatalk/aarp.c#9 integrate
.. //depot/projects/netperf_socket/sys/netatalk/at_rmx.c#3 integrate
.. //depot/projects/netperf_socket/sys/netatalk/ddp_input.c#6 integrate
.. //depot/projects/netperf_socket/sys/netatalk/ddp_pcb.c#7 integrate
.. //depot/projects/netperf_socket/sys/netatalk/ddp_pcb.h#2 integrate
.. //depot/projects/netperf_socket/sys/netatalk/ddp_usrreq.c#11 integrate
.. //depot/projects/netperf_socket/sys/netatalk/ddp_var.h#4 integrate
.. //depot/projects/netperf_socket/sys/netinet/tcp_input.c#17 integrate
.. //depot/projects/netperf_socket/sys/netipx/spx_usrreq.c#8 integrate
.. //depot/projects/netperf_socket/sys/rpc/rpcclnt.c#5 integrate
.. //depot/projects/netperf_socket/sys/vm/vm_pageout.c#8 integrate
Differences ...
==== //depot/projects/netperf_socket/sys/kern/kern_thr.c#9 (text+ko) ====
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/kern_thr.c,v 1.21 2004/07/02 00:40:07 marcel Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/kern_thr.c,v 1.22 2004/07/12 15:28:31 mtm Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@@ -280,13 +280,10 @@
hz = tvtohz(&tv);
}
PROC_LOCK(td->td_proc);
- mtx_lock_spin(&sched_lock);
- if ((td->td_flags & TDF_THRWAKEUP) == 0) {
- mtx_unlock_spin(&sched_lock);
+ if ((td->td_flags & TDF_THRWAKEUP) == 0)
error = msleep((void *)td, &td->td_proc->p_mtx,
td->td_priority | PCATCH, "lthr", hz);
- mtx_lock_spin(&sched_lock);
- }
+ mtx_lock_spin(&sched_lock);
td->td_flags &= ~TDF_THRWAKEUP;
mtx_unlock_spin(&sched_lock);
PROC_UNLOCK(td->td_proc);
==== //depot/projects/netperf_socket/sys/kern/kern_umtx.c#4 (text+ko) ====
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/kern_umtx.c,v 1.15 2004/07/02 00:40:07 marcel Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/kern_umtx.c,v 1.16 2004/07/12 15:28:31 mtm Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@@ -217,14 +217,12 @@
* unlocking the umtx.
*/
PROC_LOCK(td->td_proc);
- mtx_lock_spin(&sched_lock);
- if (old == owner && (td->td_flags & TDF_UMTXWAKEUP) == 0) {
- mtx_unlock_spin(&sched_lock);
+ if (old == owner && (td->td_flags & TDF_UMTXWAKEUP) == 0)
error = msleep(td, &td->td_proc->p_mtx,
td->td_priority | PCATCH, "umtx", 0);
- mtx_lock_spin(&sched_lock);
- } else
+ else
error = 0;
+ mtx_lock_spin(&sched_lock);
td->td_flags &= ~TDF_UMTXWAKEUP;
mtx_unlock_spin(&sched_lock);
PROC_UNLOCK(td->td_proc);
==== //depot/projects/netperf_socket/sys/netatalk/aarp.c#9 (text+ko) ====
@@ -2,7 +2,7 @@
* Copyright (c) 1990,1991 Regents of The University of Michigan.
* All Rights Reserved.
*
- * $FreeBSD: src/sys/netatalk/aarp.c,v 1.31 2004/04/25 09:24:51 luigi Exp $
+ * $FreeBSD: src/sys/netatalk/aarp.c,v 1.32 2004/07/12 18:35:30 rwatson Exp $
*/
#include "opt_atalk.h"
@@ -71,9 +71,6 @@
0x09, 0x00, 0x07, 0xff, 0xff, 0xff,
};
-/*
- * Not used?
- */
u_char at_org_code[ 3 ] = {
0x08, 0x00, 0x07,
};
==== //depot/projects/netperf_socket/sys/netatalk/at_rmx.c#3 (text+ko) ====
@@ -27,7 +27,7 @@
* SUCH DAMAGE.
*
* at_rmx.c,v 1.13 1995/05/30 08:09:31 rgrimes Exp
- * $FreeBSD: src/sys/netatalk/at_rmx.c,v 1.7 2004/03/22 03:57:01 rwatson Exp $
+ * $FreeBSD: src/sys/netatalk/at_rmx.c,v 1.8 2004/07/12 18:37:31 rwatson Exp $
*/
/* This code generates debugging traces to the radix code */
@@ -40,10 +40,10 @@
int at_inithead(void **head, int off);
-static char hexbuf[256];
+#define HEXBUF_LEN 256
-static char *
-prsockaddr(void *v)
+static const char *
+prsockaddr(void *v, char *hexbuf)
{
char *bp = &hexbuf[0];
u_char *cp = v;
@@ -55,7 +55,7 @@
/* return: "(len) hexdump" */
bp += sprintf(bp, "(%d)", len);
- for (cp++; cp < cplim && bp < hexbuf+252; cp++) {
+ for (cp++; cp < cplim && bp < hexbuf + (HEXBUF_LEN - 4); cp++) {
*bp++ = "0123456789abcdef"[*cp / 16];
*bp++ = "0123456789abcdef"[*cp % 16];
}
@@ -63,8 +63,7 @@
bp+= sprintf(bp, "null");
}
*bp = '\0';
-
- return &hexbuf[0];
+ return (hexbuf);
}
static struct radix_node *
@@ -72,9 +71,10 @@
struct radix_node *treenodes)
{
struct radix_node *rn;
+ char hexbuf[HEXBUF_LEN];
- printf("at_addroute: v=%s\n", prsockaddr(v_arg));
- printf("at_addroute: n=%s\n", prsockaddr(n_arg));
+ printf("at_addroute: v=%s\n", prsockaddr(v_arg, hexbuf));
+ printf("at_addroute: n=%s\n", prsockaddr(n_arg, hexbuf));
printf("at_addroute: head=%p treenodes=%p\n",
(void *)head, (void *)treenodes);
@@ -89,8 +89,9 @@
at_matroute(void *v_arg, struct radix_node_head *head)
{
struct radix_node *rn;
+ char hexbuf[HEXBUF_LEN];
- printf("at_matroute: v=%s\n", prsockaddr(v_arg));
+ printf("at_matroute: v=%s\n", prsockaddr(v_arg, hexbuf));
printf("at_matroute: head=%p\n", (void *)head);
rn = rn_match(v_arg, head);
@@ -104,9 +105,10 @@
at_lookup(void *v_arg, void *m_arg, struct radix_node_head *head)
{
struct radix_node *rn;
+ char hexbuf[HEXBUF_LEN];
- printf("at_lookup: v=%s\n", prsockaddr(v_arg));
- printf("at_lookup: n=%s\n", prsockaddr(m_arg));
+ printf("at_lookup: v=%s\n", prsockaddr(v_arg, hexbuf));
+ printf("at_lookup: n=%s\n", prsockaddr(m_arg, hexbuf));
printf("at_lookup: head=%p\n", (void *)head);
rn = rn_lookup(v_arg, m_arg, head);
@@ -120,9 +122,10 @@
at_delroute(void *v_arg, void *netmask_arg, struct radix_node_head *head)
{
struct radix_node *rn;
+ char hexbuf[HEXBUF_LEN];
- printf("at_delroute: v=%s\n", prsockaddr(v_arg));
- printf("at_delroute: n=%s\n", prsockaddr(netmask_arg));
+ printf("at_delroute: v=%s\n", prsockaddr(v_arg, hexbuf));
+ printf("at_delroute: n=%s\n", prsockaddr(netmask_arg, hexbuf));
printf("at_delroute: head=%p\n", (void *)head);
rn = rn_delete(v_arg, netmask_arg, head);
==== //depot/projects/netperf_socket/sys/netatalk/ddp_input.c#6 (text+ko) ====
@@ -1,8 +1,9 @@
/*
+ * Copyright (c) 2004 Robert N. M. Watson
* Copyright (c) 1990,1994 Regents of The University of Michigan.
* All Rights Reserved. See COPYRIGHT.
*
- * $FreeBSD: src/sys/netatalk/ddp_input.c,v 1.24 2004/06/13 02:50:05 rwatson Exp $
+ * $FreeBSD: src/sys/netatalk/ddp_input.c,v 1.25 2004/07/12 18:39:59 rwatson Exp $
*/
#include "opt_mac.h"
@@ -24,11 +25,13 @@
#include <netatalk/at_var.h>
#include <netatalk/ddp.h>
#include <netatalk/ddp_var.h>
+#include <netatalk/ddp_pcb.h>
#include <netatalk/at_extern.h>
static volatile int ddp_forward = 1;
static volatile int ddp_firewall = 0;
static struct ddpstat ddpstat;
+
static struct route forwro;
static void ddp_input(struct mbuf *, struct ifnet *, struct elaphdr *, int);
@@ -360,17 +363,16 @@
* Search for ddp protocol control blocks that match these
* addresses.
*/
+ DDP_LIST_SLOCK();
if ((ddp = ddp_search(&from, &to, aa)) == NULL) {
- m_freem(m);
- return;
+ goto out;
}
#ifdef MAC
SOCK_LOCK(ddp->ddp_socket);
if (mac_check_socket_deliver(ddp->ddp_socket, m) != 0) {
SOCK_UNLOCK(ddp->ddp_socket);
- m_freem(m);
- return;
+ goto out;
}
SOCK_UNLOCK(ddp->ddp_socket);
#endif
@@ -384,13 +386,17 @@
* If the socket is full (or similar error) dump the packet.
*/
ddpstat.ddps_nosockspace++;
- m_freem(m);
- return;
+ goto out;
}
/*
* And wake up whatever might be waiting for it
*/
sorwakeup(ddp->ddp_socket);
+ m = NULL;
+out:
+ DDP_LIST_SUNLOCK();
+ if (m != NULL)
+ m_freem(m);
}
#if 0
==== //depot/projects/netperf_socket/sys/netatalk/ddp_pcb.c#7 (text+ko) ====
@@ -1,8 +1,9 @@
/*
+ * Copyright (c) 2004 Robert N. M. Watson
* Copyright (c) 1990,1994 Regents of The University of Michigan.
* All Rights Reserved. See COPYRIGHT.
*
- * $FreeBSD: src/sys/netatalk/ddp_pcb.c,v 1.43 2004/06/12 20:47:29 rwatson Exp $
+ * $FreeBSD: src/sys/netatalk/ddp_pcb.c,v 1.44 2004/07/12 18:39:59 rwatson Exp $
*/
#include <sys/param.h>
@@ -22,12 +23,18 @@
#include <netatalk/ddp_pcb.h>
#include <netatalk/at_extern.h>
+struct mtx ddp_list_mtx;
static struct ddpcb *ddp_ports[ ATPORT_LAST ];
-struct ddpcb *ddpcb_list = NULL;
+struct ddpcb *ddpcb_list = NULL;
void
at_sockaddr(struct ddpcb *ddp, struct sockaddr **addr)
{
+
+ /*
+ * Prevent modification of ddp during copy of addr.
+ */
+ DDP_LOCK_ASSERT(ddp);
*addr = sodupsockaddr((struct sockaddr *)&ddp->ddp_lsat, M_NOWAIT);
}
@@ -38,6 +45,12 @@
struct at_ifaddr *aa;
struct ddpcb *ddpp;
+ /*
+ * We read and write both the ddp passed in, and also ddp_ports.
+ */
+ DDP_LIST_XLOCK_ASSERT();
+ DDP_LOCK_ASSERT(ddp);
+
if (ddp->ddp_lsat.sat_port != ATADDR_ANYPORT) { /* shouldn't be bound */
return (EINVAL);
}
@@ -134,6 +147,9 @@
struct ifnet *ifp;
u_short hintnet = 0, net;
+ DDP_LIST_XLOCK_ASSERT();
+ DDP_LOCK_ASSERT(ddp);
+
if (sat->sat_family != AF_APPLETALK) {
return (EAFNOSUPPORT);
}
@@ -222,6 +238,9 @@
void
at_pcbdisconnect(struct ddpcb *ddp)
{
+
+ DDP_LOCK_ASSERT(ddp);
+
ddp->ddp_fsat.sat_addr.s_net = ATADDR_ANYNET;
ddp->ddp_fsat.sat_addr.s_node = ATADDR_ANYNODE;
ddp->ddp_fsat.sat_port = ATADDR_ANYPORT;
@@ -232,9 +251,15 @@
{
struct ddpcb *ddp;
- MALLOC(ddp, struct ddpcb *, sizeof *ddp, M_PCB, M_WAITOK | M_ZERO);
+ DDP_LIST_XLOCK_ASSERT();
+
+ MALLOC(ddp, struct ddpcb *, sizeof *ddp, M_PCB, M_NOWAIT | M_ZERO);
+ DDP_LOCK_INIT(ddp);
ddp->ddp_lsat.sat_port = ATADDR_ANYPORT;
+ ddp->ddp_socket = so;
+ so->so_pcb = (caddr_t)ddp;
+
ddp->ddp_next = ddpcb_list;
ddp->ddp_prev = NULL;
ddp->ddp_pprev = NULL;
@@ -243,15 +268,19 @@
ddpcb_list->ddp_prev = ddp;
}
ddpcb_list = ddp;
-
- ddp->ddp_socket = so;
- so->so_pcb = (caddr_t)ddp;
- return (0);
+ return(0);
}
void
at_pcbdetach(struct socket *so, struct ddpcb *ddp)
{
+
+ /*
+ * We modify ddp, ddp_ports, and the global list.
+ */
+ DDP_LIST_XLOCK_ASSERT();
+ DDP_LOCK_ASSERT(ddp);
+
soisdisconnected(so);
SOCK_LOCK(so);
so->so_pcb = NULL;
@@ -282,6 +311,8 @@
if (ddp->ddp_next) {
ddp->ddp_next->ddp_prev = ddp->ddp_prev;
}
+ DDP_UNLOCK(ddp);
+ DDP_LOCK_DESTROY(ddp);
FREE(ddp, M_PCB);
}
@@ -297,6 +328,8 @@
{
struct ddpcb *ddp;
+ DDP_LIST_SLOCK_ASSERT();
+
/*
* Check for bad ports.
*/
@@ -309,11 +342,13 @@
* the interface?
*/
for (ddp = ddp_ports[ to->sat_port - 1 ]; ddp; ddp = ddp->ddp_pnext) {
+ DDP_LOCK(ddp);
/* XXX should we handle 0.YY? */
/* XXXX.YY to socket on destination interface */
if (to->sat_addr.s_net == ddp->ddp_lsat.sat_addr.s_net &&
to->sat_addr.s_node == ddp->ddp_lsat.sat_addr.s_node) {
+ DDP_UNLOCK(ddp);
break;
}
@@ -321,6 +356,7 @@
if (to->sat_addr.s_node == ATADDR_BCAST && (to->sat_addr.s_net == 0 ||
to->sat_addr.s_net == ddp->ddp_lsat.sat_addr.s_net) &&
ddp->ddp_lsat.sat_addr.s_net == AA_SAT(aa)->sat_addr.s_net) {
+ DDP_UNLOCK(ddp);
break;
}
@@ -331,8 +367,10 @@
ntohs(aa->aa_firstnet) &&
ntohs(ddp->ddp_lsat.sat_addr.s_net) <=
ntohs(aa->aa_lastnet)) {
+ DDP_UNLOCK(ddp);
break;
}
+ DDP_UNLOCK(ddp);
}
return (ddp);
}
==== //depot/projects/netperf_socket/sys/netatalk/ddp_pcb.h#2 (text+ko) ====
@@ -1,8 +1,9 @@
/*
+ * Copyright (c) 2004 Robert N. M. Watson
* Copyright (c) 1990,1994 Regents of The University of Michigan.
* All Rights Reserved. See COPYRIGHT.
*
- * $FreeBSD: src/sys/netatalk/ddp_pcb.h,v 1.1 2004/03/19 07:21:22 rwatson Exp $
+ * $FreeBSD: src/sys/netatalk/ddp_pcb.h,v 1.2 2004/07/12 18:39:59 rwatson Exp $
*/
#ifndef _NETATALK_DDP_PCB_H_
@@ -17,4 +18,23 @@
struct thread *td);
void at_sockaddr(struct ddpcb *ddp, struct sockaddr **addr);
+/* Lock macros for per-pcb locks. */
+#define DDP_LOCK_INIT(ddp) mtx_init(&(ddp)->ddp_mtx, "ddp_mtx", \
+ NULL, MTX_DEF)
+#define DDP_LOCK_DESTROY(ddp) mtx_destroy(&(ddp)->ddp_mtx)
+#define DDP_LOCK(ddp) mtx_lock(&(ddp)->ddp_mtx)
+#define DDP_UNLOCK(ddp) mtx_unlock(&(ddp)->ddp_mtx)
+#define DDP_LOCK_ASSERT(ddp) mtx_assert(&(ddp)->ddp_mtx, MA_OWNED)
+
+/* Lock macros for global pcb list lock. */
+#define DDP_LIST_LOCK_INIT() mtx_init(&ddp_list_mtx, "ddp_list_mtx", \
+ NULL, MTX_DEF)
+#define DDP_LIST_LOCK_DESTROY() mtx_destroy(&ddp_list_mtx)
+#define DDP_LIST_XLOCK() mtx_lock(&ddp_list_mtx)
+#define DDP_LIST_XUNLOCK() mtx_unlock(&ddp_list_mtx)
+#define DDP_LIST_XLOCK_ASSERT() mtx_assert(&ddp_list_mtx, MA_OWNED)
+#define DDP_LIST_SLOCK() mtx_lock(&ddp_list_mtx)
+#define DDP_LIST_SUNLOCK() mtx_unlock(&ddp_list_mtx)
+#define DDP_LIST_SLOCK_ASSERT() mtx_assert(&ddp_list_mtx, MA_OWNED)
+
#endif
==== //depot/projects/netperf_socket/sys/netatalk/ddp_usrreq.c#11 (text+ko) ====
@@ -1,8 +1,9 @@
/*
+ * Copyright (c) 2004 Robert N. M. Watson
* Copyright (c) 1990,1994 Regents of The University of Michigan.
* All Rights Reserved. See COPYRIGHT.
*
- * $FreeBSD: src/sys/netatalk/ddp_usrreq.c,v 1.41 2004/07/12 04:33:58 rwatson Exp $
+ * $FreeBSD: src/sys/netatalk/ddp_usrreq.c,v 1.42 2004/07/12 18:39:59 rwatson Exp $
*/
#include <sys/param.h>
@@ -33,17 +34,22 @@
struct ddpcb *ddp;
int error = 0;
+ ddp = sotoddpcb(so);
+ if (ddp != NULL)
+ return (EINVAL);
- ddp = sotoddpcb(so);
- if (ddp != NULL) {
- return (EINVAL);
- }
+ /*
+ * Allocate socket buffer space first so that it's present
+ * before first use.
+ */
+ error = soreserve(so, ddp_sendspace, ddp_recvspace);
+ if (error)
+ return (error);
+ DDP_LIST_XLOCK();
error = at_pcballoc(so);
- if (error) {
- return (error);
- }
- return (soreserve(so, ddp_sendspace, ddp_recvspace));
+ DDP_LIST_XUNLOCK();
+ return (error);
}
static int
@@ -52,10 +58,13 @@
struct ddpcb *ddp;
ddp = sotoddpcb(so);
- if (ddp == NULL) {
+ if (ddp == NULL)
return (EINVAL);
- }
+
+ DDP_LIST_XLOCK();
+ DDP_LOCK(ddp);
at_pcbdetach(so, ddp);
+ DDP_LIST_XUNLOCK();
return (0);
}
@@ -69,7 +78,11 @@
if (ddp == NULL) {
return (EINVAL);
}
+ DDP_LIST_XLOCK();
+ DDP_LOCK(ddp);
error = at_pcbsetaddr(ddp, nam, td);
+ DDP_UNLOCK(ddp);
+ DDP_LIST_XUNLOCK();
return (error);
}
@@ -84,11 +97,17 @@
return (EINVAL);
}
+ DDP_LIST_XLOCK();
+ DDP_LOCK(ddp);
if (ddp->ddp_fsat.sat_port != ATADDR_ANYPORT) {
+ DDP_UNLOCK(ddp);
+ DDP_LIST_XUNLOCK();
return (EISCONN);
}
- error = at_pcbconnect(ddp, nam, td);
+ error = at_pcbconnect( ddp, nam, td );
+ DDP_UNLOCK(ddp);
+ DDP_LIST_XUNLOCK();
if (error == 0)
soisconnected(so);
return (error);
@@ -104,12 +123,15 @@
if (ddp == NULL) {
return (EINVAL);
}
+ DDP_LOCK(ddp);
if (ddp->ddp_fsat.sat_addr.s_node == ATADDR_ANYNODE) {
+ DDP_UNLOCK(ddp);
return (ENOTCONN);
}
at_pcbdisconnect(ddp);
ddp->ddp_fsat.sat_addr.s_node = ATADDR_ANYNODE;
+ DDP_UNLOCK(ddp);
soisdisconnected(so);
return (0);
}
@@ -144,23 +166,28 @@
}
if (addr != NULL) {
+ DDP_LIST_XLOCK();
+ DDP_LOCK(ddp);
if (ddp->ddp_fsat.sat_port != ATADDR_ANYPORT) {
- return (EISCONN);
+ error = EISCONN;
+ goto out;
}
error = at_pcbconnect(ddp, addr, td);
- if (error) {
- return (error);
+ if (error == 0) {
+ error = ddp_output(m, so);
+ at_pcbdisconnect(ddp);
}
+out:
+ DDP_UNLOCK(ddp);
+ DDP_LIST_XUNLOCK();
} else {
- if (ddp->ddp_fsat.sat_port == ATADDR_ANYPORT) {
- return (ENOTCONN);
- }
- }
-
- error = ddp_output(m, so);
- if (addr != NULL) {
- at_pcbdisconnect(ddp);
+ DDP_LOCK(ddp);
+ if (ddp->ddp_fsat.sat_port == ATADDR_ANYPORT)
+ error = ENOTCONN;
+ else
+ error = ddp_output(m, so);
+ DDP_UNLOCK(ddp);
}
return (error);
}
@@ -174,20 +201,23 @@
if (ddp == NULL) {
return (EINVAL);
}
+ DDP_LIST_XLOCK();
+ DDP_LOCK(ddp);
at_pcbdetach(so, ddp);
+ DDP_LIST_XUNLOCK();
return (0);
}
void
ddp_init(void)
{
-
atintrq1.ifq_maxlen = IFQ_MAXLEN;
atintrq2.ifq_maxlen = IFQ_MAXLEN;
aarpintrq.ifq_maxlen = IFQ_MAXLEN;
mtx_init(&atintrq1.ifq_mtx, "at1_inq", NULL, MTX_DEF);
mtx_init(&atintrq2.ifq_mtx, "at2_inq", NULL, MTX_DEF);
mtx_init(&aarpintrq.ifq_mtx, "aarp_inq", NULL, MTX_DEF);
+ DDP_LIST_LOCK_INIT();
netisr_register(NETISR_ATALK1, at1intr, &atintrq1, 0);
netisr_register(NETISR_ATALK2, at2intr, &atintrq2, 0);
netisr_register(NETISR_AARP, aarpintr, &aarpintrq, 0);
@@ -202,6 +232,7 @@
for (ddp = ddpcb_list; ddp != NULL; ddp = ddp->ddp_next) {
at_pcbdetach(ddp->ddp_socket, ddp);
}
+ DDP_LIST_LOCK_DESTROY();
}
#endif
@@ -220,7 +251,9 @@
if (ddp == NULL) {
return (EINVAL);
}
+ DDP_LOCK(ddp);
at_sockaddr(ddp, nam);
+ DDP_UNLOCK(ddp);
return (0);
}
==== //depot/projects/netperf_socket/sys/netatalk/ddp_var.h#4 (text+ko) ====
@@ -2,7 +2,7 @@
* Copyright (c) 1990,1994 Regents of The University of Michigan.
* All Rights Reserved. See COPYRIGHT.
*
- * $FreeBSD: src/sys/netatalk/ddp_var.h,v 1.6 2004/03/22 04:54:36 rwatson Exp $
+ * $FreeBSD: src/sys/netatalk/ddp_var.h,v 1.7 2004/07/12 18:39:59 rwatson Exp $
*/
#ifndef _NETATALK_DDP_VAR_H_
@@ -13,6 +13,7 @@
struct socket *ddp_socket;
struct ddpcb *ddp_prev, *ddp_next;
struct ddpcb *ddp_pprev, *ddp_pnext;
+ struct mtx ddp_mtx;
};
#define sotoddpcb(so) ((struct ddpcb *)(so)->so_pcb)
@@ -34,5 +35,6 @@
extern int ddp_cksum;
extern struct ddpcb *ddpcb_list;
extern struct pr_usrreqs ddp_usrreqs;
+extern struct mtx ddp_list_mtx;
#endif
#endif /* _NETATALK_DDP_VAR_H_ */
==== //depot/projects/netperf_socket/sys/netinet/tcp_input.c#17 (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.249 2004/07/01 23:34:06 jayanth Exp $
+ * $FreeBSD: src/sys/netinet/tcp_input.c,v 1.250 2004/07/12 19:28:07 rwatson Exp $
*/
#include "opt_ipfw.h" /* for ipfw_fwd */
@@ -985,6 +985,8 @@
goto drop;
}
after_listen:
+ KASSERT(headlocked, ("tcp_input(): after_listen head is not locked"));
+ INP_LOCK_ASSERT(inp);
/* XXX temp debugging */
/* should not happen - syncache should pick up these connections */
@@ -1474,6 +1476,10 @@
}
trimthenstep6:
+ KASSERT(headlocked,
+ ("tcp_input(): trimthenstep6 head is not locked"));
+ INP_LOCK_ASSERT(inp);
+
/*
* Advance th->th_seq to correspond to first data byte.
* If data, trim to stay within window,
@@ -2083,6 +2089,10 @@
}
process_ACK:
+ KASSERT(headlocked,
+ ("tcp_input(): process_ACK head is not locked"));
+ INP_LOCK_ASSERT(inp);
+
acked = th->th_ack - tp->snd_una;
tcpstat.tcps_rcvackpack++;
tcpstat.tcps_rcvackbyte += acked;
@@ -2263,6 +2273,9 @@
}
step6:
+ KASSERT(headlocked, ("tcp_input(): step6 head is not locked"));
+ INP_LOCK_ASSERT(inp);
+
/*
* Update window information.
* Don't look at window if no ACK: TAC's send garbage on first SYN.
@@ -2345,7 +2358,9 @@
tp->rcv_up = tp->rcv_nxt;
}
dodata: /* XXX */
- KASSERT(headlocked, ("headlocked"));
+ KASSERT(headlocked, ("tcp_input(): dodata head is not locked"));
+ INP_LOCK_ASSERT(inp);
+
/*
* Process the segment text, merging it into the TCP sequencing queue,
* and arranging for acknowledgment of receipt if necessary.
@@ -2481,6 +2496,7 @@
(void) tcp_output(tp);
check_delack:
+ INP_LOCK_ASSERT(inp);
if (tp->t_flags & TF_DELACK) {
tp->t_flags &= ~TF_DELACK;
callout_reset(tp->tt_delack, tcp_delacktime,
==== //depot/projects/netperf_socket/sys/netipx/spx_usrreq.c#8 (text+ko) ====
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/netipx/spx_usrreq.c,v 1.45 2004/06/24 04:29:53 rwatson Exp $");
+__FBSDID("$FreeBSD: src/sys/netipx/spx_usrreq.c,v 1.46 2004/07/12 19:35:29 rwatson Exp $");
#include <sys/param.h>
#include <sys/lock.h>
@@ -77,7 +77,7 @@
#define spxstat spx_istat.newstats
#endif
-static int spx_backoff[SPX_MAXRXTSHIFT+1] =
+static const int spx_backoff[SPX_MAXRXTSHIFT+1] =
{ 1, 2, 4, 8, 16, 32, 64, 64, 64, 64, 64, 64, 64 };
static struct spxpcb *spx_close(struct spxpcb *cb);
==== //depot/projects/netperf_socket/sys/rpc/rpcclnt.c#5 (text+ko) ====
@@ -1,4 +1,4 @@
-/* $FreeBSD: src/sys/rpc/rpcclnt.c,v 1.9 2004/03/28 05:55:27 kan Exp $ */
+/* $FreeBSD: src/sys/rpc/rpcclnt.c,v 1.10 2004/07/12 19:37:08 rwatson Exp $ */
/* $Id: rpcclnt.c,v 1.9 2003/11/05 14:59:03 rees Exp $ */
/*
@@ -141,7 +141,7 @@
*/
#define RPC_CWNDSCALE 256
#define RPC_MAXCWND (RPC_CWNDSCALE * 32)
-static int rpcclnt_backoff[8] = {2, 4, 8, 16, 32, 64, 128, 256,};
+static const int rpcclnt_backoff[8] = {2, 4, 8, 16, 32, 64, 128, 256,};
/* XXX ugly debug strings */
#define RPC_ERRSTR_ACCEPTED_SIZE 6
==== //depot/projects/netperf_socket/sys/vm/vm_pageout.c#8 (text+ko) ====
@@ -71,7 +71,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/vm/vm_pageout.c,v 1.258 2004/06/24 04:08:43 alc Exp $");
+__FBSDID("$FreeBSD: src/sys/vm/vm_pageout.c,v 1.259 2004/07/12 17:45:37 alc Exp $");
#include "opt_vm.h"
#include <sys/param.h>
@@ -148,7 +148,7 @@
static int vm_max_launder = 32;
static int vm_pageout_stats_max=0, vm_pageout_stats_interval = 0;
static int vm_pageout_full_stats_interval = 0;
-static int vm_pageout_stats_free_max=0, vm_pageout_algorithm=0;
+static int vm_pageout_algorithm=0;
static int defer_swap_pageouts=0;
static int disable_swap_pageouts=0;
@@ -175,9 +175,6 @@
SYSCTL_INT(_vm, OID_AUTO, pageout_stats_interval,
CTLFLAG_RW, &vm_pageout_stats_interval, 0, "Interval for partial stats scan");
-SYSCTL_INT(_vm, OID_AUTO, pageout_stats_free_max,
- CTLFLAG_RW, &vm_pageout_stats_free_max, 0, "Not implemented");
-
#if defined(NO_SWAPPING)
SYSCTL_INT(_vm, VM_SWAPPING_ENABLED, swap_enabled,
CTLFLAG_RD, &vm_swap_enabled, 0, "");
@@ -1390,12 +1387,6 @@
if (vm_pageout_full_stats_interval == 0)
vm_pageout_full_stats_interval = vm_pageout_stats_interval * 4;
- /*
- * Set maximum free per pass
- */
- if (vm_pageout_stats_free_max == 0)
- vm_pageout_stats_free_max = 5;
-
swap_pager_swap_init();
pass = 0;
/*
More information about the p4-projects
mailing list