svn commit: r214858 - stable/8/sys/sys

2010-11-06 Thread Lawrence Stewart
Author: lstewart
Date: Sat Nov  6 09:23:49 2010
New Revision: 214858
URL: http://svn.freebsd.org/changeset/base/214858

Log:
  MFC r209050 (originally committed by jhb):
  
  Add helper macros to iterate over available CPUs in the system.
  CPU_FOREACH(i) iterates over the CPU IDs of all available CPUs.  The
  CPU_FIRST() and CPU_NEXT(i) macros can also be used to iterate over
  available CPU IDs.  CPU_NEXT(i) wraps around to CPU_FIRST() rather than
  returning some sort of terminator.
  
  Requested by: rwatson
  Reviewed by:  attilio

Modified:
  stable/8/sys/sys/smp.h
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/sys/smp.h
==
--- stable/8/sys/sys/smp.h  Sat Nov  6 03:59:21 2010(r214857)
+++ stable/8/sys/sys/smp.h  Sat Nov  6 09:23:49 2010(r214858)
@@ -91,6 +91,44 @@ extern cpumask_t all_cpus;
  */
 #defineCPU_ABSENT(x_cpu)   ((all_cpus & (1 << (x_cpu))) == 0)
 
+/*
+ * Macros to iterate over non-absent CPUs.  CPU_FOREACH() takes an
+ * integer iterator and iterates over the available set of CPUs.
+ * CPU_FIRST() returns the id of the first non-absent CPU.  CPU_NEXT()
+ * returns the id of the next non-absent CPU.  It will wrap back to
+ * CPU_FIRST() once the end of the list is reached.  The iterators are
+ * currently implemented via inline functions.
+ */
+#defineCPU_FOREACH(i)  
\
+   for ((i) = 0; (i) <= mp_maxid; (i)++)   \
+   if (!CPU_ABSENT((i)))
+
+static __inline int
+cpu_first(void)
+{
+   int i;
+
+   for (i = 0;; i++)
+   if (!CPU_ABSENT(i))
+   return (i);
+}
+
+static __inline int
+cpu_next(int i)
+{
+
+   for (;;) {
+   i++;
+   if (i > mp_maxid)
+   i = 0;
+   if (!CPU_ABSENT(i))
+   return (i);
+   }
+}
+
+#defineCPU_FIRST() cpu_first()
+#defineCPU_NEXT(i) cpu_next((i))
+
 #ifdef SMP
 /*
  * Machine dependent functions used to initialize MP support.
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r214859 - in stable/8: share/man/man4 sys/modules sys/modules/siftr sys/netinet

2010-11-06 Thread Lawrence Stewart
Author: lstewart
Date: Sat Nov  6 09:34:51 2010
New Revision: 214859
URL: http://svn.freebsd.org/changeset/base/214859

Log:
  MFC r209662,209665:
  
  Import the Statistical Information For TCP Research (SIFTR) kernel module into
  FreeBSD. SIFTR logs a range of statistics on active TCP connections to a log
  file, providing the ability to make highly granular measurements of TCP
  connection state. The tool is aimed at system administrators, developers and
  researchers alike. Please take it for a spin and test it out - the man page
  should have all the information required to get you going.
  
  Many thanks go to the Cisco University Research Program Fund at Community
  Foundation Silicon Valley and the FreeBSD Foundation. Their support of our 
work
  at the Centre for Advanced Internet Architectures, Swinburne University of
  Technology is greatly appreciated.
  
  r209980:
  
  Catch up with the rename of DPCPU_SUM to DPCPU_VARSUM.
  
  r209982:
  
  The SIFTR DPCPU statistics struct was not being zeroed between enable/disable
  cycles so the values would accumulate rather than reset for each cycle.
  
  Sponsored by: Cisco URP (r209662), FreeBSD Foundation
  Reviewed by:  dwmalone, gnn, rpaulo (r209662)
  Tested by:Many on freebsd-current@ and elsewhere over the years

Added:
  stable/8/share/man/man4/siftr.4
 - copied unchanged from r209662, head/share/man/man4/siftr.4
  stable/8/sys/modules/siftr/
 - copied from r209662, head/sys/modules/siftr/
  stable/8/sys/netinet/siftr.c
 - copied, changed from r209662, head/sys/netinet/siftr.c
Modified:
  stable/8/share/man/man4/Makefile
  stable/8/sys/modules/Makefile
Directory Properties:
  stable/8/share/man/   (props changed)
  stable/8/share/man/man1/   (props changed)
  stable/8/share/man/man3/   (props changed)
  stable/8/share/man/man4/   (props changed)
  stable/8/share/man/man5/   (props changed)
  stable/8/share/man/man7/   (props changed)
  stable/8/share/man/man8/   (props changed)
  stable/8/share/man/man9/   (props changed)
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/share/man/man4/Makefile
==
--- stable/8/share/man/man4/MakefileSat Nov  6 09:23:49 2010
(r214858)
+++ stable/8/share/man/man4/MakefileSat Nov  6 09:34:51 2010
(r214859)
@@ -353,8 +353,9 @@ MAN=aac.4 \
sf.4 \
sge.4 \
si.4 \
-   sio.4 \
+   siftr.4 \
siis.4 \
+   sio.4 \
sis.4 \
sk.4 \
smb.4 \

Copied: stable/8/share/man/man4/siftr.4 (from r209662, 
head/share/man/man4/siftr.4)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ stable/8/share/man/man4/siftr.4 Sat Nov  6 09:34:51 2010
(r214859, copy of r209662, head/share/man/man4/siftr.4)
@@ -0,0 +1,752 @@
+.\"
+.\" Copyright (c) 2010 The FreeBSD Foundation
+.\" All rights reserved.
+.\"
+.\" Portions of this software were developed at the Centre for Advanced
+.\" Internet Architectures, Swinburne University of Technology, Melbourne,
+.\" Australia by Lawrence Stewart under sponsorship from the FreeBSD
+.\" Foundation.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"notice, this list of conditions, and the following disclaimer,
+.\"without modification, immediately at the beginning of the file.
+.\" 2. The name of the author may not be used to endorse or promote products
+.\"derived from this software without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
+.\" ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (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$
+.\"
+.Dd June 23, 2010
+.Dt SIFTR 4
+.Os
+.Sh NAME
+.Nm SIFTR
+.Nd Statistical Information For TCP Research
+.Sh SYNOPSIS
+To load

svn commit: r214860 - stable/8/sys/netinet

2010-11-06 Thread Lawrence Stewart
Author: lstewart
Date: Sat Nov  6 09:42:41 2010
New Revision: 214860
URL: http://svn.freebsd.org/changeset/base/214860

Log:
  MFC r213158:
  
  Internalise reassembly queue related functionality and variables which should
  not be used outside of the reassembly queue implementation. Provide a new
  function to flush all segments from a reassembly queue and call it from the
  appropriate places instead of manipulating the queue directly.
  
  Sponsored by: FreeBSD Foundation
  Reviewed by:  andre, gnn, rpaulo

Modified:
  stable/8/sys/netinet/tcp_reass.c
  stable/8/sys/netinet/tcp_subr.c
  stable/8/sys/netinet/tcp_var.h
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/netinet/tcp_reass.c
==
--- stable/8/sys/netinet/tcp_reass.cSat Nov  6 09:34:51 2010
(r214859)
+++ stable/8/sys/netinet/tcp_reass.cSat Nov  6 09:42:41 2010
(r214860)
@@ -83,7 +83,8 @@ SYSCTL_VNET_INT(_net_inet_tcp_reass, OID
 &VNET_NAME(tcp_reass_maxseg), 0,
 "Global maximum number of TCP Segments in Reassembly Queue");
 
-VNET_DEFINE(int, tcp_reass_qsize) = 0;
+static VNET_DEFINE(int, tcp_reass_qsize) = 0;
+#defineV_tcp_reass_qsize   VNET(tcp_reass_qsize)
 SYSCTL_VNET_INT(_net_inet_tcp_reass, OID_AUTO, cursegments, CTLFLAG_RD,
 &VNET_NAME(tcp_reass_qsize), 0,
 "Global number of TCP Segments currently in Reassembly Queue");
@@ -100,6 +101,9 @@ SYSCTL_VNET_INT(_net_inet_tcp_reass, OID
 &VNET_NAME(tcp_reass_overflows), 0,
 "Global number of TCP Segment Reassembly Queue Overflows");
 
+static VNET_DEFINE(uma_zone_t, tcp_reass_zone);
+#defineV_tcp_reass_zoneVNET(tcp_reass_zone)
+
 /* Initialize TCP reassembly queue */
 static void
 tcp_reass_zone_change(void *tag)
@@ -109,8 +113,6 @@ tcp_reass_zone_change(void *tag)
uma_zone_set_max(V_tcp_reass_zone, V_tcp_reass_maxseg);
 }
 
-VNET_DEFINE(uma_zone_t, tcp_reass_zone);
-
 void
 tcp_reass_init(void)
 {
@@ -134,6 +136,26 @@ tcp_reass_destroy(void)
 }
 #endif
 
+void
+tcp_reass_flush(struct tcpcb *tp)
+{
+   struct tseg_qent *qe;
+
+   INP_WLOCK_ASSERT(tp->t_inpcb);
+
+   while ((qe = LIST_FIRST(&tp->t_segq)) != NULL) {
+   LIST_REMOVE(qe, tqe_q);
+   m_freem(qe->tqe_m);
+   uma_zfree(V_tcp_reass_zone, qe);
+   tp->t_segqlen--;
+   V_tcp_reass_qsize--;
+   }
+
+   KASSERT((tp->t_segqlen == 0),
+   ("TCP reass queue %p segment count is %d instead of 0 after flush.",
+   tp, tp->t_segqlen));
+}
+
 int
 tcp_reass(struct tcpcb *tp, struct tcphdr *th, int *tlenp, struct mbuf *m)
 {

Modified: stable/8/sys/netinet/tcp_subr.c
==
--- stable/8/sys/netinet/tcp_subr.c Sat Nov  6 09:34:51 2010
(r214859)
+++ stable/8/sys/netinet/tcp_subr.c Sat Nov  6 09:42:41 2010
(r214860)
@@ -775,7 +775,6 @@ tcp_drop(struct tcpcb *tp, int errno)
 void
 tcp_discardcb(struct tcpcb *tp)
 {
-   struct tseg_qent *q;
struct inpcb *inp = tp->t_inpcb;
struct socket *so = inp->inp_socket;
 #ifdef INET6
@@ -853,13 +852,7 @@ tcp_discardcb(struct tcpcb *tp)
}
 
/* free the reassembly queue, if any */
-   while ((q = LIST_FIRST(&tp->t_segq)) != NULL) {
-   LIST_REMOVE(q, tqe_q);
-   m_freem(q->tqe_m);
-   uma_zfree(V_tcp_reass_zone, q);
-   tp->t_segqlen--;
-   V_tcp_reass_qsize--;
-   }
+   tcp_reass_flush(tp);
/* Disconnect offload device, if any. */
tcp_offload_detach(tp);

@@ -917,7 +910,6 @@ tcp_drain(void)
CURVNET_SET(vnet_iter);
struct inpcb *inpb;
struct tcpcb *tcpb;
-   struct tseg_qent *te;
 
/*
 * Walk the tcpbs, if existing, and flush the reassembly queue,
@@ -933,14 +925,7 @@ tcp_drain(void)
continue;
INP_WLOCK(inpb);
if ((tcpb = intotcpcb(inpb)) != NULL) {
-   while ((te = LIST_FIRST(&tcpb->t_segq))
-   != NULL) {
-   LIST_REMOVE(te, tqe_q);
-   m_freem(te->tqe_m);
-   uma_zfree(V_tcp_reass_zone, te);
-   tcpb->t_segqlen--;
-   V_tcp_reass_qsize--;
-   }
+   tcp_reass_flush(tcpb);
   

svn commit: r214861 - stable/8/sys/vm

2010-11-06 Thread Lawrence Stewart
Author: lstewart
Date: Sat Nov  6 09:56:14 2010
New Revision: 214861
URL: http://svn.freebsd.org/changeset/base/214861

Log:
  MFC r211396 (originally committed by andre):
  
  Add uma_zone_get_max() to obtain the effective limit after a call
  to uma_zone_set_max().
  
  The UMA zone limit is not exactly set to the value supplied but rounded up to
  completely fill the backing store increment (a page normally).  This can lead 
to
  surprising situations where the number of elements allocated from UMA is 
higher
  than the supplied limit value.  The new get function reads back the effective
  value so that the supplied limit value can be adjusted to the real limit.
  
  Reviewed by:  jeffr

Modified:
  stable/8/sys/vm/uma.h
  stable/8/sys/vm/uma_core.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/vm/uma.h
==
--- stable/8/sys/vm/uma.h   Sat Nov  6 09:42:41 2010(r214860)
+++ stable/8/sys/vm/uma.h   Sat Nov  6 09:56:14 2010(r214861)
@@ -459,6 +459,18 @@ int uma_zone_set_obj(uma_zone_t zone, st
 void uma_zone_set_max(uma_zone_t zone, int nitems);
 
 /*
+ * Obtains the effective limit on the number of items in a zone
+ *
+ * Arguments:
+ * zone  The zone to obtain the effective limit from
+ *
+ * Return:
+ * 0  No limit
+ * int  The effective limit of the zone
+ */
+int uma_zone_get_max(uma_zone_t zone);
+
+/*
  * The following two routines (uma_zone_set_init/fini)
  * are used to set the backend init/fini pair which acts on an
  * object as it becomes allocated and is placed in a slab within

Modified: stable/8/sys/vm/uma_core.c
==
--- stable/8/sys/vm/uma_core.c  Sat Nov  6 09:42:41 2010(r214860)
+++ stable/8/sys/vm/uma_core.c  Sat Nov  6 09:56:14 2010(r214861)
@@ -2803,6 +2803,24 @@ uma_zone_set_max(uma_zone_t zone, int ni
 }
 
 /* See uma.h */
+int
+uma_zone_get_max(uma_zone_t zone)
+{
+   int nitems;
+   uma_keg_t keg;
+
+   ZONE_LOCK(zone);
+   keg = zone_first_keg(zone);
+   if (keg->uk_maxpages)
+   nitems = keg->uk_maxpages * keg->uk_ipers;
+   else
+   nitems = 0;
+   ZONE_UNLOCK(zone);
+
+   return (nitems);
+}
+
+/* See uma.h */
 void
 uma_zone_set_init(uma_zone_t zone, uma_init uminit)
 {
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r214862 - in stable/8: share/man/man9 sys/vm

2010-11-06 Thread Lawrence Stewart
Author: lstewart
Date: Sat Nov  6 10:06:58 2010
New Revision: 214862
URL: http://svn.freebsd.org/changeset/base/214862

Log:
  MFC r213910:
  
  - Simplify implementation of uma_zone_get_max.
  - Add uma_zone_get_cur which returns the current approximate occupancy of a
zone. This is useful for providing stats via sysctl amongst other things.
  
  Sponsored by: FreeBSD Foundation
  Reviewed by:  gnn, jhb

Modified:
  stable/8/share/man/man9/zone.9
  stable/8/sys/vm/uma.h
  stable/8/sys/vm/uma_core.c
Directory Properties:
  stable/8/share/man/   (props changed)
  stable/8/share/man/man1/   (props changed)
  stable/8/share/man/man3/   (props changed)
  stable/8/share/man/man4/   (props changed)
  stable/8/share/man/man5/   (props changed)
  stable/8/share/man/man7/   (props changed)
  stable/8/share/man/man8/   (props changed)
  stable/8/share/man/man9/   (props changed)
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/share/man/man9/zone.9
==
--- stable/8/share/man/man9/zone.9  Sat Nov  6 09:56:14 2010
(r214861)
+++ stable/8/share/man/man9/zone.9  Sat Nov  6 10:06:58 2010
(r214862)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd June 19, 2008
+.Dd October 9, 2010
 .Dt ZONE 9
 .Os
 .Sh NAME
@@ -35,7 +35,9 @@
 .Nm uma_zfree ,
 .Nm uma_zfree_arg ,
 .Nm uma_zdestroy ,
-.Nm uma_zone_set_max
+.Nm uma_zone_set_max,
+.Nm uma_zone_get_max,
+.Nm uma_zone_get_cur
 .Nd zone allocator
 .Sh SYNOPSIS
 .In sys/param.h
@@ -59,6 +61,10 @@
 .Fn uma_zdestroy "uma_zone_t zone"
 .Ft void
 .Fn uma_zone_set_max "uma_zone_t zone" "int nitems"
+.Ft int
+.Fn uma_zone_get_max "uma_zone_t zone"
+.Ft int
+.Fn uma_zone_get_cur "uma_zone_t zone"
 .Sh DESCRIPTION
 The zone allocator provides an efficient interface for managing
 dynamically-sized collections of items of similar size.
@@ -177,21 +183,36 @@ must have been freed with
 .Fn uma_zfree
 before.
 .Pp
-The purpose of
+The
 .Fn uma_zone_set_max
-is to limit the maximum amount of memory that the system can dedicated
-toward the zone specified by the
-.Fa zone
-argument.
+function limits the number of items
+.Pq and therefore memory
+that can be allocated to
+.Fa zone .
 The
 .Fa nitems
-argument gives the upper limit of items in the zone.
-This limits the total number of items in the zone which includes:
+argument specifies the requested upper limit number of items.
+The effective limit may end up being higher than requested, as the
+implementation will round up to ensure all memory pages allocated to the zone
+are utilised to capacity.
+The limit applies to the total number of items in the zone, which includes
 allocated items, free items and free items in the per-cpu caches.
 On systems with more than one CPU it may not be possible to allocate
 the specified number of items even when there is no shortage of memory,
 because all of the remaining free items may be in the caches of the
 other CPUs when the limit is hit.
+.Pp
+The
+.Fn uma_zone_get_max
+function returns the effective upper limit number of items for a zone.
+.Pp
+The
+.Fn uma_zone_get_cur
+function returns the approximate current occupancy of the zone.
+The returned value is approximate because appropriate synchronisation to
+determine an exact value is not performend by the implementation.
+This ensures low overhead at the expense of potentially stale data being used
+in the calculation.
 .Sh RETURN VALUES
 The
 .Fn uma_zalloc

Modified: stable/8/sys/vm/uma.h
==
--- stable/8/sys/vm/uma.h   Sat Nov  6 09:56:14 2010(r214861)
+++ stable/8/sys/vm/uma.h   Sat Nov  6 10:06:58 2010(r214862)
@@ -471,6 +471,17 @@ void uma_zone_set_max(uma_zone_t zone, i
 int uma_zone_get_max(uma_zone_t zone);
 
 /*
+ * Obtains the approximate current number of items allocated from a zone
+ *
+ * Arguments:
+ * zone  The zone to obtain the current allocation count from
+ *
+ * Return:
+ * int  The approximate current number of items allocated from the zone
+ */
+int uma_zone_get_cur(uma_zone_t zone);
+
+/*
  * The following two routines (uma_zone_set_init/fini)
  * are used to set the backend init/fini pair which acts on an
  * object as it becomes allocated and is placed in a slab within

Modified: stable/8/sys/vm/uma_core.c
==
--- stable/8/sys/vm/uma_core.c  Sat Nov  6 09:56:14 2010(r214861)
+++ stable/8/sys/vm/uma_core.c  Sat Nov  6 10:06:58 2010(r214862)
@@ -2811,16 +2811,36 @@ uma_zone_get_max(uma_zone_t zone)
 
ZONE_LOCK(zone);
keg = zone_first_keg(zone);
-   if (ke

svn commit: r214863 - stable/8/sys/netinet

2010-11-06 Thread Lawrence Stewart
Author: lstewart
Date: Sat Nov  6 10:17:43 2010
New Revision: 214863
URL: http://svn.freebsd.org/changeset/base/214863

Log:
  MFC r210203:
  
  - Move common code from the hook functions that fills in a packet node struct 
to
a separate inline function. This further reduces duplicate code that didn't
have a good reason to stay as it was.
  
  - Reorder the malloc of a pkt_node struct in the hook functions such that it
only occurs if we managed to find a usable tcpcb associated with the packet.
  
  - Make the inp_locally_locked variable's type consistent with the prototype of
siftr_siftdata().
  
  Sponsored by: FreeBSD Foundation

Modified:
  stable/8/sys/netinet/siftr.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/netinet/siftr.c
==
--- stable/8/sys/netinet/siftr.cSat Nov  6 10:06:58 2010
(r214862)
+++ stable/8/sys/netinet/siftr.cSat Nov  6 10:17:43 2010
(r214863)
@@ -746,6 +746,67 @@ siftr_findinpcb(int ipver, struct ip *ip
 }
 
 
+static inline void
+siftr_siftdata(struct pkt_node *pn, struct inpcb *inp, struct tcpcb *tp,
+int ipver, int dir, int inp_locally_locked)
+{
+#ifdef SIFTR_IPV6
+   if (ipver == INP_IPV4) {
+   pn->ip_laddr[3] = inp->inp_laddr.s_addr;
+   pn->ip_faddr[3] = inp->inp_faddr.s_addr;
+#else
+   *((uint32_t *)pn->ip_laddr) = inp->inp_laddr.s_addr;
+   *((uint32_t *)pn->ip_faddr) = inp->inp_faddr.s_addr;
+#endif
+#ifdef SIFTR_IPV6
+   } else {
+   pn->ip_laddr[0] = inp->in6p_laddr.s6_addr32[0];
+   pn->ip_laddr[1] = inp->in6p_laddr.s6_addr32[1];
+   pn->ip_laddr[2] = inp->in6p_laddr.s6_addr32[2];
+   pn->ip_laddr[3] = inp->in6p_laddr.s6_addr32[3];
+   pn->ip_faddr[0] = inp->in6p_faddr.s6_addr32[0];
+   pn->ip_faddr[1] = inp->in6p_faddr.s6_addr32[1];
+   pn->ip_faddr[2] = inp->in6p_faddr.s6_addr32[2];
+   pn->ip_faddr[3] = inp->in6p_faddr.s6_addr32[3];
+   }
+#endif
+   pn->tcp_localport = inp->inp_lport;
+   pn->tcp_foreignport = inp->inp_fport;
+   pn->snd_cwnd = tp->snd_cwnd;
+   pn->snd_wnd = tp->snd_wnd;
+   pn->rcv_wnd = tp->rcv_wnd;
+   pn->snd_bwnd = tp->snd_bwnd;
+   pn->snd_ssthresh = tp->snd_ssthresh;
+   pn->snd_scale = tp->snd_scale;
+   pn->rcv_scale = tp->rcv_scale;
+   pn->conn_state = tp->t_state;
+   pn->max_seg_size = tp->t_maxseg;
+   pn->smoothed_rtt = tp->t_srtt;
+   pn->sack_enabled = (tp->t_flags & TF_SACK_PERMIT) != 0;
+   pn->flags = tp->t_flags;
+   pn->rxt_length = tp->t_rxtcur;
+   pn->snd_buf_hiwater = inp->inp_socket->so_snd.sb_hiwat;
+   pn->snd_buf_cc = inp->inp_socket->so_snd.sb_cc;
+   pn->rcv_buf_hiwater = inp->inp_socket->so_rcv.sb_hiwat;
+   pn->rcv_buf_cc = inp->inp_socket->so_rcv.sb_cc;
+   pn->sent_inflight_bytes = tp->snd_max - tp->snd_una;
+
+   /* We've finished accessing the tcb so release the lock. */
+   if (inp_locally_locked)
+   INP_RUNLOCK(inp);
+
+   pn->ipver = ipver;
+   pn->direction = dir;
+
+   /*
+* Significantly more accurate than using getmicrotime(), but slower!
+* Gives true microsecond resolution at the expense of a hit to
+* maximum pps throughput processing when SIFTR is loaded and enabled.
+*/
+   microtime(&pn->tval);
+}
+
+
 /*
  * pfil hook that is called for each IPv4 packet making its way through the
  * stack in either direction.
@@ -758,13 +819,13 @@ static int
 siftr_chkpkt(void *arg, struct mbuf **m, struct ifnet *ifp, int dir,
 struct inpcb *inp)
 {
-   struct pkt_node *pkt_node;
+   struct pkt_node *pn;
struct ip *ip;
struct tcphdr *th;
struct tcpcb *tp;
struct siftr_stats *ss;
unsigned int ip_hl;
-   uint8_t inp_locally_locked;
+   int inp_locally_locked;
 
inp_locally_locked = 0;
ss = DPCPU_PTR(ss);
@@ -818,18 +879,6 @@ siftr_chkpkt(void *arg, struct mbuf **m,
 
INP_LOCK_ASSERT(inp);
 
-   pkt_node = malloc(sizeof(struct pkt_node), M_SIFTR_PKTNODE,
-   M_NOWAIT | M_ZERO);
-
-   if (pkt_node == NULL) {
-   if (dir == PFIL_IN)
-   ss->nskip_in_malloc++;
-   else
-   ss->nskip_out_malloc++;
-
-   goto inp_unlock;
-   }
-
/* Find the TCP control block that corresponds with this packet */
tp = intotcpcb(inp);
 
@@ -844,53 +893,21 @@ siftr_chkpkt(void *arg, struct mbuf **m,
else
  

svn commit: r214864 - in stable/8: share/man/man4 sys/netinet

2010-11-06 Thread Lawrence Stewart
Author: lstewart
Date: Sat Nov  6 10:21:46 2010
New Revision: 214864
URL: http://svn.freebsd.org/changeset/base/214864

Log:
  MFC r213162:
  
  Log the number of segments currently in the reassembly queue.
  
  Sponsored by: FreeBSD Foundation

Modified:
  stable/8/share/man/man4/siftr.4
  stable/8/sys/netinet/siftr.c
Directory Properties:
  stable/8/share/man/   (props changed)
  stable/8/share/man/man1/   (props changed)
  stable/8/share/man/man3/   (props changed)
  stable/8/share/man/man4/   (props changed)
  stable/8/share/man/man5/   (props changed)
  stable/8/share/man/man7/   (props changed)
  stable/8/share/man/man8/   (props changed)
  stable/8/share/man/man9/   (props changed)
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/share/man/man4/siftr.4
==
--- stable/8/share/man/man4/siftr.4 Sat Nov  6 10:17:43 2010
(r214863)
+++ stable/8/share/man/man4/siftr.4 Sat Nov  6 10:21:46 2010
(r214864)
@@ -30,7 +30,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd June 23, 2010
+.Dd September 25, 2010
 .Dt SIFTR 4
 .Os
 .Sh NAME
@@ -198,7 +198,7 @@ The data is CSV formatted.
 .Bd -literal -offset indent
 o,0xbec491a5,1238556193.463551,172.16.7.28,22,172.16.2.5,55931, \\
 1073725440,172312,6144,66560,66608,8,1,4,1448,936,1,996,255, \\
-33304,208,66608,0,208
+33304,208,66608,0,208,0
 .Ed
 .Pp
 Field descriptions are as follows:
@@ -328,6 +328,10 @@ The current number of bytes in the socke
 The current number of unacknowledged bytes in-flight.
 Bytes acknowledged via SACK are not excluded from this count.
 .El
+.Bl -tag -offset indent
+.It Va 26
+The current number of segments in the reassembly queue.
+.El
 .Pp
 The third type of log message is written to the file when the module is 
disabled
 and ceases collecting data from the running kernel.

Modified: stable/8/sys/netinet/siftr.c
==
--- stable/8/sys/netinet/siftr.cSat Nov  6 10:17:43 2010
(r214863)
+++ stable/8/sys/netinet/siftr.cSat Nov  6 10:21:46 2010
(r214864)
@@ -55,7 +55,7 @@
  * SIFTR should be directed to him via email: lastew...@swin.edu.au
  *
  * Initial release date: June 2007
- * Most recent update: June 2010
+ * Most recent update: September 2010
  **/
 
 #include 
@@ -105,7 +105,7 @@ __FBSDID("$FreeBSD$");
  */
 #define V_MAJOR1
 #define V_BACKBREAK2
-#define V_BACKCOMPAT   3
+#define V_BACKCOMPAT   4
 #define MODVERSION __CONCAT(V_MAJOR, __CONCAT(V_BACKBREAK, V_BACKCOMPAT))
 #define MODVERSION_STR __XSTRING(V_MAJOR) "." __XSTRING(V_BACKBREAK) "." \
 __XSTRING(V_BACKCOMPAT)
@@ -226,6 +226,8 @@ struct pkt_node {
u_int   rcv_buf_cc;
/* Number of bytes inflight that we are waiting on ACKs for. */
u_int   sent_inflight_bytes;
+   /* Number of segments currently in the reassembly queue. */
+   int t_segqlen;
/* Link to next pkt_node in the list. */
STAILQ_ENTRY(pkt_node)  nodes;
 };
@@ -442,7 +444,7 @@ siftr_process_pkt(struct pkt_node * pkt_
MAX_LOG_MSG_LEN,
"%c,0x%08x,%zd.%06ld,%x:%x:%x:%x:%x:%x:%x:%x,%u,%x:%x:%x:"
"%x:%x:%x:%x:%x,%u,%ld,%ld,%ld,%ld,%ld,%u,%u,%u,%u,%u,%u,"
-   "%u,%d,%u,%u,%u,%u,%u\n",
+   "%u,%d,%u,%u,%u,%u,%u,%u\n",
direction[pkt_node->direction],
pkt_node->hash,
pkt_node->tval.tv_sec,
@@ -482,7 +484,8 @@ siftr_process_pkt(struct pkt_node * pkt_
pkt_node->snd_buf_cc,
pkt_node->rcv_buf_hiwater,
pkt_node->rcv_buf_cc,
-   pkt_node->sent_inflight_bytes);
+   pkt_node->sent_inflight_bytes,
+   pkt_node->t_segqlen);
} else { /* IPv4 packet */
pkt_node->ip_laddr[0] = FIRST_OCTET(pkt_node->ip_laddr[3]);
pkt_node->ip_laddr[1] = SECOND_OCTET(pkt_node->ip_laddr[3]);
@@ -498,7 +501,7 @@ siftr_process_pkt(struct pkt_node * pkt_
log_buf->ae_bytesused = snprintf(log_buf->ae_data,
MAX_LOG_MSG_LEN,
"%c,0x%08x,%jd.%06ld,%u.%u.%u.%u,%u,%u.%u.%u.%u,%u,%ld,%ld,"
-   "%ld,%ld,%ld,%u,%u,%u,%u,%u,%u,%u,%d,%u,%u,%u,%u,%u\n",
+   "%ld,%ld,%ld,%u,%u,%u,%u,%u,%u,%u,%d,%u,%u,%u,%u,%u,%u\n",
direction[pkt_node->direction],
pkt_node->hash,
(intmax_t)pkt_node->tval.tv_sec,
@@ -530,7 +533,8 @@ s

svn commit: r214865 - stable/8/sys/netinet

2010-11-06 Thread Lawrence Stewart
Author: lstewart
Date: Sat Nov  6 10:26:49 2010
New Revision: 214865
URL: http://svn.freebsd.org/changeset/base/214865

Log:
  MFC r213912:
  
  - Switch the "net.inet.tcp.reass.cursegments" and
"net.inet.tcp.reass.maxsegments" sysctl variables to be based on UMA zone
stats. The value returned by the cursegments sysctl is approximate owing to
the way in which uma_zone_get_cur is implemented.
  
  - Discontinue use of V_tcp_reass_qsize as a global reassembly segment count
variable in the reassembly implementation. The variable was used without
proper synchronisation and was duplicating accounting done by UMA already. 
The
lack of synchronisation was particularly problematic on SMP systems
terminating many TCP sessions, resulting in poor TCP performance for
connections with non-zero packet loss.
  
  Sponsored by: FreeBSD Foundation
  Reviewed by:  andre, gnn, rpaulo (as part of a larger patch)

Modified:
  stable/8/sys/netinet/tcp_reass.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/netinet/tcp_reass.c
==
--- stable/8/sys/netinet/tcp_reass.cSat Nov  6 10:21:46 2010
(r214864)
+++ stable/8/sys/netinet/tcp_reass.cSat Nov  6 10:26:49 2010
(r214865)
@@ -74,19 +74,22 @@ __FBSDID("$FreeBSD$");
 #include 
 #endif /* TCPDEBUG */
 
+static int tcp_reass_sysctl_maxseg(SYSCTL_HANDLER_ARGS);
+static int tcp_reass_sysctl_qsize(SYSCTL_HANDLER_ARGS);
+
 SYSCTL_NODE(_net_inet_tcp, OID_AUTO, reass, CTLFLAG_RW, 0,
 "TCP Segment Reassembly Queue");
 
 static VNET_DEFINE(int, tcp_reass_maxseg) = 0;
 #defineV_tcp_reass_maxseg  VNET(tcp_reass_maxseg)
-SYSCTL_VNET_INT(_net_inet_tcp_reass, OID_AUTO, maxsegments, CTLFLAG_RDTUN,
-&VNET_NAME(tcp_reass_maxseg), 0,
+SYSCTL_VNET_PROC(_net_inet_tcp_reass, OID_AUTO, maxsegments, CTLFLAG_RDTUN,
+&VNET_NAME(tcp_reass_maxseg), 0, &tcp_reass_sysctl_maxseg, "I",
 "Global maximum number of TCP Segments in Reassembly Queue");
 
 static VNET_DEFINE(int, tcp_reass_qsize) = 0;
 #defineV_tcp_reass_qsize   VNET(tcp_reass_qsize)
-SYSCTL_VNET_INT(_net_inet_tcp_reass, OID_AUTO, cursegments, CTLFLAG_RD,
-&VNET_NAME(tcp_reass_qsize), 0,
+SYSCTL_VNET_PROC(_net_inet_tcp_reass, OID_AUTO, cursegments, CTLFLAG_RD,
+&VNET_NAME(tcp_reass_qsize), 0, &tcp_reass_sysctl_qsize, "I",
 "Global number of TCP Segments currently in Reassembly Queue");
 
 static VNET_DEFINE(int, tcp_reass_maxqlen) = 48;
@@ -148,7 +151,6 @@ tcp_reass_flush(struct tcpcb *tp)
m_freem(qe->tqe_m);
uma_zfree(V_tcp_reass_zone, qe);
tp->t_segqlen--;
-   V_tcp_reass_qsize--;
}
 
KASSERT((tp->t_segqlen == 0),
@@ -156,6 +158,20 @@ tcp_reass_flush(struct tcpcb *tp)
tp, tp->t_segqlen));
 }
 
+static int
+tcp_reass_sysctl_maxseg(SYSCTL_HANDLER_ARGS)
+{
+   V_tcp_reass_maxseg = uma_zone_get_max(V_tcp_reass_zone);
+   return (sysctl_handle_int(oidp, arg1, arg2, req));
+}
+
+static int
+tcp_reass_sysctl_qsize(SYSCTL_HANDLER_ARGS)
+{
+   V_tcp_reass_qsize = uma_zone_get_cur(V_tcp_reass_zone);
+   return (sysctl_handle_int(oidp, arg1, arg2, req));
+}
+
 int
 tcp_reass(struct tcpcb *tp, struct tcphdr *th, int *tlenp, struct mbuf *m)
 {
@@ -184,12 +200,10 @@ tcp_reass(struct tcpcb *tp, struct tcphd
 * Limit the number of segments in the reassembly queue to prevent
 * holding on to too many segments (and thus running out of mbufs).
 * Make sure to let the missing segment through which caused this
-* queue.  Always keep one global queue entry spare to be able to
-* process the missing segment.
+* queue.
 */
if (th->th_seq != tp->rcv_nxt &&
-   (V_tcp_reass_qsize + 1 >= V_tcp_reass_maxseg ||
-tp->t_segqlen >= V_tcp_reass_maxqlen)) {
+   tp->t_segqlen >= V_tcp_reass_maxqlen) {
V_tcp_reass_overflows++;
TCPSTAT_INC(tcps_rcvmemdrop);
m_freem(m);
@@ -209,7 +223,6 @@ tcp_reass(struct tcpcb *tp, struct tcphd
return (0);
}
tp->t_segqlen++;
-   V_tcp_reass_qsize++;
 
/*
 * Find a segment which begins after this one does.
@@ -236,7 +249,6 @@ tcp_reass(struct tcpcb *tp, struct tcphd
m_freem(m);
uma_zfree(V_tcp_reass_zone, te);
tp->t_segqlen--;
-   V_tcp_reass_qsize--;
/*
 * Try to present any queued data

svn commit: r214866 - stable/8/sys/netinet

2010-11-06 Thread Lawrence Stewart
Author: lstewart
Date: Sat Nov  6 10:31:52 2010
New Revision: 214866
URL: http://svn.freebsd.org/changeset/base/214866

Log:
  MFC r213913:
  
  Retire the system-wide, per-reassembly queue segment limit. The mechanism is 
far
  too coarse grained to be useful and the default value significantly degrades 
TCP
  performance on moderate to high bandwidth-delay product paths with non-zero 
loss
  (e.g. 5+Mbps connections across the public Internet often suffer).
  
  Replace the outgoing mechanism with an individual per-queue limit based on the
  number of MSS segments that fit into the socket's receive buffer.  This should
  strike a good balance between performance and the potential for resource
  exhaustion when FreeBSD is acting as a TCP receiver. With socket buffer
  autotuning (which is enabled by default), the reassembly queue tracks the 
socket
  buffer and benefits too.
  
  As the XXX comment suggests, my testing uncovered some unexpected behaviour
  which requires further investigation. By using so->so_rcv.sb_hiwat instead of
  sbspace(&so->so_rcv), we allow more segments to be held across both the socket
  receive buffer and reassembly queue than we probably should. The tradeoff is
  better performance in at least one common scenario, versus a devious sender's
  ability to consume more resources on a FreeBSD receiver.
  
  Sponsored by: FreeBSD Foundation
  Reviewed by:  andre, gnn, rpaulo

Modified:
  stable/8/sys/netinet/tcp_reass.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/netinet/tcp_reass.c
==
--- stable/8/sys/netinet/tcp_reass.cSat Nov  6 10:26:49 2010
(r214865)
+++ stable/8/sys/netinet/tcp_reass.cSat Nov  6 10:31:52 2010
(r214866)
@@ -92,12 +92,6 @@ SYSCTL_VNET_PROC(_net_inet_tcp_reass, OI
 &VNET_NAME(tcp_reass_qsize), 0, &tcp_reass_sysctl_qsize, "I",
 "Global number of TCP Segments currently in Reassembly Queue");
 
-static VNET_DEFINE(int, tcp_reass_maxqlen) = 48;
-#defineV_tcp_reass_maxqlen VNET(tcp_reass_maxqlen)
-SYSCTL_VNET_INT(_net_inet_tcp_reass, OID_AUTO, maxqlen, CTLFLAG_RW,
-&VNET_NAME(tcp_reass_maxqlen), 0,
-"Maximum number of TCP Segments per individual Reassembly Queue");
-
 static VNET_DEFINE(int, tcp_reass_overflows) = 0;
 #defineV_tcp_reass_overflows   VNET(tcp_reass_overflows)
 SYSCTL_VNET_INT(_net_inet_tcp_reass, OID_AUTO, overflows, CTLFLAG_RD,
@@ -197,13 +191,23 @@ tcp_reass(struct tcpcb *tp, struct tcphd
goto present;
 
/*
-* Limit the number of segments in the reassembly queue to prevent
-* holding on to too many segments (and thus running out of mbufs).
-* Make sure to let the missing segment through which caused this
-* queue.
+* Limit the number of segments that can be queued to reduce the
+* potential for mbuf exhaustion. For best performance, we want to be
+* able to queue a full window's worth of segments. The size of the
+* socket receive buffer determines our advertised window and grows
+* automatically when socket buffer autotuning is enabled. Use it as the
+* basis for our queue limit.
+* Always let the missing segment through which caused this queue.
+* NB: Access to the socket buffer is left intentionally unlocked as we
+* can tolerate stale information here.
+*
+* XXXLAS: Using sbspace(so->so_rcv) instead of so->so_rcv.sb_hiwat
+* should work but causes packets to be dropped when they shouldn't.
+* Investigate why and re-evaluate the below limit after the behaviour
+* is understood.
 */
if (th->th_seq != tp->rcv_nxt &&
-   tp->t_segqlen >= V_tcp_reass_maxqlen) {
+   tp->t_segqlen >= (so->so_rcv.sb_hiwat / tp->t_maxseg) + 1) {
V_tcp_reass_overflows++;
TCPSTAT_INC(tcps_rcvmemdrop);
m_freem(m);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r214867 - in head: lib/libarchive lib/libpmc usr.bin/setchannel

2010-11-06 Thread Ulrich Spoerlein
Author: uqs
Date: Sat Nov  6 10:54:33 2010
New Revision: 214867
URL: http://svn.freebsd.org/changeset/base/214867

Log:
  Fix manpage markup.

Modified:
  head/lib/libarchive/libarchive_internals.3
  head/lib/libpmc/pmc.mips.3
  head/lib/libpmc/pmc.xscale.3
  head/usr.bin/setchannel/setchannel.1

Modified: head/lib/libarchive/libarchive_internals.3
==
--- head/lib/libarchive/libarchive_internals.3  Sat Nov  6 10:31:52 2010
(r214866)
+++ head/lib/libarchive/libarchive_internals.3  Sat Nov  6 10:54:33 2010
(r214867)
@@ -363,4 +363,3 @@ The
 .Nm libarchive
 library was written by
 .An Tim Kientzle Aq kient...@acm.org .
-.Sh BUGS

Modified: head/lib/libpmc/pmc.mips.3
==
--- head/lib/libpmc/pmc.mips.3  Sat Nov  6 10:31:52 2010(r214866)
+++ head/lib/libpmc/pmc.mips.3  Sat Nov  6 10:54:33 2010(r214867)
@@ -24,8 +24,8 @@
 .\" $FreeBSD$
 .\"
 .Dd February 11, 2010
-.Os
 .Dt PMC.MIPS 3
+.Os
 .Sh NAME
 .Nm pmc.mips
 .Nd measurement events for
@@ -123,7 +123,6 @@ Counts every time the instruction cache 
 wasted fetches etc. are counted.
 For example, following a branch, even though the prediction is taken,
 the fall through access is counted.
-
 .It Li IC_MISS
 .Pq Event 9, Counter 1
 Counts all instruction cache misses that result in a bus request.

Modified: head/lib/libpmc/pmc.xscale.3
==
--- head/lib/libpmc/pmc.xscale.3Sat Nov  6 10:31:52 2010
(r214866)
+++ head/lib/libpmc/pmc.xscale.3Sat Nov  6 10:54:33 2010
(r214867)
@@ -24,8 +24,8 @@
 .\" $FreeBSD$
 .\"
 .Dd December 23, 2009
-.Os
 .Dt PMC.XSCALE 3
+.Os
 .Sh NAME
 .Nm pmc.xscale
 .Nd measurement events for

Modified: head/usr.bin/setchannel/setchannel.1
==
--- head/usr.bin/setchannel/setchannel.1Sat Nov  6 10:31:52 2010
(r214866)
+++ head/usr.bin/setchannel/setchannel.1Sat Nov  6 10:54:33 2010
(r214867)
@@ -1,32 +1,32 @@
+.\"-
+.\" Copyright (C) 2004-2006 The FreeBSD Project. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\"notice, this list of conditions and the following disclaimer in the
+.\"documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
 .\"
-.\ Copyright (C) 2004-2006 The FreeBSD Project. All rights reserved.
-.\
-.\ Redistribution and use in source and binary forms, with or without
-.\ modification, are permitted provided that the following conditions
-.\ are met:
-.\ 1. Redistributions of source code must retain the above copyright
-.\notice, this list of conditions and the following disclaimer.
-.\ 2. Redistributions in binary form must reproduce the above copyright
-.\notice, this list of conditions and the following disclaimer in the
-.\documentation and/or other materials provided with the distribution.
-.\ 
-.\ THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-.\ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\ ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
-.\ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\ SUCH DAMAGE.
-.\
 .\" $Id: cxm.4,v 1.1 20

svn commit: r214868 - in stable/7/sys: kern modules modules/alq

2010-11-06 Thread Lawrence Stewart
Author: lstewart
Date: Sat Nov  6 11:09:04 2010
New Revision: 214868
URL: http://svn.freebsd.org/changeset/base/214868

Log:
  MFC r205959:
  
  Add support for ALQ(9) to be compiled and loaded as a kernel module.
  
  Sponsored by: FreeBSD Foundation
  Reviewed by:  dwmalone, jeff, rpaulo, rwatson

Added:
  stable/7/sys/modules/alq/
 - copied from r205959, head/sys/modules/alq/
Modified:
  stable/7/sys/kern/kern_alq.c
  stable/7/sys/modules/Makefile
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/kern/kern_alq.c
==
--- stable/7/sys/kern/kern_alq.cSat Nov  6 10:54:33 2010
(r214867)
+++ stable/7/sys/kern/kern_alq.cSat Nov  6 11:09:04 2010
(r214868)
@@ -1,7 +1,13 @@
 /*-
  * Copyright (c) 2002, Jeffrey Roberson 
+ * Copyright (c) 2008-2009, Lawrence Stewart 
+ * Copyright (c) 2009-2010, The FreeBSD Foundation
  * All rights reserved.
  *
+ * Portions of this software were developed at the Centre for Advanced
+ * Internet Architectures, Swinburne University of Technology, Melbourne,
+ * Australia by Lawrence Stewart under sponsorship from the FreeBSD Foundation.
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
@@ -182,9 +188,16 @@ ald_daemon(void)
ALD_LOCK();
 
for (;;) {
-   while ((alq = LIST_FIRST(&ald_active)) == NULL)
+   while ((alq = LIST_FIRST(&ald_active)) == NULL &&
+   !ald_shutingdown)
msleep(&ald_active, &ald_mtx, PWAIT, "aldslp", 0);
 
+   /* Don't shutdown until all active ALQs are flushed. */
+   if (ald_shutingdown && alq == NULL) {
+   ALD_UNLOCK();
+   break;
+   }
+
ALQ_LOCK(alq);
ald_deactivate(alq);
ALD_UNLOCK();
@@ -194,6 +207,8 @@ ald_daemon(void)
wakeup(alq);
ALD_LOCK();
}
+
+   kproc_exit(0);
 }
 
 static void
@@ -202,14 +217,29 @@ ald_shutdown(void *arg, int howto)
struct alq *alq;
 
ALD_LOCK();
+
+   /* Ensure no new queues can be created. */
ald_shutingdown = 1;
 
+   /* Shutdown all ALQs prior to terminating the ald_daemon. */
while ((alq = LIST_FIRST(&ald_queues)) != NULL) {
LIST_REMOVE(alq, aq_link);
ALD_UNLOCK();
alq_shutdown(alq);
ALD_LOCK();
}
+
+   /* At this point, all ALQs are flushed and shutdown. */
+
+   /*
+* Wake ald_daemon so that it exits. It won't be able to do
+* anything until we msleep because we hold the ald_mtx.
+*/
+   wakeup(&ald_active);
+
+   /* Wait for ald_daemon to exit. */
+   msleep(ald_proc, &ald_mtx, PWAIT, "aldslp", 0);
+
ALD_UNLOCK();
 }
 
@@ -517,3 +547,53 @@ alq_close(struct alq *alq)
free(alq->aq_entbuf, M_ALD);
free(alq, M_ALD);
 }
+
+static int
+alq_load_handler(module_t mod, int what, void *arg)
+{
+   int ret;
+   
+   ret = 0;
+
+   switch (what) {
+   case MOD_LOAD:
+   case MOD_SHUTDOWN:
+   break;
+
+   case MOD_QUIESCE:
+   ALD_LOCK();
+   /* Only allow unload if there are no open queues. */
+   if (LIST_FIRST(&ald_queues) == NULL) {
+   ald_shutingdown = 1;
+   ALD_UNLOCK();
+   ald_shutdown(NULL, 0);
+   mtx_destroy(&ald_mtx);
+   } else {
+   ALD_UNLOCK();
+   ret = EBUSY;
+   }
+   break;
+
+   case MOD_UNLOAD:
+   /* If MOD_QUIESCE failed we must fail here too. */
+   if (ald_shutingdown == 0)
+   ret = EBUSY;
+   break;
+
+   default:
+   ret = EINVAL;
+   break;
+   }
+
+   return (ret);
+}
+
+static moduledata_t alq_mod =
+{
+   "alq",
+   alq_load_handler,
+   NULL
+};
+
+DECLARE_MODULE(alq, alq_mod, SI_SUB_SMP, SI_ORDER_ANY);
+MODULE_VERSION(alq, 1);

Modified: stable/7/sys/modules/Makefile
==
--- stable/7/sys/modules/Makefile   Sat Nov  6 10:54:33 2010
(r214867)
+++ stable/7/sys/modules/Makefile   Sat Nov  6 11:09:04 2010
(r214868)
@@ -18,6 +18,7 @@ SUBDIR=   ${_3dfx} \
aio \
alc \
ale \
+   alq \
${_amd} \
${_amdsbwd} \
${_amdtemp} \
___
svn-src-all@freebsd.org m

svn commit: r214869 - stable/7/sys/kern

2010-11-06 Thread Lawrence Stewart
Author: lstewart
Date: Sat Nov  6 11:17:30 2010
New Revision: 214869
URL: http://svn.freebsd.org/changeset/base/214869

Log:
  MFC r206026:
  
  - Factor code to destroy an ALQ out of alq_close() into a private 
alq_destroy().
  
  - Use the new alq_destroy() to properly handle a failure case in alq_open().
  
  Sponsored by: FreeBSD Foundation
  Reviewed by:  dwmalone, jeff, rpaulo, rwatson (as part of a larger patch)

Modified:
  stable/7/sys/kern/kern_alq.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/kern/kern_alq.c
==
--- stable/7/sys/kern/kern_alq.cSat Nov  6 11:09:04 2010
(r214868)
+++ stable/7/sys/kern/kern_alq.cSat Nov  6 11:17:30 2010
(r214869)
@@ -103,6 +103,7 @@ static void ald_deactivate(struct alq *)
 
 /* Internal queue functions */
 static void alq_shutdown(struct alq *);
+static void alq_destroy(struct alq *);
 static int alq_doio(struct alq *);
 
 
@@ -265,6 +266,18 @@ alq_shutdown(struct alq *alq)
crfree(alq->aq_cred);
 }
 
+void
+alq_destroy(struct alq *alq)
+{
+   /* Drain all pending IO. */
+   alq_shutdown(alq);
+
+   mtx_destroy(&alq->aq_mtx);
+   free(alq->aq_first, M_ALD);
+   free(alq->aq_entbuf, M_ALD);
+   free(alq, M_ALD);
+}
+
 /*
  * Flush all pending data to disk.  This operation will block.
  */
@@ -423,8 +436,11 @@ alq_open(struct alq **alqp, const char *
 
alp->ae_next = alq->aq_first;
 
-   if ((error = ald_add(alq)) != 0)
+   if ((error = ald_add(alq)) != 0) {
+   alq_destroy(alq);
return (error);
+   }
+
*alqp = alq;
 
return (0);
@@ -530,22 +546,9 @@ alq_flush(struct alq *alq)
 void
 alq_close(struct alq *alq)
 {
-   /*
-* If we're already shuting down someone else will flush and close
-* the vnode.
-*/
-   if (ald_rem(alq) != 0)
-   return;
-
-   /*
-* Drain all pending IO.
-*/
-   alq_shutdown(alq);
-
-   mtx_destroy(&alq->aq_mtx);
-   free(alq->aq_first, M_ALD);
-   free(alq->aq_entbuf, M_ALD);
-   free(alq, M_ALD);
+   /* Only flush and destroy alq if not already shutting down. */
+   if (ald_rem(alq) == 0)
+   alq_destroy(alq);
 }
 
 static int
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r214870 - stable/7/sys/kern

2010-11-06 Thread Lawrence Stewart
Author: lstewart
Date: Sat Nov  6 11:20:20 2010
New Revision: 214870
URL: http://svn.freebsd.org/changeset/base/214870

Log:
  MFC r206027:
  
  According to SLEEP(9), msleep() is deprecated in favour of mtx_sleep().
  
  Sponsored by: FreeBSD Foundation
  Reviewed by:  dwmalone, jeff, rpaulo, rwatson (as part of a larger patch)

Modified:
  stable/7/sys/kern/kern_alq.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/kern/kern_alq.c
==
--- stable/7/sys/kern/kern_alq.cSat Nov  6 11:17:30 2010
(r214869)
+++ stable/7/sys/kern/kern_alq.cSat Nov  6 11:20:20 2010
(r214870)
@@ -191,7 +191,7 @@ ald_daemon(void)
for (;;) {
while ((alq = LIST_FIRST(&ald_active)) == NULL &&
!ald_shutingdown)
-   msleep(&ald_active, &ald_mtx, PWAIT, "aldslp", 0);
+   mtx_sleep(&ald_active, &ald_mtx, PWAIT, "aldslp", 0);
 
/* Don't shutdown until all active ALQs are flushed. */
if (ald_shutingdown && alq == NULL) {
@@ -234,12 +234,12 @@ ald_shutdown(void *arg, int howto)
 
/*
 * Wake ald_daemon so that it exits. It won't be able to do
-* anything until we msleep because we hold the ald_mtx.
+* anything until we mtx_sleep because we hold the ald_mtx.
 */
wakeup(&ald_active);
 
/* Wait for ald_daemon to exit. */
-   msleep(ald_proc, &ald_mtx, PWAIT, "aldslp", 0);
+   mtx_sleep(ald_proc, &ald_mtx, PWAIT, "aldslp", 0);
 
ALD_UNLOCK();
 }
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r214871 - stable/7/sys/kern

2010-11-06 Thread Lawrence Stewart
Author: lstewart
Date: Sat Nov  6 11:23:46 2010
New Revision: 214871
URL: http://svn.freebsd.org/changeset/base/214871

Log:
  MFC r206028:
  
  The ALQ should not be considered drained until it has been made inactive.
  
  Sponsored by: FreeBSD Foundation
  Reviewed by:  dwmalone, jeff, rpaulo, rwatson (as part of a larger patch)

Modified:
  stable/7/sys/kern/kern_alq.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/kern/kern_alq.c
==
--- stable/7/sys/kern/kern_alq.cSat Nov  6 11:20:20 2010
(r214870)
+++ stable/7/sys/kern/kern_alq.cSat Nov  6 11:23:46 2010
(r214871)
@@ -253,7 +253,7 @@ alq_shutdown(struct alq *alq)
alq->aq_flags |= AQ_SHUTDOWN;
 
/* Drain IO */
-   while (alq->aq_flags & (AQ_FLUSHING|AQ_ACTIVE)) {
+   while (alq->aq_flags & AQ_ACTIVE) {
alq->aq_flags |= AQ_WANTED;
ALQ_UNLOCK(alq);
tsleep(alq, PWAIT, "aldclose", 0);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r214872 - in stable/7: share/man/man9 sys/kern sys/sys

2010-11-06 Thread Lawrence Stewart
Author: lstewart
Date: Sat Nov  6 11:38:40 2010
New Revision: 214872
URL: http://svn.freebsd.org/changeset/base/214872

Log:
  MFC r207223:
  
  - Rework the underlying ALQ storage to be a circular buffer, which amongst 
other
things allows variable length messages to be easily supported.
  
  - Extend KPI with alq_writen() and alq_getn() to support variable length
messages, which is enabled at ALQ creation time depending on the arguments
passed to alq_open(). Also add variants of alq_open() and alq_post() that
accept a flags argument. The KPI is still fully backwards compatible and
shouldn't require any change in ALQ consumers unless they wish to utilise 
the
new features.
  
  - Introduce the ALQ_NOACTIVATE and ALQ_ORDERED flags to allow ALQ consumers to
have more control over IO scheduling and resource acquisition respectively.
  
  - Strengthen invariants checking.
  
  - Document ALQ changes in ALQ(9) man page.
  
  Sponsored by: FreeBSD Foundation
  Reviewed by:  gnn, jeff, rpaulo, rwatson

Modified:
  stable/7/share/man/man9/alq.9
  stable/7/sys/kern/kern_alq.c
  stable/7/sys/sys/alq.h
Directory Properties:
  stable/7/share/man/   (props changed)
  stable/7/share/man/man1/   (props changed)
  stable/7/share/man/man3/   (props changed)
  stable/7/share/man/man4/   (props changed)
  stable/7/share/man/man5/   (props changed)
  stable/7/share/man/man7/   (props changed)
  stable/7/share/man/man8/   (props changed)
  stable/7/share/man/man9/   (props changed)
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/share/man/man9/alq.9
==
--- stable/7/share/man/man9/alq.9   Sat Nov  6 11:23:46 2010
(r214871)
+++ stable/7/share/man/man9/alq.9   Sat Nov  6 11:38:40 2010
(r214872)
@@ -1,7 +1,13 @@
 .\"
 .\" Copyright (c) 2003 Hiten Pandya 
+.\" Copyright (c) 2009-2010 The FreeBSD Foundation
 .\" All rights reserved.
 .\"
+.\" Portions of this software were developed at the Centre for Advanced
+.\" Internet Architectures, Swinburne University of Technology, Melbourne,
+.\" Australia by Lawrence Stewart under sponsorship from the FreeBSD
+.\" Foundation.
+.\"
 .\" Redistribution and use in source and binary forms, with or without
 .\" modification, are permitted provided that the following conditions
 .\" are met:
@@ -25,21 +31,34 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd May 16, 2003
+.Dd April 26, 2010
 .Dt ALQ 9
 .Os
 .Sh NAME
 .Nm alq ,
+.Nm alq_open_flags ,
 .Nm alq_open ,
+.Nm alq_writen ,
 .Nm alq_write ,
 .Nm alq_flush ,
 .Nm alq_close ,
+.Nm alq_getn ,
 .Nm alq_get ,
+.Nm alq_post_flags ,
 .Nm alq_post
 .Nd Asynchronous Logging Queues
 .Sh SYNOPSIS
 .In sys/alq.h
 .Ft int
+.Fo alq_open_flags
+.Fa "struct alq **app"
+.Fa "const char *file"
+.Fa "struct ucred *cred"
+.Fa "int cmode"
+.Fa "int size"
+.Fa "int flags"
+.Fc
+.Ft int
 .Fo alq_open
 .Fa "struct alq **app"
 .Fa "const char *file"
@@ -49,19 +68,25 @@
 .Fa "int count"
 .Fc
 .Ft int
-.Fn alq_write "struct alq *alq" "void *data" "int waitok"
+.Fn alq_writen "struct alq *alq" "void *data" "int len" "int flags"
+.Ft int
+.Fn alq_write "struct alq *alq" "void *data" "int flags"
 .Ft void
 .Fn alq_flush "struct alq *alq"
 .Ft void
 .Fn alq_close "struct alq *alq"
 .Ft struct ale *
-.Fn alq_get "struct alq *alq" "int waitok"
+.Fn alq_getn "struct alq *alq" "int len" "int flags"
+.Ft struct ale *
+.Fn alq_get "struct alq *alq" "int flags"
+.Ft void
+.Fn alq_post_flags "struct alq *alq" "struct ale *ale" "int flags"
 .Ft void
 .Fn alq_post "struct alq *alq" "struct ale *ale"
 .Sh DESCRIPTION
 The
 .Nm
-facility provides an asynchronous fixed length recording
+facility provides an asynchronous fixed or variable length recording
 mechanism, known as Asynchronous Logging Queues.
 It can record to any
 .Xr vnode 9 ,
@@ -81,26 +106,37 @@ is defined as
 which has the following members:
 .Bd -literal -offset indent
 struct ale {
-   struct ale  *ae_next;   /* Next Entry */
-   char*ae_data;   /* Entry buffer */
-   int ae_flags;   /* Entry flags */
+   intptr_tae_bytesused;   /* # bytes written to ALE. */
+   char*ae_data;   /* Write ptr. */
+   int ae_pad; /* Unused, compat. */
 };
 .Ed
 .Pp
-The
-.Va ae_flags
-field is for internal use, clients of the
+An
 .Nm
-interface should not modify this field.
-Behaviour is undefined if this field is modified.
+can be created in either fixed or variable length mode.
+A variable length
+.Nm
+accommodates writes of varying length using
+.Fn alq_writen
+and
+.Fn alq_getn .
+A fixed length
+.Nm
+accommodates a fixed number of writes using
+.Fn alq_write
+and
+.Fn alq_get ,
+each of fixed size (set at queue creation time).
+Fixed length mode is dep

svn commit: r214873 - head/release/doc/en_US.ISO8859-1/hardware

2010-11-06 Thread Marius Strobl
Author: marius
Date: Sat Nov  6 11:38:49 2010
New Revision: 214873
URL: http://svn.freebsd.org/changeset/base/214873

Log:
  - Move Sun Fire V240 to the list of known working machines.
  - For the parallel stable/7 and stable/8 branches mention both releases that
first supported a particular sparc64 machine and update the sparc64 hardware
list regarding machines that will be supported beginning with 7.4-RELEASE.

Modified:
  head/release/doc/en_US.ISO8859-1/hardware/article.sgml

Modified: head/release/doc/en_US.ISO8859-1/hardware/article.sgml
==
--- head/release/doc/en_US.ISO8859-1/hardware/article.sgml  Sat Nov  6 
11:38:40 2010(r214872)
+++ head/release/doc/en_US.ISO8859-1/hardware/article.sgml  Sat Nov  6 
11:38:49 2010(r214873)
@@ -585,7 +585,11 @@

 

- &sun.fire; V215 (support first appeared in 7.3-RELEASE)
+ &sun.fire; V215 (support first appeared in 7.3-RELEASE and 
8.1-RELEASE)
+   
+
+   
+ &sun.fire; V240

 

@@ -594,12 +598,12 @@
 

  &sun.fire; V440 (support for the on-board NICs first
-   appeared in 8.0-RELEASE)
+   appeared in 7.3-RELEASE and 8.0-RELEASE)

 

  &sun.fire; V480 (501-6780 and 501-6790 centerplanes only, for
-   which support first appeared in 7.3-RELEASE)
+   which support first appeared in 7.3-RELEASE and 8.1-RELEASE)

 

@@ -607,7 +611,7 @@

 

- &sun.fire; V890 (support first appeared in 8.1-RELEASE,
+ &sun.fire; V890 (support first appeared in 7.4-RELEASE and 
8.1-RELEASE,
non-mixed &ultrasparc; IV/IV+ CPU-configurations only)

 
@@ -625,20 +629,16 @@

 

- &sun.fire; V240
-   
-
-   
- &sun.fire; V245 (support first appeared in 7.3-RELEASE)
+ &sun.fire; V245 (support first appeared in 7.3-RELEASE and 
8.1-RELEASE)

 

- &sun.fire; V490 (support first appeared in 8.1-RELEASE,
+ &sun.fire; V490 (support first appeared in 7.4-RELEASE and 
8.1-RELEASE,
non-mixed &ultrasparc; IV/IV+ CPU-configurations only)

   
 
-  Starting with 8.1-RELEASE, &arch.sparc64; systems based on
+  Starting with 7.4-RELEASE and 8.1-RELEASE, &arch.sparc64; systems 
based on
Fujitsu &sparc64; V are also supported by &os;, which
includes the following known working systems:
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r214874 - stable/7/sys/kern

2010-11-06 Thread Lawrence Stewart
Author: lstewart
Date: Sat Nov  6 12:41:47 2010
New Revision: 214874
URL: http://svn.freebsd.org/changeset/base/214874

Log:
  The kthread/kproc KPI differs between 7.x and 8.x+ and requires the use of
  kthread_exit() in order to get a wakeup delivered to the "struct proc *" which
  ALQ relies on.
  
  This is an intentional direct commit to the 7-STABLE branch.

Modified:
  stable/7/sys/kern/kern_alq.c

Modified: stable/7/sys/kern/kern_alq.c
==
--- stable/7/sys/kern/kern_alq.cSat Nov  6 11:38:49 2010
(r214873)
+++ stable/7/sys/kern/kern_alq.cSat Nov  6 12:41:47 2010
(r214874)
@@ -220,7 +220,7 @@ ald_daemon(void)
ALD_LOCK();
}
 
-   kproc_exit(0);
+   kthread_exit(0);
 }
 
 static void
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r214875 - in stable/7: share/man/man4 sys/modules sys/modules/siftr sys/netinet

2010-11-06 Thread Lawrence Stewart
Author: lstewart
Date: Sat Nov  6 13:03:33 2010
New Revision: 214875
URL: http://svn.freebsd.org/changeset/base/214875

Log:
  MFC r209662,209665:
  
  Import the Statistical Information For TCP Research (SIFTR) kernel module into
  FreeBSD. SIFTR logs a range of statistics on active TCP connections to a log
  file, providing the ability to make highly granular measurements of TCP
  connection state. The tool is aimed at system administrators, developers and
  researchers alike. Please take it for a spin and test it out - the man page
  should have all the information required to get you going.
  
  Many thanks go to the Cisco University Research Program Fund at Community
  Foundation Silicon Valley and the FreeBSD Foundation. Their support of our 
work
  at the Centre for Advanced Internet Architectures, Swinburne University of
  Technology is greatly appreciated.
  
  The base SIFTR code from r209662 was modified as part of this MFC in order to
  work correctly on FreeBSD 7.
  
  r209980:
  
  Catch up with the rename of DPCPU_SUM to DPCPU_VARSUM.
  
  r209982:
  
  The SIFTR DPCPU statistics struct was not being zeroed between enable/disable
  cycles so the values would accumulate rather than reset for each cycle.
  
  Sponsored by: Cisco URP (r209662), FreeBSD Foundation
  Reviewed by:  dwmalone, gnn, rpaulo (r209662)
  Tested by:Many on freebsd-current@ and elsewhere over the years

Added:
  stable/7/share/man/man4/siftr.4
 - copied unchanged from r209662, head/share/man/man4/siftr.4
  stable/7/sys/modules/siftr/
 - copied from r209662, head/sys/modules/siftr/
  stable/7/sys/netinet/siftr.c
 - copied, changed from r209662, head/sys/netinet/siftr.c
Modified:
  stable/7/share/man/man4/Makefile
  stable/7/sys/modules/Makefile
Directory Properties:
  stable/7/share/man/   (props changed)
  stable/7/share/man/man1/   (props changed)
  stable/7/share/man/man3/   (props changed)
  stable/7/share/man/man4/   (props changed)
  stable/7/share/man/man5/   (props changed)
  stable/7/share/man/man7/   (props changed)
  stable/7/share/man/man8/   (props changed)
  stable/7/share/man/man9/   (props changed)
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/share/man/man4/Makefile
==
--- stable/7/share/man/man4/MakefileSat Nov  6 12:41:47 2010
(r214874)
+++ stable/7/share/man/man4/MakefileSat Nov  6 13:03:33 2010
(r214875)
@@ -314,6 +314,8 @@ MAN=aac.4 \
sf.4 \
sge.4 \
si.4 \
+   siftr.4 \
+   siis.4 \
sio.4 \
sis.4 \
sk.4 \

Copied: stable/7/share/man/man4/siftr.4 (from r209662, 
head/share/man/man4/siftr.4)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ stable/7/share/man/man4/siftr.4 Sat Nov  6 13:03:33 2010
(r214875, copy of r209662, head/share/man/man4/siftr.4)
@@ -0,0 +1,752 @@
+.\"
+.\" Copyright (c) 2010 The FreeBSD Foundation
+.\" All rights reserved.
+.\"
+.\" Portions of this software were developed at the Centre for Advanced
+.\" Internet Architectures, Swinburne University of Technology, Melbourne,
+.\" Australia by Lawrence Stewart under sponsorship from the FreeBSD
+.\" Foundation.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"notice, this list of conditions, and the following disclaimer,
+.\"without modification, immediately at the beginning of the file.
+.\" 2. The name of the author may not be used to endorse or promote products
+.\"derived from this software without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
+.\" ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (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$
+.\"
+.Dd June 23, 2010
+.Dt SIFTR 4
+.Os
+.Sh NAME
+.Nm SIFTR
+.Nd Statistical Information For TCP Research
+.Sh SYNOPSIS
+To load
+.Ns Nm
+as a modu

svn commit: r214876 - head/sys/netinet

2010-11-06 Thread Michael Tuexen
Author: tuexen
Date: Sat Nov  6 13:30:54 2010
New Revision: 214876
URL: http://svn.freebsd.org/changeset/base/214876

Log:
  * Fix an accounting bug regarding SACK/NR-SACK chunks.
  * Fix the generation of the SACK/NR-SACK gap lists.
  
  MFC after: 3 days.

Modified:
  head/sys/netinet/sctp_output.c

Modified: head/sys/netinet/sctp_output.c
==
--- head/sys/netinet/sctp_output.c  Sat Nov  6 13:03:33 2010
(r214875)
+++ head/sys/netinet/sctp_output.c  Sat Nov  6 13:30:54 2010
(r214876)
@@ -9927,7 +9927,7 @@ sctp_send_sack(struct sctp_tcb *stcb)
caddr_t limit;
uint32_t *dup;
int limit_reached = 0;
-   unsigned int i, sel_start, siz, j, starting_index;
+   unsigned int i, sel_start, siz, j;
unsigned int num_gap_blocks = 0, num_nr_gap_blocks = 0, space;
int num_dups = 0;
int space_req;
@@ -9954,7 +9954,7 @@ sctp_send_sack(struct sctp_tcb *stcb)
if (chk->rec.chunk_id.id == type) {
/* Hmm, found a sack already on queue, remove it */
TAILQ_REMOVE(&asoc->control_send_queue, chk, sctp_next);
-   asoc->ctrl_queue_cnt++;
+   asoc->ctrl_queue_cnt--;
a_chk = chk;
if (a_chk->data) {
sctp_m_freem(a_chk->data);
@@ -9993,15 +9993,13 @@ sctp_send_sack(struct sctp_tcb *stcb)
a_chk->whoTo = NULL;
 
if ((asoc->numduptsns) ||
-   (asoc->last_data_chunk_from->dest_state & SCTP_ADDR_NOT_REACHABLE)
-   ) {
+   (asoc->last_data_chunk_from->dest_state & SCTP_ADDR_NOT_REACHABLE)) 
{
/*-
 * Ok, we have some duplicates or the destination for the
 * sack is unreachable, lets see if we can select an
 * alternate than asoc->last_data_chunk_from
 */
-   if ((!(asoc->last_data_chunk_from->dest_state &
-   SCTP_ADDR_NOT_REACHABLE)) &&
+   if ((!(asoc->last_data_chunk_from->dest_state & 
SCTP_ADDR_NOT_REACHABLE)) &&
(asoc->used_alt_onsack > asoc->numnets)) {
/* We used an alt last time, don't this time */
a_chk->whoTo = NULL;
@@ -10120,53 +10118,25 @@ sctp_send_sack(struct sctp_tcb *stcb)
}
}
 
-   if (compare_with_wrap(asoc->mapping_array_base_tsn, 
asoc->cumulative_tsn, MAX_TSN)) {
-   offset = 1;
-   /*-
-* The base TSN is intialized to be the first TSN the peer
-* will send us. If the cum-ack is behind this then when they
-* send us the next in sequence it will mark the base_tsn bit.
-* Thus we need to use the very first selector and the offset
-* is 1. Our table is built for this case.
-*/
-   starting_index = 0;
+   if (((type == SCTP_SELECTIVE_ACK) &&
+   (((asoc->mapping_array[0] | asoc->nr_mapping_array[0]) & 0x01) == 
0x00)) ||
+   ((type == SCTP_NR_SELECTIVE_ACK) &&
+   ((asoc->mapping_array[0] & 0x01) == 0x00))) {
sel_start = 0;
} else {
-   /*-
-* we skip the first selector  when the cum-ack is at or above 
the
-* mapping array base. This is because the bits at the base or 
above
-* are turned on and our first selector in the table assumes 
they are
-* off. We thus will use the second selector (first is 0). We 
use
-* the reverse of our macro to fix the offset, in bits, that our
-* table is at. Note that this method assumes that the cum-tsn 
is
-* within the first bit, i.e. its value is 0-7 which means the
-* result to our offset will be either a 0 - -7. If the cumack
-* is NOT in the first byte (0) (which it should be since we did
-* a mapping array slide above) then we need to calculate the 
starting
-* index i.e. which byte of the mapping array we should start 
at. We
-* do this by dividing by 8 and pushing the remainder (mod) 
into offset.
-* then we multiply the offset to be negative, since we need a 
negative
-* offset into the selector table.
-*/
-   SCTP_CALC_TSN_TO_GAP(offset, asoc->cumulative_tsn, 
asoc->mapping_array_base_tsn);
-   if (offset > 7) {
-   starting_index = offset / 8;
-   offset = offset % 8;
-   printf("Strange starting index is %d offset:%d (not 
0/x)\n",
-   starting_index, offset);
-   } else {
-   starting_index = 0;
-   }
-   /

svn commit: r214877 - head/sys/netinet

2010-11-06 Thread Michael Tuexen
Author: tuexen
Date: Sat Nov  6 13:43:18 2010
New Revision: 214877
URL: http://svn.freebsd.org/changeset/base/214877

Log:
  Do not resend DATA chunks without delay when dropped by the peer and
  the CRC was correct.
  
  MFC after: 3 days.

Modified:
  head/sys/netinet/sctp_input.c

Modified: head/sys/netinet/sctp_input.c
==
--- head/sys/netinet/sctp_input.c   Sat Nov  6 13:30:54 2010
(r214876)
+++ head/sys/netinet/sctp_input.c   Sat Nov  6 13:43:18 2010
(r214877)
@@ -3115,6 +3115,10 @@ process_chunk_drop(struct sctp_tcb *stcb
if ((tp1) && (tp1->sent < SCTP_DATAGRAM_ACKED)) {
uint8_t *ddp;
 
+   if (((flg & SCTP_BADCRC) == 0) &&
+   ((flg & SCTP_FROM_MIDDLE_BOX) == 0)) {
+   return (0);
+   }
if ((stcb->asoc.peers_rwnd == 0) &&
((flg & SCTP_FROM_MIDDLE_BOX) == 0)) {
SCTP_STAT_INCR(sctps_pdrpdiwnp);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r214878 - stable/7/sys/netinet

2010-11-06 Thread Lawrence Stewart
Author: lstewart
Date: Sat Nov  6 13:46:58 2010
New Revision: 214878
URL: http://svn.freebsd.org/changeset/base/214878

Log:
  MFC r213158:
  
  Internalise reassembly queue related functionality and variables which should
  not be used outside of the reassembly queue implementation. Provide a new
  function to flush all segments from a reassembly queue and call it from the
  appropriate places instead of manipulating the queue directly.
  
  The base code from r213158 was modified as part of this MFC in order to work
  correctly on FreeBSD 7.
  
  Sponsored by: FreeBSD Foundation
  Reviewed by:  andre, gnn, rpaulo

Modified:
  stable/7/sys/netinet/tcp_reass.c
  stable/7/sys/netinet/tcp_subr.c
  stable/7/sys/netinet/tcp_var.h
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/netinet/tcp_reass.c
==
--- stable/7/sys/netinet/tcp_reass.cSat Nov  6 13:43:18 2010
(r214877)
+++ stable/7/sys/netinet/tcp_reass.cSat Nov  6 13:46:58 2010
(r214878)
@@ -81,7 +81,7 @@ SYSCTL_INT(_net_inet_tcp_reass, OID_AUTO
 &tcp_reass_maxseg, 0,
 "Global maximum number of TCP Segments in Reassembly Queue");
 
-int tcp_reass_qsize = 0;
+static int tcp_reass_qsize = 0;
 SYSCTL_INT(_net_inet_tcp_reass, OID_AUTO, cursegments, CTLFLAG_RD,
 &tcp_reass_qsize, 0,
 "Global number of TCP Segments currently in Reassembly Queue");
@@ -96,6 +96,8 @@ SYSCTL_INT(_net_inet_tcp_reass, OID_AUTO
 &tcp_reass_overflows, 0,
 "Global number of TCP Segment Reassembly Queue Overflows");
 
+static uma_zone_t  tcp_reass_zone;
+
 /* Initialize TCP reassembly queue */
 static void
 tcp_reass_zone_change(void *tag)
@@ -105,8 +107,6 @@ tcp_reass_zone_change(void *tag)
uma_zone_set_max(tcp_reass_zone, tcp_reass_maxseg);
 }
 
-uma_zone_t tcp_reass_zone;
-
 void
 tcp_reass_init(void)
 {
@@ -121,6 +121,26 @@ tcp_reass_init(void)
tcp_reass_zone_change, NULL, EVENTHANDLER_PRI_ANY);
 }
 
+void
+tcp_reass_flush(struct tcpcb *tp)
+{
+   struct tseg_qent *qe;
+
+   INP_WLOCK_ASSERT(tp->t_inpcb);
+
+   while ((qe = LIST_FIRST(&tp->t_segq)) != NULL) {
+   LIST_REMOVE(qe, tqe_q);
+   m_freem(qe->tqe_m);
+   uma_zfree(tcp_reass_zone, qe);
+   tp->t_segqlen--;
+   tcp_reass_qsize--;
+   }
+
+   KASSERT((tp->t_segqlen == 0),
+   ("TCP reass queue %p segment count is %d instead of 0 after flush.",
+   tp, tp->t_segqlen));
+}
+
 int
 tcp_reass(struct tcpcb *tp, struct tcphdr *th, int *tlenp, struct mbuf *m)
 {

Modified: stable/7/sys/netinet/tcp_subr.c
==
--- stable/7/sys/netinet/tcp_subr.c Sat Nov  6 13:43:18 2010
(r214877)
+++ stable/7/sys/netinet/tcp_subr.c Sat Nov  6 13:46:58 2010
(r214878)
@@ -704,7 +704,6 @@ tcp_drop(struct tcpcb *tp, int errno)
 void
 tcp_discardcb(struct tcpcb *tp)
 {
-   struct tseg_qent *q;
struct inpcb *inp = tp->t_inpcb;
struct socket *so = inp->inp_socket;
 #ifdef INET6
@@ -782,13 +781,7 @@ tcp_discardcb(struct tcpcb *tp)
}
 
/* free the reassembly queue, if any */
-   while ((q = LIST_FIRST(&tp->t_segq)) != NULL) {
-   LIST_REMOVE(q, tqe_q);
-   m_freem(q->tqe_m);
-   uma_zfree(tcp_reass_zone, q);
-   tp->t_segqlen--;
-   tcp_reass_qsize--;
-   }
+   tcp_reass_flush(tp);
/* Disconnect offload device, if any. */
tcp_offload_detach(tp);

@@ -840,7 +833,6 @@ tcp_drain(void)
if (do_tcpdrain) {
struct inpcb *inpb;
struct tcpcb *tcpb;
-   struct tseg_qent *te;
 
/*
 * Walk the tcpbs, if existing, and flush the reassembly queue,
@@ -856,14 +848,7 @@ tcp_drain(void)
continue;
INP_WLOCK(inpb);
if ((tcpb = intotcpcb(inpb)) != NULL) {
-   while ((te = LIST_FIRST(&tcpb->t_segq))
-   != NULL) {
-   LIST_REMOVE(te, tqe_q);
-   m_freem(te->tqe_m);
-   uma_zfree(tcp_reass_zone, te);
-   tcpb->t_segqlen--;
-   tcp_reass_qsize--;
-   }
+   tcp_reass_flush(tcpb);
tcp_clean_sackreport(tcpb);
}
INP_WUNLOCK(inpb);

Modified: stable/7/sys/netinet/tcp_var.h
===

svn commit: r214879 - head/sys/sparc64/sparc64

2010-11-06 Thread Marius Strobl
Author: marius
Date: Sat Nov  6 13:58:24 2010
New Revision: 214879
URL: http://svn.freebsd.org/changeset/base/214879

Log:
  Implement pmap_is_prefaultable().
  
  Reviewed by:  alc (with bugfix)

Modified:
  head/sys/sparc64/sparc64/pmap.c

Modified: head/sys/sparc64/sparc64/pmap.c
==
--- head/sys/sparc64/sparc64/pmap.c Sat Nov  6 13:46:58 2010
(r214878)
+++ head/sys/sparc64/sparc64/pmap.c Sat Nov  6 13:58:24 2010
(r214879)
@@ -1960,8 +1960,12 @@ pmap_is_modified(vm_page_t m)
 boolean_t
 pmap_is_prefaultable(pmap_t pmap, vm_offset_t addr)
 {
+   boolean_t rv;
 
-   return (FALSE);
+   PMAP_LOCK(pmap);
+   rv = tsb_tte_lookup(pmap, addr) == NULL;
+   PMAP_UNLOCK(pmap);
+   return (rv);
 }
 
 /*
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r214880 - head/sys/dev/ata

2010-11-06 Thread Alexander Motin
Author: mav
Date: Sat Nov  6 14:22:50 2010
New Revision: 214880
URL: http://svn.freebsd.org/changeset/base/214880

Log:
  Add support for odd-sized PIO transfers, sometimes used by ATAPI.

Modified:
  head/sys/dev/ata/ata-lowlevel.c

Modified: head/sys/dev/ata/ata-lowlevel.c
==
--- head/sys/dev/ata/ata-lowlevel.c Sat Nov  6 13:58:24 2010
(r214879)
+++ head/sys/dev/ata/ata-lowlevel.c Sat Nov  6 14:22:50 2010
(r214880)
@@ -833,12 +833,18 @@ ata_pio_read(struct ata_request *request
 struct ata_channel *ch = device_get_softc(request->parent);
 int size = min(request->transfersize, length);
 int resid;
+uint8_t buf[2];
 
-if (ch->flags & ATA_USE_16BIT || (size % sizeof(int32_t)))
+if (ch->flags & ATA_USE_16BIT || (size % sizeof(int32_t))) {
ATA_IDX_INSW_STRM(ch, ATA_DATA,
  (void*)((uintptr_t)request->data+request->donecount),
  size / sizeof(int16_t));
-else
+   if (size & 1) {
+   ATA_IDX_INSW_STRM(ch, ATA_DATA, (void*)buf, 1);
+   ((uint8_t *)request->data + request->donecount +
+   (size & ~1))[0] = buf[0];
+   }
+} else
ATA_IDX_INSL_STRM(ch, ATA_DATA,
  (void*)((uintptr_t)request->data+request->donecount),
  size / sizeof(int32_t));
@@ -846,7 +852,7 @@ ata_pio_read(struct ata_request *request
 if (request->transfersize < length) {
device_printf(request->parent, "WARNING - %s read data overrun %d>%d\n",
   ata_cmd2str(request), length, request->transfersize);
-   for (resid = request->transfersize; resid < length;
+   for (resid = request->transfersize + (size & 1); resid < length;
 resid += sizeof(int16_t))
ATA_IDX_INW(ch, ATA_DATA);
 }
@@ -858,12 +864,18 @@ ata_pio_write(struct ata_request *reques
 struct ata_channel *ch = device_get_softc(request->parent);
 int size = min(request->transfersize, length);
 int resid;
+uint8_t buf[2];
 
-if (ch->flags & ATA_USE_16BIT || (size % sizeof(int32_t)))
+if (ch->flags & ATA_USE_16BIT || (size % sizeof(int32_t))) {
ATA_IDX_OUTSW_STRM(ch, ATA_DATA,
   (void*)((uintptr_t)request->data+request->donecount),
   size / sizeof(int16_t));
-else
+   if (size & 1) {
+   buf[0] = ((uint8_t *)request->data + request->donecount +
+   (size & ~1))[0];
+   ATA_IDX_OUTSW_STRM(ch, ATA_DATA, (void*)buf, 1);
+   }
+} else
ATA_IDX_OUTSL_STRM(ch, ATA_DATA,
   (void*)((uintptr_t)request->data+request->donecount),
   size / sizeof(int32_t));
@@ -871,7 +883,7 @@ ata_pio_write(struct ata_request *reques
 if (request->transfersize < length) {
device_printf(request->parent, "WARNING - %s write data underrun 
%d>%d\n",
   ata_cmd2str(request), length, request->transfersize);
-   for (resid = request->transfersize; resid < length;
+   for (resid = request->transfersize + (size & 1); resid < length;
 resid += sizeof(int16_t))
ATA_IDX_OUTW(ch, ATA_DATA, 0);
 }
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r214881 - stable/7/sys/vm

2010-11-06 Thread Lawrence Stewart
Author: lstewart
Date: Sat Nov  6 14:38:57 2010
New Revision: 214881
URL: http://svn.freebsd.org/changeset/base/214881

Log:
  MFC r211396 (originally committed by andre):
  
  Add uma_zone_get_max() to obtain the effective limit after a call to
  uma_zone_set_max().
  
  The UMA zone limit is not exactly set to the value supplied but rounded up to
  completely fill the backing store increment (a page normally).  This can lead 
to
  surprising situations where the number of elements allocated from UMA is 
higher
  than the supplied limit value.  The new get function reads back the effective
  value so that the supplied limit value can be adjusted to the real limit.
  
  The base code from r211396 was modified as part of this MFC in order to work
  correctly on FreeBSD 7.
  
  Reviewed by:  jeffr

Modified:
  stable/7/sys/vm/uma.h
  stable/7/sys/vm/uma_core.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/vm/uma.h
==
--- stable/7/sys/vm/uma.h   Sat Nov  6 14:22:50 2010(r214880)
+++ stable/7/sys/vm/uma.h   Sat Nov  6 14:38:57 2010(r214881)
@@ -431,6 +431,18 @@ int uma_zone_set_obj(uma_zone_t zone, st
 void uma_zone_set_max(uma_zone_t zone, int nitems);
 
 /*
+ * Obtains the effective limit on the number of items in a zone
+ *
+ * Arguments:
+ * zone  The zone to obtain the effective limit from
+ *
+ * Return:
+ * 0  No limit
+ * int  The effective limit of the zone
+ */
+int uma_zone_get_max(uma_zone_t zone);
+
+/*
  * The following two routines (uma_zone_set_init/fini)
  * are used to set the backend init/fini pair which acts on an
  * object as it becomes allocated and is placed in a slab within

Modified: stable/7/sys/vm/uma_core.c
==
--- stable/7/sys/vm/uma_core.c  Sat Nov  6 14:22:50 2010(r214880)
+++ stable/7/sys/vm/uma_core.c  Sat Nov  6 14:38:57 2010(r214881)
@@ -2521,6 +2521,24 @@ uma_zone_set_max(uma_zone_t zone, int ni
 }
 
 /* See uma.h */
+int
+uma_zone_get_max(uma_zone_t zone)
+{
+   int nitems;
+   uma_keg_t keg;
+
+   ZONE_LOCK(zone);
+   keg = zone->uz_keg;
+   if (keg->uk_maxpages)
+   nitems = keg->uk_maxpages * keg->uk_ipers;
+   else
+   nitems = 0;
+   ZONE_UNLOCK(zone);
+
+   return (nitems);
+}
+
+/* See uma.h */
 void
 uma_zone_set_init(uma_zone_t zone, uma_init uminit)
 {
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r214882 - in stable/8/sys: netinet netinet6 netipsec

2010-11-06 Thread Bjoern A. Zeeb
Author: bz
Date: Sat Nov  6 14:46:24 2010
New Revision: 214882
URL: http://svn.freebsd.org/changeset/base/214882

Log:
  MFC r214250:
  
Make the IPsec SADB embedded route cache a union to be able to hold both the
legacy and IPv6 route destination address.
Previously in case of IPv6, there was a memory overwrite due to not enough
space for the IPv6 address.
  
  PR:   kern/122565

Modified:
  stable/8/sys/netinet/ip_ipsec.c
  stable/8/sys/netinet6/ip6_ipsec.c
  stable/8/sys/netipsec/ipsec_output.c
  stable/8/sys/netipsec/key.c
  stable/8/sys/netipsec/keydb.h
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/netinet/ip_ipsec.c
==
--- stable/8/sys/netinet/ip_ipsec.c Sat Nov  6 14:38:57 2010
(r214881)
+++ stable/8/sys/netinet/ip_ipsec.c Sat Nov  6 14:46:24 2010
(r214882)
@@ -239,7 +239,7 @@ ip_ipsec_mtu(struct mbuf *m, int mtu)
if (sp->req != NULL &&
sp->req->sav != NULL &&
sp->req->sav->sah != NULL) {
-   ro = &sp->req->sav->sah->sa_route;
+   ro = &sp->req->sav->sah->route_cache.sa_route;
if (ro->ro_rt && ro->ro_rt->rt_ifp) {
mtu =
ro->ro_rt->rt_rmx.rmx_mtu ?

Modified: stable/8/sys/netinet6/ip6_ipsec.c
==
--- stable/8/sys/netinet6/ip6_ipsec.c   Sat Nov  6 14:38:57 2010
(r214881)
+++ stable/8/sys/netinet6/ip6_ipsec.c   Sat Nov  6 14:46:24 2010
(r214882)
@@ -366,7 +366,7 @@ ip6_ipsec_mtu(struct mbuf *m)
if (sp->req != NULL &&
sp->req->sav != NULL &&
sp->req->sav->sah != NULL) {
-   ro = &sp->req->sav->sah->sa_route;
+   ro = &sp->req->sav->sah->route_cache.sa_route;
if (ro->ro_rt && ro->ro_rt->rt_ifp) {
mtu =
ro->ro_rt->rt_rmx.rmx_mtu ?

Modified: stable/8/sys/netipsec/ipsec_output.c
==
--- stable/8/sys/netipsec/ipsec_output.cSat Nov  6 14:38:57 2010
(r214881)
+++ stable/8/sys/netipsec/ipsec_output.cSat Nov  6 14:46:24 2010
(r214882)
@@ -829,7 +829,8 @@ ipsec6_output_tunnel(struct ipsec_output
}
ip6 = mtod(m, struct ip6_hdr *);
 
-   state->ro = &isr->sav->sah->sa_route;
+   state->ro =
+   (struct route *)&isr->sav->sah->route_cache.sin6_route;
state->dst = (struct sockaddr *)&state->ro->ro_dst;
dst6 = (struct sockaddr_in6 *)state->dst;
if (state->ro->ro_rt

Modified: stable/8/sys/netipsec/key.c
==
--- stable/8/sys/netipsec/key.c Sat Nov  6 14:38:57 2010(r214881)
+++ stable/8/sys/netipsec/key.c Sat Nov  6 14:46:24 2010(r214882)
@@ -2767,9 +2767,9 @@ key_delsah(sah)
/* remove from tree of SA index */
if (__LIST_CHAINED(sah))
LIST_REMOVE(sah, chain);
-   if (sah->sa_route.ro_rt) {
-   RTFREE(sah->sa_route.ro_rt);
-   sah->sa_route.ro_rt = (struct rtentry *)NULL;
+   if (sah->route_cache.sa_route.ro_rt) {
+   RTFREE(sah->route_cache.sa_route.ro_rt);
+   sah->route_cache.sa_route.ro_rt = (struct rtentry 
*)NULL;
}
free(sah, M_IPSEC_SAH);
}
@@ -7933,7 +7933,7 @@ key_sa_routechange(dst)
 
SAHTREE_LOCK();
LIST_FOREACH(sah, &V_sahtree, chain) {
-   ro = &sah->sa_route;
+   ro = &sah->route_cache.sa_route;
if (ro->ro_rt && dst->sa_len == ro->ro_dst.sa_len
 && bcmp(dst, &ro->ro_dst, dst->sa_len) == 0) {
RTFREE(ro->ro_rt);

Modified: stable/8/sys/netipsec/keydb.h
==
--- stable/8/sys/netipsec/keydb.h   Sat Nov  6 14:38:57 2010
(r214881)
+++ stable/8/sys/netipsec/keydb.h   Sat Nov  6 14:46:24 2010
(r214882)
@@ -85,6 +85,12 @@ struct seclifetime {
u_int64_t usetime;
 };
 
+union sa_route_union {
+   struct routesa_route;
+   struct routesin_route;  /* Duplicate for consistency. */
+   struct route_in6

svn commit: r214883 - stable/7/sys/netinet

2010-11-06 Thread Lawrence Stewart
Author: lstewart
Date: Sat Nov  6 14:49:10 2010
New Revision: 214883
URL: http://svn.freebsd.org/changeset/base/214883

Log:
  MFC r210203:
  
  - Move common code from the hook functions that fills in a packet node struct 
to
a separate inline function. This further reduces duplicate code that didn't
have a good reason to stay as it was.
  
  - Reorder the malloc of a pkt_node struct in the hook functions such that it
only occurs if we managed to find a usable tcpcb associated with the packet.
  
  - Make the inp_locally_locked variable's type consistent with the prototype of
siftr_siftdata().
  
  Sponsored by: FreeBSD Foundation

Modified:
  stable/7/sys/netinet/siftr.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/netinet/siftr.c
==
--- stable/7/sys/netinet/siftr.cSat Nov  6 14:46:24 2010
(r214882)
+++ stable/7/sys/netinet/siftr.cSat Nov  6 14:49:10 2010
(r214883)
@@ -752,6 +752,67 @@ siftr_findinpcb(int ipver, struct ip *ip
 }
 
 
+static inline void
+siftr_siftdata(struct pkt_node *pn, struct inpcb *inp, struct tcpcb *tp,
+int ipver, int dir, int inp_locally_locked)
+{
+#ifdef SIFTR_IPV6
+   if (ipver == INP_IPV4) {
+   pn->ip_laddr[3] = inp->inp_laddr.s_addr;
+   pn->ip_faddr[3] = inp->inp_faddr.s_addr;
+#else
+   *((uint32_t *)pn->ip_laddr) = inp->inp_laddr.s_addr;
+   *((uint32_t *)pn->ip_faddr) = inp->inp_faddr.s_addr;
+#endif
+#ifdef SIFTR_IPV6
+   } else {
+   pn->ip_laddr[0] = inp->in6p_laddr.s6_addr32[0];
+   pn->ip_laddr[1] = inp->in6p_laddr.s6_addr32[1];
+   pn->ip_laddr[2] = inp->in6p_laddr.s6_addr32[2];
+   pn->ip_laddr[3] = inp->in6p_laddr.s6_addr32[3];
+   pn->ip_faddr[0] = inp->in6p_faddr.s6_addr32[0];
+   pn->ip_faddr[1] = inp->in6p_faddr.s6_addr32[1];
+   pn->ip_faddr[2] = inp->in6p_faddr.s6_addr32[2];
+   pn->ip_faddr[3] = inp->in6p_faddr.s6_addr32[3];
+   }
+#endif
+   pn->tcp_localport = inp->inp_lport;
+   pn->tcp_foreignport = inp->inp_fport;
+   pn->snd_cwnd = tp->snd_cwnd;
+   pn->snd_wnd = tp->snd_wnd;
+   pn->rcv_wnd = tp->rcv_wnd;
+   pn->snd_bwnd = tp->snd_bwnd;
+   pn->snd_ssthresh = tp->snd_ssthresh;
+   pn->snd_scale = tp->snd_scale;
+   pn->rcv_scale = tp->rcv_scale;
+   pn->conn_state = tp->t_state;
+   pn->max_seg_size = tp->t_maxseg;
+   pn->smoothed_rtt = tp->t_srtt;
+   pn->sack_enabled = (tp->t_flags & TF_SACK_PERMIT) != 0;
+   pn->flags = tp->t_flags;
+   pn->rxt_length = tp->t_rxtcur;
+   pn->snd_buf_hiwater = inp->inp_socket->so_snd.sb_hiwat;
+   pn->snd_buf_cc = inp->inp_socket->so_snd.sb_cc;
+   pn->rcv_buf_hiwater = inp->inp_socket->so_rcv.sb_hiwat;
+   pn->rcv_buf_cc = inp->inp_socket->so_rcv.sb_cc;
+   pn->sent_inflight_bytes = tp->snd_max - tp->snd_una;
+
+   /* We've finished accessing the tcb so release the lock. */
+   if (inp_locally_locked)
+   INP_RUNLOCK(inp);
+
+   pn->ipver = ipver;
+   pn->direction = dir;
+
+   /*
+* Significantly more accurate than using getmicrotime(), but slower!
+* Gives true microsecond resolution at the expense of a hit to
+* maximum pps throughput processing when SIFTR is loaded and enabled.
+*/
+   microtime(&pn->tval);
+}
+
+
 /*
  * pfil hook that is called for each IPv4 packet making its way through the
  * stack in either direction.
@@ -764,13 +825,13 @@ static int
 siftr_chkpkt(void *arg, struct mbuf **m, struct ifnet *ifp, int dir,
 struct inpcb *inp)
 {
-   struct pkt_node *pkt_node;
+   struct pkt_node *pn;
struct ip *ip;
struct tcphdr *th;
struct tcpcb *tp;
struct siftr_stats *ss;
unsigned int ip_hl;
-   uint8_t inp_locally_locked;
+   int inp_locally_locked;
 
inp_locally_locked = 0;
ss = DPCPU_PTR(ss);
@@ -824,18 +885,6 @@ siftr_chkpkt(void *arg, struct mbuf **m,
 
INP_LOCK_ASSERT(inp);
 
-   pkt_node = malloc(sizeof(struct pkt_node), M_SIFTR_PKTNODE,
-   M_NOWAIT | M_ZERO);
-
-   if (pkt_node == NULL) {
-   if (dir == PFIL_IN)
-   ss->nskip_in_malloc++;
-   else
-   ss->nskip_out_malloc++;
-
-   goto inp_unlock;
-   }
-
/* Find the TCP control block that corresponds with this packet */
tp = intotcpcb(inp);
 
@@ -850,53 +899,21 @@ siftr_chkpkt(void *arg, struct mbuf **m,
else
ss->nskip_out_tcpcb++;
 
-   free(pkt_node, M_SIFTR_PKTNODE);
g

svn commit: r214884 - in stable/7: share/man/man4 sys/netinet

2010-11-06 Thread Lawrence Stewart
Author: lstewart
Date: Sat Nov  6 14:53:22 2010
New Revision: 214884
URL: http://svn.freebsd.org/changeset/base/214884

Log:
  MFC r213162:
  
  Log the number of segments currently in the reassembly queue.
  
  Sponsored by: FreeBSD Foundation

Modified:
  stable/7/share/man/man4/siftr.4
  stable/7/sys/netinet/siftr.c
Directory Properties:
  stable/7/share/man/   (props changed)
  stable/7/share/man/man1/   (props changed)
  stable/7/share/man/man3/   (props changed)
  stable/7/share/man/man4/   (props changed)
  stable/7/share/man/man5/   (props changed)
  stable/7/share/man/man7/   (props changed)
  stable/7/share/man/man8/   (props changed)
  stable/7/share/man/man9/   (props changed)
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/share/man/man4/siftr.4
==
--- stable/7/share/man/man4/siftr.4 Sat Nov  6 14:49:10 2010
(r214883)
+++ stable/7/share/man/man4/siftr.4 Sat Nov  6 14:53:22 2010
(r214884)
@@ -30,7 +30,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd June 23, 2010
+.Dd September 25, 2010
 .Dt SIFTR 4
 .Os
 .Sh NAME
@@ -198,7 +198,7 @@ The data is CSV formatted.
 .Bd -literal -offset indent
 o,0xbec491a5,1238556193.463551,172.16.7.28,22,172.16.2.5,55931, \\
 1073725440,172312,6144,66560,66608,8,1,4,1448,936,1,996,255, \\
-33304,208,66608,0,208
+33304,208,66608,0,208,0
 .Ed
 .Pp
 Field descriptions are as follows:
@@ -328,6 +328,10 @@ The current number of bytes in the socke
 The current number of unacknowledged bytes in-flight.
 Bytes acknowledged via SACK are not excluded from this count.
 .El
+.Bl -tag -offset indent
+.It Va 26
+The current number of segments in the reassembly queue.
+.El
 .Pp
 The third type of log message is written to the file when the module is 
disabled
 and ceases collecting data from the running kernel.

Modified: stable/7/sys/netinet/siftr.c
==
--- stable/7/sys/netinet/siftr.cSat Nov  6 14:49:10 2010
(r214883)
+++ stable/7/sys/netinet/siftr.cSat Nov  6 14:53:22 2010
(r214884)
@@ -55,7 +55,7 @@
  * SIFTR should be directed to him via email: lastew...@swin.edu.au
  *
  * Initial release date: June 2007
- * Most recent update: June 2010
+ * Most recent update: September 2010
  **/
 
 #include 
@@ -105,7 +105,7 @@ __FBSDID("$FreeBSD$");
  */
 #define V_MAJOR1
 #define V_BACKBREAK2
-#define V_BACKCOMPAT   3
+#define V_BACKCOMPAT   4
 #define MODVERSION __CONCAT(V_MAJOR, __CONCAT(V_BACKBREAK, V_BACKCOMPAT))
 #define MODVERSION_STR __XSTRING(V_MAJOR) "." __XSTRING(V_BACKBREAK) "." \
 __XSTRING(V_BACKCOMPAT)
@@ -226,6 +226,8 @@ struct pkt_node {
u_int   rcv_buf_cc;
/* Number of bytes inflight that we are waiting on ACKs for. */
u_int   sent_inflight_bytes;
+   /* Number of segments currently in the reassembly queue. */
+   int t_segqlen;
/* Link to next pkt_node in the list. */
STAILQ_ENTRY(pkt_node)  nodes;
 };
@@ -448,7 +450,7 @@ siftr_process_pkt(struct pkt_node * pkt_
MAX_LOG_MSG_LEN,
"%c,0x%08x,%zd.%06ld,%x:%x:%x:%x:%x:%x:%x:%x,%u,%x:%x:%x:"
"%x:%x:%x:%x:%x,%u,%ld,%ld,%ld,%ld,%ld,%u,%u,%u,%u,%u,%u,"
-   "%u,%d,%u,%u,%u,%u,%u\n",
+   "%u,%d,%u,%u,%u,%u,%u,%u\n",
direction[pkt_node->direction],
pkt_node->hash,
pkt_node->tval.tv_sec,
@@ -488,7 +490,8 @@ siftr_process_pkt(struct pkt_node * pkt_
pkt_node->snd_buf_cc,
pkt_node->rcv_buf_hiwater,
pkt_node->rcv_buf_cc,
-   pkt_node->sent_inflight_bytes);
+   pkt_node->sent_inflight_bytes,
+   pkt_node->t_segqlen);
} else { /* IPv4 packet */
pkt_node->ip_laddr[0] = FIRST_OCTET(pkt_node->ip_laddr[3]);
pkt_node->ip_laddr[1] = SECOND_OCTET(pkt_node->ip_laddr[3]);
@@ -504,7 +507,7 @@ siftr_process_pkt(struct pkt_node * pkt_
log_buf->ae_bytesused = snprintf(log_buf->ae_data,
MAX_LOG_MSG_LEN,
"%c,0x%08x,%jd.%06ld,%u.%u.%u.%u,%u,%u.%u.%u.%u,%u,%ld,%ld,"
-   "%ld,%ld,%ld,%u,%u,%u,%u,%u,%u,%u,%d,%u,%u,%u,%u,%u\n",
+   "%ld,%ld,%ld,%u,%u,%u,%u,%u,%u,%u,%d,%u,%u,%u,%u,%u,%u\n",
direction[pkt_node->direction],
pkt_node->hash,
(intmax_t)pkt_node->tval.tv_sec,
@@ -536,7 +539,8 @@ siftr_process_pkt(struct pkt_node * pkt_
pkt_node->snd_buf_cc,
   

svn commit: r214885 - head/usr.sbin

2010-11-06 Thread Ulrich Spoerlein
Author: uqs
Date: Sat Nov  6 15:04:48 2010
New Revision: 214885
URL: http://svn.freebsd.org/changeset/base/214885

Log:
  Put string in quotes, like is done everywhere.

Modified:
  head/usr.sbin/Makefile

Modified: head/usr.sbin/Makefile
==
--- head/usr.sbin/Makefile  Sat Nov  6 14:53:22 2010(r214884)
+++ head/usr.sbin/Makefile  Sat Nov  6 15:04:48 2010(r214885)
@@ -155,7 +155,7 @@ SUBDIR+=fdwrite
 SUBDIR+=   freebsd-update
 .endif
 
-.if ${MK_GSSAPI} != no
+.if ${MK_GSSAPI} != "no"
 SUBDIR+=   gssd
 .endif
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r214886 - head/usr.bin/setchannel

2010-11-06 Thread Ulrich Spoerlein
Author: uqs
Date: Sat Nov  6 15:04:56 2010
New Revision: 214886
URL: http://svn.freebsd.org/changeset/base/214886

Log:
  Apply style(9) and unbreak build.
  
  This went unnoticed during the WARNS bump, as this tool is not connected
  to the build.

Modified:
  head/usr.bin/setchannel/setchannel.c

Modified: head/usr.bin/setchannel/setchannel.c
==
--- head/usr.bin/setchannel/setchannel.cSat Nov  6 15:04:48 2010
(r214885)
+++ head/usr.bin/setchannel/setchannel.cSat Nov  6 15:04:56 2010
(r214886)
@@ -1,4 +1,4 @@
-/*
+/*-
  * Copyright (c) 2003, 2004, 2005
  * John Wehle .  All rights reserved.
  *
@@ -28,40 +28,34 @@
 
 /* Set the channel of the tuner card. */
 
-#include 
-#include 
+#include 
+#include 
+
 #include 
 #include 
 #include 
+#include 
+#include 
 #include 
-#include 
-#include 
-#include 
 #include 
 
-#if __FreeBSD_version < 503001
-#  include 
-#  include 
-#else
-#  include 
-#  include 
-#endif
-
+#include 
+#include 
 
 static void
-usage()
+usage(void)
 {
printf
("Usage: setchannel [-a {on|off}] [-c | -r | -s | -t] "
"[-g geom] [-m chnl_set] [chnl | freq]\n"
"  -aEnable / disable AFC.\n"
"  -cSelect composite input.\n"
-"  -dSelect tuner unit number.\n"
-"  -rSelect radio input.\n"
+   "  -dSelect tuner unit number.\n"
+   "  -rSelect radio input.\n"
"  -sSelect svideo input.\n"
-"  -tSelect tuner.\n"
+   "  -tSelect tuner.\n"
"  -gSelect geometry.\n"
-"  352x240 or 352x288 = VCD\n"
+   "  352x240 or 352x288 = VCD\n"
"  480x480 or 480x576 = SVCD\n"
"  352x480 or 352x576 = DVD (half D1)\n"
"  720x480 or 720x576 = DVD (full D1)\n"
@@ -74,7 +68,7 @@ usage()
"  %u = Japan Cable / NTSC\n"
"  %u = Australia / PAL\n"
"  %u = France / SECAM\n"
-"  chnl  Channel\n"
+   "  chnl  Channel\n"
"  freq  Frequency in MHz (must include decimal point).\n",
CHNLSET_NABCST, CHNLSET_CABLEIRC, CHNLSET_WEUROPE, CHNLSET_JPNBCST,
CHNLSET_JPNCABLE, CHNLSET_AUSTRALIA, CHNLSET_FRANCE);
@@ -94,7 +88,7 @@ main(int argc, char *argv[])
int channel_set;
int i;
int status;
-int unit;
+   int unit;
int tfd;
unsigned int channel;
unsigned int fraction;
@@ -111,7 +105,7 @@ main(int argc, char *argv[])
device = 0;
freq = 0;
status = 0;
-unit = 0;
+   unit = 0;
x_size = 0;
y_size = 0;
 
@@ -214,11 +208,11 @@ main(int argc, char *argv[])
exit(1);
}
 
-sprintf(dev_name, DEVNAME_BASE "%d", unit);
-tfd = open(dev_name, O_RDONLY);
+   sprintf(dev_name, DEVNAME_BASE "%d", unit);
+   tfd = open(dev_name, O_RDONLY);
if (tfd < 0) {
fprintf(stderr, "Can't open %s: %s (%d)\n", dev_name,
-strerror(errno), errno);
+   strerror(errno), errno);
exit(1);
}
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r214887 - stable/7/sys/sys

2010-11-06 Thread Lawrence Stewart
Author: lstewart
Date: Sat Nov  6 15:10:31 2010
New Revision: 214887
URL: http://svn.freebsd.org/changeset/base/214887

Log:
  MFC r209050 (originally committed by jhb):
  
  Add helper macros to iterate over available CPUs in the system.
  CPU_FOREACH(i) iterates over the CPU IDs of all available CPUs.  The
  CPU_FIRST() and CPU_NEXT(i) macros can also be used to iterate over
  available CPU IDs.  CPU_NEXT(i) wraps around to CPU_FIRST() rather than
  returning some sort of terminator.
  
  Requested by: rwatson
  Reviewed by:  attilio

Modified:
  stable/7/sys/sys/smp.h
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/sys/smp.h
==
--- stable/7/sys/sys/smp.h  Sat Nov  6 15:04:56 2010(r214886)
+++ stable/7/sys/sys/smp.h  Sat Nov  6 15:10:31 2010(r214887)
@@ -68,6 +68,44 @@ extern cpumask_t all_cpus;
  */
 #defineCPU_ABSENT(x_cpu)   ((all_cpus & (1 << (x_cpu))) == 0)
 
+/*
+ * Macros to iterate over non-absent CPUs.  CPU_FOREACH() takes an
+ * integer iterator and iterates over the available set of CPUs.
+ * CPU_FIRST() returns the id of the first non-absent CPU.  CPU_NEXT()
+ * returns the id of the next non-absent CPU.  It will wrap back to
+ * CPU_FIRST() once the end of the list is reached.  The iterators are
+ * currently implemented via inline functions.
+ */
+#defineCPU_FOREACH(i)  
\
+   for ((i) = 0; (i) <= mp_maxid; (i)++)   \
+   if (!CPU_ABSENT((i)))
+
+static __inline int
+cpu_first(void)
+{
+   int i;
+
+   for (i = 0;; i++)
+   if (!CPU_ABSENT(i))
+   return (i);
+}
+
+static __inline int
+cpu_next(int i)
+{
+
+   for (;;) {
+   i++;
+   if (i > mp_maxid)
+   i = 0;
+   if (!CPU_ABSENT(i))
+   return (i);
+   }
+}
+
+#defineCPU_FIRST() cpu_first()
+#defineCPU_NEXT(i) cpu_next((i))
+
 #ifdef SMP
 /*
  * Machine dependent functions used to initialize MP support.
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r214888 - in stable/7: share/man/man9 sys/vm

2010-11-06 Thread Lawrence Stewart
Author: lstewart
Date: Sat Nov  6 15:21:46 2010
New Revision: 214888
URL: http://svn.freebsd.org/changeset/base/214888

Log:
  MFC r213910:
  
  - Simplify implementation of uma_zone_get_max.
  - Add uma_zone_get_cur which returns the current approximate occupancy of a
zone. This is useful for providing stats via sysctl amongst other things.
  
  Sponsored by: FreeBSD Foundation
  Reviewed by:  gnn, jhb

Modified:
  stable/7/share/man/man9/zone.9
  stable/7/sys/vm/uma.h
  stable/7/sys/vm/uma_core.c
Directory Properties:
  stable/7/share/man/   (props changed)
  stable/7/share/man/man1/   (props changed)
  stable/7/share/man/man3/   (props changed)
  stable/7/share/man/man4/   (props changed)
  stable/7/share/man/man5/   (props changed)
  stable/7/share/man/man7/   (props changed)
  stable/7/share/man/man8/   (props changed)
  stable/7/share/man/man9/   (props changed)
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/share/man/man9/zone.9
==
--- stable/7/share/man/man9/zone.9  Sat Nov  6 15:10:31 2010
(r214887)
+++ stable/7/share/man/man9/zone.9  Sat Nov  6 15:21:46 2010
(r214888)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd June 19, 2008
+.Dd October 9, 2010
 .Dt ZONE 9
 .Os
 .Sh NAME
@@ -35,7 +35,9 @@
 .Nm uma_zfree ,
 .Nm uma_zfree_arg ,
 .Nm uma_zdestroy ,
-.Nm uma_zone_set_max
+.Nm uma_zone_set_max,
+.Nm uma_zone_get_max,
+.Nm uma_zone_get_cur
 .Nd zone allocator
 .Sh SYNOPSIS
 .In sys/param.h
@@ -59,6 +61,10 @@
 .Fn uma_zdestroy "uma_zone_t zone"
 .Ft void
 .Fn uma_zone_set_max "uma_zone_t zone" "int nitems"
+.Ft int
+.Fn uma_zone_get_max "uma_zone_t zone"
+.Ft int
+.Fn uma_zone_get_cur "uma_zone_t zone"
 .Sh DESCRIPTION
 The zone allocator provides an efficient interface for managing
 dynamically-sized collections of items of similar size.
@@ -177,21 +183,36 @@ must have been freed with
 .Fn uma_zfree
 before.
 .Pp
-The purpose of
+The
 .Fn uma_zone_set_max
-is to limit the maximum amount of memory that the system can dedicated
-toward the zone specified by the
-.Fa zone
-argument.
+function limits the number of items
+.Pq and therefore memory
+that can be allocated to
+.Fa zone .
 The
 .Fa nitems
-argument gives the upper limit of items in the zone.
-This limits the total number of items in the zone which includes:
+argument specifies the requested upper limit number of items.
+The effective limit may end up being higher than requested, as the
+implementation will round up to ensure all memory pages allocated to the zone
+are utilised to capacity.
+The limit applies to the total number of items in the zone, which includes
 allocated items, free items and free items in the per-cpu caches.
 On systems with more than one CPU it may not be possible to allocate
 the specified number of items even when there is no shortage of memory,
 because all of the remaining free items may be in the caches of the
 other CPUs when the limit is hit.
+.Pp
+The
+.Fn uma_zone_get_max
+function returns the effective upper limit number of items for a zone.
+.Pp
+The
+.Fn uma_zone_get_cur
+function returns the approximate current occupancy of the zone.
+The returned value is approximate because appropriate synchronisation to
+determine an exact value is not performend by the implementation.
+This ensures low overhead at the expense of potentially stale data being used
+in the calculation.
 .Sh RETURN VALUES
 The
 .Fn uma_zalloc

Modified: stable/7/sys/vm/uma.h
==
--- stable/7/sys/vm/uma.h   Sat Nov  6 15:10:31 2010(r214887)
+++ stable/7/sys/vm/uma.h   Sat Nov  6 15:21:46 2010(r214888)
@@ -443,6 +443,17 @@ void uma_zone_set_max(uma_zone_t zone, i
 int uma_zone_get_max(uma_zone_t zone);
 
 /*
+ * Obtains the approximate current number of items allocated from a zone
+ *
+ * Arguments:
+ * zone  The zone to obtain the current allocation count from
+ *
+ * Return:
+ * int  The approximate current number of items allocated from the zone
+ */
+int uma_zone_get_cur(uma_zone_t zone);
+
+/*
  * The following two routines (uma_zone_set_init/fini)
  * are used to set the backend init/fini pair which acts on an
  * object as it becomes allocated and is placed in a slab within

Modified: stable/7/sys/vm/uma_core.c
==
--- stable/7/sys/vm/uma_core.c  Sat Nov  6 15:10:31 2010(r214887)
+++ stable/7/sys/vm/uma_core.c  Sat Nov  6 15:21:46 2010(r214888)
@@ -2529,16 +2529,36 @@ uma_zone_get_max(uma_zone_t zone)
 
ZONE_LOCK(zone);
keg = zone->uz_keg;
-   if (keg->uk_maxpages)
-   nitems = keg->uk_maxpages * keg->uk_ipers;
-   else
-   nitem

svn commit: r214889 - stable/7/sys/netinet

2010-11-06 Thread Lawrence Stewart
Author: lstewart
Date: Sat Nov  6 15:40:34 2010
New Revision: 214889
URL: http://svn.freebsd.org/changeset/base/214889

Log:
  MFC r213912:
  
  - Switch the "net.inet.tcp.reass.cursegments" and
"net.inet.tcp.reass.maxsegments" sysctl variables to be based on UMA zone
stats. The value returned by the cursegments sysctl is approximate owing to
the way in which uma_zone_get_cur is implemented.
  
  - Discontinue use of V_tcp_reass_qsize as a global reassembly segment count
variable in the reassembly implementation. The variable was used without
proper synchronisation and was duplicating accounting done by UMA already. 
The
lack of synchronisation was particularly problematic on SMP systems
terminating many TCP sessions, resulting in poor TCP performance for
connections with non-zero packet loss.
  
  The base code from r213912 was modified as part of this MFC in order to work
  correctly on FreeBSD 7.
  
  Sponsored by: FreeBSD Foundation
  Reviewed by:  andre, gnn, rpaulo (as part of a larger patch)

Modified:
  stable/7/sys/netinet/tcp_reass.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/netinet/tcp_reass.c
==
--- stable/7/sys/netinet/tcp_reass.cSat Nov  6 15:21:46 2010
(r214888)
+++ stable/7/sys/netinet/tcp_reass.cSat Nov  6 15:40:34 2010
(r214889)
@@ -73,17 +73,20 @@ __FBSDID("$FreeBSD$");
 #include 
 #endif /* TCPDEBUG */
 
+static int tcp_reass_sysctl_maxseg(SYSCTL_HANDLER_ARGS);
+static int tcp_reass_sysctl_qsize(SYSCTL_HANDLER_ARGS);
+
 SYSCTL_NODE(_net_inet_tcp, OID_AUTO, reass, CTLFLAG_RW, 0,
 "TCP Segment Reassembly Queue");
 
 static int tcp_reass_maxseg = 0;
-SYSCTL_INT(_net_inet_tcp_reass, OID_AUTO, maxsegments, CTLFLAG_RDTUN,
-&tcp_reass_maxseg, 0,
+SYSCTL_PROC(_net_inet_tcp_reass, OID_AUTO, maxsegments, CTLFLAG_RDTUN,
+&tcp_reass_maxseg, 0, &tcp_reass_sysctl_maxseg, "I",
 "Global maximum number of TCP Segments in Reassembly Queue");
 
 static int tcp_reass_qsize = 0;
-SYSCTL_INT(_net_inet_tcp_reass, OID_AUTO, cursegments, CTLFLAG_RD,
-&tcp_reass_qsize, 0,
+SYSCTL_PROC(_net_inet_tcp_reass, OID_AUTO, cursegments, CTLFLAG_RD,
+&tcp_reass_qsize, 0, &tcp_reass_sysctl_qsize, "I",
 "Global number of TCP Segments currently in Reassembly Queue");
 
 static int tcp_reass_maxqlen = 48;
@@ -133,7 +136,6 @@ tcp_reass_flush(struct tcpcb *tp)
m_freem(qe->tqe_m);
uma_zfree(tcp_reass_zone, qe);
tp->t_segqlen--;
-   tcp_reass_qsize--;
}
 
KASSERT((tp->t_segqlen == 0),
@@ -141,6 +143,20 @@ tcp_reass_flush(struct tcpcb *tp)
tp, tp->t_segqlen));
 }
 
+static int
+tcp_reass_sysctl_maxseg(SYSCTL_HANDLER_ARGS)
+{
+   tcp_reass_maxseg = uma_zone_get_max(tcp_reass_zone);
+   return (sysctl_handle_int(oidp, arg1, arg2, req));
+}
+
+static int
+tcp_reass_sysctl_qsize(SYSCTL_HANDLER_ARGS)
+{
+   tcp_reass_qsize = uma_zone_get_cur(tcp_reass_zone);
+   return (sysctl_handle_int(oidp, arg1, arg2, req));
+}
+
 int
 tcp_reass(struct tcpcb *tp, struct tcphdr *th, int *tlenp, struct mbuf *m)
 {
@@ -170,12 +186,10 @@ tcp_reass(struct tcpcb *tp, struct tcphd
 * Limit the number of segments in the reassembly queue to prevent
 * holding on to too many segments (and thus running out of mbufs).
 * Make sure to let the missing segment through which caused this
-* queue.  Always keep one global queue entry spare to be able to
-* process the missing segment.
+* queue.
 */
if (th->th_seq != tp->rcv_nxt &&
-   (tcp_reass_qsize + 1 >= tcp_reass_maxseg ||
-tp->t_segqlen >= tcp_reass_maxqlen)) {
+tp->t_segqlen >= tcp_reass_maxqlen) {
tcp_reass_overflows++;
tcpstat.tcps_rcvmemdrop++;
m_freem(m);
@@ -195,7 +209,6 @@ tcp_reass(struct tcpcb *tp, struct tcphd
return (0);
}
tp->t_segqlen++;
-   tcp_reass_qsize++;
 
/*
 * Find a segment which begins after this one does.
@@ -222,7 +235,6 @@ tcp_reass(struct tcpcb *tp, struct tcphd
m_freem(m);
uma_zfree(tcp_reass_zone, te);
tp->t_segqlen--;
-   tcp_reass_qsize--;
/*
 * Try to present any queued data
 * at the left window edge to the user.
@@ -259,7 +271,6 @@ tcp_reass(struct tcpcb *tp, struct tcphd
m_freem(q->tqe_m);
uma_zfree(tcp_reass_zone, q);
tp->t_segqlen--;
-   tcp_reass_qsize--;

svn commit: r214890 - stable/7/sys/netinet

2010-11-06 Thread Lawrence Stewart
Author: lstewart
Date: Sat Nov  6 15:49:59 2010
New Revision: 214890
URL: http://svn.freebsd.org/changeset/base/214890

Log:
  MFC r213913:
  
  Retire the system-wide, per-reassembly queue segment limit. The mechanism is 
far
  too coarse grained to be useful and the default value significantly degrades 
TCP
  performance on moderate to high bandwidth-delay product paths with non-zero 
loss
  (e.g. 5+Mbps connections across the public Internet often suffer).
  
  Replace the outgoing mechanism with an individual per-queue limit based on the
  number of MSS segments that fit into the socket's receive buffer.  This should
  strike a good balance between performance and the potential for resource
  exhaustion when FreeBSD is acting as a TCP receiver. With socket buffer
  autotuning (which is enabled by default), the reassembly queue tracks the 
socket
  buffer and benefits too.
  
  As the XXX comment suggests, my testing uncovered some unexpected behaviour
  which requires further investigation. By using so->so_rcv.sb_hiwat instead of
  sbspace(&so->so_rcv), we allow more segments to be held across both the socket
  receive buffer and reassembly queue than we probably should. The tradeoff is
  better performance in at least one common scenario, versus a devious sender's
  ability to consume more resources on a FreeBSD receiver.
  
  The base code from r213913 was modified as part of this MFC in order to work
  correctly on FreeBSD 7.
  
  Sponsored by: FreeBSD Foundation
  Reviewed by:  andre, gnn, rpaulo

Modified:
  stable/7/sys/netinet/tcp_reass.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/netinet/tcp_reass.c
==
--- stable/7/sys/netinet/tcp_reass.cSat Nov  6 15:40:34 2010
(r214889)
+++ stable/7/sys/netinet/tcp_reass.cSat Nov  6 15:49:59 2010
(r214890)
@@ -89,11 +89,6 @@ SYSCTL_PROC(_net_inet_tcp_reass, OID_AUT
 &tcp_reass_qsize, 0, &tcp_reass_sysctl_qsize, "I",
 "Global number of TCP Segments currently in Reassembly Queue");
 
-static int tcp_reass_maxqlen = 48;
-SYSCTL_INT(_net_inet_tcp_reass, OID_AUTO, maxqlen, CTLFLAG_RW,
-&tcp_reass_maxqlen, 0,
-"Maximum number of TCP Segments per individual Reassembly Queue");
-
 static int tcp_reass_overflows = 0;
 SYSCTL_INT(_net_inet_tcp_reass, OID_AUTO, overflows, CTLFLAG_RD,
 &tcp_reass_overflows, 0,
@@ -183,13 +178,23 @@ tcp_reass(struct tcpcb *tp, struct tcphd
goto present;
 
/*
-* Limit the number of segments in the reassembly queue to prevent
-* holding on to too many segments (and thus running out of mbufs).
-* Make sure to let the missing segment through which caused this
-* queue.
+* Limit the number of segments that can be queued to reduce the
+* potential for mbuf exhaustion. For best performance, we want to be
+* able to queue a full window's worth of segments. The size of the
+* socket receive buffer determines our advertised window and grows
+* automatically when socket buffer autotuning is enabled. Use it as the
+* basis for our queue limit.
+* Always let the missing segment through which caused this queue.
+* NB: Access to the socket buffer is left intentionally unlocked as we
+* can tolerate stale information here.
+*
+* XXXLAS: Using sbspace(so->so_rcv) instead of so->so_rcv.sb_hiwat
+* should work but causes packets to be dropped when they shouldn't.
+* Investigate why and re-evaluate the below limit after the behaviour
+* is understood.
 */
if (th->th_seq != tp->rcv_nxt &&
-tp->t_segqlen >= tcp_reass_maxqlen) {
+tp->t_segqlen >= (so->so_rcv.sb_hiwat / tp->t_maxseg) + 1) {
tcp_reass_overflows++;
tcpstat.tcps_rcvmemdrop++;
m_freem(m);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r214891 - in stable/7/sys: netinet netinet6 netipsec

2010-11-06 Thread Bjoern A. Zeeb
Author: bz
Date: Sat Nov  6 15:56:44 2010
New Revision: 214891
URL: http://svn.freebsd.org/changeset/base/214891

Log:
  MFC r214250:
  
Make the IPsec SADB embedded route cache a union to be able to hold both the
legacy and IPv6 route destination address.
Previously in case of IPv6, there was a memory overwrite due to not enough
space for the IPv6 address.
  
  PR:   kern/122565

Modified:
  stable/7/sys/netinet/ip_ipsec.c
  stable/7/sys/netinet6/ip6_ipsec.c
  stable/7/sys/netipsec/ipsec_output.c
  stable/7/sys/netipsec/key.c
  stable/7/sys/netipsec/keydb.h
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/netinet/ip_ipsec.c
==
--- stable/7/sys/netinet/ip_ipsec.c Sat Nov  6 15:49:59 2010
(r214890)
+++ stable/7/sys/netinet/ip_ipsec.c Sat Nov  6 15:56:44 2010
(r214891)
@@ -220,7 +220,7 @@ ip_ipsec_mtu(struct mbuf *m, int mtu)
if (sp->req != NULL &&
sp->req->sav != NULL &&
sp->req->sav->sah != NULL) {
-   ro = &sp->req->sav->sah->sa_route;
+   ro = &sp->req->sav->sah->route_cache.sa_route;
if (ro->ro_rt && ro->ro_rt->rt_ifp) {
mtu =
ro->ro_rt->rt_rmx.rmx_mtu ?

Modified: stable/7/sys/netinet6/ip6_ipsec.c
==
--- stable/7/sys/netinet6/ip6_ipsec.c   Sat Nov  6 15:49:59 2010
(r214890)
+++ stable/7/sys/netinet6/ip6_ipsec.c   Sat Nov  6 15:56:44 2010
(r214891)
@@ -346,7 +346,7 @@ ip6_ipsec_mtu(struct mbuf *m)
if (sp->req != NULL &&
sp->req->sav != NULL &&
sp->req->sav->sah != NULL) {
-   ro = &sp->req->sav->sah->sa_route;
+   ro = &sp->req->sav->sah->route_cache.sa_route;
if (ro->ro_rt && ro->ro_rt->rt_ifp) {
mtu =
ro->ro_rt->rt_rmx.rmx_mtu ?

Modified: stable/7/sys/netipsec/ipsec_output.c
==
--- stable/7/sys/netipsec/ipsec_output.cSat Nov  6 15:49:59 2010
(r214890)
+++ stable/7/sys/netipsec/ipsec_output.cSat Nov  6 15:56:44 2010
(r214891)
@@ -773,7 +773,8 @@ ipsec6_output_tunnel(struct ipsec_output
}
ip6 = mtod(m, struct ip6_hdr *);
 
-   state->ro = &isr->sav->sah->sa_route;
+   state->ro =
+   (struct route *)&isr->sav->sah->route_cache.sin6_route;
state->dst = (struct sockaddr *)&state->ro->ro_dst;
dst6 = (struct sockaddr_in6 *)state->dst;
if (state->ro->ro_rt

Modified: stable/7/sys/netipsec/key.c
==
--- stable/7/sys/netipsec/key.c Sat Nov  6 15:49:59 2010(r214890)
+++ stable/7/sys/netipsec/key.c Sat Nov  6 15:56:44 2010(r214891)
@@ -2674,9 +2674,9 @@ key_delsah(sah)
/* remove from tree of SA index */
if (__LIST_CHAINED(sah))
LIST_REMOVE(sah, chain);
-   if (sah->sa_route.ro_rt) {
-   RTFREE(sah->sa_route.ro_rt);
-   sah->sa_route.ro_rt = (struct rtentry *)NULL;
+   if (sah->route_cache.sa_route.ro_rt) {
+   RTFREE(sah->route_cache.sa_route.ro_rt);
+   sah->route_cache.sa_route.ro_rt = (struct rtentry 
*)NULL;
}
free(sah, M_IPSEC_SAH);
}
@@ -7196,7 +7196,7 @@ key_sa_routechange(dst)
 
SAHTREE_LOCK();
LIST_FOREACH(sah, &sahtree, chain) {
-   ro = &sah->sa_route;
+   ro = &sah->route_cache.sa_route;
if (ro->ro_rt && dst->sa_len == ro->ro_dst.sa_len
 && bcmp(dst, &ro->ro_dst, dst->sa_len) == 0) {
RTFREE(ro->ro_rt);

Modified: stable/7/sys/netipsec/keydb.h
==
--- stable/7/sys/netipsec/keydb.h   Sat Nov  6 15:49:59 2010
(r214890)
+++ stable/7/sys/netipsec/keydb.h   Sat Nov  6 15:56:44 2010
(r214891)
@@ -85,6 +85,12 @@ struct seclifetime {
u_int64_t usetime;
 };
 
+union sa_route_union {
+   struct routesa_route;
+   struct routesin_route;  /* Duplicate for consistency. */
+   struct route_in6sin6_route;
+};
+
 /* Security Association Data Base */
 struct secashead {
LIST_ENTRY(secashea

svn commit: r214892 - stable/8/release/powerpc

2010-11-06 Thread Marcel Moolenaar
Author: marcel
Date: Sat Nov  6 16:09:25 2010
New Revision: 214892
URL: http://svn.freebsd.org/changeset/base/214892

Log:
  MFC 213381:
  Replace an obsolete flag -L in an mkisofs(1) command line with
  -allow-leading-dots to fix "make release" for FreeBSD/powerpc.
  
  Author: hrs

Modified:
  stable/8/release/powerpc/mkisoimages.sh
Directory Properties:
  stable/8/release/powerpc/   (props changed)

Modified: stable/8/release/powerpc/mkisoimages.sh
==
--- stable/8/release/powerpc/mkisoimages.sh Sat Nov  6 15:56:44 2010
(r214891)
+++ stable/8/release/powerpc/mkisoimages.sh Sat Nov  6 16:09:25 2010
(r214892)
@@ -54,4 +54,4 @@ fi
 LABEL=$1; shift
 NAME=$1; shift
 
-mkisofs $bootable -r -hfs -part -no-desktop -hfs-volid $LABEL -l -J -L -o 
$NAME $*
+mkisofs $bootable -r -hfs -part -no-desktop -hfs-volid $LABEL -l -J 
-allow-leading-dots -o $NAME $*
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r214893 - head/usr.bin/fold

2010-11-06 Thread Jean-Sebastien Pedron
Author: dumbbell
Date: Sat Nov  6 17:48:46 2010
New Revision: 214893
URL: http://svn.freebsd.org/changeset/base/214893

Log:
  Fix a segmentation fault in argument processing.
  
  The crash was caused by a command line such as this one:
  # foldl -b1
  
  PR:   bin/151592
  Reported by:  Marcus Reid 
  Tested by:Marcus Reid 
  MFC after:3 days

Modified:
  head/usr.bin/fold/fold.c

Modified: head/usr.bin/fold/fold.c
==
--- head/usr.bin/fold/fold.cSat Nov  6 16:09:25 2010(r214892)
+++ head/usr.bin/fold/fold.cSat Nov  6 17:48:46 2010(r214893)
@@ -71,14 +71,14 @@ int sflag;  /* Split on word boundaries
 int
 main(int argc, char **argv)
 {
-   int ch;
+   int ch, previous_ch;
int rval, width;
-   char *p;
 
(void) setlocale(LC_CTYPE, "");
 
width = -1;
-   while ((ch = getopt(argc, argv, "0123456789bsw:")) != -1)
+   previous_ch = 0;
+   while ((ch = getopt(argc, argv, "0123456789bsw:")) != -1) {
switch (ch) {
case 'b':
bflag = 1;
@@ -93,17 +93,33 @@ main(int argc, char **argv)
break;
case '0': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9':
-   if (width == -1) {
-   p = argv[optind - 1];
-   if (p[0] == '-' && p[1] == ch && !p[2])
-   width = atoi(++p);
-   else
-   width = atoi(argv[optind] + 1);
+   /* Accept a width as eg. -30. Note that a width
+* specified using the -w option is always used prior
+* to this undocumented option. */
+   switch (previous_ch) {
+   case '0': case '1': case '2': case '3': case '4':
+   case '5': case '6': case '7': case '8': case '9':
+   /* The width is a number with multiple digits:
+* add the last one. */
+   width = width * 10 + (ch - '0');
+   break;
+   default:
+   /* Set the width, unless it was previously
+* set. For instance, the following options
+* would all give a width of 5 and not 10:
+*   -10 -w5
+*   -5b10
+*   -5 -10b */
+   if (width == -1)
+   width = ch - '0';
+   break;
}
break;
default:
usage();
}
+   previous_ch = ch;
+   }
argv += optind;
argc -= optind;
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r214894 - in head/sys: dev/bwi dev/bwn dev/iwn dev/ral dev/usb/wlan dev/wpi net80211

2010-11-06 Thread Bernhard Schmidt
Author: bschmidt
Date: Sat Nov  6 18:17:20 2010
New Revision: 214894
URL: http://svn.freebsd.org/changeset/base/214894

Log:
  Instead of using the AMRR ratectl algo as default for drivers which have
  the IEEE80211_C_RATECTL flag set, default to NONE for all drivers. Only if
  a driver calls ieee80211_ratectl_init() check if the NONE algo is still
  selected and try to use AMRR in that case. Drivers are still free to use
  any other algo by calling ieee80211_ratectl_set() prior to the
  ieee80211_ratectl_init() call.
  
  After this change it is now safe to assume that a ratectl algo is always
  available and selected, which renders the IEEE80211_C_RATECTL flag pretty
  much useless. Therefore revert r211314 and 211546.
  
  Reviewed by:  rpaulo
  MFC after:2 weeks

Modified:
  head/sys/dev/bwi/if_bwi.c
  head/sys/dev/bwn/if_bwn.c
  head/sys/dev/iwn/if_iwn.c
  head/sys/dev/ral/rt2560.c
  head/sys/dev/ral/rt2661.c
  head/sys/dev/usb/wlan/if_rum.c
  head/sys/dev/usb/wlan/if_run.c
  head/sys/dev/usb/wlan/if_ural.c
  head/sys/dev/usb/wlan/if_zyd.c
  head/sys/dev/wpi/if_wpi.c
  head/sys/net80211/ieee80211.c
  head/sys/net80211/ieee80211_node.c
  head/sys/net80211/ieee80211_ratectl.c
  head/sys/net80211/ieee80211_ratectl.h
  head/sys/net80211/ieee80211_sta.c
  head/sys/net80211/ieee80211_var.h

Modified: head/sys/dev/bwi/if_bwi.c
==
--- head/sys/dev/bwi/if_bwi.c   Sat Nov  6 17:48:46 2010(r214893)
+++ head/sys/dev/bwi/if_bwi.c   Sat Nov  6 18:17:20 2010(r214894)
@@ -511,8 +511,7 @@ bwi_attach(struct bwi_softc *sc)
  IEEE80211_C_SHPREAMBLE |
  IEEE80211_C_WPA |
  IEEE80211_C_BGSCAN |
- IEEE80211_C_MONITOR |
- IEEE80211_C_RATECTL;
+ IEEE80211_C_MONITOR;
ic->ic_opmode = IEEE80211_M_STA;
ieee80211_ifattach(ic, macaddr);
 

Modified: head/sys/dev/bwn/if_bwn.c
==
--- head/sys/dev/bwn/if_bwn.c   Sat Nov  6 17:48:46 2010(r214893)
+++ head/sys/dev/bwn/if_bwn.c   Sat Nov  6 18:17:20 2010(r214894)
@@ -1070,7 +1070,6 @@ bwn_attach_post(struct bwn_softc *sc)
| IEEE80211_C_WPA   /* capable of WPA1+WPA2 */
| IEEE80211_C_BGSCAN/* capable of bg scanning */
| IEEE80211_C_TXPMGT/* capable of txpow mgt */
-   | IEEE80211_C_RATECTL   /* use ratectl */
;
 
ic->ic_flags_ext |= IEEE80211_FEXT_SWBMISS; /* s/w bmiss */

Modified: head/sys/dev/iwn/if_iwn.c
==
--- head/sys/dev/iwn/if_iwn.c   Sat Nov  6 17:48:46 2010(r214893)
+++ head/sys/dev/iwn/if_iwn.c   Sat Nov  6 18:17:20 2010(r214894)
@@ -584,7 +584,6 @@ iwn_attach(device_t dev)
| IEEE80211_C_IBSS  /* ibss/adhoc mode */
 #endif
| IEEE80211_C_WME   /* WME */
-   | IEEE80211_C_RATECTL   /* use ratectl */
;
 #if 0  /* HT */
/* XXX disable until HT channel setup works */

Modified: head/sys/dev/ral/rt2560.c
==
--- head/sys/dev/ral/rt2560.c   Sat Nov  6 17:48:46 2010(r214893)
+++ head/sys/dev/ral/rt2560.c   Sat Nov  6 18:17:20 2010(r214894)
@@ -291,7 +291,6 @@ rt2560_attach(device_t dev, int id)
 #ifdef notyet
| IEEE80211_C_TXFRAG/* handle tx frags */
 #endif
-   | IEEE80211_C_RATECTL   /* use ratectl */
;
 
bands = 0;

Modified: head/sys/dev/ral/rt2661.c
==
--- head/sys/dev/ral/rt2661.c   Sat Nov  6 17:48:46 2010(r214893)
+++ head/sys/dev/ral/rt2661.c   Sat Nov  6 18:17:20 2010(r214894)
@@ -294,7 +294,6 @@ rt2661_attach(device_t dev, int id)
| IEEE80211_C_TXFRAG/* handle tx frags */
| IEEE80211_C_WME   /* 802.11e */
 #endif
-   | IEEE80211_C_RATECTL   /* use ratectl */
;
 
bands = 0;

Modified: head/sys/dev/usb/wlan/if_rum.c
==
--- head/sys/dev/usb/wlan/if_rum.c  Sat Nov  6 17:48:46 2010
(r214893)
+++ head/sys/dev/usb/wlan/if_rum.c  Sat Nov  6 18:17:20 2010
(r214894)
@@ -496,7 +496,6 @@ rum_attach(device_t self)
| IEEE80211_C_SHSLOT/* short slot time supported */
| IEEE80211_C_BGSCAN/* bg scanning supported */
| IEEE80211_C_WPA   /* 802.11i */
-   | IEEE80211_C_RATECTL   /* use ratectl */
;
 
bands = 0;

Modified: 

svn commit: r214896 - head/sys/dev/ata

2010-11-06 Thread Alexander Motin
Author: mav
Date: Sat Nov  6 19:11:49 2010
New Revision: 214896
URL: http://svn.freebsd.org/changeset/base/214896

Log:
  Mark command submission timeouts as timeouts. This should trigger device
  resets and increase chances of getting device back again.

Modified:
  head/sys/dev/ata/ata-lowlevel.c

Modified: head/sys/dev/ata/ata-lowlevel.c
==
--- head/sys/dev/ata/ata-lowlevel.c Sat Nov  6 18:36:21 2010
(r214895)
+++ head/sys/dev/ata/ata-lowlevel.c Sat Nov  6 19:11:49 2010
(r214896)
@@ -672,7 +672,8 @@ ata_generic_command(struct ata_request *
 /* ready to issue command ? */
 if (ata_wait(ch, request->unit, 0) < 0) { 
device_printf(request->parent, "timeout waiting to issue command\n");
-   return -1;
+   request->flags |= ATA_R_TIMEOUT;
+   return (-1);
 }
 
 /* enable interrupt */
@@ -697,13 +698,16 @@ ata_generic_command(struct ata_request *
 
/* command interrupt device ? just return and wait for interrupt */
if (request->flags & ATA_R_ATAPI_INTR)
-   return 0;
+   return (0);
 
/* command processed ? */
res = ata_wait(ch, request->unit, 0);
if (res != 0) {
-   if (res < 0)
-   device_printf(request->parent, "timeout waiting for PACKET 
command\n");
+   if (res < 0) {
+   device_printf(request->parent,
+   "timeout waiting for PACKET command\n");
+   request->flags |= ATA_R_TIMEOUT;
+   }
return (-1);
}
/* wait for ready to write ATAPI command block */
@@ -717,9 +721,10 @@ ata_generic_command(struct ata_request *
DELAY(20);
}
if (timeout <= 0) {
-   device_printf(request->parent, "timeout waiting for ATAPI ready\n");
-   request->result = EIO;
-   return -1;
+   device_printf(request->parent,
+   "timeout waiting for ATAPI ready\n");
+   request->flags |= ATA_R_TIMEOUT;
+   return (-1);
}
 
/* this seems to be needed for some (slow) devices */
@@ -735,7 +740,7 @@ ata_generic_command(struct ata_request *
/* issue command to controller */
ATA_IDX_OUTB(ch, ATA_COMMAND, request->u.ata.command);
 }
-return 0;
+return (0);
 }
 
 static void
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r214897 - stable/8/etc/periodic/security

2010-11-06 Thread Gabor Kovesdan
Author: gabor
Date: Sat Nov  6 21:04:01 2010
New Revision: 214897
URL: http://svn.freebsd.org/changeset/base/214897

Log:
  MFC r210254:
  
- Add a periodic script, which can be used to find installed ports' files 
with
  mismatched checksum
  
  MFC r211141
  
- Fixes to the chkportsum script to handle better some special cases,
  like spaces in filename
  
  Approved by:  delphij (mentor)

Added:
 - copied unchanged from r214895, head/etc/periodic/security/460.chkportsum
Directory Properties:
  stable/8/etc/periodic/security/460.chkportsum   (props changed)
Modified:
  stable/8/etc/periodic/security/Makefile

Copied: stable/8/etc/periodic/security/460.chkportsum (from r214895, 
head/etc/periodic/security/460.chkportsum)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ stable/8/etc/periodic/security/460.chkportsum   Sat Nov  6 21:04:01 
2010(r214897, copy of r214895, 
head/etc/periodic/security/460.chkportsum)
@@ -0,0 +1,68 @@
+#!/bin/sh -
+#
+# Copyright (c) 2010  The FreeBSD Project
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#notice, this list of conditions and the following disclaimer in the
+#documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (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$
+#
+
+if [ -r /etc/defaults/periodic.conf ]
+then
+. /etc/defaults/periodic.conf
+source_periodic_confs
+fi
+
+. /etc/periodic/security/security.functions
+
+rc=0
+
+echo ""
+echo 'Checking for ports with mismatched checksums:'
+
+case "${daily_status_security_chkportsum_enable}" in
+   [Yy][Ee][Ss])
+   set -f
+   pkg_info -ga 2>/dev/null | \
+   while IFS= read -r line; do
+   set -- $line
+   case $1 in
+   Information)
+   case $2 in
+   for) name="${3%%:}" ;;
+   *) name='??' ;;
+   esac
+   ;;
+   Mismatched|'') ;;
+   *) [ -n "${name}" ] &&
+   echo "${name}: ${line%% fails the original MD5 
checksum}"
+   ;;
+   esac
+   done
+   ;;
+   *)
+   rc=0
+   ;;
+esac
+
+exit $rc

Modified: stable/8/etc/periodic/security/Makefile
==
--- stable/8/etc/periodic/security/Makefile Sat Nov  6 19:11:49 2010
(r214896)
+++ stable/8/etc/periodic/security/Makefile Sat Nov  6 21:04:01 2010
(r214897)
@@ -6,6 +6,7 @@ FILES=  100.chksetuid \
200.chkmounts \
300.chkuid0 \
400.passwdless \
+   460.chkportsum \
410.logincheck \
700.kernelmsg \
800.loginfail \
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r214898 - head/sys/dev/sk

2010-11-06 Thread Pyun YongHyeon
Author: yongari
Date: Sat Nov  6 21:54:32 2010
New Revision: 214898
URL: http://svn.freebsd.org/changeset/base/214898

Log:
  If we got an invalid station address, generate random address. This
  might be caused by broken BIOS.
  
  Reported by:  "Mikhail T."  aldan.algebra.com>
  MFC after:1 week

Modified:
  head/sys/dev/sk/if_sk.c

Modified: head/sys/dev/sk/if_sk.c
==
--- head/sys/dev/sk/if_sk.c Sat Nov  6 21:04:01 2010(r214897)
+++ head/sys/dev/sk/if_sk.c Sat Nov  6 21:54:32 2010(r214898)
@@ -1319,8 +1319,10 @@ sk_attach(dev)
struct sk_softc *sc;
struct sk_if_softc  *sc_if;
struct ifnet*ifp;
+   u_int32_t   r;
int error, i, phy, port;
u_char  eaddr[6];
+   u_char  inv_mac[] = {0, 0, 0, 0, 0, 0};
 
if (dev == NULL)
return(EINVAL);
@@ -1400,6 +1402,23 @@ sk_attach(dev)
eaddr[i] =
sk_win_read_1(sc, SK_MAC0_0 + (port * 8) + i);
 
+   /* Verify whether the station address is invalid or not. */
+   if (bcmp(eaddr, inv_mac, sizeof(inv_mac)) == 0) {
+   device_printf(sc_if->sk_if_dev,
+   "Generating random ethernet address\n");
+   r = arc4random();
+   /*
+* Set OUI to convenient locally assigned address.  'b'
+* is 0x62, which has the locally assigned bit set, and
+* the broadcast/multicast bit clear.
+*/
+   eaddr[0] = 'b';
+   eaddr[1] = 's';
+   eaddr[2] = 'd';
+   eaddr[3] = (r >> 16) & 0xff;
+   eaddr[4] = (r >>  8) & 0xff;
+   eaddr[5] = (r >>  0) & 0xff;
+   }
/*
 * Set up RAM buffer addresses. The NIC will have a certain
 * amount of SRAM on it, somewhere between 512K and 2MB. We
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r214899 - head/sys/dev/sk

2010-11-06 Thread Pyun YongHyeon
Author: yongari
Date: Sat Nov  6 22:07:22 2010
New Revision: 214899
URL: http://svn.freebsd.org/changeset/base/214899

Log:
  Fix a long standing bug in programming station address for Yukon
  controllers. sk(4) never reprogrammed station address for Yukon
  controllers so overriding station address with ifconfig(8) was not
  possible.
  Fix the bug by reprogramming all registers that control station
  address, flow-control and virtual station address. Virtual station
  address has no use at this moment since driver does not make use of
  fail over feature.
  
  Tested by:"Mikhail T."  aldan.algebra.com>
  MFC after:1 week

Modified:
  head/sys/dev/sk/if_sk.c

Modified: head/sys/dev/sk/if_sk.c
==
--- head/sys/dev/sk/if_sk.c Sat Nov  6 21:54:32 2010(r214898)
+++ head/sys/dev/sk/if_sk.c Sat Nov  6 22:07:22 2010(r214899)
@@ -3356,6 +3356,7 @@ sk_init_yukon(sc_if)
u_int16_t   reg;
struct sk_softc *sc;
struct ifnet*ifp;
+   u_int8_t*eaddr;
int i;
 
SK_IF_LOCK_ASSERT(sc_if);
@@ -3431,19 +3432,19 @@ sk_init_yukon(sc_if)
reg |= YU_SMR_MFL_JUMBO;
SK_YU_WRITE_2(sc_if, YUKON_SMR, reg);
 
-   /* Setup Yukon's address */
-   for (i = 0; i < 3; i++) {
-   /* Write Source Address 1 (unicast filter) */
+   /* Setup Yukon's station address */
+   eaddr = IF_LLADDR(sc_if->sk_ifp);
+   for (i = 0; i < 3; i++)
+   SK_YU_WRITE_2(sc_if, SK_MAC0_0 + i * 4,
+   eaddr[i * 2] | eaddr[i * 2 + 1] << 8);
+   /* Set GMAC source address of flow control. */
+   for (i = 0; i < 3; i++)
SK_YU_WRITE_2(sc_if, YUKON_SAL1 + i * 4,
- IF_LLADDR(sc_if->sk_ifp)[i * 2] |
- IF_LLADDR(sc_if->sk_ifp)[i * 2 + 1] << 8);
-   }
-
-   for (i = 0; i < 3; i++) {
-   reg = sk_win_read_2(sc_if->sk_softc,
-   SK_MAC1_0 + i * 2 + sc_if->sk_port * 8);
-   SK_YU_WRITE_2(sc_if, YUKON_SAL2 + i * 4, reg);
-   }
+   eaddr[i * 2] | eaddr[i * 2 + 1] << 8);
+   /* Set GMAC virtual address. */
+   for (i = 0; i < 3; i++)
+   SK_YU_WRITE_2(sc_if, YUKON_SAL2 + i * 4,
+   eaddr[i * 2] | eaddr[i * 2 + 1] << 8);
 
/* Set Rx filter */
sk_rxfilter_yukon(sc_if);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r214900 - stable/7/share/man/man4

2010-11-06 Thread Lawrence Stewart
Author: lstewart
Date: Sun Nov  7 01:19:40 2010
New Revision: 214900
URL: http://svn.freebsd.org/changeset/base/214900

Log:
  Remove siis.4 from the man4/Makefile. It was incorrectly included in r214875 
as
  part of the SIFTR MFC and breaks buildworld as siis.4 doesn't exist in 
stable/7.
  
  This is an intentional direct commit to the 7-STABLE branch.
  
  Pointy hat to:lstewart
  Noticed by:   Michael Butler 

Modified:
  stable/7/share/man/man4/Makefile

Modified: stable/7/share/man/man4/Makefile
==
--- stable/7/share/man/man4/MakefileSat Nov  6 22:07:22 2010
(r214899)
+++ stable/7/share/man/man4/MakefileSun Nov  7 01:19:40 2010
(r214900)
@@ -315,7 +315,6 @@ MAN=aac.4 \
sge.4 \
si.4 \
siftr.4 \
-   siis.4 \
sio.4 \
sis.4 \
sk.4 \
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r214903 - in head/sys: conf mips/include mips/mips sys vm

2010-11-06 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Sun Nov  7 03:09:02 2010
New Revision: 214903
URL: http://svn.freebsd.org/changeset/base/214903

Log:
  - Add minidump support for FreeBSD/mips

Added:
  head/sys/mips/mips/minidump_machdep.c   (contents, props changed)
Modified:
  head/sys/conf/files.mips
  head/sys/mips/include/cpuregs.h
  head/sys/mips/include/md_var.h
  head/sys/mips/include/pmap.h
  head/sys/mips/mips/dump_machdep.c
  head/sys/mips/mips/machdep.c
  head/sys/sys/kerneldump.h
  head/sys/vm/vm_page.c

Modified: head/sys/conf/files.mips
==
--- head/sys/conf/files.mipsSun Nov  7 02:20:34 2010(r214902)
+++ head/sys/conf/files.mipsSun Nov  7 03:09:02 2010(r214903)
@@ -55,6 +55,7 @@ mips/mips/db_trace.c  optionalddb
 mips/mips/dump_machdep.c   standard
 mips/mips/in_cksum.c   optionalinet
 mips/mips/locore.S standardno-obj
+mips/mips/minidump_machdep.c   standard
 mips/mips/mem.coptionalmem
 mips/mips/nexus.c  standard
 mips/mips/stack_machdep.c  optionalddb | stack

Modified: head/sys/mips/include/cpuregs.h
==
--- head/sys/mips/include/cpuregs.h Sun Nov  7 02:20:34 2010
(r214902)
+++ head/sys/mips/include/cpuregs.h Sun Nov  7 03:09:02 2010
(r214903)
@@ -181,6 +181,9 @@
 #defineMIPS_XUSEG_END  0x0100
 #defineMIPS_XKSEG_START0xc000
 #defineMIPS_XKSEG_END  0xc0ff8000
+#defineMIPS_XKSEG_COMPAT32_START   0x8000
+#defineMIPS_XKSEG_COMPAT32_END 0x
+#defineMIPS_XKSEG_TO_COMPAT32(va)  ((va) & 0x)
 
 #ifdef __mips_n64
 #defineMIPS_DIRECT_MAPPABLE(pa)1

Modified: head/sys/mips/include/md_var.h
==
--- head/sys/mips/include/md_var.h  Sun Nov  7 02:20:34 2010
(r214902)
+++ head/sys/mips/include/md_var.h  Sun Nov  7 03:09:02 2010
(r214903)
@@ -42,6 +42,8 @@
 extern longMaxmem;
 extern charsigcode[];
 extern int szsigcode, szosigcode;
+extern uint32_t *vm_page_dump;
+extern int vm_page_dump_size;
 
 extern vm_offset_t kstack0;
 extern vm_offset_t kernel_kseg0_end;
@@ -74,4 +76,7 @@ void  platform_identify(void);
 
 extern int busdma_swi_pending;
 void   busdma_swi(void);
+
+struct dumperinfo;
+void minidumpsys(struct dumperinfo *);
 #endif /* !_MACHINE_MD_VAR_H_ */

Modified: head/sys/mips/include/pmap.h
==
--- head/sys/mips/include/pmap.hSun Nov  7 02:20:34 2010
(r214902)
+++ head/sys/mips/include/pmap.hSun Nov  7 03:09:02 2010
(r214903)
@@ -144,6 +144,8 @@ extern vm_offset_t physmem_desc[PHYS_AVA
 extern vm_offset_t virtual_avail;
 extern vm_offset_t virtual_end;
 
+extern vm_paddr_t dump_avail[PHYS_AVAIL_ENTRIES + 2];
+
 #definepmap_page_get_memattr(m)VM_MEMATTR_DEFAULT
 #definepmap_page_is_mapped(m)  (!TAILQ_EMPTY(&(m)->md.pv_list))
 #definepmap_page_set_memattr(m, ma)(void)0

Modified: head/sys/mips/mips/dump_machdep.c
==
--- head/sys/mips/mips/dump_machdep.c   Sun Nov  7 02:20:34 2010
(r214902)
+++ head/sys/mips/mips/dump_machdep.c   Sun Nov  7 03:09:02 2010
(r214903)
@@ -1,35 +1,362 @@
 /*-
- * Copyright (c) 2006 Oleksandr Tymoshenko
+ * Copyright (c) 2002 Marcel Moolenaar
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
- * 1. Redistributions of source code must retain the above copyright
- *notice, this list of conditions, and the following disclaimer,
- *without modification, immediately at the beginning of the file.
- * 2. The name of the author may not be used to endorse or promote products
- *derived from this software without specific prior written permission.
  *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY

svn commit: r214904 - head/lib/libkvm

2010-11-06 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Sun Nov  7 03:26:22 2010
New Revision: 214904
URL: http://svn.freebsd.org/changeset/base/214904

Log:
  Add minidump support for MIPS

Added:
  head/lib/libkvm/kvm_minidump_mips.c   (contents, props changed)
Modified:
  head/lib/libkvm/Makefile
  head/lib/libkvm/kvm_mips.c
  head/lib/libkvm/kvm_private.h

Modified: head/lib/libkvm/Makefile
==
--- head/lib/libkvm/MakefileSun Nov  7 03:09:02 2010(r214903)
+++ head/lib/libkvm/MakefileSun Nov  7 03:26:22 2010(r214904)
@@ -20,7 +20,7 @@ WARNS?=   0
 SRCS=  kvm.c kvm_${KVM_ARCH}.c kvm_cptime.c kvm_file.c kvm_getloadavg.c \
kvm_getswapinfo.c kvm_pcpu.c kvm_proc.c kvm_vnet.c
 .if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386" || \
-${MACHINE_CPUARCH} == "arm"
+${MACHINE_CPUARCH} == "arm" || ${MACHINE_CPUARCH} == "mips"
 SRCS+= kvm_minidump_${KVM_ARCH}.c
 .endif
 INCS=  kvm.h

Added: head/lib/libkvm/kvm_minidump_mips.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/lib/libkvm/kvm_minidump_mips.c Sun Nov  7 03:26:22 2010
(r214904)
@@ -0,0 +1,275 @@
+/*-
+ * Copyright (c) 2010 Oleksandr Tymoshenko 
+ * Copyright (c) 2008 Semihalf, Grzegorz Bernacki
+ * Copyright (c) 2006 Peter Wemm
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * From: FreeBSD: src/lib/libkvm/kvm_minidump_arm.c r214223
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+/*
+ * MIPS machine dependent routines for kvm and minidumps.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#include 
+
+#include "kvm_private.h"
+
+struct hpte {
+   struct hpte *next;
+   uint64_tpa;
+   int64_t off;
+};
+
+#define HPT_SIZE 1024
+
+/* minidump must be the first field */
+struct vmstate {
+   int minidump;   /* 1 = minidump mode */
+   struct  minidumphdr hdr;
+   void*hpt_head[HPT_SIZE];
+   uint32_t*bitmap;
+   void*ptemap;
+};
+
+static void
+hpt_insert(kvm_t *kd, uint64_t pa, int64_t off)
+{
+   struct hpte *hpte;
+   uint32_t fnv = FNV1_32_INIT;
+
+   fnv = fnv_32_buf(&pa, sizeof(pa), fnv);
+   fnv &= (HPT_SIZE - 1);
+   hpte = malloc(sizeof(*hpte));
+   hpte->pa = pa;
+   hpte->off = off;
+   hpte->next = kd->vmst->hpt_head[fnv];
+   kd->vmst->hpt_head[fnv] = hpte;
+}
+
+static int64_t
+hpt_find(kvm_t *kd, uint64_t pa)
+{
+   struct hpte *hpte;
+   uint32_t fnv = FNV1_32_INIT;
+
+   fnv = fnv_32_buf(&pa, sizeof(pa), fnv);
+   fnv &= (HPT_SIZE - 1);
+   for (hpte = kd->vmst->hpt_head[fnv]; hpte != NULL; hpte = hpte->next)
+   if (pa == hpte->pa)
+   return (hpte->off);
+
+   return (-1);
+}
+
+static int
+inithash(kvm_t *kd, uint32_t *base, int len, off_t off)
+{
+   uint64_t idx, pa;
+   uint32_t bit, bits;
+
+   for (idx = 0; idx < len / sizeof(*base); idx++) {
+   bits = base[idx];
+   while (bits) {
+   bit = ffs(bits) - 1;
+   bits &= ~(1ul << bit);
+   pa = (idx * sizeof(*base) * NBBY + bit) * PAGE_SIZE;
+   hpt_insert(kd, pa, off);
+   off += PAGE_SIZE;
+   }
+   }
+
+   return (off);
+}
+
+void
+_kvm_minidump_freevtop(kvm_t *kd)
+{
+   struct vmstate *vm = kd->vmst;
+
+   if (vm->bitmap)
+  

svn commit: r214905 - in head/lib/libarchive: . test

2010-11-06 Thread Tim Kientzle
Author: kientzle
Date: Sun Nov  7 03:40:37 2010
New Revision: 214905
URL: http://svn.freebsd.org/changeset/base/214905

Log:
  If the Zip reader doesn't see a PK signature block
  because there's inter-entry garbage, just scan forward
  to find the next one.  This allows us to handle a lot
  of Zip archives that have been modified in-place.
  
  Thanks to: Gleb Kurtsou for sending me a sample archive

Added:
  head/lib/libarchive/test/test_compat_zip_2.zip.uu   (contents, props changed)
Modified:
  head/lib/libarchive/archive_read_support_format_zip.c
  head/lib/libarchive/test/test_compat_zip.c

Modified: head/lib/libarchive/archive_read_support_format_zip.c
==
--- head/lib/libarchive/archive_read_support_format_zip.c   Sun Nov  7 
03:26:22 2010(r214904)
+++ head/lib/libarchive/archive_read_support_format_zip.c   Sun Nov  7 
03:40:37 2010(r214905)
@@ -128,6 +128,7 @@ static int  archive_read_format_zip_read_
 static int archive_read_format_zip_read_data_skip(struct archive_read *a);
 static int archive_read_format_zip_read_header(struct archive_read *,
struct archive_entry *);
+static int search_next_signature(struct archive_read *);
 static int zip_read_data_deflate(struct archive_read *a, const void **buff,
size_t *size, off_t *offset);
 static int zip_read_data_none(struct archive_read *a, const void **buff,
@@ -317,10 +318,17 @@ archive_read_format_zip_read_header(stru
signature = (const char *)h;
}
 
+   /* If we don't see a PK signature here, scan forward. */
if (signature[0] != 'P' || signature[1] != 'K') {
-   archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
-   "Bad ZIP file");
-   return (ARCHIVE_FATAL);
+   r = search_next_signature(a);
+   if (r != ARCHIVE_OK) {
+   archive_set_error(&a->archive, 
ARCHIVE_ERRNO_FILE_FORMAT,
+   "Bad ZIP file");
+   return (ARCHIVE_FATAL);
+   }
+   if ((h = __archive_read_ahead(a, 4, NULL)) == NULL)
+   return (ARCHIVE_FATAL);
+   signature = (const char *)h;
}
 
/*
@@ -375,6 +383,42 @@ archive_read_format_zip_read_header(stru
 }
 
 static int
+search_next_signature(struct archive_read *a)
+{
+   const void *h;
+   const char *p, *q;
+   size_t skip;
+   ssize_t bytes;
+   int64_t skipped = 0;
+
+   for (;;) {
+   h = __archive_read_ahead(a, 4, &bytes);
+   if (h == NULL)
+   return (ARCHIVE_FATAL);
+   p = h;
+   q = p + bytes;
+
+   while (p + 4 <= q) {
+   if (p[0] == 'P' && p[1] == 'K') {
+   if ((p[2] == '\001' && p[3] == '\002')
+   || (p[2] == '\003' && p[3] == '\004')
+   || (p[2] == '\005' && p[3] == '\006')
+   || (p[2] == '\007' && p[3] == '\010')
+   || (p[2] == '0' && p[3] == '0')) {
+   skip = p - (const char *)h;
+   __archive_read_consume(a, skip);
+   return (ARCHIVE_OK);
+   }
+   }
+   ++p;
+   }
+   skip = p - (const char *)h;
+   __archive_read_consume(a, skip);
+   skipped += skip;
+   }
+}
+
+static int
 zip_read_file_header(struct archive_read *a, struct archive_entry *entry,
 struct zip *zip)
 {
@@ -888,6 +932,9 @@ process_extra(const void* extra, struct 
if (datasize >= 4)
zip->gid = archive_le16dec(p + offset + 2);
break;
+   case 0x7875:
+   /* Info-Zip Unix Extra Field (type 3) "ux". */
+   break;
default:
break;
}

Modified: head/lib/libarchive/test/test_compat_zip.c
==
--- head/lib/libarchive/test/test_compat_zip.c  Sun Nov  7 03:26:22 2010
(r214904)
+++ head/lib/libarchive/test/test_compat_zip.c  Sun Nov  7 03:40:37 2010
(r214905)
@@ -71,10 +71,43 @@ finish:
 #endif
 }
 
+/*
+ * Verify that we skip junk between entries.  The compat_zip_2.zip file
+ * has several bytes of junk between 'file1' and 'file2'.  Such
+ * junk is routinely introduced by some Zip writers when they manipulate
+ * existing zip archives.
+ */
+static void
+test_compat_zip_2(void)
+{
+   char name[] = "test_compat_zip_2.zip";
+   struct archive_entry *ae;
+   struct archiv

Re: svn commit: r214905 - in head/lib/libarchive: . test

2010-11-06 Thread Anonymous
Tim Kientzle  writes:

> Author: kientzle
> Date: Sun Nov  7 03:40:37 2010
> New Revision: 214905
> URL: http://svn.freebsd.org/changeset/base/214905
>
> Log:
>   If the Zip reader doesn't see a PK signature block
>   because there's inter-entry garbage, just scan forward
>   to find the next one.  This allows us to handle a lot
>   of Zip archives that have been modified in-place.

It's unrelated but can you also look at archives produces by Mojo Setup?

  http://icculus.org/mojosetup/examples/

$ /usr/bin/unzip duke3d-mojosetup-linux-x86.bin
Archive:  duke3d-mojosetup-linux-x86.bin
unzip: Unrecognized archive format
zsh: exit 1

$ LOCALBASE/bin/unzip duke3d-mojosetup-linux-x86.bin
Archive:  duke3d-mojosetup-linux-x86.bin
warning [duke3d-mojosetup-linux-x86.bin]:  157716 extra bytes at beginning or 
within zipfile
  (attempting to process anyway)
   creating: data/
  inflating: data/duke3d_readme.txt
  inflating: data/duke3d.png
  inflating: data/mojosetup_readme.txt
  inflating: data/gpl.txt
   creating: guis/
  inflating: guis/libmojosetupgui_ncurses.so
  inflating: guis/libmojosetupgui_gtkplus2.so
   creating: meta/
  inflating: meta/splash.bmp
   creating: meta/xdg-utils/
  inflating: meta/xdg-utils/xdg-desktop-menu
  inflating: meta/xdg-utils/xdg-open
   creating: scripts/
  inflating: scripts/config.luac
  inflating: scripts/localization.luac
  inflating: scripts/mojosetup_init.luac
  inflating: scripts/app_localization.luac
  inflating: scripts/mojosetup_mainline.luac
zsh: exit 1
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"