svn commit: r353486 - head/share/man/man3

2019-10-13 Thread Lawrence Stewart
Author: lstewart
Date: Mon Oct 14 05:26:42 2019
New Revision: 353486
URL: https://svnweb.freebsd.org/changeset/base/353486

Log:
  Fix some "RB_" -> "ARB_" copy and paste nits for text sourced from tree(3).

Modified:
  head/share/man/man3/arb.3

Modified: head/share/man/man3/arb.3
==
--- head/share/man/man3/arb.3   Mon Oct 14 04:17:56 2019(r353485)
+++ head/share/man/man3/arb.3   Mon Oct 14 05:26:42 2019(r353486)
@@ -30,7 +30,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd October 2, 2019
+.Dd October 14, 2019
 .Dt ARB 3
 .Os
 .Sh NAME
@@ -399,7 +399,7 @@ macros can be used to find a particular element in the
 .Bd -literal -offset indent
 struct TYPE find, *res;
 find.key = 30;
-res = RB_FIND(NAME, head, );
+res = ARB_FIND(NAME, head, );
 .Ed
 .Pp
 The
@@ -411,7 +411,7 @@ and
 .Fn ARB_PREV
 macros can be used to traverse the tree:
 .Pp
-.Dl "for (np = RB_MIN(NAME, ); np != NULL; np = RB_NEXT(NAME, , np))"
+.Dl "for (np = ARB_MIN(NAME, ); np != NULL; np = ARB_NEXT(NAME, , 
np))"
 .Pp
 Or, for simplicity, one can use the
 .Fn ARB_FOREACH
@@ -419,7 +419,7 @@ or
 .Fn ARB_FOREACH_REVERSE
 macro:
 .Bd -ragged -offset indent
-.Fn RB_FOREACH np NAME head
+.Fn ARB_FOREACH np NAME head
 .Ed
 .Pp
 The macros
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r336596 - in head/sys/netinet: . cc

2018-07-23 Thread Lawrence Stewart
On 22/07/2018 15:37, Matt Macy wrote:
> Author: mmacy
> Date: Sun Jul 22 05:37:58 2018
> New Revision: 336596
> URL: https://svnweb.freebsd.org/changeset/base/336596
> 
> Log:
>   NULL out cc_data in pluggable TCP {cc}_cb_destroy
>   
>   When ABE was added (rS331214) to NewReno and leak fixed (rS333699) , it now 
> has
>   a destructor (newreno_cb_destroy) for per connection state. Other congestion
>   controls may allocate and free cc_data on entry and exit, but the field is
>   never explicitly NULLed if moving back to NewReno which only internally
>   allocates stateful data (no entry contstructor) resulting in a situation 
> where
>   newreno_cb_destory might be called on a junk pointer.
>   
>-NULL out cc_data in the framework after calling {cc}_cb_destroy
>-free(9) checks for NULL so there is no need to perform not NULL checks
>before calling free.
>-Improve a comment about NewReno in tcp_ccalgounload
>   
>   This is the result of a debugging session from Jason Wolfe, Jason Eggleston,
>   and mmacy@ and very helpful insight from lstewart@.
>   
>   Submitted by: Kevin Bowling
>   Reviewed by: lstewart
>   Sponsored by: Limelight Networks
>   Differential Revision: https://reviews.freebsd.org/D16282

Pointy hat to: lstewart

Apologies for the bug and thanks for fixing.

Cheers,
Lawrence

___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r333699 - in head: lib/libc/sys share/man/man4 sys/netinet/cc

2018-05-16 Thread Lawrence Stewart
Author: lstewart
Date: Thu May 17 02:46:27 2018
New Revision: 333699
URL: https://svnweb.freebsd.org/changeset/base/333699

Log:
  Plug a memory leak and potential NULL-pointer dereference introduced in 
r331214.
  
  Each TCP connection that uses the system default cc_newreno(4) congestion
  control algorithm module leaks a "struct newreno" (8 bytes of memory) at
  connection initialisation time. The NULL-pointer dereference is only germane
  when using the ABE feature, which is disabled by default.
  
  While at it:
  
  - Defer the allocation of memory until it is actually needed given that ABE is
optional and disabled by default.
  
  - Document the ENOMEM errno in getsockopt(2)/setsockopt(2).
  
  - Document ENOMEM and ENOBUFS in tcp(4) as being synonymous given that they 
are
used interchangeably throughout the code.
  
  - Fix a few other nits also accidentally omitted from the original patch.
  
  Reported by:  Harsh Jain on freebsd-net@
  Tested by:tjh@
  Differential Revision:https://reviews.freebsd.org/D15358

Modified:
  head/lib/libc/sys/getsockopt.2
  head/share/man/man4/tcp.4
  head/sys/netinet/cc/cc_newreno.c

Modified: head/lib/libc/sys/getsockopt.2
==
--- head/lib/libc/sys/getsockopt.2  Thu May 17 01:42:18 2018
(r333698)
+++ head/lib/libc/sys/getsockopt.2  Thu May 17 02:46:27 2018
(r333699)
@@ -28,7 +28,7 @@
 .\" @(#)getsockopt.2   8.4 (Berkeley) 5/2/95
 .\" $FreeBSD$
 .\"
-.Dd January 18, 2017
+.Dd May 9, 2018
 .Dt GETSOCKOPT 2
 .Os
 .Sh NAME
@@ -548,6 +548,8 @@ is not in a valid part of the process address space.
 Installing an
 .Xr accept_filter 9
 on a non-listening socket was attempted.
+.It Bq Er ENOMEM
+A memory allocation failed that was required to service the request.
 .El
 .Sh SEE ALSO
 .Xr ioctl 2 ,

Modified: head/share/man/man4/tcp.4
==
--- head/share/man/man4/tcp.4   Thu May 17 01:42:18 2018(r333698)
+++ head/share/man/man4/tcp.4   Thu May 17 02:46:27 2018(r333699)
@@ -34,7 +34,7 @@
 .\" From: @(#)tcp.48.1 (Berkeley) 6/5/93
 .\" $FreeBSD$
 .\"
-.Dd February 6, 2017
+.Dd May 9, 2018
 .Dt TCP 4
 .Os
 .Sh NAME
@@ -599,7 +599,7 @@ A socket operation may fail with one of the following 
 .It Bq Er EISCONN
 when trying to establish a connection on a socket which
 already has one;
-.It Bq Er ENOBUFS
+.It Bo Er ENOBUFS Bc or Bo Er ENOMEM Bc
 when the system runs out of memory for
 an internal data structure;
 .It Bq Er ETIMEDOUT

Modified: head/sys/netinet/cc/cc_newreno.c
==
--- head/sys/netinet/cc/cc_newreno.cThu May 17 01:42:18 2018
(r333698)
+++ head/sys/netinet/cc/cc_newreno.cThu May 17 02:46:27 2018
(r333699)
@@ -81,7 +81,7 @@ static MALLOC_DEFINE(M_NEWRENO, "newreno data",
 
 #defineCAST_PTR_INT(X) (*((int*)(X)))
 
-static int newreno_cb_init(struct cc_var *ccv);
+static voidnewreno_cb_destroy(struct cc_var *ccv);
 static voidnewreno_ack_received(struct cc_var *ccv, uint16_t type);
 static voidnewreno_after_idle(struct cc_var *ccv);
 static voidnewreno_cong_signal(struct cc_var *ccv, uint32_t type);
@@ -95,7 +95,7 @@ static VNET_DEFINE(uint32_t, newreno_beta_ecn) = 80;
 
 struct cc_algo newreno_cc_algo = {
.name = "newreno",
-   .cb_init = newreno_cb_init,
+   .cb_destroy = newreno_cb_destroy,
.ack_received = newreno_ack_received,
.after_idle = newreno_after_idle,
.cong_signal = newreno_cong_signal,
@@ -108,21 +108,31 @@ struct newreno {
uint32_t beta_ecn;
 };
 
-int
-newreno_cb_init(struct cc_var *ccv)
+static inline struct newreno *
+newreno_malloc(struct cc_var *ccv)
 {
-   struct newreno *nreno;  
+   struct newreno *nreno;
 
-   nreno = malloc(sizeof(struct newreno), M_NEWRENO, M_NOWAIT|M_ZERO);
+   nreno = malloc(sizeof(struct newreno), M_NEWRENO, M_NOWAIT);
if (nreno != NULL) {
+   /* NB: nreno is not zeroed, so initialise all fields. */
nreno->beta = V_newreno_beta;
nreno->beta_ecn = V_newreno_beta_ecn;
+   ccv->cc_data = nreno;
}
 
-   return (0);
+   return (nreno);
 }
 
 static void
+newreno_cb_destroy(struct cc_var *ccv)
+{
+
+   if (ccv->cc_data != NULL)
+   free(ccv->cc_data, M_NEWRENO);
+}
+
+static void
 newreno_ack_received(struct cc_var *ccv, uint16_t type)
 {
if (type == CC_ACK && !IN_RECOVERY(CCV(ccv, t_flags)) &&
@@ -224,20 +234,18 @@ static void
 newreno_cong_signal(struct cc_var *ccv, uint32_t type)
 {
struct newreno *nreno;
-   uint32_t cwin, factor;
+   uint32_t beta, beta_ecn, cwin, factor;
u_int mss;
 
-   factor = V_newreno_beta;
-   nreno = ccv->cc_data;
-   if (nreno != NULL) {
-   

svn commit: r331214 - in head: share/man/man4 sys/netinet/cc

2018-03-19 Thread Lawrence Stewart
;draft-ietf-tcpm-alternativebackoff-ecn"
+.%O "work in progress"
+.Re
 .Sh ACKNOWLEDGEMENTS
 Development and testing of this software were made possible in part by grants
 from the FreeBSD Foundation and Cisco University Research Program Fund at
@@ -77,6 +147,9 @@ congestion control module was written by
 .An Lawrence Stewart Aq Mt lstew...@freebsd.org
 and
 .An David Hayes Aq Mt david.ha...@ieee.org .
+.Pp
+Support for TCP ABE was added by
+.An Tom Jones Aq Mt t...@enoti.me .
 .Pp
 This manual page was written by
 .An Lawrence Stewart Aq Mt lstew...@freebsd.org .

Modified: head/share/man/man4/mod_cc.4
==
--- head/share/man/man4/mod_cc.4Mon Mar 19 16:17:10 2018
(r331213)
+++ head/share/man/man4/mod_cc.4Mon Mar 19 16:37:47 2018
(r331214)
@@ -30,7 +30,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd January 21, 2016
+.Dd March 19, 2018
 .Dt MOD_CC 4
 .Os
 .Sh NAME
@@ -73,7 +73,7 @@ The framework exposes the following variables in the
 branch of the
 .Xr sysctl 3
 MIB:
-.Bl -tag -width ".Va available"
+.Bl -tag -width ".Va abe_frlossreduce"
 .It Va available
 Read-only list of currently available congestion control algorithms by name.
 .It Va algorithm
@@ -83,6 +83,15 @@ When attempting to change the default algorithm, this 
 one of the names listed by the
 .Va net.inet.tcp.cc.available
 MIB variable.
+.It Va abe
+Enable support for draft-ietf-tcpm-alternativebackoff-ecn,
+which alters the window decrease factor applied to the congestion window in
+response to an ECN congestion signal.
+Refer to individual congestion control man pages to determine if they implement
+support for ABE and for configuration details.
+.It Va abe_frlossreduce
+If non-zero, apply standard beta instead of ABE-beta during ECN-signalled
+congestion recovery episodes if loss also needs to be repaired.
 .El
 .Sh SEE ALSO
 .Xr cc_cdg 4 ,

Modified: head/sys/netinet/cc/cc.c
==
--- head/sys/netinet/cc/cc.cMon Mar 19 16:17:10 2018(r331213)
+++ head/sys/netinet/cc/cc.cMon Mar 19 16:37:47 2018(r331214)
@@ -327,3 +327,14 @@ SYSCTL_PROC(_net_inet_tcp_cc, OID_AUTO, algorithm,
 SYSCTL_PROC(_net_inet_tcp_cc, OID_AUTO, available, CTLTYPE_STRING|CTLFLAG_RD,
 NULL, 0, cc_list_available, "A",
 "List available congestion control algorithms");
+
+VNET_DEFINE(int, cc_do_abe) = 0;
+SYSCTL_INT(_net_inet_tcp_cc, OID_AUTO, abe, CTLFLAG_VNET | CTLFLAG_RW,
+_NAME(cc_do_abe), 0,
+"Enable draft-ietf-tcpm-alternativebackoff-ecn (TCP Alternative Backoff 
with ECN)");
+
+VNET_DEFINE(int, cc_abe_frlossreduce) = 0;
+SYSCTL_INT(_net_inet_tcp_cc, OID_AUTO, abe_frlossreduce, CTLFLAG_VNET | 
CTLFLAG_RW,
+_NAME(cc_abe_frlossreduce), 0,
+"Apply standard beta instead of ABE-beta during ECN-signalled congestion "
+"recovery episodes if loss also needs to be repaired");

Modified: head/sys/netinet/cc/cc.h
==
--- head/sys/netinet/cc/cc.hMon Mar 19 16:17:10 2018(r331213)
+++ head/sys/netinet/cc/cc.hMon Mar 19 16:37:47 2018(r331214)
@@ -64,6 +64,12 @@ extern struct cc_algo newreno_cc_algo;
 VNET_DECLARE(struct cc_algo *, default_cc_ptr);
 #defineV_default_cc_ptr VNET(default_cc_ptr)
 
+VNET_DECLARE(int, cc_do_abe);
+#defineV_cc_do_abe VNET(cc_do_abe)
+
+VNET_DECLARE(int, cc_abe_frlossreduce);
+#defineV_cc_abe_frlossreduce   VNET(cc_abe_frlossreduce)
+
 /* Define the new net.inet.tcp.cc sysctl tree. */
 SYSCTL_DECL(_net_inet_tcp_cc);
 

Modified: head/sys/netinet/cc/cc_newreno.c
==
--- head/sys/netinet/cc/cc_newreno.cMon Mar 19 16:17:10 2018
(r331213)
+++ head/sys/netinet/cc/cc_newreno.cMon Mar 19 16:37:47 2018
(r331214)
@@ -3,7 +3,7 @@
  *
  * Copyright (c) 1982, 1986, 1988, 1990, 1993, 1994, 1995
  * The Regents of the University of California.
- * Copyright (c) 2007-2008,2010
+ * Copyright (c) 2007-2008,2010,2014
  * Swinburne University of Technology, Melbourne, Australia.
  * Copyright (c) 2009-2010 Lawrence Stewart <lstew...@freebsd.org>
  * Copyright (c) 2010 The FreeBSD Foundation
@@ -48,6 +48,11 @@
  * University Research Program Fund at Community Foundation Silicon Valley.
  * More details are available at:
  *   http://caia.swin.edu.au/urp/newtcp/
+ *
+ * Dec 2014 garmit...@swin.edu.au
+ * Borrowed code fragments from cc_cdg.c to add modifiable beta
+ * via sysctls.
+ *
  */
 
 #include 
@@ -69,20 +74,54 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
+static MALLOC_DEFINE(M_NEWRENO, "newreno data",
+   "newreno beta valu

svn commit: r322831 - head/bin/pkill

2017-08-24 Thread Lawrence Stewart
Author: lstewart
Date: Thu Aug 24 08:20:23 2017
New Revision: 322831
URL: https://svnweb.freebsd.org/changeset/base/322831

Log:
  Only emit the trailing new line added in r322613 when not operating in quiet
  mode.
  
  Reported by:  pho
  MFC after:1 week
  X-MFC-with:   r322210

Modified:
  head/bin/pkill/pkill.c

Modified: head/bin/pkill/pkill.c
==
--- head/bin/pkill/pkill.c  Thu Aug 24 08:09:42 2017(r322830)
+++ head/bin/pkill/pkill.c  Thu Aug 24 08:20:23 2017(r322831)
@@ -568,7 +568,7 @@ main(int argc, char **argv)
continue;
rv |= (*action)(kp);
}
-   if (rv && pgrep)
+   if (rv && pgrep && !quiet)
putchar('\n');
if (!did_action && !pgrep && longfmt)
fprintf(stderr,
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r322643 - head/sys/kern

2017-08-17 Thread Lawrence Stewart
Author: lstewart
Date: Fri Aug 18 02:06:28 2017
New Revision: 322643
URL: https://svnweb.freebsd.org/changeset/base/322643

Log:
  An off-by-one error exists in sbuf_vprintf()'s use of SBUF_HASROOM() when an
  sbuf is filled to capacity by vsnprintf(), the loop exits without error, and
  the sbuf is not marked as auto-extendable.
  
  SBUF_HASROOM() evaluates true if there is room for one or more non-NULL
  characters, but in the case that the sbuf was filled exactly to capacity,
  SBUF_HASROOM() evaluates false. Consequently, sbuf_vprintf() incorrectly
  assigns an ENOMEM error to the sbuf when in fact everything is fine, in turn
  poisoning the buffer for all subsequent operations.
  
  Correct by moving the ENOMEM assignment into the loop where it can be made
  unambiguously.
  
  As a related safety net change, explicitly check for the zero bytes drained
  case in sbuf_drain() and set EDEADLK as the error. This avoids an infinite 
loop
  in sbuf_vprintf() if a drain function were to inadvertently return a value of
  zero to sbuf_drain().
  
  Reviewed by:  cem, jtl, gallatin
  MFC after:2 weeks
  Sponsored by: Netflix, Inc.
  Differential Revision:https://reviews.freebsd.org/D8535

Modified:
  head/sys/kern/subr_sbuf.c

Modified: head/sys/kern/subr_sbuf.c
==
--- head/sys/kern/subr_sbuf.c   Fri Aug 18 01:34:38 2017(r322642)
+++ head/sys/kern/subr_sbuf.c   Fri Aug 18 02:06:28 2017(r322643)
@@ -369,8 +369,8 @@ sbuf_drain(struct sbuf *s)
return (s->s_error = EDEADLK);
len = s->s_drain_func(s->s_drain_arg, s->s_buf,
SBUF_DODRAINTOEOR(s) ? s->s_rec_off : s->s_len);
-   if (len < 0) {
-   s->s_error = -len;
+   if (len <= 0) {
+   s->s_error = len ? -len : EDEADLK;
return (s->s_error);
}
KASSERT(len > 0 && len <= s->s_len,
@@ -640,9 +640,9 @@ sbuf_vprintf(struct sbuf *s, const char *fmt, va_list 
break;
/* Cannot print with the current available space. */
if (s->s_drain_func != NULL && s->s_len > 0)
-   error = sbuf_drain(s);
-   else
-   error = sbuf_extend(s, len - SBUF_FREESPACE(s));
+   error = sbuf_drain(s); /* sbuf_drain() sets s_error. */
+   else if (sbuf_extend(s, len - SBUF_FREESPACE(s)) != 0)
+   s->s_error = error = ENOMEM;
} while (error == 0);
 
/*
@@ -659,8 +659,6 @@ sbuf_vprintf(struct sbuf *s, const char *fmt, va_list 
s->s_len += len;
if (SBUF_ISSECTION(s))
s->s_sect_len += len;
-   if (!SBUF_HASROOM(s) && !SBUF_CANEXTEND(s))
-   s->s_error = ENOMEM;
 
KASSERT(s->s_len < s->s_size,
("wrote past end of sbuf (%d >= %d)", s->s_len, s->s_size));
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r322614 - in head: share/man/man9 sys/kern sys/sys

2017-08-17 Thread Lawrence Stewart
Author: lstewart
Date: Thu Aug 17 07:20:09 2017
New Revision: 322614
URL: https://svnweb.freebsd.org/changeset/base/322614

Log:
  Implement simple record boundary tracking in sbuf(9) to avoid record splitting
  during drain operations. When an sbuf is configured to use this feature by way
  of the SBUF_DRAINTOEOR sbuf_new() flag, top-level sections started with
  sbuf_start_section() create a record boundary marker that is used to avoid
  flushing partial records.
  
  Reviewed by:  cem,imp,wblock
  MFC after:2 weeks
  Sponsored by: Netflix, Inc.
  Differential Revision:https://reviews.freebsd.org/D8536

Modified:
  head/share/man/man9/sbuf.9
  head/sys/kern/subr_sbuf.c
  head/sys/sys/sbuf.h

Modified: head/share/man/man9/sbuf.9
==
--- head/share/man/man9/sbuf.9  Thu Aug 17 06:36:21 2017(r322613)
+++ head/share/man/man9/sbuf.9  Thu Aug 17 07:20:09 2017(r322614)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd April 5, 2017
+.Dd August 17, 2017
 .Dt SBUF 9
 .Os
 .Sh NAME
@@ -271,6 +271,14 @@ This indicates that the storage buffer may be extended
 as resources allow, to hold additional data.
 .It Dv SBUF_INCLUDENUL
 This causes the final nulterm byte to be counted in the length of the data.
+.It Dv SBUF_DRAINTOEOR
+Treat top-level sections started with
+.Fn sbuf_start_section
+as a record boundary marker that will be used during drain operations to avoid
+records being split.
+If a record grows sufficiently large such that it fills the
+.Fa sbuf
+and therefore cannot be drained without being split, an error of EDEADLK is 
set.
 .El
 .Pp
 Note that if

Modified: head/sys/kern/subr_sbuf.c
==
--- head/sys/kern/subr_sbuf.c   Thu Aug 17 06:36:21 2017(r322613)
+++ head/sys/kern/subr_sbuf.c   Thu Aug 17 07:20:09 2017(r322614)
@@ -73,6 +73,8 @@ static MALLOC_DEFINE(M_SBUF, "sbuf", "string buffers")
 #defineSBUF_CANEXTEND(s)   ((s)->s_flags & SBUF_AUTOEXTEND)
 #defineSBUF_ISSECTION(s)   ((s)->s_flags & SBUF_INSECTION)
 #defineSBUF_NULINCLUDED(s) ((s)->s_flags & SBUF_INCLUDENUL)
+#defineSBUF_ISDRAINTOEOR(s)((s)->s_flags & SBUF_DRAINTOEOR)
+#defineSBUF_DODRAINTOEOR(s)(SBUF_ISSECTION(s) && 
SBUF_ISDRAINTOEOR(s))
 
 /*
  * Set / clear flags
@@ -308,6 +310,7 @@ sbuf_clear(struct sbuf *s)
SBUF_CLEARFLAG(s, SBUF_FINISHED);
s->s_error = 0;
s->s_len = 0;
+   s->s_rec_off = 0;
s->s_sect_len = 0;
 }
 
@@ -362,7 +365,10 @@ sbuf_drain(struct sbuf *s)
 
KASSERT(s->s_len > 0, ("Shouldn't drain empty sbuf %p", s));
KASSERT(s->s_error == 0, ("Called %s with error on %p", __func__, s));
-   len = s->s_drain_func(s->s_drain_arg, s->s_buf, s->s_len);
+   if (SBUF_DODRAINTOEOR(s) && s->s_rec_off == 0)
+   return (s->s_error = EDEADLK);
+   len = s->s_drain_func(s->s_drain_arg, s->s_buf,
+   SBUF_DODRAINTOEOR(s) ? s->s_rec_off : s->s_len);
if (len < 0) {
s->s_error = -len;
return (s->s_error);
@@ -370,6 +376,7 @@ sbuf_drain(struct sbuf *s)
KASSERT(len > 0 && len <= s->s_len,
("Bad drain amount %d for sbuf %p", len, s));
s->s_len -= len;
+   s->s_rec_off -= len;
/*
 * Fast path for the expected case where all the data was
 * drained.
@@ -835,6 +842,7 @@ sbuf_start_section(struct sbuf *s, ssize_t *old_lenp)
("s_sect_len != 0 when starting a section"));
if (old_lenp != NULL)
*old_lenp = -1;
+   s->s_rec_off = s->s_len;
SBUF_SETFLAG(s, SBUF_INSECTION);
} else {
KASSERT(old_lenp != NULL,
@@ -865,7 +873,7 @@ sbuf_end_section(struct sbuf *s, ssize_t old_len, size
}
len = s->s_sect_len;
if (old_len == -1) {
-   s->s_sect_len = 0;
+   s->s_rec_off = s->s_sect_len = 0;
SBUF_CLEARFLAG(s, SBUF_INSECTION);
} else {
s->s_sect_len += old_len;

Modified: head/sys/sys/sbuf.h
==
--- head/sys/sys/sbuf.h Thu Aug 17 06:36:21 2017(r322613)
+++ head/sys/sys/sbuf.h Thu Aug 17 07:20:09 2017(r322614)
@@ -49,6 +49,7 @@ struct sbuf {
 #defineSBUF_FIXEDLEN   0x  /* fixed length buffer 
(default) */
 #defineSBUF_AUTOEXTEND 0x0001  /* automatically extend buffer 
*/
 #defineSBUF_INCLUDENUL 0x0002  /* nulterm byte is counted in 
len */
+#defineSBUF_DRAINTOEOR 0x0004  /* use section 0 as drain EOR 
marker */
 #defineSBUF_USRFLAGMSK 0x  /* mask of flags the user may 
specify */
 #defineSBUF_DYNAMIC0x0001  /* s_buf must be freed */
 #define

svn commit: r322613 - head/bin/pkill

2017-08-17 Thread Lawrence Stewart
Author: lstewart
Date: Thu Aug 17 06:36:21 2017
New Revision: 322613
URL: https://svnweb.freebsd.org/changeset/base/322613

Log:
  The r322210 change to pgrep's PID delimiting behaviour causes pgrep's default
  output to not include a trailing new line, which is a potential POLA violation
  for existing consumers. Change pgrep to always emit a trailing new line on
  completion of its output, regardless of the delimeter in use (which 
technically
  is also a potential POLA violation for existing consumers that rely on the
  pre-r322210 buggy behaviour, but a line has to be drawn somewhere).
  
  PR:   221534
  Submitted by: kdrakehp zoho com
  Reported by:  kdrakehp zoho com
  MFC after:1 week
  X-MFC-with:   r322210

Modified:
  head/bin/pkill/pkill.c

Modified: head/bin/pkill/pkill.c
==
--- head/bin/pkill/pkill.c  Thu Aug 17 05:09:22 2017(r322612)
+++ head/bin/pkill/pkill.c  Thu Aug 17 06:36:21 2017(r322613)
@@ -568,6 +568,8 @@ main(int argc, char **argv)
continue;
rv |= (*action)(kp);
}
+   if (rv && pgrep)
+   putchar('\n');
if (!did_action && !pgrep && longfmt)
fprintf(stderr,
"No matching processes belonging to you were found\n");
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r322210 - head/bin/pkill

2017-08-07 Thread Lawrence Stewart
Author: lstewart
Date: Tue Aug  8 00:31:10 2017
New Revision: 322210
URL: https://svnweb.freebsd.org/changeset/base/322210

Log:
  pgrep naively appends the delimiter to all PIDs including the last
  e.g. "pgrep -d, getty" outputs "1399,1386,1309,1308,1307,1306,1305,1302,"
  Ensure the list is correctly delimited by suppressing the emission of the
  delimiter after the final PID.
  
  Reviewed by:  imp, kib
  MFC after:1 week
  Sponsored by: Netflix, Inc.
  Differential Revision:https://reviews.freebsd.org/D8537

Modified:
  head/bin/pkill/pkill.c

Modified: head/bin/pkill/pkill.c
==
--- head/bin/pkill/pkill.c  Mon Aug  7 23:33:05 2017(r322209)
+++ head/bin/pkill/pkill.c  Tue Aug  8 00:31:10 2017(r322210)
@@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$");
 #include 
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -656,10 +657,12 @@ killact(const struct kinfo_proc *kp)
 static int
 grepact(const struct kinfo_proc *kp)
 {
+   static bool first = true;
 
-   show_process(kp);
-   if (!quiet)
+   if (!quiet && !first)
printf("%s", delim);
+   show_process(kp);
+   first = false;
return (1);
 }
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r314780 - head/lib/libpam/modules/pam_exec

2017-03-12 Thread Lawrence Stewart
Hi Pedro,

On 07/03/2017 02:45, Pedro F. Giffuni wrote:
> Author: pfg
> Date: Mon Mar  6 15:45:46 2017
> New Revision: 314780
> URL: https://svnweb.freebsd.org/changeset/base/314780
> 
> Log:
>   libpam: extra bounds checking through reallocarray(3).
>   
>   Reviewed by:des
>   MFC after:  1 week
> 
> Modified:
>   head/lib/libpam/modules/pam_exec/pam_exec.c
> 
> Modified: head/lib/libpam/modules/pam_exec/pam_exec.c
> ==
> --- head/lib/libpam/modules/pam_exec/pam_exec.c   Mon Mar  6 15:42:03 
> 2017(r314779)
> +++ head/lib/libpam/modules/pam_exec/pam_exec.c   Mon Mar  6 15:45:46 
> 2017(r314780)
> @@ -138,7 +138,7 @@ _pam_exec(pam_handle_t *pamh __unused,
>   nitems = sizeof(env_items) / sizeof(*env_items);
>   /* Count PAM return values put in the environment. */
>   nitems_rv = options->return_prog_exit_status ? PAM_RV_COUNT : 0;
> - tmp = realloc(envlist, (envlen + nitems + 1 + nitems_rv + 1) *
> + tmp = reallocarray(envlist, envlen + nitems + 1 + nitems_rv + 1,
>   sizeof(*envlist));
>   if (tmp == NULL) {
>   openpam_free_envlist(envlist);
> 

This commit breaks pam_exec for me... without this change I see the
expected PAM_* environment variables from my execed script, but with
this change I no longer see any of them.

Cheers,
Lawrence
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r304803 - in head/sys: netinet netinet/cc sys

2016-08-26 Thread Lawrence Stewart
On 08/26/16 04:39, hiren panchasara wrote:
> On 08/25/16 at 01:33P, Lawrence Stewart wrote:
>> Author: lstewart
>> Date: Thu Aug 25 13:33:32 2016
>> New Revision: 304803
>> URL: https://svnweb.freebsd.org/changeset/base/304803
>>
>> Log:
>>   Pass the number of segments coalesced by LRO up the stack by repurposing 
>> the
>>   tso_segsz pkthdr field during RX processing, and use the information in 
>> TCP for
>>   more correct accounting and as a congestion control input. This is only a 
>> start,
>>   and an audit of other uses for the data is left as future work.
>>   
>>   Reviewed by:   gallatin, rrs
>>   Sponsored by:  Netflix, Inc.
>>   Differential Revision: https://reviews.freebsd.org/D7564

[snip]

> Also, can this be brought back to stable/11?

I believe so, but need to make a sanity check pass to convince myself
it's ok.

Cheers,
Lawrence
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r304857 - head/sys/netinet/tcp_stacks

2016-08-26 Thread Lawrence Stewart
Pointy hat to: lstewart@

Apologies all for the breakage, thanks Hiren for fixing and apologies
also for missing your email. For some reason your reply to my commit did
not make it to my inbox and was filtered straight to my mailing list
folder which is annoying - I must have introduced a bug in my
.procmailrc at some point.

I don't understand why my buildkernel prior to commit succeeded though.
Is fastpath not build by default?

Cheers,
Lawrence

On 08/27/16 05:23, Hiren Panchasara wrote:
> Author: hiren
> Date: Fri Aug 26 19:23:17 2016
> New Revision: 304857
> URL: https://svnweb.freebsd.org/changeset/base/304857
> 
> Log:
>   Adjust TCP module fastpath after r304803's cc_ack_received() changes.
>   
>   Reported by:hiren, bz, np
>   Reviewed by:rrs
>   Sponsored by:   Limelight Networks
>   Differential Revision:  https://reviews.freebsd.org/D7664
> 
> Modified:
>   head/sys/netinet/tcp_stacks/fastpath.c
> 
> Modified: head/sys/netinet/tcp_stacks/fastpath.c
> ==
> --- head/sys/netinet/tcp_stacks/fastpath.cFri Aug 26 19:08:58 2016
> (r304856)
> +++ head/sys/netinet/tcp_stacks/fastpath.cFri Aug 26 19:23:17 2016
> (r304857)
> @@ -172,7 +172,10 @@ tcp_do_fastack(struct mbuf *m, struct tc
>  int ti_locked, u_long tiwin)
>  {
>   int acked;
> + uint16_t nsegs;
>   int winup_only=0;
> +
> + nsegs = max(1, m->m_pkthdr.lro_nsegs);
>  #ifdef TCPDEBUG
>   /*
>* The size of tcp_saveipgen must be the size of the max ip header,
> @@ -278,7 +281,7 @@ tcp_do_fastack(struct mbuf *m, struct tc
>* typically means increasing the congestion
>* window.
>*/
> - cc_ack_received(tp, th, CC_ACK);
> + cc_ack_received(tp, th, nsegs, CC_ACK);
>  
>   tp->snd_una = th->th_ack;
>   /*
> @@ -502,9 +505,12 @@ tcp_do_slowpath(struct mbuf *m, struct t
>  {
>   int  acked, ourfinisacked, needoutput = 0;
>   int rstreason, todrop, win;
> + uint16_t nsegs;
>   char *s;
>   struct in_conninfo *inc;
>   struct mbuf *mfree = NULL;
> +
> + nsegs = max(1, m->m_pkthdr.lro_nsegs);
>  #ifdef TCPDEBUG
>   /*
>* The size of tcp_saveipgen must be the size of the max ip header,
> @@ -1085,7 +1091,8 @@ tcp_do_slowpath(struct mbuf *m, struct t
>   tp->t_dupacks = 0;
>   else if (++tp->t_dupacks > tcprexmtthresh ||
>IN_FASTRECOVERY(tp->t_flags)) {
> - cc_ack_received(tp, th, CC_DUPACK);
> + cc_ack_received(tp, th, nsegs,
> + CC_DUPACK);
>   if ((tp->t_flags & TF_SACK_PERMIT) &&
>   IN_FASTRECOVERY(tp->t_flags)) {
>   int awnd;
> @@ -1135,7 +1142,8 @@ tcp_do_slowpath(struct mbuf *m, struct t
>   }
>   /* Congestion signal before ack. */
>   cc_cong_signal(tp, th, CC_NDUPACK);
> - cc_ack_received(tp, th, CC_DUPACK);
> + cc_ack_received(tp, th, nsegs,
> + CC_DUPACK);
>   tcp_timer_activate(tp, TT_REXMT, 0);
>   tp->t_rtttime = 0;
>   if (tp->t_flags & TF_SACK_PERMIT) {
> @@ -1169,7 +1177,8 @@ tcp_do_slowpath(struct mbuf *m, struct t
>* segment. Restore the original
>* snd_cwnd after packet transmission.
>*/
> - cc_ack_received(tp, th, CC_DUPACK);
> + cc_ack_received(tp, th, nsegs,
> + CC_DUPACK);
>   u_long oldcwnd = tp->snd_cwnd;
>   tcp_seq oldsndmax = tp->snd_max;
>   u_int sent;
> @@ -1323,7 +1332,7 @@ process_ACK:
>* control related information. This typically means increasing
>* the congestion window.
>*/
> - cc_ack_received(tp, th, CC_ACK);
> + cc_ack_received(tp, th, nsegs, CC_ACK);
>  
>   SOCKBUF_LOCK(>so_snd);
>   if (acked > sbavail(>so_snd)) {
> @@ -1758,6 +1767,7 @@ tcp_do_segment_fastslow(struct mbuf *m, 
>   int thflags;
>   u_long tiwin;
>   char *s;
> + uint16_t nsegs;
>   int can_enter;
>   struct in_conninfo *inc;
>  

Re: svn commit: r304857 - head/sys/netinet/tcp_stacks

2016-08-26 Thread Lawrence Stewart
Pointy hat to: lstewart@

Apologies all for the breakage, thanks Hiren for fixing and apologies
also for missing your email. For some reason your reply to my commit did
not make it to my inbox and was filtered straight to my mailing list
folder which is annoying - I must have introduced a bug in my
.procmailrc at some point.

I don't understand why my buildkernel prior to commit succeeded though.
Is fastpath not build by default?

Cheers,
Lawrence

On 08/27/16 05:23, Hiren Panchasara wrote:
> Author: hiren
> Date: Fri Aug 26 19:23:17 2016
> New Revision: 304857
> URL: https://svnweb.freebsd.org/changeset/base/304857
> 
> Log:
>   Adjust TCP module fastpath after r304803's cc_ack_received() changes.
>   
>   Reported by:hiren, bz, np
>   Reviewed by:rrs
>   Sponsored by:   Limelight Networks
>   Differential Revision:  https://reviews.freebsd.org/D7664
> 
> Modified:
>   head/sys/netinet/tcp_stacks/fastpath.c
> 
> Modified: head/sys/netinet/tcp_stacks/fastpath.c
> ==
> --- head/sys/netinet/tcp_stacks/fastpath.cFri Aug 26 19:08:58 2016
> (r304856)
> +++ head/sys/netinet/tcp_stacks/fastpath.cFri Aug 26 19:23:17 2016
> (r304857)
> @@ -172,7 +172,10 @@ tcp_do_fastack(struct mbuf *m, struct tc
>  int ti_locked, u_long tiwin)
>  {
>   int acked;
> + uint16_t nsegs;
>   int winup_only=0;
> +
> + nsegs = max(1, m->m_pkthdr.lro_nsegs);
>  #ifdef TCPDEBUG
>   /*
>* The size of tcp_saveipgen must be the size of the max ip header,
> @@ -278,7 +281,7 @@ tcp_do_fastack(struct mbuf *m, struct tc
>* typically means increasing the congestion
>* window.
>*/
> - cc_ack_received(tp, th, CC_ACK);
> + cc_ack_received(tp, th, nsegs, CC_ACK);
>  
>   tp->snd_una = th->th_ack;
>   /*
> @@ -502,9 +505,12 @@ tcp_do_slowpath(struct mbuf *m, struct t
>  {
>   int  acked, ourfinisacked, needoutput = 0;
>   int rstreason, todrop, win;
> + uint16_t nsegs;
>   char *s;
>   struct in_conninfo *inc;
>   struct mbuf *mfree = NULL;
> +
> + nsegs = max(1, m->m_pkthdr.lro_nsegs);
>  #ifdef TCPDEBUG
>   /*
>* The size of tcp_saveipgen must be the size of the max ip header,
> @@ -1085,7 +1091,8 @@ tcp_do_slowpath(struct mbuf *m, struct t
>   tp->t_dupacks = 0;
>   else if (++tp->t_dupacks > tcprexmtthresh ||
>IN_FASTRECOVERY(tp->t_flags)) {
> - cc_ack_received(tp, th, CC_DUPACK);
> + cc_ack_received(tp, th, nsegs,
> + CC_DUPACK);
>   if ((tp->t_flags & TF_SACK_PERMIT) &&
>   IN_FASTRECOVERY(tp->t_flags)) {
>   int awnd;
> @@ -1135,7 +1142,8 @@ tcp_do_slowpath(struct mbuf *m, struct t
>   }
>   /* Congestion signal before ack. */
>   cc_cong_signal(tp, th, CC_NDUPACK);
> - cc_ack_received(tp, th, CC_DUPACK);
> + cc_ack_received(tp, th, nsegs,
> + CC_DUPACK);
>   tcp_timer_activate(tp, TT_REXMT, 0);
>   tp->t_rtttime = 0;
>   if (tp->t_flags & TF_SACK_PERMIT) {
> @@ -1169,7 +1177,8 @@ tcp_do_slowpath(struct mbuf *m, struct t
>* segment. Restore the original
>* snd_cwnd after packet transmission.
>*/
> - cc_ack_received(tp, th, CC_DUPACK);
> + cc_ack_received(tp, th, nsegs,
> + CC_DUPACK);
>   u_long oldcwnd = tp->snd_cwnd;
>   tcp_seq oldsndmax = tp->snd_max;
>   u_int sent;
> @@ -1323,7 +1332,7 @@ process_ACK:
>* control related information. This typically means increasing
>* the congestion window.
>*/
> - cc_ack_received(tp, th, CC_ACK);
> + cc_ack_received(tp, th, nsegs, CC_ACK);
>  
>   SOCKBUF_LOCK(>so_snd);
>   if (acked > sbavail(>so_snd)) {
> @@ -1758,6 +1767,7 @@ tcp_do_segment_fastslow(struct mbuf *m, 
>   int thflags;
>   u_long tiwin;
>   char *s;
> + uint16_t nsegs;
>   int can_enter;
>   struct in_conninfo *inc;
>  

svn commit: r304803 - in head/sys: netinet netinet/cc sys

2016-08-25 Thread Lawrence Stewart
Author: lstewart
Date: Thu Aug 25 13:33:32 2016
New Revision: 304803
URL: https://svnweb.freebsd.org/changeset/base/304803

Log:
  Pass the number of segments coalesced by LRO up the stack by repurposing the
  tso_segsz pkthdr field during RX processing, and use the information in TCP 
for
  more correct accounting and as a congestion control input. This is only a 
start,
  and an audit of other uses for the data is left as future work.
  
  Reviewed by:  gallatin, rrs
  Sponsored by: Netflix, Inc.
  Differential Revision:https://reviews.freebsd.org/D7564

Modified:
  head/sys/netinet/cc/cc.h
  head/sys/netinet/cc/cc_newreno.c
  head/sys/netinet/tcp_input.c
  head/sys/netinet/tcp_lro.c
  head/sys/netinet/tcp_var.h
  head/sys/sys/mbuf.h

Modified: head/sys/netinet/cc/cc.h
==
--- head/sys/netinet/cc/cc.hThu Aug 25 13:24:11 2016(r304802)
+++ head/sys/netinet/cc/cc.hThu Aug 25 13:33:32 2016(r304803)
@@ -86,6 +86,7 @@ struct cc_var {
struct tcpcb*tcp;
struct sctp_nets*sctp;
} ccvc;
+   uint16_tnsegs; /* # segments coalesced into current chain. */
 };
 
 /* cc_var flags. */

Modified: head/sys/netinet/cc/cc_newreno.c
==
--- head/sys/netinet/cc/cc_newreno.cThu Aug 25 13:24:11 2016
(r304802)
+++ head/sys/netinet/cc/cc_newreno.cThu Aug 25 13:33:32 2016
(r304803)
@@ -137,7 +137,8 @@ newreno_ack_received(struct cc_var *ccv,
 */
if (CCV(ccv, snd_nxt) == CCV(ccv, snd_max))
incr = min(ccv->bytes_this_ack,
-   V_tcp_abc_l_var * CCV(ccv, t_maxseg));
+   ccv->nsegs * V_tcp_abc_l_var *
+   CCV(ccv, t_maxseg));
else
incr = min(ccv->bytes_this_ack, CCV(ccv, 
t_maxseg));
}

Modified: head/sys/netinet/tcp_input.c
==
--- head/sys/netinet/tcp_input.cThu Aug 25 13:24:11 2016
(r304802)
+++ head/sys/netinet/tcp_input.cThu Aug 25 13:33:32 2016
(r304803)
@@ -300,10 +300,12 @@ hhook_run_tcp_est_in(struct tcpcb *tp, s
  * CC wrapper hook functions
  */
 void
-cc_ack_received(struct tcpcb *tp, struct tcphdr *th, uint16_t type)
+cc_ack_received(struct tcpcb *tp, struct tcphdr *th, uint16_t nsegs,
+uint16_t type)
 {
INP_WLOCK_ASSERT(tp->t_inpcb);
 
+   tp->ccv->nsegs = nsegs;
tp->ccv->bytes_this_ack = BYTES_THIS_ACK(tp, th);
if (tp->snd_cwnd <= tp->snd_wnd)
tp->ccv->flags |= CCF_CWND_LIMITED;
@@ -313,7 +315,7 @@ cc_ack_received(struct tcpcb *tp, struct
if (type == CC_ACK) {
if (tp->snd_cwnd > tp->snd_ssthresh) {
tp->t_bytes_acked += min(tp->ccv->bytes_this_ack,
-V_tcp_abc_l_var * tcp_maxseg(tp));
+nsegs * V_tcp_abc_l_var * tcp_maxseg(tp));
if (tp->t_bytes_acked >= tp->snd_cwnd) {
tp->t_bytes_acked -= tp->snd_cwnd;
tp->ccv->flags |= CCF_ABC_SENTAWND;
@@ -1502,6 +1504,7 @@ tcp_do_segment(struct mbuf *m, struct tc
int thflags, acked, ourfinisacked, needoutput = 0, sack_changed;
int rstreason, todrop, win;
u_long tiwin;
+   uint16_t nsegs;
char *s;
struct in_conninfo *inc;
struct mbuf *mfree;
@@ -1521,6 +1524,7 @@ tcp_do_segment(struct mbuf *m, struct tc
inc = >t_inpcb->inp_inc;
tp->sackhint.last_sack_ack = 0;
sack_changed = 0;
+   nsegs = max(1, m->m_pkthdr.lro_nsegs);
 
/*
 * If this is either a state-changing packet or current state isn't
@@ -1759,7 +1763,7 @@ tcp_do_segment(struct mbuf *m, struct tc
/* Run HHOOK_TCP_ESTABLISHED_IN helper hooks. */
hhook_run_tcp_est_in(tp, th, );
 
-   TCPSTAT_INC(tcps_rcvackpack);
+   TCPSTAT_ADD(tcps_rcvackpack, nsegs);
TCPSTAT_ADD(tcps_rcvackbyte, acked);
sbdrop(>so_snd, acked);
if (SEQ_GT(tp->snd_una, tp->snd_recover) &&
@@ -1772,7 +1776,7 @@ tcp_do_segment(struct mbuf *m, struct tc
 * typically means increasing the congestion
 * window.
 */
-   cc_ack_received(tp, th, CC_ACK);
+   cc_ack_received(tp, th, nsegs, CC_ACK);
 
tp->snd_una = th->th_ack;
 

Re: svn commit: r297193 - head/sys/netinet

2016-03-22 Thread Lawrence Stewart
On 03/23/16 10:59, Conrad Meyer wrote:
> On Tue, Mar 22, 2016 at 8:55 AM, Jonathan T. Looney  wrote:
>> Author: jtl
>> Date: Tue Mar 22 15:55:17 2016
>> New Revision: 297193
>> URL: https://svnweb.freebsd.org/changeset/base/297193
>>
>> ...
>>
>>   MFC after:2 weeks
> 
> This change seems like it would be ineligible for a MFC due to
> changing the ABI of struct tcpopt.

Off the top of my head I can't think of why you would consider struct
tcpopt to be part of the ABI. Can you point to any concrete examples
demonstrating that it is either explicitly or in a defacto sense?

Cheers,
Lawrence
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r294535 - in head/sys/netinet: . cc tcp_stacks

2016-01-26 Thread Lawrence Stewart
On 01/24/16 19:07, Gleb Smirnoff wrote:
>   Lawrence,
> 
> On Sat, Jan 23, 2016 at 05:19:36PM +1100, Lawrence Stewart wrote:
> L> > The problem is that cc.h (or tcp_cc.h) is already depening on many
> L> > TCP types. So, the structures defined inside are not agnostic, including
> L> > tcp headers before cc.h is required.
> L> 
> L> Not in any significant way that tightly couples the API to TCP from
> L> consumers' perspective.
> L> 
> L> > The old cc.h used to include tcp.h implicitly, which is a bad style.
> L> > 
> L> > Since many developers sorted netinet/* includes in a .c file using
> L> > sort(1), that lead to cc.h always come before actual tcp includes,
> L> > hiding the real requirement for tcp.h in a .c file.
> L> 
> L> To provide some more context, I considered that choice to be a lesser
> L> evil at the time. Linux had set the defacto standard macro naming and
> L> location so even though I would have put the CC related defines in cc.h
> L> given the choice, I wanted third-party software which checked for
> L> modular CC the Linux way to work on FreeBSD. The alphabetical ordering
> L> of includes is what prompted me to include tcp.h in cc.h so that cc.h
> L> could happily sit at the top of the list. I probably could have just
> L> moved cc.h to the cc subdir, in which case it would always come
> L> logically after the TCP includes as  - perhaps that's
> L> the right solution.
> 
> Well, if the intent was to provide some sort of compatibility with Linux,
> then my rename is even more valid! Look what left in the cc.h in the
> Netflix source (which is kinda forward of FreeBSD): almost the whole
> file is under _KERNEL. Only the tcp.h pollution left for userland.
> 
> If Linux has cc.h and we want to put same definitions in cc.h, then
> we should start new cc.h and keep this one renamed. Because if we
> provided that one, we won't provide any compatibility, but would
> just pollute with tcp.h.

They do not have cc.h, they stuffed things into tcp.h. When I say I was
trying to keep compat with Linux, I meant that I wanted to leave
TCP_CA_NAME_MAX in tcp.h rather than move it to cc.h where it logically
belongs and is required. This has no bearing on the naming of our cc.h
file, but is the reason why I included tcp.h in cc.h, bad as that may be.

> I am fine with netinet/cc/cc.h. If you agree I can run the rename.

I think this is the right option. Please go ahead and move tcp_cc.h to
netinet/cc/cc.h and update ifdef guard, src includes and man page
accordingly.

Cheers,
Lawrence
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r294535 - in head/sys/netinet: . cc tcp_stacks

2016-01-22 Thread Lawrence Stewart
On 01/23/16 05:18, Gleb Smirnoff wrote:
> On Fri, Jan 22, 2016 at 06:13:54PM +1100, Lawrence Stewart wrote:
> L> On 01/22/16 09:34, Gleb Smirnoff wrote:
> L> > Author: glebius
> L> > Date: Thu Jan 21 22:34:51 2016
> L> > New Revision: 294535
> L> > URL: https://svnweb.freebsd.org/changeset/base/294535
> L> > 
> L> > Log:
> L> >   - Rename cc.h to more meaningful tcp_cc.h.
> L> 
> L> As a bit of historical context, the naming was intentionally protocol
> L> agnostic because it was originally hoped that the CC framework could be
> L> shared between multiple CC aware transports, and the design went to some
> L> lengths to accommodate that possibility (e.g. the ccv_container union in
> L> struct cc_var). SCTP was the obvious potential in tree consumer at the
> L> time, and other protocols like DCCP were considered as well.
> L> 
> L> This hasn't come about to date, but I'm not sure what value is obtained
> L> from your rename change unless we decide to completely give up on shared
> L> CC and if we do that, this change doesn't go far enough and we can
> L> further simplify the framework to make it entirely TCP specific e.g. we
> L> should probably do away with struct cc_var.
> L> 
> L> I'd argue in favour of reverting the rename and if you're gung ho about
> L> making the framework TCP specific, we can start a public discussion
> L> about what that should look like.
> 
> The problem is that cc.h (or tcp_cc.h) is already depening on many
> TCP types. So, the structures defined inside are not agnostic, including
> tcp headers before cc.h is required.

Not in any significant way that tightly couples the API to TCP from
consumers' perspective.

> The old cc.h used to include tcp.h implicitly, which is a bad style.
> 
> Since many developers sorted netinet/* includes in a .c file using
> sort(1), that lead to cc.h always come before actual tcp includes,
> hiding the real requirement for tcp.h in a .c file.

To provide some more context, I considered that choice to be a lesser
evil at the time. Linux had set the defacto standard macro naming and
location so even though I would have put the CC related defines in cc.h
given the choice, I wanted third-party software which checked for
modular CC the Linux way to work on FreeBSD. The alphabetical ordering
of includes is what prompted me to include tcp.h in cc.h so that cc.h
could happily sit at the top of the list. I probably could have just
moved cc.h to the cc subdir, in which case it would always come
logically after the TCP includes as  - perhaps that's
the right solution.

> P.S. Speaking of agnostic stuff. My humble opinion, that in the
> network stack through the whole BSD history agnosticism never yield
> in virtue. Examples: routing code can be used for IPv4, IPv6, Atalk
> and IPX. Result is that Atalk and IPX are history, but our routing
> table uses 8x more memory for IPv4 and performs miserably. Another
> example is the same sockbuf used for all types of sockets, including
> stream, datagram, local and network, which first yielded in quite
> complex code for a quite trivial task, and later then, when SCTP
> came in failed to be agnostic enough to fit into SCTP.

I generally agree with you, though I'm not sure the examples are overly
applicable to the CC framework given the minimal overhead required to
make it agnostic vs the potential overhead of maintaining multiple
incarnations of the same algorithm. That being said, I'm not at all
against declaring the shared CC idea a failed experiment given that it
hasn't come to fruition. I just suggest that if we're going to do that,
we have to go a lot further than just a rename.

Cheers,
Lawrence
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r294536 - head/sys/netinet

2016-01-22 Thread Lawrence Stewart
On 01/23/16 05:04, Gleb Smirnoff wrote:
> On Fri, Jan 22, 2016 at 05:19:34PM +1100, Lawrence Stewart wrote:
> L> On 01/22/16 09:53, Gleb Smirnoff wrote:
> L> > Author: glebius
> L> > Date: Thu Jan 21 22:53:12 2016
> L> > New Revision: 294536
> L> > URL: https://svnweb.freebsd.org/changeset/base/294536
> L> > 
> L> > Log:
> L> >   Refactor TCP_CONGESTION setsockopt handling:
> L> >   - Use M_TEMP instead of stack variable.
> L> >   - Unroll error handling, removing several levels of indentation.
> L> 
> L> As noted privately elsewhere, this change introduces races with respect
> L> to CC algorithm module unloading which will need to be fixed. Just
> L> mentioning it again publicly so others are aware of it.
> 
> In the code checked in the check for (CC_ALGO(tp)->ctl_output being
> not NULL and the actual call are under the same lock.
> 
> Is that the race you refer to?

No, the TCP_CONGESTION refactoring i.e. this commit, introduced races in
the get and set cases. I guess I didn't provide enough context in
Crucible, so here goes...

The post refactoring get code is now:

case TCP_CONGESTION:
INP_WUNLOCK(inp);
error = sooptcopyout(sopt, CC_ALGO(tp)->name, TCP_CA_NAME_MAX);
break;

Consider that tp is using cc_blah and that the cc_blah module is
unloaded as the copy out is happening. By not holding the INP lock, the
CC module unload code is able to walk the list of active connections,
find this connection is using cc_blah, acquire the INP lock, switch this
connection to cc_newreno, release the lock and finally unload the
cc_blah module, rendering the pointer passed in to sooptcopyout garbage.
See cc_deregister_algo() in cc.c and tcp_ccalgounload() in tcp_subr.c
for details related to CC module unload.

The post refactoring set code is now:

case TCP_CONGESTION:
INP_WUNLOCK(inp);
buf = malloc(TCP_CA_NAME_MAX, M_TEMP, M_WAITOK|M_ZERO);
error = sooptcopyin(sopt, buf, TCP_CA_NAME_MAX, 1);
if (error) {
free(buf, M_TEMP);
break;
}
CC_LIST_RLOCK();
STAILQ_FOREACH(algo, _list, entries)
if (strncmp(buf, algo->name, TCP_CA_NAME_MAX) == 0)
break;
CC_LIST_RUNLOCK();
free(buf, M_TEMP);
if (algo == NULL) {
error = EINVAL;
break;
}
INP_WLOCK_RECHECK(inp);
/*
 * We hold a write lock over the tcb so it's safe to
 * do these things without ordering concerns.
 */
if (CC_ALGO(tp)->cb_destroy != NULL)
CC_ALGO(tp)->cb_destroy(tp->ccv);
CC_ALGO(tp) = algo;
/*
 * If something goes pear shaped initialising the new
 * algo, fall back to newreno (which does not
 * require initialisation).
 */
if (algo->cb_init != NULL && algo->cb_init(tp->ccv) != 0) {
CC_ALGO(tp) = _cc_algo;
/*
 * The only reason init should fail is
 * because of malloc.
 */
error = ENOMEM;
   }
   INP_WUNLOCK(inp);
   break;

Consider that the application has requested to switch to "blah"
congestion control and that the cc_blah module is unloaded as the
request is being processed. We hold no locks, copy in the string "blah",
grab the CC list lock, find cc_blah's algo struct in the list leaving
its pointer stored in the "algo" variable and drop the CC list lock.

Crucially at this point, we don't hold the INP lock, so once we drop the
CC list lock, the CC module unload code is free to pull cc_blah from the
CC module list, walk the list of active connections and switch any using
cc_blah to cc_newreno and to unload the cc_blah module. The tp we're
modifying hasn't switched to cc_blah yet so it won't be reverted to
cc_newreno by the CC module unload code, which means the "algo" variable
will be a garbage pointer by the time we get around to grabbing the INP
lock at the INP_WLOCK_RECHECK() line of code.

You have to ensure that the algo pointer is valid and that the INP lock
is held at the time of assigning to the tp, as that will ensure that if
you're racing with the unload code, the unload code will correctly
switch the connection's algo back to cc_newreno once it's able to
acquire the INP lock.

Cheers,
Lawrence
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r294535 - in head/sys/netinet: . cc tcp_stacks

2016-01-22 Thread Lawrence Stewart
On 01/23/16 03:06, Bjoern A. Zeeb wrote:
> 
>> On 22 Jan 2016, at 15:21 , George Neville-Neil <g...@neville-neil.com> wrote:
>>
>>
>>
>> On 22 Jan 2016, at 2:13, Lawrence Stewart wrote:
>>
>>> Hi Gleb,
>>>
>>> On 01/22/16 09:34, Gleb Smirnoff wrote:
>>>> Author: glebius
>>>> Date: Thu Jan 21 22:34:51 2016
>>>> New Revision: 294535
>>>> URL: https://svnweb.freebsd.org/changeset/base/294535
>>>>
>>>> Log:
>>>> - Rename cc.h to more meaningful tcp_cc.h.
>>>
>>> As a bit of historical context, the naming was intentionally protocol
>>> agnostic because it was originally hoped that the CC framework could be
>>> shared between multiple CC aware transports, and the design went to some
>>> lengths to accommodate that possibility (e.g. the ccv_container union in
>>> struct cc_var). SCTP was the obvious potential in tree consumer at the
>>> time, and other protocols like DCCP were considered as well.
>>>
>>> This hasn't come about to date, but I'm not sure what value is obtained
>>> from your rename change unless we decide to completely give up on shared
>>> CC and if we do that, this change doesn't go far enough and we can
>>> further simplify the framework to make it entirely TCP specific e.g. we
>>> should probably do away with struct cc_var.
>>>
>>> I'd argue in favour of reverting the rename and if you're gung ho about
>>> making the framework TCP specific, we can start a public discussion
>>> about what that should look like.
>>>
>>
>> I actually was wondering about this as well.  I think it ought to be 
>> reverted to agnostic.
> 
> I probably share that view but I also agree that cc.h is not a good name.
> 
> So before we entirely revert this, can when maybe come up with a name that is 
> better than cc.h or tcp_cc.h and only make this one more change forward 
> rather than going back to the previous status quo?

I don't object to a name change if it's desired by others, but I don't
have any suggestions to offer and would personally just stick with cc.h

Cheers,
Lawrence
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r294536 - head/sys/netinet

2016-01-21 Thread Lawrence Stewart
Hi Gleb,

On 01/22/16 09:53, Gleb Smirnoff wrote:
> Author: glebius
> Date: Thu Jan 21 22:53:12 2016
> New Revision: 294536
> URL: https://svnweb.freebsd.org/changeset/base/294536
> 
> Log:
>   Refactor TCP_CONGESTION setsockopt handling:
>   - Use M_TEMP instead of stack variable.
>   - Unroll error handling, removing several levels of indentation.

As noted privately elsewhere, this change introduces races with respect
to CC algorithm module unloading which will need to be fixed. Just
mentioning it again publicly so others are aware of it.

Cheers,
Lawrence
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r294535 - in head/sys/netinet: . cc tcp_stacks

2016-01-21 Thread Lawrence Stewart
Hi Gleb,

On 01/22/16 09:34, Gleb Smirnoff wrote:
> Author: glebius
> Date: Thu Jan 21 22:34:51 2016
> New Revision: 294535
> URL: https://svnweb.freebsd.org/changeset/base/294535
> 
> Log:
>   - Rename cc.h to more meaningful tcp_cc.h.

As a bit of historical context, the naming was intentionally protocol
agnostic because it was originally hoped that the CC framework could be
shared between multiple CC aware transports, and the design went to some
lengths to accommodate that possibility (e.g. the ccv_container union in
struct cc_var). SCTP was the obvious potential in tree consumer at the
time, and other protocols like DCCP were considered as well.

This hasn't come about to date, but I'm not sure what value is obtained
from your rename change unless we decide to completely give up on shared
CC and if we do that, this change doesn't go far enough and we can
further simplify the framework to make it entirely TCP specific e.g. we
should probably do away with struct cc_var.

I'd argue in favour of reverting the rename and if you're gung ho about
making the framework TCP specific, we can start a public discussion
about what that should look like.

Cheers,
Lawrence
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r293713 - svnadmin/conf

2016-01-11 Thread Lawrence Stewart
Author: lstewart
Date: Tue Jan 12 00:07:26 2016
New Revision: 293713
URL: https://svnweb.freebsd.org/changeset/base/293713

Log:
  Remove myself after having forgotten to do so post my previous large commit.

Modified:
  svnadmin/conf/sizelimit.conf

Modified: svnadmin/conf/sizelimit.conf
==
--- svnadmin/conf/sizelimit.confMon Jan 11 23:42:00 2016
(r293712)
+++ svnadmin/conf/sizelimit.confTue Jan 12 00:07:26 2016
(r293713)
@@ -22,7 +22,6 @@ dim
 imp
 jb
 jeff
-lstewart
 obrien
 peter
 rwatson
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r283136 - head/sys/netinet

2015-05-20 Thread Lawrence Stewart
On 05/20/15 14:24, Hiren Panchasara wrote:
 On 05/20/15 at 02:13P, Lawrence Stewart wrote:
 Hi Hiren,
 
 On 05/20/15 11:08, Hiren Panchasara wrote:
 Author: hiren Date: Wed May 20 01:08:01 2015 New Revision:
 283136 URL: https://svnweb.freebsd.org/changeset/base/283136
 
 Log: Add a new sysctl net.inet.tcp.hostcache.purgenow=1 to
 expire and purge all entries in hostcache immediately.
 
 In collaboration with:  bz, rwatson MFC after:  1 week Relnotes:
 yes Sponsored by:   Limelight Networks
 
 Why introduce a new sysctl and not change the existing behaviour
 of net.inet.tcp.hostcache.purge?
 
 I thought it'd make more sense to keep the existing behavior as is
 and provide new knob for the new behavior.

Don't think so - why would deferring a purge to the next purge run be
useful compared to purging immediately? I'd strongly suggest you adapt
this change to the existing purge sysctl. I can't see why anyone would
miss the old functionality.

Cheers,
Lawrence
___
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


Re: svn commit: r283136 - head/sys/netinet

2015-05-20 Thread Lawrence Stewart
On 05/20/15 23:19, Eric van Gyzen wrote:
 On 05/20/2015 02:33, Lawrence Stewart wrote:
 On 05/20/15 14:24, Hiren Panchasara wrote:
 On 05/20/15 at 02:13P, Lawrence Stewart wrote:
 Hi Hiren,

 On 05/20/15 11:08, Hiren Panchasara wrote:
 Author: hiren Date: Wed May 20 01:08:01 2015 New Revision:
 283136 URL: https://svnweb.freebsd.org/changeset/base/283136

 Log: Add a new sysctl net.inet.tcp.hostcache.purgenow=1 to
 expire and purge all entries in hostcache immediately.

 In collaboration with:bz, rwatson MFC after:  1 week Relnotes:
 yes Sponsored by: Limelight Networks

 Why introduce a new sysctl and not change the existing behaviour
 of net.inet.tcp.hostcache.purge?

 I thought it'd make more sense to keep the existing behavior as is
 and provide new knob for the new behavior.

 Don't think so - why would deferring a purge to the next purge run be
 useful compared to purging immediately? I'd strongly suggest you adapt
 this change to the existing purge sysctl. I can't see why anyone would
 miss the old functionality.
 
 I am generally wary of a question such as Why would anyone want..., because 
 as soon as the code is released, someone answers it.
 
 That being said, I have always wanted Hiren's purgenow behavior, and I've 
 always been annoyed by the lazy-purge behavior.  I would suggest implementing 
 Lawrence's suggestion, but NOT MFC'ing it, since that would be a disruptive 
 change.
 
 Thanks for your work, Hiren.

I see no reason not to MFC it - it's not a POLA violation for a stable
branch. When the user requests a purge, it's surely equally as good (and
I think anyone of right mind would argue better ;) to purge immediately
than some number of seconds n in the future, where n is between 1
and the value of net.inet.tcp.hostcache.prune.

Cheers,
Lawrence
___
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


Re: svn commit: r283136 - head/sys/netinet

2015-05-19 Thread Lawrence Stewart
Hi Hiren,

On 05/20/15 11:08, Hiren Panchasara wrote:
 Author: hiren
 Date: Wed May 20 01:08:01 2015
 New Revision: 283136
 URL: https://svnweb.freebsd.org/changeset/base/283136
 
 Log:
   Add a new sysctl net.inet.tcp.hostcache.purgenow=1 to expire and purge all
   entries in hostcache immediately.
   
   In collaboration with:  bz, rwatson
   MFC after:  1 week
   Relnotes:   yes
   Sponsored by:   Limelight Networks

Why introduce a new sysctl and not change the existing behaviour of
net.inet.tcp.hostcache.purge?

Cheers,
Lawrence
___
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: r280441 - head/sys/netinet

2015-03-24 Thread Lawrence Stewart
Author: lstewart
Date: Tue Mar 24 15:08:43 2015
New Revision: 280441
URL: https://svnweb.freebsd.org/changeset/base/280441

Log:
  The addition of flowid and flowtype in r280233 and r280237 respectively forgot
  to extend the IPv6 packet node format string, which causes a build failure 
when
  SIFTR is compiled with IPv6 support.
  
  Reported by:  Lars Eggert

Modified:
  head/sys/netinet/siftr.c

Modified: head/sys/netinet/siftr.c
==
--- head/sys/netinet/siftr.cTue Mar 24 15:05:36 2015(r280440)
+++ head/sys/netinet/siftr.cTue Mar 24 15:08:43 2015(r280441)
@@ -448,7 +448,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,%u\n,
+   %u,%d,%u,%u,%u,%u,%u,%u,%u,%u\n,
direction[pkt_node-direction],
pkt_node-hash,
pkt_node-tval.tv_sec,
___
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


Re: svn commit: r275832 - head/tools/tools/nanobsd

2015-01-21 Thread Lawrence Stewart
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA512

On 01/22/15 02:23, Will Andrews wrote:
 On Wed, Jan 21, 2015 at 06:51:23PM +1100, Lawrence Stewart wrote:
 I think this change introduced a bug - I'm seeing nanobsd error 
 out with the NANO_TOOLS directory does not exist message.
 
 The problem is that NANO_TOOLS is initialised to 
 tools/tools/nanobsd, and you changed the test in nanobsd.sh to 
 *not* check for ${NANO_SRC}/${NANO_TOOLS}, which errors out 
 except if the cwd is ${NANO_SRC}.
 
 You tweak NANO_TOOLS appropriately in set_defaults_and_export() 
 but it's run after the dir test. There are a couple of ways to 
 fix but I'll leave it to you to decide which you prefer.
 
 Will this work for you?
 
 https://people.freebsd.org/~will/patches/nanobsd.sh.diff
 
 This also fixes another bug where NANO_PMAKE would be modified too 
 early.

Yes, looks good to me and fixes the issue I reported. Please commit.

Cheers,
Lawrence
-BEGIN PGP SIGNATURE-
Version: GnuPG v2

iQJ8BAEBCgBmBQJUwC4GXxSAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w
ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXQ4RkIyRTlBMzM5RUE3OEExNUUxREI4QTI5
QTUwQkNGQ0Y0MEQ5QjA5AAoJEJpQvPz0DZsJ40QP+gOt9Sl11w5jLOxwfEYYKNCb
AjFkwhpmbAlpLMFR7OR7DvlRG6svHaO7RzK7pTbEHID3igdSx3+NRpBE+tyAe8fC
dl2hSmGLcGq6007HCGOZGW181tfv9BrRRxKwEXEP7sGhByR5hyFy0JweaLr0TpGb
8CruuZ3hUjDEaTMIBPhBaMWMNsWHJy6Qszj3iE8FwFnmMLnC9yXbfKTXP3iT88wd
y+Aq86Y5NT4HytcbWOaNa6mvQTsZfxnFIVppN+u3AWpgzhh76HzOgeFKK4Wj32/j
eK3v/hi/aSmOaW5AKR10n2ADutjFvMLaHhMVVIOIBTJ6KQ7W38PGR4/sTqbxkAqa
AUsTm53Bz9w3fjr4YhNzOtu0nwgcD1LyUJKnwoyUig97BL8Ogphj+I/4rzB150uD
dnvgLoqY8Qh2ck0eciFiKZdY9k5t0cpQPNwpRl/L+wssKbdKGg4/0Ob5/fy9HVkx
JrcrkmNyIMpLsN683OMNgvbIB5ow6Ya2cNmJtHVS8N8sJ7/Sd4RYPfEWIk7UUX9b
lv+NQm42CyERE98TvE6felmb+iLFF79D2e0wJAis+pbDf8KlMIC3DBjdXls+BEZm
048o1sulxUuo2YMnQHF1sP6bZgeCwI9LslJGlXmLG8WA2oL5I9GJfnkwyD6rbJyx
668QEgpTzhLuAUBXGMT8
=QGdi
-END PGP SIGNATURE-
___
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


Re: svn commit: r275832 - head/tools/tools/nanobsd

2015-01-21 Thread Lawrence Stewart
Hi Will,

On 12/17/14 04:59, Will Andrews wrote:
 Author: will
 Date: Tue Dec 16 17:59:05 2014
 New Revision: 275832
 URL: https://svnweb.freebsd.org/changeset/base/275832
 
 Log:
   Make NanoBSD source-able from other scripts.
   
   Summary:
   This change converts NanoBSD into a two-script bundle.
   - defaults.sh contains all non-CLI code.  Most NanoBSD code is moved into
 this file.
   - nanobsd.sh now consists just of a command line interface that calls into
 functions in defaults.sh.
   
   Test Plan: Run NanoBSD using a previously-working configuration.
   
   Reviewers: imp
   
   Reviewed By: imp
   
   Differential Revision: https://reviews.freebsd.org/D1321
 
 Added:
   head/tools/tools/nanobsd/defaults.sh   (contents, props changed)
 Modified:
   head/tools/tools/nanobsd/nanobsd.sh

I think this change introduced a bug - I'm seeing nanobsd error out with
the NANO_TOOLS directory does not exist message.

The problem is that NANO_TOOLS is initialised to tools/tools/nanobsd,
and you changed the test in nanobsd.sh to *not* check for
${NANO_SRC}/${NANO_TOOLS}, which errors out except if the cwd is
${NANO_SRC}.

You tweak NANO_TOOLS appropriately in set_defaults_and_export() but it's
run after the dir test. There are a couple of ways to fix but I'll leave
it to you to decide which you prefer.

Cheers,
Lawrence
___
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


Re: svn commit: r277213 - in head: share/man/man9 sys/kern sys/ofed/include/linux sys/sys

2015-01-21 Thread Lawrence Stewart
On 01/20/15 09:22, Adrian Chadd wrote:
 Yeah, it looks like you set c_cpu to timeout_cpu in
 _callout_init_locked(), but then you only handle the case of the CPU
 being changed in certain circumstances. You aren't handling the CPU
 being initialised when the callout is first added.
 
 And, callout_restart_async() calls callout_lock(), which calls
 CC_LOCK() on the callout CPU, which initially is zero. Then, it never
 seems to be 'moved' into the correct CPU, even though it's being
 called with a CPU id.
 
 So, if I am reading this all correctly, you aren't really handling
 multi CPU callwheels at all. ;)
 
 In my instance, I'm seeing quite a lot of lock contention between the
 userland threads, the network RX threads and the clock thread, all
 contending on a single callout wheel being used for TCP timers. One of
 the early goals for fixing up the RSS stuff in -HEAD was to make
 per-CPU (Well, per-RSS-bucket really) TCP timers not contend with the
 NIC RX processing path, and now it does. :(

To clarify, you're seeing this with net.inet.tcp.per_cpu_timers=1?

Cheers,
Lawrence
___
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


Re: svn commit: r272386 - in head: sbin/ifconfig share/man/man4 sys/net

2014-10-28 Thread Lawrence Stewart
On 10/27/14 13:43, Lawrence Stewart wrote:
 Hi Hiroki-san,
 
 On 10/02/14 07:37, Hiroki Sato wrote:
 Author: hrs
 Date: Wed Oct  1 21:37:32 2014
 New Revision: 272386
 URL: https://svnweb.freebsd.org/changeset/base/272386

 Log:
   Virtualize lagg(4) cloner.  This change fixes a panic when tearing down
   if_lagg(4) interfaces which were cloned in a vnet jail.
   
   Sysctl nodes which are dynamically generated for each cloned interface
   (net.link.lagg.N.*) have been removed, and use_flowid and flowid_shift
   ifconfig(8) parameters have been added instead.  Flags and per-interface
   statistics counters are displayed in ifconfig -v.
   
   CR:D842

 Modified:
   head/sbin/ifconfig/ifconfig.8
   head/sbin/ifconfig/iflagg.c
   head/share/man/man4/lagg.4
   head/sys/net/ieee8023ad_lacp.c
   head/sys/net/if_lagg.c
   head/sys/net/if_lagg.h
 
 What was the reasoning for removing the net.link.lagg.* sysctls? We use
 them at Netflix and the new way of obtaining the information via
 ifconfig -v is less structured and significantly higher overhead by
 comparison. Would be good to have the sysctls back or an equivalent low
 overhead way of obtaining the previously available information.

So it turns out I was missing some important context on this matter. We
don't in fact want or need the sysctls back and have a sane way to
access the information via means other than parsing ifconfig output.

In short, apologies for the noise and move along, there's nothing to see
here :)

Cheers,
Lawrence

___
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


Re: svn commit: r272386 - in head: sbin/ifconfig share/man/man4 sys/net

2014-10-26 Thread Lawrence Stewart
Hi Hiroki-san,

On 10/02/14 07:37, Hiroki Sato wrote:
 Author: hrs
 Date: Wed Oct  1 21:37:32 2014
 New Revision: 272386
 URL: https://svnweb.freebsd.org/changeset/base/272386
 
 Log:
   Virtualize lagg(4) cloner.  This change fixes a panic when tearing down
   if_lagg(4) interfaces which were cloned in a vnet jail.
   
   Sysctl nodes which are dynamically generated for each cloned interface
   (net.link.lagg.N.*) have been removed, and use_flowid and flowid_shift
   ifconfig(8) parameters have been added instead.  Flags and per-interface
   statistics counters are displayed in ifconfig -v.
   
   CR: D842
 
 Modified:
   head/sbin/ifconfig/ifconfig.8
   head/sbin/ifconfig/iflagg.c
   head/share/man/man4/lagg.4
   head/sys/net/ieee8023ad_lacp.c
   head/sys/net/if_lagg.c
   head/sys/net/if_lagg.h

What was the reasoning for removing the net.link.lagg.* sysctls? We use
them at Netflix and the new way of obtaining the information via
ifconfig -v is less structured and significantly higher overhead by
comparison. Would be good to have the sysctls back or an equivalent low
overhead way of obtaining the previously available information.

Cheers,
Lawrence
___
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


Re: svn commit: r271946 - in head/sys: dev/oce dev/vmware/vmxnet3 dev/xen/netfront kern net netinet ofed/drivers/net/mlx4 sys

2014-10-13 Thread Lawrence Stewart
Hi Hans,

I have questions and feedback regarding this patch that I was hoping to
work through with you. Some general points are below and then context
specific points are inline with the patch further down.

- Is QinQ support affected by this change?

- There are some style(9) nits throughout that might be tweaked if parts
of this patch end up being reworked e.g. new lines in
if_hw_tsomax_common() and if_hw_tsomax_update()


On 09/22/14 18:27, Hans Petter Selasky wrote:
 Author: hselasky
 Date: Mon Sep 22 08:27:27 2014
 New Revision: 271946
 URL: http://svnweb.freebsd.org/changeset/base/271946
 
 Log:
   Improve transmit sending offload, TSO, algorithm in general.
   
   The current TSO limitation feature only takes the total number of
   bytes in an mbuf chain into account and does not limit by the number
   of mbufs in a chain. Some kinds of hardware is limited by two
   factors. One is the fragment length and the second is the fragment
   count. Both of these limits need to be taken into account when doing
   TSO. Else some kinds of hardware might have to drop completely valid
   mbuf chains because they cannot loaded into the given hardware's DMA
   engine. The new way of doing TSO limitation has been made backwards
   compatible as input from other FreeBSD developers and will use
   defaults for values not set.
   
   Reviewed by:adrian, rmacklem
   Sponsored by:   Mellanox Technologies
   MFC after:  1 week
 
 Modified:
   head/sys/dev/oce/oce_if.c
   head/sys/dev/oce/oce_if.h
   head/sys/dev/vmware/vmxnet3/if_vmx.c
   head/sys/dev/vmware/vmxnet3/if_vmxvar.h
   head/sys/dev/xen/netfront/netfront.c
   head/sys/kern/uipc_sockbuf.c
   head/sys/net/if.c
   head/sys/net/if_lagg.c
   head/sys/net/if_var.h
   head/sys/net/if_vlan.c
   head/sys/netinet/tcp_input.c
   head/sys/netinet/tcp_output.c
   head/sys/netinet/tcp_subr.c
   head/sys/netinet/tcp_var.h
   head/sys/ofed/drivers/net/mlx4/en_netdev.c
   head/sys/sys/sockbuf.h
 
 Modified: head/sys/dev/oce/oce_if.c
 ==
 --- head/sys/dev/oce/oce_if.c Mon Sep 22 07:59:25 2014(r271945)
 +++ head/sys/dev/oce/oce_if.c Mon Sep 22 08:27:27 2014(r271946)
 @@ -1731,7 +1731,9 @@ oce_attach_ifp(POCE_SOFTC sc)
   sc-ifp-if_baudrate = IF_Gbps(10);
  
  #if __FreeBSD_version = 100
 - sc-ifp-if_hw_tsomax = OCE_MAX_TSO_SIZE;
 + sc-ifp-if_hw_tsomax = 65536 - (ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN);
 + sc-ifp-if_hw_tsomaxsegcount = OCE_MAX_TX_ELEMENTS;
 + sc-ifp-if_hw_tsomaxsegsize = 4096;
  #endif
  
   ether_ifattach(sc-ifp, sc-macaddr.mac_addr);
 

I don't like the use of the 65536 magic number here and throughout the
driver changes. Also, should it be 65536 or IP_MAXPACKET (65535)?

 Modified: head/sys/dev/oce/oce_if.h
 ==
 --- head/sys/dev/oce/oce_if.h Mon Sep 22 07:59:25 2014(r271945)
 +++ head/sys/dev/oce/oce_if.h Mon Sep 22 08:27:27 2014(r271946)
 @@ -152,7 +152,6 @@ extern int mp_ncpus;  /* system's 
 total
  #define OCE_MAX_TX_ELEMENTS  29
  #define OCE_MAX_TX_DESC  1024
  #define OCE_MAX_TX_SIZE  65535
 -#define OCE_MAX_TSO_SIZE (65535 - ETHER_HDR_LEN)
  #define OCE_MAX_RX_SIZE  4096
  #define OCE_MAX_RQ_POSTS 255
  #define OCE_DEFAULT_PROMISCUOUS  0
 
 Modified: head/sys/dev/vmware/vmxnet3/if_vmx.c
 ==
 --- head/sys/dev/vmware/vmxnet3/if_vmx.c  Mon Sep 22 07:59:25 2014
 (r271945)
 +++ head/sys/dev/vmware/vmxnet3/if_vmx.c  Mon Sep 22 08:27:27 2014
 (r271946)
 @@ -1722,7 +1722,9 @@ vmxnet3_setup_interface(struct vmxnet3_s
   ifp-if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
   ifp-if_init = vmxnet3_init;
   ifp-if_ioctl = vmxnet3_ioctl;
 - ifp-if_hw_tsomax = VMXNET3_TSO_MAXSIZE;
 + ifp-if_hw_tsomax = 65536 - (ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN);
 + ifp-if_hw_tsomaxsegcount = VMXNET3_TX_MAXSEGS;
 + ifp-if_hw_tsomaxsegsize = VMXNET3_TX_MAXSEGSIZE;
  
  #ifdef VMXNET3_LEGACY_TX
   ifp-if_start = vmxnet3_start;
 
 Modified: head/sys/dev/vmware/vmxnet3/if_vmxvar.h
 ==
 --- head/sys/dev/vmware/vmxnet3/if_vmxvar.h   Mon Sep 22 07:59:25 2014
 (r271945)
 +++ head/sys/dev/vmware/vmxnet3/if_vmxvar.h   Mon Sep 22 08:27:27 2014
 (r271946)
 @@ -277,8 +277,6 @@ struct vmxnet3_softc {
   */
  #define VMXNET3_TX_MAXSEGS   32
  #define VMXNET3_TX_MAXSIZE   (VMXNET3_TX_MAXSEGS * MCLBYTES)
 -#define VMXNET3_TSO_MAXSIZE \
 -(VMXNET3_TX_MAXSIZE - sizeof(struct ether_vlan_header))
  
  /*
   * Maximum support Tx segments size. The length field in the
 
 Modified: 

svn commit: r271690 - stable/10/sys/netinet/cc

2014-09-16 Thread Lawrence Stewart
Author: lstewart
Date: Tue Sep 16 21:26:24 2014
New Revision: 271690
URL: http://svnweb.freebsd.org/changeset/base/271690

Log:
  MFC r270160:
  
  Destroy the qdiffsample_zone UMA zone on unload to avoid a use-after-unload
  panic easily triggered by running sysctl -a after unload.
  
  Reported and tested by:   Grenville Armitage garmit...@swin.edu.au
  Approved by:  re(gjb)

Modified:
  stable/10/sys/netinet/cc/cc_cdg.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/netinet/cc/cc_cdg.c
==
--- stable/10/sys/netinet/cc/cc_cdg.c   Tue Sep 16 20:48:13 2014
(r271689)
+++ stable/10/sys/netinet/cc/cc_cdg.c   Tue Sep 16 21:26:24 2014
(r271690)
@@ -221,6 +221,7 @@ static VNET_DEFINE(uint32_t, cdg_hold_ba
 
 /* Function prototypes. */
 static int cdg_mod_init(void);
+static int cdg_mod_destroy(void);
 static void cdg_conn_init(struct cc_var *ccv);
 static int cdg_cb_init(struct cc_var *ccv);
 static void cdg_cb_destroy(struct cc_var *ccv);
@@ -234,7 +235,8 @@ struct cc_algo cdg_cc_algo = {
.cb_destroy = cdg_cb_destroy,
.cb_init = cdg_cb_init,
.conn_init = cdg_conn_init,
-   .cong_signal = cdg_cong_signal
+   .cong_signal = cdg_cong_signal,
+   .mod_destroy = cdg_mod_destroy
 };
 
 /* Vnet created and being initialised. */
@@ -278,6 +280,14 @@ cdg_mod_init(void)
 }
 
 static int
+cdg_mod_destroy(void)
+{
+
+   uma_zdestroy(qdiffsample_zone);
+   return (0);
+}
+
+static int
 cdg_cb_init(struct cc_var *ccv)
 {
struct cdg *cdg_data;
___
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: r271653 - stable/9/sys/netinet/cc

2014-09-15 Thread Lawrence Stewart
Author: lstewart
Date: Tue Sep 16 00:04:38 2014
New Revision: 271653
URL: http://svnweb.freebsd.org/changeset/base/271653

Log:
  MFC r270160:
  
  Destroy the qdiffsample_zone UMA zone on unload to avoid a use-after-unload
  panic easily triggered by running sysctl -a after unload.
  
  Reported and tested by:   Grenville Armitage garmit...@swin.edu.au

Modified:
  stable/9/sys/netinet/cc/cc_cdg.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/netinet/cc/cc_cdg.c
==
--- stable/9/sys/netinet/cc/cc_cdg.cMon Sep 15 23:43:01 2014
(r271652)
+++ stable/9/sys/netinet/cc/cc_cdg.cTue Sep 16 00:04:38 2014
(r271653)
@@ -226,6 +226,7 @@ static VNET_DEFINE(uint32_t, cdg_hold_ba
 
 /* Function prototypes. */
 static int cdg_mod_init(void);
+static int cdg_mod_destroy(void);
 static void cdg_conn_init(struct cc_var *ccv);
 static int cdg_cb_init(struct cc_var *ccv);
 static void cdg_cb_destroy(struct cc_var *ccv);
@@ -239,7 +240,8 @@ struct cc_algo cdg_cc_algo = {
.cb_destroy = cdg_cb_destroy,
.cb_init = cdg_cb_init,
.conn_init = cdg_conn_init,
-   .cong_signal = cdg_cong_signal
+   .cong_signal = cdg_cong_signal,
+   .mod_destroy = cdg_mod_destroy
 };
 
 /* Vnet created and being initialised. */
@@ -283,6 +285,14 @@ cdg_mod_init(void)
 }
 
 static int
+cdg_mod_destroy(void)
+{
+
+   uma_zdestroy(qdiffsample_zone);
+   return (0);
+}
+
+static int
 cdg_cb_init(struct cc_var *ccv)
 {
struct cdg *cdg_data;
___
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: r271654 - stable/8/sys/netinet/cc

2014-09-15 Thread Lawrence Stewart
Author: lstewart
Date: Tue Sep 16 00:11:01 2014
New Revision: 271654
URL: http://svnweb.freebsd.org/changeset/base/271654

Log:
  MFC r270160:
  
  Destroy the qdiffsample_zone UMA zone on unload to avoid a use-after-unload
  panic easily triggered by running sysctl -a after unload.
  
  Reported and tested by:   Grenville Armitage garmit...@swin.edu.au

Modified:
  stable/8/sys/netinet/cc/cc_cdg.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/netinet/   (props changed)

Modified: stable/8/sys/netinet/cc/cc_cdg.c
==
--- stable/8/sys/netinet/cc/cc_cdg.cTue Sep 16 00:04:38 2014
(r271653)
+++ stable/8/sys/netinet/cc/cc_cdg.cTue Sep 16 00:11:01 2014
(r271654)
@@ -226,6 +226,7 @@ static VNET_DEFINE(uint32_t, cdg_hold_ba
 
 /* Function prototypes. */
 static int cdg_mod_init(void);
+static int cdg_mod_destroy(void);
 static void cdg_conn_init(struct cc_var *ccv);
 static int cdg_cb_init(struct cc_var *ccv);
 static void cdg_cb_destroy(struct cc_var *ccv);
@@ -239,7 +240,8 @@ struct cc_algo cdg_cc_algo = {
.cb_destroy = cdg_cb_destroy,
.cb_init = cdg_cb_init,
.conn_init = cdg_conn_init,
-   .cong_signal = cdg_cong_signal
+   .cong_signal = cdg_cong_signal,
+   .mod_destroy = cdg_mod_destroy
 };
 
 /* Vnet created and being initialised. */
@@ -283,6 +285,14 @@ cdg_mod_init(void)
 }
 
 static int
+cdg_mod_destroy(void)
+{
+
+   uma_zdestroy(qdiffsample_zone);
+   return (0);
+}
+
+static int
 cdg_cb_init(struct cc_var *ccv)
 {
struct cdg *cdg_data;
___
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: r270160 - head/sys/netinet/cc

2014-08-18 Thread Lawrence Stewart
Author: lstewart
Date: Tue Aug 19 02:19:53 2014
New Revision: 270160
URL: http://svnweb.freebsd.org/changeset/base/270160

Log:
  Destroy the qdiffsample_zone UMA zone on unload to avoid a use-after-unload
  panic easily triggered by running sysctl -a after unload.
  
  Reported and tested by:   Grenville Armitage garmit...@swin.edu.au
  MFC after:1 week

Modified:
  head/sys/netinet/cc/cc_cdg.c

Modified: head/sys/netinet/cc/cc_cdg.c
==
--- head/sys/netinet/cc/cc_cdg.cTue Aug 19 01:20:24 2014
(r270159)
+++ head/sys/netinet/cc/cc_cdg.cTue Aug 19 02:19:53 2014
(r270160)
@@ -221,6 +221,7 @@ static VNET_DEFINE(uint32_t, cdg_hold_ba
 
 /* Function prototypes. */
 static int cdg_mod_init(void);
+static int cdg_mod_destroy(void);
 static void cdg_conn_init(struct cc_var *ccv);
 static int cdg_cb_init(struct cc_var *ccv);
 static void cdg_cb_destroy(struct cc_var *ccv);
@@ -234,7 +235,8 @@ struct cc_algo cdg_cc_algo = {
.cb_destroy = cdg_cb_destroy,
.cb_init = cdg_cb_init,
.conn_init = cdg_conn_init,
-   .cong_signal = cdg_cong_signal
+   .cong_signal = cdg_cong_signal,
+   .mod_destroy = cdg_mod_destroy
 };
 
 /* Vnet created and being initialised. */
@@ -278,6 +280,14 @@ cdg_mod_init(void)
 }
 
 static int
+cdg_mod_destroy(void)
+{
+
+   uma_zdestroy(qdiffsample_zone);
+   return (0);
+}
+
+static int
 cdg_cb_init(struct cc_var *ccv)
 {
struct cdg *cdg_data;
___
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


Re: svn commit: r261071 - in head: contrib/jemalloc contrib/jemalloc/doc contrib/jemalloc/include/jemalloc contrib/jemalloc/include/jemalloc/internal contrib/jemalloc/src include lib/libc/gen lib/libc

2014-02-09 Thread Lawrence Stewart
On 02/07/14 16:06, Jason Evans wrote:
 On Feb 6, 2014, at 8:01 PM, Lawrence Stewart lstew...@freebsd.org
 wrote:
 On 01/23/14 13:47, Jason Evans wrote:
 Author: jasone Date: Thu Jan 23 02:47:36 2014 New Revision:
 261071 URL: http://svnweb.freebsd.org/changeset/base/261071
 
 Log: Update jemalloc to version 3.5.0.
 
 I suspect that this commit is related to the assertion failures
 I've been seeing on recent head when I updated from r260427 to
 r261453. Here's two I noticed today:
 
 jemalloc: 
 /usr/local/poudriere/jails/head-amd64/usr/src/lib/libc/../../contrib/jemalloc/include/jemalloc/internal/arena.h:7

 
76: Failed assertion: binind == actual_binind
 *** Signal 6
 
 and
 
 jemalloc: 
 /usr/src/lib/libc/../../contrib/jemalloc/include/jemalloc/internal/arena.h:776:

 
Failed assertion: binind == actual_binind
 Abort trap
 
 I seem to be able to reproduce the first one readily when
 poudriere tries to build chromium so I can provide more info and
 help test ideas.
 
 Cheers, Lawrence
 
 Are the failures you saw happening only for the chromium build, or
 have you seen that same failure for other things as well?

Other things as well. The second example came from a completely
unrelated app - dnsmasq if I remember correctly. The assertion failures
are not deterministic. I do recall the machine was using a fairly
substantial amount of swap at the time which might be relevant, as I
haven't noted a failure recently since rebooting the laptop.

 If this is an application bug, it’s probably due do a buffer overrun
 corrupting an adjacent page that contains page run metadata.  If it’s
 a jemalloc bug, I’m going to need to reproduce it and dig in; it’s
 unlikely to be easy to diagnose.

I'll keep an eye out for further failures and see if I can figure out a
reproduction recipe.

Cheers,
Lawrence
___
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


Re: svn commit: r261071 - in head: contrib/jemalloc contrib/jemalloc/doc contrib/jemalloc/include/jemalloc contrib/jemalloc/include/jemalloc/internal contrib/jemalloc/src include lib/libc/gen lib/libc

2014-02-06 Thread Lawrence Stewart
Hi Jason,

On 01/23/14 13:47, Jason Evans wrote:
 Author: jasone
 Date: Thu Jan 23 02:47:36 2014
 New Revision: 261071
 URL: http://svnweb.freebsd.org/changeset/base/261071
 
 Log:
   Update jemalloc to version 3.5.0.

I suspect that this commit is related to the assertion failures I've
been seeing on recent head when I updated from r260427 to r261453.
Here's two I noticed today:

jemalloc:
/usr/local/poudriere/jails/head-amd64/usr/src/lib/libc/../../contrib/jemalloc/include/jemalloc/internal/arena.h:7
76: Failed assertion: binind == actual_binind
*** Signal 6

and

jemalloc:
/usr/src/lib/libc/../../contrib/jemalloc/include/jemalloc/internal/arena.h:776:
Failed assertion: binind == actual_binind
Abort trap

I seem to be able to reproduce the first one readily when poudriere
tries to build chromium so I can provide more info and help test ideas.

Cheers,
Lawrence
___
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


Re: svn commit: r260702 - head/sys/netinet

2014-01-19 Thread Lawrence Stewart
On 01/16/14 22:50, Alexander V. Chernikov wrote:
 Author: melifaro
 Date: Thu Jan 16 11:50:00 2014
 New Revision: 260702
 URL: http://svnweb.freebsd.org/changeset/base/260702
 
 Log:
   Fix ipfw fwd for IPv4 traffic broken by r249894.
   
   Problem case:
   Original lookup returns route with GW set, so gw points to
   rte-rt_gateway.
   After that we're changing dst and performing lookup another time.
   Since fwd host is most probably directly reachable, resulting
   rte does not contain rt_gateway, so gw is not set. Finally, we
   end with packet transmitted to proper interface but wrong
   link-layer address.
   
   Found by:   lstewart
   Discussed with: ae,lstewart
   MFC after:  2 weeks
   Sponsored by:   Yandex LLC

Thanks again for fixing this Alexander. Is the setfib fix going to hit
the tree soon as well?

Cheers,
Lawrence
___
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


Re: svn commit: r254524 - head/sys/sys

2013-08-21 Thread Lawrence Stewart
On 08/22/13 02:18, Andre Oppermann wrote:
 On 21.08.2013 17:59, Davide Italiano wrote:
 On Wed, Aug 21, 2013 at 5:30 PM, Andre Oppermann
 an...@freebsd.org wrote:
 On 20.08.2013 20:13, Davide Italiano wrote:
 
 On Tue, Aug 20, 2013 at 7:42 PM, Andre Oppermann
 an...@freebsd.org wrote:
 
 On 19.08.2013 19:37, Navdeep Parhar wrote:
 
 Why reuse the freed up bits so soon (at least one of which
 I think was prematurely GC'ed -- see my other email on
 M_NOFREE).  There was room beyond M_HASHTYPEBITS, no?
 
 
 This is HEAD where kernel and modules have to be (re)compiled
 together at any point in time.  On stable this reuse would
 not have been possible.
 
 In a subsequent commit I compacted and ordered the flags.
 There's a couple of free ones remaining.
 
 I have some additional mbuf changes coming up to be posted
 for possible objections later today.  The close HEAD freeze
 deadline has got me rushed a bit to allow 10.x backporting of
 the checksum/offload overhaul.
 
 -- Andre
 
 
 In my opinion the possibility we have about breaking KPI/KBI
 should not be abused, even if it's allowed in HEAD. In other
 words,people should go for preserving it  when (as in this
 case) it's easy and without additional costs. Your point about
 this is HEAD, it can be broken at any time makes relatively
 little sense  to me. Note that in the worst case such KPI/KBI
 breakages are annoying for $VENDORS who maintain out-of-tree
 code, which need to rebuild/change their code, or, if they get
 pissed off, drop FreeBSD support. In your case, it's just a
 matter of code cleaness about few lines, which, IMHO and
 always IMHO, doesn't justify the breakage.
 
 
 Preserving the API but having to recompile is always fair game in
 HEAD. In fact it happens all the time and the only supported way
 to track HEAD is to recompile kernel and modules together.
 
 For removing (crufty) functionality I agree that it shouldn't be
 done just for the sake of it and also shouldn't be done often.
 Sometimes it is necessary in the name of progress.  Having to
 support old, crufty or broken ways of doing something is a waste
 of developer time too.
 
 It's always a judgement call.  In this case there is a perfectly
 valid alternative way of doing that also is less dangerous to
 leak mbufs.
 
 -- Andre
 
 
 I don't see in any way how flags reordering might be in any way 
 connected to mbufs leaks, alas. There's a similar recent('ish)
 discussion and it was decided to not compact/reorder flags. See
 r253662/r253775 for references. So, I'm not sure what's the
 de-facto policy, but still, as a community FreeBSD should decide
 one strategy and be stuck with that. It's a matter of being
 consistent, which, IMHO, is something that should not be
 undervaluated.
 
 I fail to see what problem you have with the flag reordering.
 Recompile and done.  That's why we work with #defines instead of
 magic 0x1234 values.

On a general note, Navdeep's and Davide's objections are fair and in
line with defacto policy and established practice. Breaking the KBI
because we allow ourselves to on head doesn't mean we should, especially
when there is an alternative approach that preserves it, achieves the
same outcome and would be an equivalent amount of effort. As noted by
Navdeep, there are 4 bits beyond M_HASHTYPEBITS which could have been used.

We want to allow as much time to elapse as possible between deprecating
a bit's use/meaning and reusing it for something new. As an aside,
embedding the date a bit became free in the comment next to the bit
would be useful to ensure eventual bit reuse reclaims the oldest free
bit(s) first.

 If someone outside the tree was using the spare bits for their own
 private purposes, yes, they would quickly have to check and possibly
 adjust them. That's trivial however and should be expected when
 tracking an OpenSource operating system.

To be expected, sure, but we should only inflict the pain when it is
truly necessary.

Determining necessity should be straight forward in this instance:

Are there other changes on the immediate horizon for 10.0 that require
new bits? If yes, how many bits?

If the answer is no, the recently deprecated bits should be reinstated
as they were and M_PROTOFLAGS[9-12] should be moved to after M_HASHTYPEBITS.

If yes, moving M_PROTOFLAGS[9-12] to after M_HASHTYPEBITS is probably a
waste of time/effort (depending on how many bits are needed) as the new
functionality will have to recycle some of the free bits anyway.

In addition to this, the reordering done in r254527 is also a POLA and
KBI issue for no gain. The flags easily fit on a single screen of text
so it's not like they couldn't all be seen together easily. Changing bit
definitions in such an important subsystem for purely cosmetic gain is a
bad idea and I would argue in favour of reverting the reordering done in
r254527 (which should have been committed as a separate commit anyway -
lumping everything in one commit was unfortunate).

The fact these 

svn commit: r252951 - in stable/9: share/man/man4 sys/modules/cc sys/modules/cc/cc_cdg sys/netinet/cc

2013-07-07 Thread Lawrence Stewart
 to loss-based operation as required.
+.Sh MIB Variables
+The algorithm exposes the following variables in the
+.Va net.inet.tcp.cc.cdg
+branch of the
+.Xr sysctl 3
+MIB:
+.Bl -tag -width .Va exp_backoff_scale
+.It Va version
+Current algorithm/implementation version number.
+.It Va beta_delay
+Delay-based window decrease factor as a percentage (on delay-based backoff, w =
+w * beta_delay / 100).
+Default is 70.
+.It Va beta_loss
+Loss-based window decrease factor as a percentage (on loss-based backoff, w =
+w * beta_loss / 100).
+Default is 50.
+.It Va exp_backoff_scale
+Scaling parameter for the probabilistic exponential backoff.
+Default is 2.
+.It Va smoothing_factor
+Number of samples used for moving average smoothing (0 means no smoothing).
+Default is 8.
+.It Va loss_compete_consec_cong
+Number of consecutive delay-gradient based congestion episodes which will
+trigger loss-based CC compatibility.
+Default is 5.
+.It Va loss_compete_hold_backoff
+Number of consecutive delay-gradient based congestion episodes to hold the
+window backoff for loss-based CC compatibility.
+Default is 5.
+.It Va alpha_inc
+If non-zero, this enables an experimental mode where CDG's window increase
+factor (alpha) is increased by 1 MSS every
+.Va alpha_inc
+RTTs during congestion avoidance mode.
+(Setting
+.Va alpha_inc
+to 1 results in the most aggressive growth of the window increase factor over
+time.
+Use higher
+.Va alpha_inc
+values for slower growth.)
+Default is 0.
+.El
+.Sh SEE ALSO
+.Xr cc_chd 4 ,
+.Xr cc_cubic 4 ,
+.Xr cc_hd 4 ,
+.Xr cc_htcp 4 ,
+.Xr cc_newreno 4 ,
+.Xr cc_vegas 4 ,
+.Xr h_ertt 4 ,
+.Xr mod_cc 4 ,
+.Xr tcp 4 ,
+.Xr khelp 9 ,
+.Xr mod_cc 9
+.Rs
+.%A D. A. Hayes
+.%A G. Armitage
+.%T Revisiting TCP Congestion Control using Delay Gradients
+.%J Networking 2011 Proceedings, Part II
+.%D May 2011
+.%P 328-341
+.Re
+.Rs
+.%A N. Khademi
+.%A G. Armitage
+.%T Minimising RTT across homogeneous 802.11 WLANs with CAIA Delay-Gradient 
TCP (v0.1)
+.%R CAIA Technical Report 121113A
+.%D November 2012
+.%U http://caia.swin.edu.au/reports/121113A/CAIA-TR-121113A.pdf;
+.Re
+.Sh ACKNOWLEDGEMENTS
+Development and testing of this software were made possible in part by grants
+from the FreeBSD Foundation and The Cisco University Research Program Fund, a
+corporate advised fund of Silicon Valley Community Foundation.
+.Sh HISTORY
+The
+.Nm
+congestion control module first appeared in
+.Fx 9.2 .
+.Pp
+The module was first released in 2011 by David Hayes whilst working on the
+NewTCP research project at Swinburne University of Technology's Centre for
+Advanced Internet Architectures, Melbourne, Australia.
+More details are available at:
+.Pp
+http://caia.swin.edu.au/urp/newtcp/
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+congestion control module was written by
+.An David Hayes Aq david.ha...@ieee.org .
+This manual page was written by
+.An Lawrence Stewart Aq lstew...@freebsd.org
+and
+.An Grenville Armitage Aq garmit...@swin.edu.au .
+.Sh BUGS
+The underlying algorithm and parameter values are still a work in progress and
+may not be optimal for some network scenarios.

Modified: stable/9/sys/modules/cc/Makefile
==
--- stable/9/sys/modules/cc/MakefileSun Jul  7 13:20:35 2013
(r252950)
+++ stable/9/sys/modules/cc/MakefileSun Jul  7 14:14:44 2013
(r252951)
@@ -1,6 +1,7 @@
 # $FreeBSD$
 
-SUBDIR=cc_chd \
+SUBDIR=cc_cdg \
+   cc_chd \
cc_cubic \
cc_hd \
cc_htcp \

Copied: stable/9/sys/netinet/cc/cc_cdg.c (from r252504, 
head/sys/netinet/cc/cc_cdg.c)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ stable/9/sys/netinet/cc/cc_cdg.cSun Jul  7 14:14:44 2013
(r252951, copy of r252504, head/sys/netinet/cc/cc_cdg.c)
@@ -0,0 +1,695 @@
+/*-
+ * Copyright (c) 2009-2013
+ * Swinburne University of Technology, Melbourne, Australia
+ * All rights reserved.
+ *
+ * This software was developed at the Centre for Advanced Internet
+ * Architectures, Swinburne University of Technology, by David Hayes, made
+ * possible in part by a gift from The Cisco University Research Program Fund,
+ * a corporate advised fund of Silicon Valley Community Foundation. Development
+ * and testing were further assisted by a grant 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.
+ * 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

svn commit: r252952 - in stable/8: share/man/man4 sys/modules/cc sys/modules/cc/cc_cdg sys/netinet/cc

2013-07-07 Thread Lawrence Stewart
 operation, but will keep
+switching back to loss-based operation as required.
+.Sh MIB Variables
+The algorithm exposes the following variables in the
+.Va net.inet.tcp.cc.cdg
+branch of the
+.Xr sysctl 3
+MIB:
+.Bl -tag -width .Va exp_backoff_scale
+.It Va version
+Current algorithm/implementation version number.
+.It Va beta_delay
+Delay-based window decrease factor as a percentage (on delay-based backoff, w =
+w * beta_delay / 100).
+Default is 70.
+.It Va beta_loss
+Loss-based window decrease factor as a percentage (on loss-based backoff, w =
+w * beta_loss / 100).
+Default is 50.
+.It Va exp_backoff_scale
+Scaling parameter for the probabilistic exponential backoff.
+Default is 2.
+.It Va smoothing_factor
+Number of samples used for moving average smoothing (0 means no smoothing).
+Default is 8.
+.It Va loss_compete_consec_cong
+Number of consecutive delay-gradient based congestion episodes which will
+trigger loss-based CC compatibility.
+Default is 5.
+.It Va loss_compete_hold_backoff
+Number of consecutive delay-gradient based congestion episodes to hold the
+window backoff for loss-based CC compatibility.
+Default is 5.
+.It Va alpha_inc
+If non-zero, this enables an experimental mode where CDG's window increase
+factor (alpha) is increased by 1 MSS every
+.Va alpha_inc
+RTTs during congestion avoidance mode.
+(Setting
+.Va alpha_inc
+to 1 results in the most aggressive growth of the window increase factor over
+time.
+Use higher
+.Va alpha_inc
+values for slower growth.)
+Default is 0.
+.El
+.Sh SEE ALSO
+.Xr cc_chd 4 ,
+.Xr cc_cubic 4 ,
+.Xr cc_hd 4 ,
+.Xr cc_htcp 4 ,
+.Xr cc_newreno 4 ,
+.Xr cc_vegas 4 ,
+.Xr h_ertt 4 ,
+.Xr mod_cc 4 ,
+.Xr tcp 4 ,
+.Xr khelp 9 ,
+.Xr mod_cc 9
+.Rs
+.%A D. A. Hayes
+.%A G. Armitage
+.%T Revisiting TCP Congestion Control using Delay Gradients
+.%J Networking 2011 Proceedings, Part II
+.%D May 2011
+.%P 328-341
+.Re
+.Rs
+.%A N. Khademi
+.%A G. Armitage
+.%T Minimising RTT across homogeneous 802.11 WLANs with CAIA Delay-Gradient 
TCP (v0.1)
+.%R CAIA Technical Report 121113A
+.%D November 2012
+.%U http://caia.swin.edu.au/reports/121113A/CAIA-TR-121113A.pdf;
+.Re
+.Sh ACKNOWLEDGEMENTS
+Development and testing of this software were made possible in part by grants
+from the FreeBSD Foundation and The Cisco University Research Program Fund, a
+corporate advised fund of Silicon Valley Community Foundation.
+.Sh HISTORY
+The
+.Nm
+congestion control module first appeared in
+.Fx 9.2 .
+.Pp
+The module was first released in 2011 by David Hayes whilst working on the
+NewTCP research project at Swinburne University of Technology's Centre for
+Advanced Internet Architectures, Melbourne, Australia.
+More details are available at:
+.Pp
+http://caia.swin.edu.au/urp/newtcp/
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+congestion control module was written by
+.An David Hayes Aq david.ha...@ieee.org .
+This manual page was written by
+.An Lawrence Stewart Aq lstew...@freebsd.org
+and
+.An Grenville Armitage Aq garmit...@swin.edu.au .
+.Sh BUGS
+The underlying algorithm and parameter values are still a work in progress and
+may not be optimal for some network scenarios.

Modified: stable/8/sys/modules/cc/Makefile
==
--- stable/8/sys/modules/cc/MakefileSun Jul  7 14:14:44 2013
(r252951)
+++ stable/8/sys/modules/cc/MakefileSun Jul  7 14:20:00 2013
(r252952)
@@ -1,6 +1,7 @@
 # $FreeBSD$
 
-SUBDIR=cc_chd \
+SUBDIR=cc_cdg \
+   cc_chd \
cc_cubic \
cc_hd \
cc_htcp \

Copied: stable/8/sys/netinet/cc/cc_cdg.c (from r252504, 
head/sys/netinet/cc/cc_cdg.c)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ stable/8/sys/netinet/cc/cc_cdg.cSun Jul  7 14:20:00 2013
(r252952, copy of r252504, head/sys/netinet/cc/cc_cdg.c)
@@ -0,0 +1,695 @@
+/*-
+ * Copyright (c) 2009-2013
+ * Swinburne University of Technology, Melbourne, Australia
+ * All rights reserved.
+ *
+ * This software was developed at the Centre for Advanced Internet
+ * Architectures, Swinburne University of Technology, by David Hayes, made
+ * possible in part by a gift from The Cisco University Research Program Fund,
+ * a corporate advised fund of Silicon Valley Community Foundation. Development
+ * and testing were further assisted by a grant 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.
+ * 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

svn commit: r252541 - stable/9/sys/kern

2013-07-03 Thread Lawrence Stewart
Author: lstewart
Date: Wed Jul  3 05:58:51 2013
New Revision: 252541
URL: http://svnweb.freebsd.org/changeset/base/252541

Log:
  MFC r251778:
  
  Cleanup and simplification in khelp_{register|deregister}_helper(). No
  functional changes.

Modified:
  stable/9/sys/kern/kern_khelp.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/kern/kern_khelp.c
==
--- stable/9/sys/kern/kern_khelp.c  Wed Jul  3 05:54:23 2013
(r252540)
+++ stable/9/sys/kern/kern_khelp.c  Wed Jul  3 05:58:51 2013
(r252541)
@@ -72,34 +72,32 @@ khelp_register_helper(struct helper *h)
struct helper *tmph;
int error, i, inserted;
 
-   error = 0;
-   inserted = 0;
+   error = inserted = 0;
refcount_init(h-h_refcount, 0);
h-h_id = osd_register(OSD_KHELP, NULL, NULL);
 
/* It's only safe to add the hooks after osd_register(). */
-   if (h-h_nhooks  0) {
-   for (i = 0; i  h-h_nhooks  !error; i++) {
-   /* We don't require the module to assign hook_helper. */
-   h-h_hooks[i].hook_helper = h;
-   error = hhook_add_hook_lookup(h-h_hooks[i],
-   HHOOK_WAITOK);
-   }
-
-   if (error) {
-   for (i--; i = 0; i--)
-   hhook_remove_hook_lookup(h-h_hooks[i]);
-
-   osd_deregister(OSD_KHELP, h-h_id);
-   }
+   for (i = 0; i  h-h_nhooks  !error; i++) {
+   /* We don't require the module to assign hook_helper. */
+   h-h_hooks[i].hook_helper = h;
+   error = hhook_add_hook_lookup(h-h_hooks[i], HHOOK_WAITOK);
+   if (error)
+   printf(%s: \%s\ khelp module unable to 
+   hook type %d id %d due to error %d\n, __func__,
+   h-h_name, h-h_hooks[i].hook_type,
+   h-h_hooks[i].hook_id, error);
}
 
-   if (!error) {
+   if (error) {
+   for (i--; i = 0; i--)
+   hhook_remove_hook_lookup(h-h_hooks[i]);
+   osd_deregister(OSD_KHELP, h-h_id);
+   } else {
KHELP_LIST_WLOCK();
/*
 * Keep list of helpers sorted in descending h_id order. Due to
 * the way osd_set() works, a sorted list ensures
-* init_helper_osd() will operate with improved efficiency.
+* khelp_init_osd() will operate with improved efficiency.
 */
TAILQ_FOREACH(tmph, helpers, h_next) {
if (tmph-h_id  h-h_id) {
@@ -123,8 +121,6 @@ khelp_deregister_helper(struct helper *h
struct helper *tmph;
int error, i;
 
-   error = 0;
-
KHELP_LIST_WLOCK();
if (h-h_refcount  0)
error = EBUSY;
@@ -141,10 +137,8 @@ khelp_deregister_helper(struct helper *h
KHELP_LIST_WUNLOCK();
 
if (!error) {
-   if (h-h_nhooks  0) {
-   for (i = 0; i  h-h_nhooks; i++)
-   hhook_remove_hook_lookup(h-h_hooks[i]);
-   }
+   for (i = 0; i  h-h_nhooks; i++)
+   hhook_remove_hook_lookup(h-h_hooks[i]);
osd_deregister(OSD_KHELP, h-h_id);
}
 
___
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: r252542 - stable/8/sys/kern

2013-07-03 Thread Lawrence Stewart
Author: lstewart
Date: Wed Jul  3 05:59:48 2013
New Revision: 252542
URL: http://svnweb.freebsd.org/changeset/base/252542

Log:
  MFC r251778:
  
  Cleanup and simplification in khelp_{register|deregister}_helper(). No
  functional changes.

Modified:
  stable/8/sys/kern/kern_khelp.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/kern/   (props changed)

Modified: stable/8/sys/kern/kern_khelp.c
==
--- stable/8/sys/kern/kern_khelp.c  Wed Jul  3 05:58:51 2013
(r252541)
+++ stable/8/sys/kern/kern_khelp.c  Wed Jul  3 05:59:48 2013
(r252542)
@@ -72,34 +72,32 @@ khelp_register_helper(struct helper *h)
struct helper *tmph;
int error, i, inserted;
 
-   error = 0;
-   inserted = 0;
+   error = inserted = 0;
refcount_init(h-h_refcount, 0);
h-h_id = osd_register(OSD_KHELP, NULL, NULL);
 
/* It's only safe to add the hooks after osd_register(). */
-   if (h-h_nhooks  0) {
-   for (i = 0; i  h-h_nhooks  !error; i++) {
-   /* We don't require the module to assign hook_helper. */
-   h-h_hooks[i].hook_helper = h;
-   error = hhook_add_hook_lookup(h-h_hooks[i],
-   HHOOK_WAITOK);
-   }
-
-   if (error) {
-   for (i--; i = 0; i--)
-   hhook_remove_hook_lookup(h-h_hooks[i]);
-
-   osd_deregister(OSD_KHELP, h-h_id);
-   }
+   for (i = 0; i  h-h_nhooks  !error; i++) {
+   /* We don't require the module to assign hook_helper. */
+   h-h_hooks[i].hook_helper = h;
+   error = hhook_add_hook_lookup(h-h_hooks[i], HHOOK_WAITOK);
+   if (error)
+   printf(%s: \%s\ khelp module unable to 
+   hook type %d id %d due to error %d\n, __func__,
+   h-h_name, h-h_hooks[i].hook_type,
+   h-h_hooks[i].hook_id, error);
}
 
-   if (!error) {
+   if (error) {
+   for (i--; i = 0; i--)
+   hhook_remove_hook_lookup(h-h_hooks[i]);
+   osd_deregister(OSD_KHELP, h-h_id);
+   } else {
KHELP_LIST_WLOCK();
/*
 * Keep list of helpers sorted in descending h_id order. Due to
 * the way osd_set() works, a sorted list ensures
-* init_helper_osd() will operate with improved efficiency.
+* khelp_init_osd() will operate with improved efficiency.
 */
TAILQ_FOREACH(tmph, helpers, h_next) {
if (tmph-h_id  h-h_id) {
@@ -123,8 +121,6 @@ khelp_deregister_helper(struct helper *h
struct helper *tmph;
int error, i;
 
-   error = 0;
-
KHELP_LIST_WLOCK();
if (h-h_refcount  0)
error = EBUSY;
@@ -141,10 +137,8 @@ khelp_deregister_helper(struct helper *h
KHELP_LIST_WUNLOCK();
 
if (!error) {
-   if (h-h_nhooks  0) {
-   for (i = 0; i  h-h_nhooks; i++)
-   hhook_remove_hook_lookup(h-h_hooks[i]);
-   }
+   for (i = 0; i  h-h_nhooks; i++)
+   hhook_remove_hook_lookup(h-h_hooks[i]);
osd_deregister(OSD_KHELP, h-h_id);
}
 
___
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: r252543 - stable/9/sys/kern

2013-07-03 Thread Lawrence Stewart
Author: lstewart
Date: Wed Jul  3 06:20:47 2013
New Revision: 252543
URL: http://svnweb.freebsd.org/changeset/base/252543

Log:
  MFC r251787:
  
  Move hhook's per-vnet initialisation to an earlier SYSINIT SI_SUB stage to
  ensure all per-vnet related hhook initialisation is completed prior to any
  virtualised hhook points attempting registration.
  
  vnet_register_sysinit() requires that a stage later than SI_SUB_VNET be 
chosen.
  There are no per-vnet initialisors in the source tree at this time which run
  earlier than SI_SUB_INIT_IF. A quick audit of non-virtualised SYSINITs 
indicates
  there are no subsystems pre SI_SUB_MBUF that would likely be interested in
  registering a virtualised hhook point.
  
  Settle on SI_SUB_MBUF as hhook's per-vnet initialisation stage as it's the 
first
  overtly network-related initilisation stage to run after SI_SUB_VNET. If a
  subsystem that initialises earlier than SI_SUB_MBUF ends up wanting to 
register
  virtualised hhook points in future, hhook's use of SI_SUB_MBUF will need to be
  revisited and would probably warrant creating a dedicated SI_SUB_HHOOK which
  runs immediately after SI_SUB_VNET.

Modified:
  stable/9/sys/kern/kern_hhook.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/kern/kern_hhook.c
==
--- stable/9/sys/kern/kern_hhook.c  Wed Jul  3 05:59:48 2013
(r252542)
+++ stable/9/sys/kern/kern_hhook.c  Wed Jul  3 06:20:47 2013
(r252543)
@@ -509,7 +509,7 @@ hhook_vnet_uninit(const void *unused __u
 /*
  * When a vnet is created and being initialised, init the V_hhook_vhead_list.
  */
-VNET_SYSINIT(hhook_vnet_init, SI_SUB_PROTO_BEGIN, SI_ORDER_FIRST,
+VNET_SYSINIT(hhook_vnet_init, SI_SUB_MBUF, SI_ORDER_FIRST,
 hhook_vnet_init, NULL);
 
 /*
@@ -517,5 +517,5 @@ VNET_SYSINIT(hhook_vnet_init, SI_SUB_PRO
  * points to clean up on vnet tear down, but in case the KPI is misused,
  * provide a function to clean up and free memory for a vnet being destroyed.
  */
-VNET_SYSUNINIT(hhook_vnet_uninit, SI_SUB_PROTO_BEGIN, SI_ORDER_FIRST,
+VNET_SYSUNINIT(hhook_vnet_uninit, SI_SUB_MBUF, SI_ORDER_ANY,
 hhook_vnet_uninit, NULL);
___
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: r252544 - stable/8/sys/kern

2013-07-03 Thread Lawrence Stewart
Author: lstewart
Date: Wed Jul  3 06:23:46 2013
New Revision: 252544
URL: http://svnweb.freebsd.org/changeset/base/252544

Log:
  MFC r251787:
  
  Move hhook's per-vnet initialisation to an earlier SYSINIT SI_SUB stage to
  ensure all per-vnet related hhook initialisation is completed prior to any
  virtualised hhook points attempting registration.
  
  vnet_register_sysinit() requires that a stage later than SI_SUB_VNET be 
chosen.
  There are no per-vnet initialisors in the source tree at this time which run
  earlier than SI_SUB_INIT_IF. A quick audit of non-virtualised SYSINITs 
indicates
  there are no subsystems pre SI_SUB_MBUF that would likely be interested in
  registering a virtualised hhook point.
  
  Settle on SI_SUB_MBUF as hhook's per-vnet initialisation stage as it's the 
first
  overtly network-related initilisation stage to run after SI_SUB_VNET. If a
  subsystem that initialises earlier than SI_SUB_MBUF ends up wanting to 
register
  virtualised hhook points in future, hhook's use of SI_SUB_MBUF will need to be
  revisited and would probably warrant creating a dedicated SI_SUB_HHOOK which
  runs immediately after SI_SUB_VNET.

Modified:
  stable/8/sys/kern/kern_hhook.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/kern/   (props changed)

Modified: stable/8/sys/kern/kern_hhook.c
==
--- stable/8/sys/kern/kern_hhook.c  Wed Jul  3 06:20:47 2013
(r252543)
+++ stable/8/sys/kern/kern_hhook.c  Wed Jul  3 06:23:46 2013
(r252544)
@@ -509,7 +509,7 @@ hhook_vnet_uninit(const void *unused __u
 /*
  * When a vnet is created and being initialised, init the V_hhook_vhead_list.
  */
-VNET_SYSINIT(hhook_vnet_init, SI_SUB_PROTO_BEGIN, SI_ORDER_FIRST,
+VNET_SYSINIT(hhook_vnet_init, SI_SUB_MBUF, SI_ORDER_FIRST,
 hhook_vnet_init, NULL);
 
 /*
@@ -517,5 +517,5 @@ VNET_SYSINIT(hhook_vnet_init, SI_SUB_PRO
  * points to clean up on vnet tear down, but in case the KPI is misused,
  * provide a function to clean up and free memory for a vnet being destroyed.
  */
-VNET_SYSUNINIT(hhook_vnet_uninit, SI_SUB_PROTO_BEGIN, SI_ORDER_FIRST,
+VNET_SYSUNINIT(hhook_vnet_uninit, SI_SUB_MBUF, SI_ORDER_ANY,
 hhook_vnet_uninit, NULL);
___
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: r252549 - stable/9/sys/sys

2013-07-03 Thread Lawrence Stewart
Author: lstewart
Date: Wed Jul  3 07:57:22 2013
New Revision: 252549
URL: http://svnweb.freebsd.org/changeset/base/252549

Log:
  MFC r251789:
  
  Now that the necessary infrastructure is in place to ensure hhook points which
  register after a khelp module will get hooked, move khelp module 
initialisation
  to the earlier SI_SUB_KLD stage.

Modified:
  stable/9/sys/sys/module_khelp.h
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/sys/   (props changed)

Modified: stable/9/sys/sys/module_khelp.h
==
--- stable/9/sys/sys/module_khelp.h Wed Jul  3 07:31:07 2013
(r252548)
+++ stable/9/sys/sys/module_khelp.h Wed Jul  3 07:57:22 2013
(r252549)
@@ -85,8 +85,7 @@ struct khelp_modevent_data {
.evhand = khelp_modevent,   \
.priv = kmd_##hname\
};  \
-   DECLARE_MODULE(hname, h_##hname, SI_SUB_PROTO_IFATTACHDOMAIN,   \
-   SI_ORDER_ANY);  \
+   DECLARE_MODULE(hname, h_##hname, SI_SUB_KLD, SI_ORDER_ANY); \
MODULE_VERSION(hname, version)
 
 #defineKHELP_DECLARE_MOD(hname, hdata, hhooks, version)
\
___
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: r252550 - stable/8/sys/sys

2013-07-03 Thread Lawrence Stewart
Author: lstewart
Date: Wed Jul  3 07:58:14 2013
New Revision: 252550
URL: http://svnweb.freebsd.org/changeset/base/252550

Log:
  MFC r251789:
  
  Now that the necessary infrastructure is in place to ensure hhook points which
  register after a khelp module will get hooked, move khelp module 
initialisation
  to the earlier SI_SUB_KLD stage.

Modified:
  stable/8/sys/sys/module_khelp.h
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/sys/   (props changed)

Modified: stable/8/sys/sys/module_khelp.h
==
--- stable/8/sys/sys/module_khelp.h Wed Jul  3 07:57:22 2013
(r252549)
+++ stable/8/sys/sys/module_khelp.h Wed Jul  3 07:58:14 2013
(r252550)
@@ -85,8 +85,7 @@ struct khelp_modevent_data {
.evhand = khelp_modevent,   \
.priv = kmd_##hname\
};  \
-   DECLARE_MODULE(hname, h_##hname, SI_SUB_PROTO_IFATTACHDOMAIN,   \
-   SI_ORDER_ANY);  \
+   DECLARE_MODULE(hname, h_##hname, SI_SUB_KLD, SI_ORDER_ANY); \
MODULE_VERSION(hname, version)
 
 #defineKHELP_DECLARE_MOD(hname, hdata, hhooks, version)
\
___
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: r252551 - stable/9/share/man/man9

2013-07-03 Thread Lawrence Stewart
Author: lstewart
Date: Wed Jul  3 08:20:40 2013
New Revision: 252551
URL: http://svnweb.freebsd.org/changeset/base/252551

Log:
  MFC r252052:
  
  Non-virtualised hhook points are supported as of r251732.

Modified:
  stable/9/share/man/man9/hhook.9
Directory Properties:
  stable/9/share/man/   (props changed)
  stable/9/share/man/man9/   (props changed)

Modified: stable/9/share/man/man9/hhook.9
==
--- stable/9/share/man/man9/hhook.9 Wed Jul  3 07:58:14 2013
(r252550)
+++ stable/9/share/man/man9/hhook.9 Wed Jul  3 08:20:40 2013
(r252551)
@@ -30,7 +30,7 @@
 .\
 .\ $FreeBSD$
 .\
-.Dd February 15, 2011
+.Dd June 21, 2013
 .Dt HHOOK 9
 .Os
 .Sh NAME
@@ -380,9 +380,3 @@ This manual page was written by
 .An David Hayes Aq david.ha...@ieee.org
 and
 .An Lawrence Stewart Aq lstew...@freebsd.org .
-.Sh BUGS
-The framework does not currently support registering hook points in subsystems
-which have not been virtualised with VIMAGE.
-Fairly minimal internal changes to the
-.Nm
-implementation are required to address this.
___
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: r252552 - stable/8/share/man/man9

2013-07-03 Thread Lawrence Stewart
Author: lstewart
Date: Wed Jul  3 08:21:05 2013
New Revision: 252552
URL: http://svnweb.freebsd.org/changeset/base/252552

Log:
  MFC r252052:
  
  Non-virtualised hhook points are supported as of r251732.

Modified:
  stable/8/share/man/man9/hhook.9
Directory Properties:
  stable/8/share/man/   (props changed)
  stable/8/share/man/man9/   (props changed)

Modified: stable/8/share/man/man9/hhook.9
==
--- stable/8/share/man/man9/hhook.9 Wed Jul  3 08:20:40 2013
(r252551)
+++ stable/8/share/man/man9/hhook.9 Wed Jul  3 08:21:05 2013
(r252552)
@@ -30,7 +30,7 @@
 .\
 .\ $FreeBSD$
 .\
-.Dd February 15, 2011
+.Dd June 21, 2013
 .Dt HHOOK 9
 .Os
 .Sh NAME
@@ -380,9 +380,3 @@ This manual page was written by
 .An David Hayes Aq david.ha...@ieee.org
 and
 .An Lawrence Stewart Aq lstew...@freebsd.org .
-.Sh BUGS
-The framework does not currently support registering hook points in subsystems
-which have not been virtualised with VIMAGE.
-Fairly minimal internal changes to the
-.Nm
-implementation are required to address this.
___
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: r252504 - in head: share/man/man4 sys/modules/cc sys/modules/cc/cc_cdg sys/netinet/cc

2013-07-02 Thread Lawrence Stewart
 * beta_delay / 100).
+Default is 70.
+.It Va beta_loss
+Loss-based window decrease factor as a percentage (on loss-based backoff, w =
+w * beta_loss / 100).
+Default is 50.
+.It Va exp_backoff_scale
+Scaling parameter for the probabilistic exponential backoff.
+Default is 2.
+.It Va smoothing_factor
+Number of samples used for moving average smoothing (0 means no smoothing).
+Default is 8.
+.It Va loss_compete_consec_cong
+Number of consecutive delay-gradient based congestion episodes which will
+trigger loss-based CC compatibility.
+Default is 5.
+.It Va loss_compete_hold_backoff
+Number of consecutive delay-gradient based congestion episodes to hold the
+window backoff for loss-based CC compatibility.
+Default is 5.
+.It Va alpha_inc
+If non-zero, this enables an experimental mode where CDG's window increase
+factor (alpha) is increased by 1 MSS every
+.Va alpha_inc
+RTTs during congestion avoidance mode.
+(Setting
+.Va alpha_inc
+to 1 results in the most aggressive growth of the window increase factor over
+time.
+Use higher
+.Va alpha_inc
+values for slower growth.)
+Default is 0.
+.El
+.Sh SEE ALSO
+.Xr cc_chd 4 ,
+.Xr cc_cubic 4 ,
+.Xr cc_hd 4 ,
+.Xr cc_htcp 4 ,
+.Xr cc_newreno 4 ,
+.Xr cc_vegas 4 ,
+.Xr h_ertt 4 ,
+.Xr mod_cc 4 ,
+.Xr tcp 4 ,
+.Xr khelp 9 ,
+.Xr mod_cc 9
+.Rs
+.%A D. A. Hayes
+.%A G. Armitage
+.%T Revisiting TCP Congestion Control using Delay Gradients
+.%J Networking 2011 Proceedings, Part II
+.%D May 2011
+.%P 328-341
+.Re
+.Rs
+.%A N. Khademi
+.%A G. Armitage
+.%T Minimising RTT across homogeneous 802.11 WLANs with CAIA Delay-Gradient 
TCP (v0.1)
+.%R CAIA Technical Report 121113A
+.%D November 2012
+.%U http://caia.swin.edu.au/reports/121113A/CAIA-TR-121113A.pdf;
+.Re
+.Sh ACKNOWLEDGEMENTS
+Development and testing of this software were made possible in part by grants
+from the FreeBSD Foundation and The Cisco University Research Program Fund, a
+corporate advised fund of Silicon Valley Community Foundation.
+.Sh HISTORY
+The
+.Nm
+congestion control module first appeared in
+.Fx 9.2 .
+.Pp
+The module was first released in 2011 by David Hayes whilst working on the
+NewTCP research project at Swinburne University of Technology's Centre for
+Advanced Internet Architectures, Melbourne, Australia.
+More details are available at:
+.Pp
+http://caia.swin.edu.au/urp/newtcp/
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+congestion control module was written by
+.An David Hayes Aq david.ha...@ieee.org .
+This manual page was written by
+.An Lawrence Stewart Aq lstew...@freebsd.org
+and
+.An Grenville Armitage Aq garmit...@swin.edu.au .
+.Sh BUGS
+The underlying algorithm and parameter values are still a work in progress and
+may not be optimal for some network scenarios.

Modified: head/sys/modules/cc/Makefile
==
--- head/sys/modules/cc/MakefileTue Jul  2 08:04:41 2013
(r252503)
+++ head/sys/modules/cc/MakefileTue Jul  2 08:44:56 2013
(r252504)
@@ -1,6 +1,7 @@
 # $FreeBSD$
 
-SUBDIR=cc_chd \
+SUBDIR=cc_cdg \
+   cc_chd \
cc_cubic \
cc_hd \
cc_htcp \

Added: head/sys/modules/cc/cc_cdg/Makefile
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/modules/cc/cc_cdg/Makefile Tue Jul  2 08:44:56 2013
(r252504)
@@ -0,0 +1,9 @@
+# $FreeBSD$
+
+.include bsd.own.mk
+
+.PATH: ${.CURDIR}/../../../netinet/cc
+KMOD=  cc_cdg
+SRCS=  cc_cdg.c
+
+.include bsd.kmod.mk

Added: head/sys/netinet/cc/cc_cdg.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/netinet/cc/cc_cdg.cTue Jul  2 08:44:56 2013
(r252504)
@@ -0,0 +1,695 @@
+/*-
+ * Copyright (c) 2009-2013
+ * Swinburne University of Technology, Melbourne, Australia
+ * All rights reserved.
+ *
+ * This software was developed at the Centre for Advanced Internet
+ * Architectures, Swinburne University of Technology, by David Hayes, made
+ * possible in part by a gift from The Cisco University Research Program Fund,
+ * a corporate advised fund of Silicon Valley Community Foundation. Development
+ * and testing were further assisted by a grant 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.
+ * 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

svn commit: r252532 - stable/9/sys/kern

2013-07-02 Thread Lawrence Stewart
Author: lstewart
Date: Wed Jul  3 03:36:36 2013
New Revision: 252532
URL: http://svnweb.freebsd.org/changeset/base/252532

Log:
  When a previous call to sbsndptr() leaves sb-sb_sndptroff at the start of an
  mbuf that was fully consumed by the previous call, the mbuf ptr returned by 
the
  current call ends up being the previous mbuf in the sb chain to the one that
  contains the data we want.
  
  This does not cause any observable issues because the mbuf copy routines 
happily
  walk the mbuf chain to get to the data at the moff offset, which in this case
  means they effectively skip over the mbuf returned by sbsndptr().
  
  We can't adjust sb-sb_sndptr during the previous call for this case because 
the
  next mbuf in the chain may not exist yet. We therefore need to detect the
  condition and make the adjustment during the current call.
  
  Fix by detecting the special case of moff being at the start of the next mbuf 
in
  the chain and adjust the required accounting variables accordingly.
  
  Reviewed by:  andre

Modified:
  stable/9/sys/kern/uipc_sockbuf.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/kern/uipc_sockbuf.c
==
--- stable/9/sys/kern/uipc_sockbuf.cWed Jul  3 02:14:12 2013
(r252531)
+++ stable/9/sys/kern/uipc_sockbuf.cWed Jul  3 03:36:36 2013
(r252532)
@@ -939,6 +939,13 @@ sbsndptr(struct sockbuf *sb, u_int off, 
/* Return closest mbuf in chain for current offset. */
*moff = off - sb-sb_sndptroff;
m = ret = sb-sb_sndptr ? sb-sb_sndptr : sb-sb_mb;
+   if (*moff == m-m_len) {
+   *moff = 0;
+   sb-sb_sndptroff += m-m_len;
+   m = ret = m-m_next;
+   KASSERT(ret-m_len  0,
+   (mbuf %p in sockbuf %p chain has no valid data, ret, sb));
+   }
 
/* Advance by len to be as close as possible for the next transmit. */
for (off = off - sb-sb_sndptroff + len - 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: r252533 - stable/8/sys/kern

2013-07-02 Thread Lawrence Stewart
Author: lstewart
Date: Wed Jul  3 03:40:06 2013
New Revision: 252533
URL: http://svnweb.freebsd.org/changeset/base/252533

Log:
  When a previous call to sbsndptr() leaves sb-sb_sndptroff at the start of an
  mbuf that was fully consumed by the previous call, the mbuf ptr returned by 
the
  current call ends up being the previous mbuf in the sb chain to the one that
  contains the data we want.
  
  This does not cause any observable issues because the mbuf copy routines 
happily
  walk the mbuf chain to get to the data at the moff offset, which in this case
  means they effectively skip over the mbuf returned by sbsndptr().
  
  We can't adjust sb-sb_sndptr during the previous call for this case because 
the
  next mbuf in the chain may not exist yet. We therefore need to detect the
  condition and make the adjustment during the current call.
  
  Fix by detecting the special case of moff being at the start of the next mbuf 
in
  the chain and adjust the required accounting variables accordingly.
  
  Reviewed by:  andre

Modified:
  stable/8/sys/kern/uipc_sockbuf.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/kern/   (props changed)

Modified: stable/8/sys/kern/uipc_sockbuf.c
==
--- stable/8/sys/kern/uipc_sockbuf.cWed Jul  3 03:36:36 2013
(r252532)
+++ stable/8/sys/kern/uipc_sockbuf.cWed Jul  3 03:40:06 2013
(r252533)
@@ -939,6 +939,13 @@ sbsndptr(struct sockbuf *sb, u_int off, 
/* Return closest mbuf in chain for current offset. */
*moff = off - sb-sb_sndptroff;
m = ret = sb-sb_sndptr ? sb-sb_sndptr : sb-sb_mb;
+   if (*moff == m-m_len) {
+   *moff = 0;
+   sb-sb_sndptroff += m-m_len;
+   m = ret = m-m_next;
+   KASSERT(ret-m_len  0,
+   (mbuf %p in sockbuf %p chain has no valid data, ret, sb));
+   }
 
/* Advance by len to be as close as possible for the next transmit. */
for (off = off - sb-sb_sndptroff + len - 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: r252534 - in stable/9/sys: kern sys

2013-07-02 Thread Lawrence Stewart
Author: lstewart
Date: Wed Jul  3 04:20:36 2013
New Revision: 252534
URL: http://svnweb.freebsd.org/changeset/base/252534

Log:
  MFC r251732,251752:
  
  Add support for non-virtualised hhook points, which are uniquely identified by
  type and id, as compared to virtualised hook points which are now uniquely
  identified by type, id and a vid (which for vimage is the pointer to the vnet
  that the hhook resides in).
  
  All hhook_head structs for both virtualised and non-virtualised hook points
  coexist in hhook_head_list, and a separate list is maintained for hhook points
  within each vnet to simplify some vimage-related housekeeping.
  
  Reviewed by:  scottl

Modified:
  stable/9/sys/kern/kern_hhook.c
  stable/9/sys/sys/hhook.h
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/sys/   (props changed)

Modified: stable/9/sys/kern/kern_hhook.c
==
--- stable/9/sys/kern/kern_hhook.c  Wed Jul  3 03:40:06 2013
(r252533)
+++ stable/9/sys/kern/kern_hhook.c  Wed Jul  3 04:20:36 2013
(r252534)
@@ -61,8 +61,9 @@ struct hhook {
 static MALLOC_DEFINE(M_HHOOK, hhook, Helper hooks are linked off hhook_head 
lists);
 
 LIST_HEAD(hhookheadhead, hhook_head);
-VNET_DEFINE(struct hhookheadhead, hhook_head_list);
-#defineV_hhook_head_list VNET(hhook_head_list)
+struct hhookheadhead hhook_head_list;
+VNET_DEFINE(struct hhookheadhead, hhook_vhead_list);
+#defineV_hhook_vhead_list VNET(hhook_vhead_list)
 
 static struct mtx hhook_head_list_lock;
 MTX_SYSINIT(hhookheadlistlock, hhook_head_list_lock, hhook_head list lock,
@@ -245,13 +246,6 @@ hhook_head_register(int32_t hhook_type, 
return (EEXIST);
}
 
-   /* XXXLAS: Need to implement support for non-virtualised hooks. */
-   if ((flags  HHOOK_HEADISINVNET) == 0) {
-   printf(%s: only vnet-style virtualised hooks can be used\n,
-   __func__);
-   return (EINVAL);
-   }
-
tmphhh = malloc(sizeof(struct hhook_head), M_HHOOK,
M_ZERO | ((flags  HHOOK_WAITOK) ? M_WAITOK : M_NOWAIT));
 
@@ -270,14 +264,17 @@ hhook_head_register(int32_t hhook_type, 
} else
refcount_init(tmphhh-hhh_refcount, 0);
 
+   HHHLIST_LOCK();
if (flags  HHOOK_HEADISINVNET) {
tmphhh-hhh_flags |= HHH_ISINVNET;
-   HHHLIST_LOCK();
-   LIST_INSERT_HEAD(V_hhook_head_list, tmphhh, hhh_next);
-   HHHLIST_UNLOCK();
-   } else {
-   /* XXXLAS: Add tmphhh to the non-virtualised list. */
+#ifdef VIMAGE
+   KASSERT(curvnet != NULL, (curvnet is NULL));
+   tmphhh-hhh_vid = (uintptr_t)curvnet;
+   LIST_INSERT_HEAD(V_hhook_vhead_list, tmphhh, hhh_vnext);
+#endif
}
+   LIST_INSERT_HEAD(hhook_head_list, tmphhh, hhh_next);
+   HHHLIST_UNLOCK();
 
return (0);
 }
@@ -290,6 +287,10 @@ hhook_head_destroy(struct hhook_head *hh
HHHLIST_LOCK_ASSERT();
 
LIST_REMOVE(hhh, hhh_next);
+#ifdef VIMAGE
+   if (hhook_head_is_virtualised(hhh) == HHOOK_HEADISINVNET)
+   LIST_REMOVE(hhh, hhh_vnext);
+#endif
HHH_WLOCK(hhh);
STAILQ_FOREACH_SAFE(tmp, hhh-hhh_hooks, hhk_next, tmp2)
free(tmp, M_HHOOK);
@@ -347,10 +348,17 @@ hhook_head_get(int32_t hhook_type, int32
 {
struct hhook_head *hhh;
 
-   /* XXXLAS: Pick hhook_head_list based on hhook_head flags. */
HHHLIST_LOCK();
-   LIST_FOREACH(hhh, V_hhook_head_list, hhh_next) {
+   LIST_FOREACH(hhh, hhook_head_list, hhh_next) {
if (hhh-hhh_type == hhook_type  hhh-hhh_id == hhook_id) {
+#ifdef VIMAGE
+   if (hhook_head_is_virtualised(hhh) ==
+   HHOOK_HEADISINVNET) {
+   KASSERT(curvnet != NULL, (curvnet is NULL));
+   if (hhh-hhh_vid != (uintptr_t)curvnet)
+   continue;
+   }
+#endif
refcount_acquire(hhh-hhh_refcount);
break;
}
@@ -412,7 +420,7 @@ static void
 hhook_vnet_init(const void *unused __unused)
 {
 
-   LIST_INIT(V_hhook_head_list);
+   LIST_INIT(V_hhook_vhead_list);
 }
 
 /*
@@ -429,7 +437,7 @@ hhook_vnet_uninit(const void *unused __u
 * subsystem should have already called hhook_head_deregister().
 */
HHHLIST_LOCK();
-   LIST_FOREACH_SAFE(hhh, V_hhook_head_list, hhh_next, tmphhh) {
+   LIST_FOREACH_SAFE(hhh, V_hhook_vhead_list, hhh_vnext, tmphhh) {
printf(%s: hhook_head type=%d, id=%d cleanup required\n,
__func__, hhh-hhh_type, hhh-hhh_id);
hhook_head_destroy(hhh);
@@ -439,7 +447,7 @@ hhook_vnet_uninit(const void *unused __u
 
 
 /*
- * When a vnet is created and being initialised, init 

svn commit: r252535 - in stable/8/sys: kern sys

2013-07-02 Thread Lawrence Stewart
Author: lstewart
Date: Wed Jul  3 04:21:29 2013
New Revision: 252535
URL: http://svnweb.freebsd.org/changeset/base/252535

Log:
  MFC r251732,251752:
  
  Add support for non-virtualised hhook points, which are uniquely identified by
  type and id, as compared to virtualised hook points which are now uniquely
  identified by type, id and a vid (which for vimage is the pointer to the vnet
  that the hhook resides in).
  
  All hhook_head structs for both virtualised and non-virtualised hook points
  coexist in hhook_head_list, and a separate list is maintained for hhook points
  within each vnet to simplify some vimage-related housekeeping.
  
  Reviewed by:  scottl

Modified:
  stable/8/sys/kern/kern_hhook.c
  stable/8/sys/sys/hhook.h
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/kern/   (props changed)
  stable/8/sys/sys/   (props changed)

Modified: stable/8/sys/kern/kern_hhook.c
==
--- stable/8/sys/kern/kern_hhook.c  Wed Jul  3 04:20:36 2013
(r252534)
+++ stable/8/sys/kern/kern_hhook.c  Wed Jul  3 04:21:29 2013
(r252535)
@@ -61,8 +61,9 @@ struct hhook {
 static MALLOC_DEFINE(M_HHOOK, hhook, Helper hooks are linked off hhook_head 
lists);
 
 LIST_HEAD(hhookheadhead, hhook_head);
-VNET_DEFINE(struct hhookheadhead, hhook_head_list);
-#defineV_hhook_head_list VNET(hhook_head_list)
+struct hhookheadhead hhook_head_list;
+VNET_DEFINE(struct hhookheadhead, hhook_vhead_list);
+#defineV_hhook_vhead_list VNET(hhook_vhead_list)
 
 static struct mtx hhook_head_list_lock;
 MTX_SYSINIT(hhookheadlistlock, hhook_head_list_lock, hhook_head list lock,
@@ -245,13 +246,6 @@ hhook_head_register(int32_t hhook_type, 
return (EEXIST);
}
 
-   /* XXXLAS: Need to implement support for non-virtualised hooks. */
-   if ((flags  HHOOK_HEADISINVNET) == 0) {
-   printf(%s: only vnet-style virtualised hooks can be used\n,
-   __func__);
-   return (EINVAL);
-   }
-
tmphhh = malloc(sizeof(struct hhook_head), M_HHOOK,
M_ZERO | ((flags  HHOOK_WAITOK) ? M_WAITOK : M_NOWAIT));
 
@@ -270,14 +264,17 @@ hhook_head_register(int32_t hhook_type, 
} else
refcount_init(tmphhh-hhh_refcount, 0);
 
+   HHHLIST_LOCK();
if (flags  HHOOK_HEADISINVNET) {
tmphhh-hhh_flags |= HHH_ISINVNET;
-   HHHLIST_LOCK();
-   LIST_INSERT_HEAD(V_hhook_head_list, tmphhh, hhh_next);
-   HHHLIST_UNLOCK();
-   } else {
-   /* XXXLAS: Add tmphhh to the non-virtualised list. */
+#ifdef VIMAGE
+   KASSERT(curvnet != NULL, (curvnet is NULL));
+   tmphhh-hhh_vid = (uintptr_t)curvnet;
+   LIST_INSERT_HEAD(V_hhook_vhead_list, tmphhh, hhh_vnext);
+#endif
}
+   LIST_INSERT_HEAD(hhook_head_list, tmphhh, hhh_next);
+   HHHLIST_UNLOCK();
 
return (0);
 }
@@ -290,6 +287,10 @@ hhook_head_destroy(struct hhook_head *hh
HHHLIST_LOCK_ASSERT();
 
LIST_REMOVE(hhh, hhh_next);
+#ifdef VIMAGE
+   if (hhook_head_is_virtualised(hhh) == HHOOK_HEADISINVNET)
+   LIST_REMOVE(hhh, hhh_vnext);
+#endif
HHH_WLOCK(hhh);
STAILQ_FOREACH_SAFE(tmp, hhh-hhh_hooks, hhk_next, tmp2)
free(tmp, M_HHOOK);
@@ -347,10 +348,17 @@ hhook_head_get(int32_t hhook_type, int32
 {
struct hhook_head *hhh;
 
-   /* XXXLAS: Pick hhook_head_list based on hhook_head flags. */
HHHLIST_LOCK();
-   LIST_FOREACH(hhh, V_hhook_head_list, hhh_next) {
+   LIST_FOREACH(hhh, hhook_head_list, hhh_next) {
if (hhh-hhh_type == hhook_type  hhh-hhh_id == hhook_id) {
+#ifdef VIMAGE
+   if (hhook_head_is_virtualised(hhh) ==
+   HHOOK_HEADISINVNET) {
+   KASSERT(curvnet != NULL, (curvnet is NULL));
+   if (hhh-hhh_vid != (uintptr_t)curvnet)
+   continue;
+   }
+#endif
refcount_acquire(hhh-hhh_refcount);
break;
}
@@ -412,7 +420,7 @@ static void
 hhook_vnet_init(const void *unused __unused)
 {
 
-   LIST_INIT(V_hhook_head_list);
+   LIST_INIT(V_hhook_vhead_list);
 }
 
 /*
@@ -429,7 +437,7 @@ hhook_vnet_uninit(const void *unused __u
 * subsystem should have already called hhook_head_deregister().
 */
HHHLIST_LOCK();
-   LIST_FOREACH_SAFE(hhh, V_hhook_head_list, hhh_next, tmphhh) {
+   LIST_FOREACH_SAFE(hhh, V_hhook_vhead_list, hhh_vnext, tmphhh) {
printf(%s: hhook_head type=%d, id=%d cleanup required\n,
__func__, hhh-hhh_type, hhh-hhh_id);
hhook_head_destroy(hhh);
@@ -439,7 +447,7 @@ hhook_vnet_uninit(const void *unused __u
 
 
 /*
- * When a vnet 

Re: svn commit: r252532 - stable/9/sys/kern

2013-07-02 Thread Lawrence Stewart
On 07/03/13 13:36, Lawrence Stewart wrote:
 Author: lstewart
 Date: Wed Jul  3 03:36:36 2013
 New Revision: 252532
 URL: http://svnweb.freebsd.org/changeset/base/252532
 
 Log:

MFC r251984:

   When a previous call to sbsndptr() leaves sb-sb_sndptroff at the start of 
 an
   mbuf that was fully consumed by the previous call, the mbuf ptr returned by 
 the
   current call ends up being the previous mbuf in the sb chain to the one that
   contains the data we want.
   
   This does not cause any observable issues because the mbuf copy routines 
 happily
   walk the mbuf chain to get to the data at the moff offset, which in this 
 case
   means they effectively skip over the mbuf returned by sbsndptr().
   
   We can't adjust sb-sb_sndptr during the previous call for this case 
 because the
   next mbuf in the chain may not exist yet. We therefore need to detect the
   condition and make the adjustment during the current call.
   
   Fix by detecting the special case of moff being at the start of the next 
 mbuf in
   the chain and adjust the required accounting variables accordingly.
   
   Reviewed by:andre
___
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


Re: svn commit: r252533 - stable/8/sys/kern

2013-07-02 Thread Lawrence Stewart
On 07/03/13 13:40, Lawrence Stewart wrote:
 Author: lstewart
 Date: Wed Jul  3 03:40:06 2013
 New Revision: 252533
 URL: http://svnweb.freebsd.org/changeset/base/252533
 
 Log:

MFC r251984:

   When a previous call to sbsndptr() leaves sb-sb_sndptroff at the start of 
 an
   mbuf that was fully consumed by the previous call, the mbuf ptr returned by 
 the
   current call ends up being the previous mbuf in the sb chain to the one that
   contains the data we want.
   
   This does not cause any observable issues because the mbuf copy routines 
 happily
   walk the mbuf chain to get to the data at the moff offset, which in this 
 case
   means they effectively skip over the mbuf returned by sbsndptr().
   
   We can't adjust sb-sb_sndptr during the previous call for this case 
 because the
   next mbuf in the chain may not exist yet. We therefore need to detect the
   condition and make the adjustment during the current call.
   
   Fix by detecting the special case of moff being at the start of the next 
 mbuf in
   the chain and adjust the required accounting variables accordingly.
   
   Reviewed by:andre
___
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: r252536 - in stable/9/sys: kern sys

2013-07-02 Thread Lawrence Stewart
Author: lstewart
Date: Wed Jul  3 05:28:22 2013
New Revision: 252536
URL: http://svnweb.freebsd.org/changeset/base/252536

Log:
  MFC r251770:
  
  Internalise handling of virtualised hook points inside
  hhook_{add|remove}_hook_lookup() so that khelp (and other potential API
  consumers) do not have to care when they attempt to (un)hook a particular hook
  point identified by id and type.
  
  Reviewed by:  scottl

Modified:
  stable/9/sys/kern/kern_hhook.c
  stable/9/sys/kern/kern_khelp.c
  stable/9/sys/sys/hhook.h
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/sys/   (props changed)

Modified: stable/9/sys/kern/kern_hhook.c
==
--- stable/9/sys/kern/kern_hhook.c  Wed Jul  3 04:21:29 2013
(r252535)
+++ stable/9/sys/kern/kern_hhook.c  Wed Jul  3 05:28:22 2013
(r252536)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2010 Lawrence Stewart lstew...@freebsd.org
+ * Copyright (c) 2010,2013 Lawrence Stewart lstew...@freebsd.org
  * Copyright (c) 2010 The FreeBSD Foundation
  * All rights reserved.
  *
@@ -69,6 +69,9 @@ static struct mtx hhook_head_list_lock;
 MTX_SYSINIT(hhookheadlistlock, hhook_head_list_lock, hhook_head list lock,
 MTX_DEF);
 
+/* Protected by hhook_head_list_lock. */
+static uint32_t n_hhookheads;
+
 /* Private function prototypes. */
 static void hhook_head_destroy(struct hhook_head *hhh);
 
@@ -165,21 +168,71 @@ hhook_add_hook(struct hhook_head *hhh, s
 }
 
 /*
- * Lookup a helper hook point and register a new helper hook function with it.
+ * Register a helper hook function with a helper hook point (including all
+ * virtual instances of the hook point if it is virtualised).
+ *
+ * The logic is unfortunately far more complex than for
+ * hhook_remove_hook_lookup() because hhook_add_hook() can call malloc() with
+ * M_WAITOK and thus we cannot call hhook_add_hook() with the
+ * hhook_head_list_lock held.
+ *
+ * The logic assembles an array of hhook_head structs that correspond to the
+ * helper hook point being hooked and bumps the refcount on each (all done with
+ * the hhook_head_list_lock held). The hhook_head_list_lock is then dropped, 
and
+ * hhook_add_hook() is called and the refcount dropped for each hhook_head
+ * struct in the array.
  */
 int
 hhook_add_hook_lookup(struct hookinfo *hki, uint32_t flags)
 {
-   struct hhook_head *hhh;
-   int error;
+   struct hhook_head **heads_to_hook, *hhh;
+   int error, i, n_heads_to_hook;
 
-   hhh = hhook_head_get(hki-hook_type, hki-hook_id);
+tryagain:
+   error = i = 0;
+   /*
+* Accessing n_hhookheads without hhook_head_list_lock held opens up a
+* race with hhook_head_register() which we are unlikely to lose, but
+* nonetheless have to cope with - hence the complex goto logic.
+*/
+   n_heads_to_hook = n_hhookheads;
+   heads_to_hook = malloc(n_heads_to_hook * sizeof(struct hhook_head *),
+   M_HHOOK, flags  HHOOK_WAITOK ? M_WAITOK : M_NOWAIT);
+   if (heads_to_hook == NULL)
+   return (ENOMEM);
 
-   if (hhh == NULL)
-   return (ENOENT);
+   HHHLIST_LOCK();
+   LIST_FOREACH(hhh, hhook_head_list, hhh_next) {
+   if (hhh-hhh_type == hki-hook_type 
+   hhh-hhh_id == hki-hook_id) {
+   if (i  n_heads_to_hook) {
+   heads_to_hook[i] = hhh;
+   
refcount_acquire(heads_to_hook[i]-hhh_refcount);
+   i++;
+   } else {
+   /*
+* We raced with hhook_head_register() which
+* inserted a hhook_head that we need to hook
+* but did not malloc space for. Abort this run
+* and try again.
+*/
+   for (i--; i = 0; i--)
+   
refcount_release(heads_to_hook[i]-hhh_refcount);
+   free(heads_to_hook, M_HHOOK);
+   HHHLIST_UNLOCK();
+   goto tryagain;
+   }
+   }
+   }
+   HHHLIST_UNLOCK();
 
-   error = hhook_add_hook(hhh, hki, flags);
-   hhook_head_release(hhh);
+   for (i--; i = 0; i--) {
+   if (!error)
+   error = hhook_add_hook(heads_to_hook[i], hki, flags);
+   refcount_release(heads_to_hook[i]-hhh_refcount);
+   }
+
+   free(heads_to_hook, M_HHOOK);
 
return (error);
 }
@@ -211,20 +264,21 @@ hhook_remove_hook(struct hhook_head *hhh
 }
 
 /*
- * Lookup a helper hook point and remove a helper hook function from it.
+ * Remove a helper hook function from a helper hook point (including all
+ * virtual instances of the hook point

svn commit: r252537 - in stable/8/sys: kern sys

2013-07-02 Thread Lawrence Stewart
Author: lstewart
Date: Wed Jul  3 05:29:21 2013
New Revision: 252537
URL: http://svnweb.freebsd.org/changeset/base/252537

Log:
  MFC r251770:
  
  Internalise handling of virtualised hook points inside
  hhook_{add|remove}_hook_lookup() so that khelp (and other potential API
  consumers) do not have to care when they attempt to (un)hook a particular hook
  point identified by id and type.
  
  Reviewed by:  scottl

Modified:
  stable/8/sys/kern/kern_hhook.c
  stable/8/sys/kern/kern_khelp.c
  stable/8/sys/sys/hhook.h
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/kern/   (props changed)
  stable/8/sys/sys/   (props changed)

Modified: stable/8/sys/kern/kern_hhook.c
==
--- stable/8/sys/kern/kern_hhook.c  Wed Jul  3 05:28:22 2013
(r252536)
+++ stable/8/sys/kern/kern_hhook.c  Wed Jul  3 05:29:21 2013
(r252537)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2010 Lawrence Stewart lstew...@freebsd.org
+ * Copyright (c) 2010,2013 Lawrence Stewart lstew...@freebsd.org
  * Copyright (c) 2010 The FreeBSD Foundation
  * All rights reserved.
  *
@@ -69,6 +69,9 @@ static struct mtx hhook_head_list_lock;
 MTX_SYSINIT(hhookheadlistlock, hhook_head_list_lock, hhook_head list lock,
 MTX_DEF);
 
+/* Protected by hhook_head_list_lock. */
+static uint32_t n_hhookheads;
+
 /* Private function prototypes. */
 static void hhook_head_destroy(struct hhook_head *hhh);
 
@@ -165,21 +168,71 @@ hhook_add_hook(struct hhook_head *hhh, s
 }
 
 /*
- * Lookup a helper hook point and register a new helper hook function with it.
+ * Register a helper hook function with a helper hook point (including all
+ * virtual instances of the hook point if it is virtualised).
+ *
+ * The logic is unfortunately far more complex than for
+ * hhook_remove_hook_lookup() because hhook_add_hook() can call malloc() with
+ * M_WAITOK and thus we cannot call hhook_add_hook() with the
+ * hhook_head_list_lock held.
+ *
+ * The logic assembles an array of hhook_head structs that correspond to the
+ * helper hook point being hooked and bumps the refcount on each (all done with
+ * the hhook_head_list_lock held). The hhook_head_list_lock is then dropped, 
and
+ * hhook_add_hook() is called and the refcount dropped for each hhook_head
+ * struct in the array.
  */
 int
 hhook_add_hook_lookup(struct hookinfo *hki, uint32_t flags)
 {
-   struct hhook_head *hhh;
-   int error;
+   struct hhook_head **heads_to_hook, *hhh;
+   int error, i, n_heads_to_hook;
 
-   hhh = hhook_head_get(hki-hook_type, hki-hook_id);
+tryagain:
+   error = i = 0;
+   /*
+* Accessing n_hhookheads without hhook_head_list_lock held opens up a
+* race with hhook_head_register() which we are unlikely to lose, but
+* nonetheless have to cope with - hence the complex goto logic.
+*/
+   n_heads_to_hook = n_hhookheads;
+   heads_to_hook = malloc(n_heads_to_hook * sizeof(struct hhook_head *),
+   M_HHOOK, flags  HHOOK_WAITOK ? M_WAITOK : M_NOWAIT);
+   if (heads_to_hook == NULL)
+   return (ENOMEM);
 
-   if (hhh == NULL)
-   return (ENOENT);
+   HHHLIST_LOCK();
+   LIST_FOREACH(hhh, hhook_head_list, hhh_next) {
+   if (hhh-hhh_type == hki-hook_type 
+   hhh-hhh_id == hki-hook_id) {
+   if (i  n_heads_to_hook) {
+   heads_to_hook[i] = hhh;
+   
refcount_acquire(heads_to_hook[i]-hhh_refcount);
+   i++;
+   } else {
+   /*
+* We raced with hhook_head_register() which
+* inserted a hhook_head that we need to hook
+* but did not malloc space for. Abort this run
+* and try again.
+*/
+   for (i--; i = 0; i--)
+   
refcount_release(heads_to_hook[i]-hhh_refcount);
+   free(heads_to_hook, M_HHOOK);
+   HHHLIST_UNLOCK();
+   goto tryagain;
+   }
+   }
+   }
+   HHHLIST_UNLOCK();
 
-   error = hhook_add_hook(hhh, hki, flags);
-   hhook_head_release(hhh);
+   for (i--; i = 0; i--) {
+   if (!error)
+   error = hhook_add_hook(heads_to_hook[i], hki, flags);
+   refcount_release(heads_to_hook[i]-hhh_refcount);
+   }
+
+   free(heads_to_hook, M_HHOOK);
 
return (error);
 }
@@ -211,20 +264,21 @@ hhook_remove_hook(struct hhook_head *hhh
 }
 
 /*
- * Lookup a helper hook point and remove a helper hook function from it.
+ * Remove a helper hook function from a helper hook point (including all

svn commit: r252538 - stable/8/sys/kern

2013-07-02 Thread Lawrence Stewart
Author: lstewart
Date: Wed Jul  3 05:47:28 2013
New Revision: 252538
URL: http://svnweb.freebsd.org/changeset/base/252538

Log:
  MFC r251774:
  
  Add a private KPI between hhook and khelp that allows khelp modules to insert
  hook functions into hhook points which register after the modules were loaded 
-
  potentially useful during boot or if hhook points are dynamically registered.

Modified:
  stable/8/sys/kern/kern_hhook.c
  stable/8/sys/kern/kern_khelp.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/kern/   (props changed)

Modified: stable/8/sys/kern/kern_hhook.c
==
--- stable/8/sys/kern/kern_hhook.c  Wed Jul  3 05:29:21 2013
(r252537)
+++ stable/8/sys/kern/kern_hhook.c  Wed Jul  3 05:47:28 2013
(r252538)
@@ -74,6 +74,7 @@ static uint32_t n_hhookheads;
 
 /* Private function prototypes. */
 static void hhook_head_destroy(struct hhook_head *hhh);
+void khelp_new_hhook_registered(struct hhook_head *hhh, uint32_t flags);
 
 #defineHHHLIST_LOCK() mtx_lock(hhook_head_list_lock)
 #defineHHHLIST_UNLOCK() mtx_unlock(hhook_head_list_lock)
@@ -311,12 +312,7 @@ hhook_head_register(int32_t hhook_type, 
tmphhh-hhh_nhooks = 0;
STAILQ_INIT(tmphhh-hhh_hooks);
HHH_LOCK_INIT(tmphhh);
-
-   if (hhh != NULL) {
-   refcount_init(tmphhh-hhh_refcount, 1);
-   *hhh = tmphhh;
-   } else
-   refcount_init(tmphhh-hhh_refcount, 0);
+   refcount_init(tmphhh-hhh_refcount, 1);
 
HHHLIST_LOCK();
if (flags  HHOOK_HEADISINVNET) {
@@ -331,6 +327,13 @@ hhook_head_register(int32_t hhook_type, 
n_hhookheads++;
HHHLIST_UNLOCK();
 
+   khelp_new_hhook_registered(tmphhh, flags);
+
+   if (hhh != NULL)
+   *hhh = tmphhh;
+   else
+   refcount_release(tmphhh-hhh_refcount);
+
return (0);
 }
 

Modified: stable/8/sys/kern/kern_khelp.c
==
--- stable/8/sys/kern/kern_khelp.c  Wed Jul  3 05:29:21 2013
(r252537)
+++ stable/8/sys/kern/kern_khelp.c  Wed Jul  3 05:47:28 2013
(r252538)
@@ -40,7 +40,6 @@ __FBSDID($FreeBSD$);
 #include sys/param.h
 #include sys/kernel.h
 #include sys/hhook.h
-#include sys/jail.h
 #include sys/khelp.h
 #include sys/lock.h
 #include sys/malloc.h
@@ -52,8 +51,6 @@ __FBSDID($FreeBSD$);
 #include sys/rwlock.h
 #include sys/systm.h
 
-#include net/vnet.h
-
 static struct rwlock khelp_list_lock;
 RW_SYSINIT(khelplistlock, khelp_list_lock, helper list lock);
 
@@ -61,6 +58,7 @@ static TAILQ_HEAD(helper_head, helper) h
 
 /* Private function prototypes. */
 static inline void khelp_remove_osd(struct helper *h, struct osd *hosd);
+void khelp_new_hhook_registered(struct hhook_head *hhh, uint32_t flags);
 
 #defineKHELP_LIST_WLOCK() rw_wlock(khelp_list_lock)
 #defineKHELP_LIST_WUNLOCK() rw_wunlock(khelp_list_lock)
@@ -289,6 +287,36 @@ khelp_remove_hhook(struct hookinfo *hki)
return (error);
 }
 
+/*
+ * Private KPI between hhook and khelp that allows khelp modules to insert hook
+ * functions into hhook points which register after the modules were loaded.
+ */
+void
+khelp_new_hhook_registered(struct hhook_head *hhh, uint32_t flags)
+{
+   struct helper *h;
+   int error, i;
+
+   KHELP_LIST_RLOCK();
+   TAILQ_FOREACH(h, helpers, h_next) {
+   for (i = 0; i  h-h_nhooks; i++) {
+   if (hhh-hhh_type != h-h_hooks[i].hook_type ||
+   hhh-hhh_id != h-h_hooks[i].hook_id)
+   continue;
+   error = hhook_add_hook(hhh, h-h_hooks[i], flags);
+   if (error) {
+   printf(%s: \%s\ khelp module unable to 
+   hook type %d id %d due to error %d\n,
+   __func__, h-h_name,
+   h-h_hooks[i].hook_type,
+   h-h_hooks[i].hook_id, error);
+   error = 0;
+   }
+   }
+   }
+   KHELP_LIST_RUNLOCK();
+}
+
 int
 khelp_modevent(module_t mod, int event_type, void *data)
 {
@@ -348,95 +376,3 @@ khelp_modevent(module_t mod, int event_t
 
return (error);
 }
-
-/*
- * This function is called in two separate situations:
- *
- * - When the kernel is booting, it is called directly by the SYSINIT framework
- * to allow Khelp modules which were compiled into the kernel or loaded by the
- * boot loader to insert their non-virtualised hook functions into the kernel.
- *
- * - When the kernel is booting or a vnet is created, this function is also
- * called indirectly through khelp_vnet_init() by the vnet initialisation code.
- * In this situation, Khelp modules are able to insert their virtualised 

svn commit: r252539 - stable/9/sys/kern

2013-07-02 Thread Lawrence Stewart
Author: lstewart
Date: Wed Jul  3 05:48:46 2013
New Revision: 252539
URL: http://svnweb.freebsd.org/changeset/base/252539

Log:
  MFC r251774:
  
  Add a private KPI between hhook and khelp that allows khelp modules to insert
  hook functions into hhook points which register after the modules were loaded 
-
  potentially useful during boot or if hhook points are dynamically registered.

Modified:
  stable/9/sys/kern/kern_hhook.c
  stable/9/sys/kern/kern_khelp.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/kern/kern_hhook.c
==
--- stable/9/sys/kern/kern_hhook.c  Wed Jul  3 05:47:28 2013
(r252538)
+++ stable/9/sys/kern/kern_hhook.c  Wed Jul  3 05:48:46 2013
(r252539)
@@ -74,6 +74,7 @@ static uint32_t n_hhookheads;
 
 /* Private function prototypes. */
 static void hhook_head_destroy(struct hhook_head *hhh);
+void khelp_new_hhook_registered(struct hhook_head *hhh, uint32_t flags);
 
 #defineHHHLIST_LOCK() mtx_lock(hhook_head_list_lock)
 #defineHHHLIST_UNLOCK() mtx_unlock(hhook_head_list_lock)
@@ -311,12 +312,7 @@ hhook_head_register(int32_t hhook_type, 
tmphhh-hhh_nhooks = 0;
STAILQ_INIT(tmphhh-hhh_hooks);
HHH_LOCK_INIT(tmphhh);
-
-   if (hhh != NULL) {
-   refcount_init(tmphhh-hhh_refcount, 1);
-   *hhh = tmphhh;
-   } else
-   refcount_init(tmphhh-hhh_refcount, 0);
+   refcount_init(tmphhh-hhh_refcount, 1);
 
HHHLIST_LOCK();
if (flags  HHOOK_HEADISINVNET) {
@@ -331,6 +327,13 @@ hhook_head_register(int32_t hhook_type, 
n_hhookheads++;
HHHLIST_UNLOCK();
 
+   khelp_new_hhook_registered(tmphhh, flags);
+
+   if (hhh != NULL)
+   *hhh = tmphhh;
+   else
+   refcount_release(tmphhh-hhh_refcount);
+
return (0);
 }
 

Modified: stable/9/sys/kern/kern_khelp.c
==
--- stable/9/sys/kern/kern_khelp.c  Wed Jul  3 05:47:28 2013
(r252538)
+++ stable/9/sys/kern/kern_khelp.c  Wed Jul  3 05:48:46 2013
(r252539)
@@ -40,7 +40,6 @@ __FBSDID($FreeBSD$);
 #include sys/param.h
 #include sys/kernel.h
 #include sys/hhook.h
-#include sys/jail.h
 #include sys/khelp.h
 #include sys/lock.h
 #include sys/malloc.h
@@ -52,8 +51,6 @@ __FBSDID($FreeBSD$);
 #include sys/rwlock.h
 #include sys/systm.h
 
-#include net/vnet.h
-
 static struct rwlock khelp_list_lock;
 RW_SYSINIT(khelplistlock, khelp_list_lock, helper list lock);
 
@@ -61,6 +58,7 @@ static TAILQ_HEAD(helper_head, helper) h
 
 /* Private function prototypes. */
 static inline void khelp_remove_osd(struct helper *h, struct osd *hosd);
+void khelp_new_hhook_registered(struct hhook_head *hhh, uint32_t flags);
 
 #defineKHELP_LIST_WLOCK() rw_wlock(khelp_list_lock)
 #defineKHELP_LIST_WUNLOCK() rw_wunlock(khelp_list_lock)
@@ -289,6 +287,36 @@ khelp_remove_hhook(struct hookinfo *hki)
return (error);
 }
 
+/*
+ * Private KPI between hhook and khelp that allows khelp modules to insert hook
+ * functions into hhook points which register after the modules were loaded.
+ */
+void
+khelp_new_hhook_registered(struct hhook_head *hhh, uint32_t flags)
+{
+   struct helper *h;
+   int error, i;
+
+   KHELP_LIST_RLOCK();
+   TAILQ_FOREACH(h, helpers, h_next) {
+   for (i = 0; i  h-h_nhooks; i++) {
+   if (hhh-hhh_type != h-h_hooks[i].hook_type ||
+   hhh-hhh_id != h-h_hooks[i].hook_id)
+   continue;
+   error = hhook_add_hook(hhh, h-h_hooks[i], flags);
+   if (error) {
+   printf(%s: \%s\ khelp module unable to 
+   hook type %d id %d due to error %d\n,
+   __func__, h-h_name,
+   h-h_hooks[i].hook_type,
+   h-h_hooks[i].hook_id, error);
+   error = 0;
+   }
+   }
+   }
+   KHELP_LIST_RUNLOCK();
+}
+
 int
 khelp_modevent(module_t mod, int event_type, void *data)
 {
@@ -348,95 +376,3 @@ khelp_modevent(module_t mod, int event_t
 
return (error);
 }
-
-/*
- * This function is called in two separate situations:
- *
- * - When the kernel is booting, it is called directly by the SYSINIT framework
- * to allow Khelp modules which were compiled into the kernel or loaded by the
- * boot loader to insert their non-virtualised hook functions into the kernel.
- *
- * - When the kernel is booting or a vnet is created, this function is also
- * called indirectly through khelp_vnet_init() by the vnet initialisation code.
- * In this situation, Khelp modules are able to insert their virtualised hook
- * functions into the virtualised 

svn commit: r252365 - in stable/9: share/man/man3 sys/sys

2013-06-28 Thread Lawrence Stewart
Author: lstewart
Date: Sat Jun 29 04:25:40 2013
New Revision: 252365
URL: http://svnweb.freebsd.org/changeset/base/252365

Log:
  MFC r251887:
  
  Add new FOREACH_FROM variants of the queue(3) FOREACH macros which can
  optionally start the traversal from a previously found element by passing the
  element in as var. Passing a NULL var retains the same semantics as the
  regular FOREACH macros.
  
  Reviewed by:  jhb (previous version), rpaulo

Modified:
  stable/9/share/man/man3/queue.3
  stable/9/sys/sys/queue.h
Directory Properties:
  stable/9/share/man/   (props changed)
  stable/9/share/man/man3/   (props changed)
  stable/9/sys/   (props changed)
  stable/9/sys/sys/   (props changed)

Modified: stable/9/share/man/man3/queue.3
==
--- stable/9/share/man/man3/queue.3 Sat Jun 29 01:35:28 2013
(r252364)
+++ stable/9/share/man/man3/queue.3 Sat Jun 29 04:25:40 2013
(r252365)
@@ -32,7 +32,7 @@
 .\@(#)queue.3 8.2 (Berkeley) 1/24/94
 .\ $FreeBSD$
 .\
-.Dd Sep 12, 2012
+.Dd June 17, 2013
 .Dt QUEUE 3
 .Os
 .Sh NAME
@@ -40,7 +40,9 @@
 .Nm SLIST_ENTRY ,
 .Nm SLIST_FIRST ,
 .Nm SLIST_FOREACH ,
+.Nm SLIST_FOREACH_FROM ,
 .Nm SLIST_FOREACH_SAFE ,
+.Nm SLIST_FOREACH_FROM_SAFE ,
 .Nm SLIST_HEAD ,
 .Nm SLIST_HEAD_INITIALIZER ,
 .Nm SLIST_INIT ,
@@ -56,7 +58,9 @@
 .Nm STAILQ_ENTRY ,
 .Nm STAILQ_FIRST ,
 .Nm STAILQ_FOREACH ,
+.Nm STAILQ_FOREACH_FROM ,
 .Nm STAILQ_FOREACH_SAFE ,
+.Nm STAILQ_FOREACH_FROM_SAFE ,
 .Nm STAILQ_HEAD ,
 .Nm STAILQ_HEAD_INITIALIZER ,
 .Nm STAILQ_INIT ,
@@ -73,7 +77,9 @@
 .Nm LIST_ENTRY ,
 .Nm LIST_FIRST ,
 .Nm LIST_FOREACH ,
+.Nm LIST_FOREACH_FROM ,
 .Nm LIST_FOREACH_SAFE ,
+.Nm LIST_FOREACH_FROM_SAFE ,
 .Nm LIST_HEAD ,
 .Nm LIST_HEAD_INITIALIZER ,
 .Nm LIST_INIT ,
@@ -89,9 +95,13 @@
 .Nm TAILQ_ENTRY ,
 .Nm TAILQ_FIRST ,
 .Nm TAILQ_FOREACH ,
+.Nm TAILQ_FOREACH_FROM ,
 .Nm TAILQ_FOREACH_SAFE ,
+.Nm TAILQ_FOREACH_FROM_SAFE ,
 .Nm TAILQ_FOREACH_REVERSE ,
+.Nm TAILQ_FOREACH_REVERSE_FROM ,
 .Nm TAILQ_FOREACH_REVERSE_SAFE ,
+.Nm TAILQ_FOREACH_REVERSE_FROM_SAFE ,
 .Nm TAILQ_HEAD ,
 .Nm TAILQ_HEAD_INITIALIZER ,
 .Nm TAILQ_INIT ,
@@ -113,7 +123,9 @@ lists and tail queues
 .Fn SLIST_ENTRY TYPE
 .Fn SLIST_FIRST SLIST_HEAD *head
 .Fn SLIST_FOREACH TYPE *var SLIST_HEAD *head SLIST_ENTRY NAME
+.Fn SLIST_FOREACH_FROM TYPE *var SLIST_HEAD *head SLIST_ENTRY NAME
 .Fn SLIST_FOREACH_SAFE TYPE *var SLIST_HEAD *head SLIST_ENTRY NAME TYPE 
*temp_var
+.Fn SLIST_FOREACH_FROM_SAFE TYPE *var SLIST_HEAD *head SLIST_ENTRY NAME 
TYPE *temp_var
 .Fn SLIST_HEAD HEADNAME TYPE
 .Fn SLIST_HEAD_INITIALIZER SLIST_HEAD head
 .Fn SLIST_INIT SLIST_HEAD *head
@@ -130,7 +142,9 @@ lists and tail queues
 .Fn STAILQ_ENTRY TYPE
 .Fn STAILQ_FIRST STAILQ_HEAD *head
 .Fn STAILQ_FOREACH TYPE *var STAILQ_HEAD *head STAILQ_ENTRY NAME
+.Fn STAILQ_FOREACH_FROM TYPE *var STAILQ_HEAD *head STAILQ_ENTRY NAME
 .Fn STAILQ_FOREACH_SAFE TYPE *var STAILQ_HEAD *head STAILQ_ENTRY NAME 
TYPE *temp_var
+.Fn STAILQ_FOREACH_FROM_SAFE TYPE *var STAILQ_HEAD *head STAILQ_ENTRY 
NAME TYPE *temp_var
 .Fn STAILQ_HEAD HEADNAME TYPE
 .Fn STAILQ_HEAD_INITIALIZER STAILQ_HEAD head
 .Fn STAILQ_INIT STAILQ_HEAD *head
@@ -148,7 +162,9 @@ lists and tail queues
 .Fn LIST_ENTRY TYPE
 .Fn LIST_FIRST LIST_HEAD *head
 .Fn LIST_FOREACH TYPE *var LIST_HEAD *head LIST_ENTRY NAME
+.Fn LIST_FOREACH_FROM TYPE *var LIST_HEAD *head LIST_ENTRY NAME
 .Fn LIST_FOREACH_SAFE TYPE *var LIST_HEAD *head LIST_ENTRY NAME TYPE 
*temp_var
+.Fn LIST_FOREACH_FROM_SAFE TYPE *var LIST_HEAD *head LIST_ENTRY NAME 
TYPE *temp_var
 .Fn LIST_HEAD HEADNAME TYPE
 .Fn LIST_HEAD_INITIALIZER LIST_HEAD head
 .Fn LIST_INIT LIST_HEAD *head
@@ -165,9 +181,13 @@ lists and tail queues
 .Fn TAILQ_ENTRY TYPE
 .Fn TAILQ_FIRST TAILQ_HEAD *head
 .Fn TAILQ_FOREACH TYPE *var TAILQ_HEAD *head TAILQ_ENTRY NAME
+.Fn TAILQ_FOREACH_FROM TYPE *var TAILQ_HEAD *head TAILQ_ENTRY NAME
 .Fn TAILQ_FOREACH_SAFE TYPE *var TAILQ_HEAD *head TAILQ_ENTRY NAME TYPE 
*temp_var
+.Fn TAILQ_FOREACH_FROM_SAFE TYPE *var TAILQ_HEAD *head TAILQ_ENTRY NAME 
TYPE *temp_var
 .Fn TAILQ_FOREACH_REVERSE TYPE *var TAILQ_HEAD *head HEADNAME 
TAILQ_ENTRY NAME
+.Fn TAILQ_FOREACH_REVERSE_FROM TYPE *var TAILQ_HEAD *head HEADNAME 
TAILQ_ENTRY NAME
 .Fn TAILQ_FOREACH_REVERSE_SAFE TYPE *var TAILQ_HEAD *head HEADNAME 
TAILQ_ENTRY NAME TYPE *temp_var
+.Fn TAILQ_FOREACH_REVERSE_FROM_SAFE TYPE *var TAILQ_HEAD *head HEADNAME 
TAILQ_ENTRY NAME TYPE *temp_var
 .Fn TAILQ_HEAD HEADNAME TYPE
 .Fn TAILQ_HEAD_INITIALIZER TAILQ_HEAD head
 .Fn TAILQ_INIT TAILQ_HEAD *head
@@ -365,6 +385,19 @@ turn to
 .Fa var .
 .Pp
 The macro
+.Nm SLIST_FOREACH_FROM
+behaves identically to
+.Nm SLIST_FOREACH
+when
+.Fa var
+is NULL, else it treats
+.Fa var
+as a previously found SLIST element and begins the loop at
+.Fa var
+instead of the first element in the SLIST referenced by
+.Fa head .
+.Pp
+The macro
 .Nm SLIST_FOREACH_SAFE
 traverses the list referenced by
 .Fa head
@@ -379,6 +412,19 

svn commit: r252366 - in stable/8: share/man/man3 sys/sys

2013-06-28 Thread Lawrence Stewart
Author: lstewart
Date: Sat Jun 29 04:27:04 2013
New Revision: 252366
URL: http://svnweb.freebsd.org/changeset/base/252366

Log:
  MFC r251887:
  
  Add new FOREACH_FROM variants of the queue(3) FOREACH macros which can
  optionally start the traversal from a previously found element by passing the
  element in as var. Passing a NULL var retains the same semantics as the
  regular FOREACH macros.
  
  Reviewed by:  jhb (previous version), rpaulo

Modified:
  stable/8/share/man/man3/queue.3
  stable/8/sys/sys/queue.h
Directory Properties:
  stable/8/share/man/   (props changed)
  stable/8/share/man/man3/   (props changed)
  stable/8/sys/   (props changed)
  stable/8/sys/sys/   (props changed)

Modified: stable/8/share/man/man3/queue.3
==
--- stable/8/share/man/man3/queue.3 Sat Jun 29 04:25:40 2013
(r252365)
+++ stable/8/share/man/man3/queue.3 Sat Jun 29 04:27:04 2013
(r252366)
@@ -32,7 +32,7 @@
 .\@(#)queue.3 8.2 (Berkeley) 1/24/94
 .\ $FreeBSD$
 .\
-.Dd May 13, 2011
+.Dd June 17, 2013
 .Dt QUEUE 3
 .Os
 .Sh NAME
@@ -40,7 +40,9 @@
 .Nm SLIST_ENTRY ,
 .Nm SLIST_FIRST ,
 .Nm SLIST_FOREACH ,
+.Nm SLIST_FOREACH_FROM ,
 .Nm SLIST_FOREACH_SAFE ,
+.Nm SLIST_FOREACH_FROM_SAFE ,
 .Nm SLIST_HEAD ,
 .Nm SLIST_HEAD_INITIALIZER ,
 .Nm SLIST_INIT ,
@@ -56,7 +58,9 @@
 .Nm STAILQ_ENTRY ,
 .Nm STAILQ_FIRST ,
 .Nm STAILQ_FOREACH ,
+.Nm STAILQ_FOREACH_FROM ,
 .Nm STAILQ_FOREACH_SAFE ,
+.Nm STAILQ_FOREACH_FROM_SAFE ,
 .Nm STAILQ_HEAD ,
 .Nm STAILQ_HEAD_INITIALIZER ,
 .Nm STAILQ_INIT ,
@@ -73,7 +77,9 @@
 .Nm LIST_ENTRY ,
 .Nm LIST_FIRST ,
 .Nm LIST_FOREACH ,
+.Nm LIST_FOREACH_FROM ,
 .Nm LIST_FOREACH_SAFE ,
+.Nm LIST_FOREACH_FROM_SAFE ,
 .Nm LIST_HEAD ,
 .Nm LIST_HEAD_INITIALIZER ,
 .Nm LIST_INIT ,
@@ -88,9 +94,13 @@
 .Nm TAILQ_ENTRY ,
 .Nm TAILQ_FIRST ,
 .Nm TAILQ_FOREACH ,
+.Nm TAILQ_FOREACH_FROM ,
 .Nm TAILQ_FOREACH_SAFE ,
+.Nm TAILQ_FOREACH_FROM_SAFE ,
 .Nm TAILQ_FOREACH_REVERSE ,
+.Nm TAILQ_FOREACH_REVERSE_FROM ,
 .Nm TAILQ_FOREACH_REVERSE_SAFE ,
+.Nm TAILQ_FOREACH_REVERSE_FROM_SAFE ,
 .Nm TAILQ_HEAD ,
 .Nm TAILQ_HEAD_INITIALIZER ,
 .Nm TAILQ_INIT ,
@@ -112,7 +122,9 @@ lists and tail queues
 .Fn SLIST_ENTRY TYPE
 .Fn SLIST_FIRST SLIST_HEAD *head
 .Fn SLIST_FOREACH TYPE *var SLIST_HEAD *head SLIST_ENTRY NAME
+.Fn SLIST_FOREACH_FROM TYPE *var SLIST_HEAD *head SLIST_ENTRY NAME
 .Fn SLIST_FOREACH_SAFE TYPE *var SLIST_HEAD *head SLIST_ENTRY NAME TYPE 
*temp_var
+.Fn SLIST_FOREACH_FROM_SAFE TYPE *var SLIST_HEAD *head SLIST_ENTRY NAME 
TYPE *temp_var
 .Fn SLIST_HEAD HEADNAME TYPE
 .Fn SLIST_HEAD_INITIALIZER SLIST_HEAD head
 .Fn SLIST_INIT SLIST_HEAD *head
@@ -129,7 +141,9 @@ lists and tail queues
 .Fn STAILQ_ENTRY TYPE
 .Fn STAILQ_FIRST STAILQ_HEAD *head
 .Fn STAILQ_FOREACH TYPE *var STAILQ_HEAD *head STAILQ_ENTRY NAME
+.Fn STAILQ_FOREACH_FROM TYPE *var STAILQ_HEAD *head STAILQ_ENTRY NAME
 .Fn STAILQ_FOREACH_SAFE TYPE *var STAILQ_HEAD *head STAILQ_ENTRY NAME 
TYPE *temp_var
+.Fn STAILQ_FOREACH_FROM_SAFE TYPE *var STAILQ_HEAD *head STAILQ_ENTRY 
NAME TYPE *temp_var
 .Fn STAILQ_HEAD HEADNAME TYPE
 .Fn STAILQ_HEAD_INITIALIZER STAILQ_HEAD head
 .Fn STAILQ_INIT STAILQ_HEAD *head
@@ -147,7 +161,9 @@ lists and tail queues
 .Fn LIST_ENTRY TYPE
 .Fn LIST_FIRST LIST_HEAD *head
 .Fn LIST_FOREACH TYPE *var LIST_HEAD *head LIST_ENTRY NAME
+.Fn LIST_FOREACH_FROM TYPE *var LIST_HEAD *head LIST_ENTRY NAME
 .Fn LIST_FOREACH_SAFE TYPE *var LIST_HEAD *head LIST_ENTRY NAME TYPE 
*temp_var
+.Fn LIST_FOREACH_FROM_SAFE TYPE *var LIST_HEAD *head LIST_ENTRY NAME 
TYPE *temp_var
 .Fn LIST_HEAD HEADNAME TYPE
 .Fn LIST_HEAD_INITIALIZER LIST_HEAD head
 .Fn LIST_INIT LIST_HEAD *head
@@ -163,9 +179,13 @@ lists and tail queues
 .Fn TAILQ_ENTRY TYPE
 .Fn TAILQ_FIRST TAILQ_HEAD *head
 .Fn TAILQ_FOREACH TYPE *var TAILQ_HEAD *head TAILQ_ENTRY NAME
+.Fn TAILQ_FOREACH_FROM TYPE *var TAILQ_HEAD *head TAILQ_ENTRY NAME
 .Fn TAILQ_FOREACH_SAFE TYPE *var TAILQ_HEAD *head TAILQ_ENTRY NAME TYPE 
*temp_var
+.Fn TAILQ_FOREACH_FROM_SAFE TYPE *var TAILQ_HEAD *head TAILQ_ENTRY NAME 
TYPE *temp_var
 .Fn TAILQ_FOREACH_REVERSE TYPE *var TAILQ_HEAD *head HEADNAME 
TAILQ_ENTRY NAME
+.Fn TAILQ_FOREACH_REVERSE_FROM TYPE *var TAILQ_HEAD *head HEADNAME 
TAILQ_ENTRY NAME
 .Fn TAILQ_FOREACH_REVERSE_SAFE TYPE *var TAILQ_HEAD *head HEADNAME 
TAILQ_ENTRY NAME TYPE *temp_var
+.Fn TAILQ_FOREACH_REVERSE_FROM_SAFE TYPE *var TAILQ_HEAD *head HEADNAME 
TAILQ_ENTRY NAME TYPE *temp_var
 .Fn TAILQ_HEAD HEADNAME TYPE
 .Fn TAILQ_HEAD_INITIALIZER TAILQ_HEAD head
 .Fn TAILQ_INIT TAILQ_HEAD *head
@@ -353,6 +373,19 @@ turn to
 .Fa var .
 .Pp
 The macro
+.Nm SLIST_FOREACH_FROM
+behaves identically to
+.Nm SLIST_FOREACH
+when
+.Fa var
+is NULL, else it treats
+.Fa var
+as a previously found SLIST element and begins the loop at
+.Fa var
+instead of the first element in the SLIST referenced by
+.Fa head .
+.Pp
+The macro
 .Nm SLIST_FOREACH_SAFE
 traverses the list referenced by
 .Fa head
@@ -367,6 +400,19 

svn commit: r252323 - stable/9/sys/kern

2013-06-27 Thread Lawrence Stewart
Author: lstewart
Date: Fri Jun 28 02:38:33 2013
New Revision: 252323
URL: http://svnweb.freebsd.org/changeset/base/252323

Log:
  MFC r250951,251838:
  
  Ensure alq's shutdown_pre_sync event handler is deregistered on module unload 
to
  avoid a dangling pointer and eventual panic on system shutdown.
  
  Reported by:  Ali comnetboy at gmail.com

Modified:
  stable/9/sys/kern/kern_alq.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/kern/kern_alq.c
==
--- stable/9/sys/kern/kern_alq.cFri Jun 28 00:34:39 2013
(r252322)
+++ stable/9/sys/kern/kern_alq.cFri Jun 28 02:38:33 2013
(r252323)
@@ -99,6 +99,7 @@ static LIST_HEAD(, alq) ald_active;
 static int ald_shutingdown = 0;
 struct thread *ald_thread;
 static struct proc *ald_proc;
+static eventhandler_tag alq_eventhandler_tag = NULL;
 
 #defineALD_LOCK()  mtx_lock(ald_mtx)
 #defineALD_UNLOCK()mtx_unlock(ald_mtx)
@@ -194,8 +195,8 @@ ald_daemon(void)
 
ald_thread = FIRST_THREAD_IN_PROC(ald_proc);
 
-   EVENTHANDLER_REGISTER(shutdown_pre_sync, ald_shutdown, NULL,
-   SHUTDOWN_PRI_FIRST);
+   alq_eventhandler_tag = EVENTHANDLER_REGISTER(shutdown_pre_sync,
+   ald_shutdown, NULL, SHUTDOWN_PRI_FIRST);
 
ALD_LOCK();
 
@@ -941,6 +942,8 @@ alq_load_handler(module_t mod, int what,
if (LIST_FIRST(ald_queues) == NULL) {
ald_shutingdown = 1;
ALD_UNLOCK();
+   EVENTHANDLER_DEREGISTER(shutdown_pre_sync,
+   alq_eventhandler_tag);
ald_shutdown(NULL, 0);
mtx_destroy(ald_mtx);
} else {
___
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: r252324 - stable/8/sys/kern

2013-06-27 Thread Lawrence Stewart
Author: lstewart
Date: Fri Jun 28 03:04:07 2013
New Revision: 252324
URL: http://svnweb.freebsd.org/changeset/base/252324

Log:
  MFC r250951,251838:
  
  Ensure alq's shutdown_pre_sync event handler is deregistered on module unload 
to
  avoid a dangling pointer and eventual panic on system shutdown.
  
  Reported by:  Ali comnetboy at gmail.com

Modified:
  stable/8/sys/kern/kern_alq.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/kern/   (props changed)

Modified: stable/8/sys/kern/kern_alq.c
==
--- stable/8/sys/kern/kern_alq.cFri Jun 28 02:38:33 2013
(r252323)
+++ stable/8/sys/kern/kern_alq.cFri Jun 28 03:04:07 2013
(r252324)
@@ -99,6 +99,7 @@ static LIST_HEAD(, alq) ald_active;
 static int ald_shutingdown = 0;
 struct thread *ald_thread;
 static struct proc *ald_proc;
+static eventhandler_tag alq_eventhandler_tag = NULL;
 
 #defineALD_LOCK()  mtx_lock(ald_mtx)
 #defineALD_UNLOCK()mtx_unlock(ald_mtx)
@@ -194,8 +195,8 @@ ald_daemon(void)
 
ald_thread = FIRST_THREAD_IN_PROC(ald_proc);
 
-   EVENTHANDLER_REGISTER(shutdown_pre_sync, ald_shutdown, NULL,
-   SHUTDOWN_PRI_FIRST);
+   alq_eventhandler_tag = EVENTHANDLER_REGISTER(shutdown_pre_sync,
+   ald_shutdown, NULL, SHUTDOWN_PRI_FIRST);
 
ALD_LOCK();
 
@@ -941,6 +942,8 @@ alq_load_handler(module_t mod, int what,
if (LIST_FIRST(ald_queues) == NULL) {
ald_shutingdown = 1;
ALD_UNLOCK();
+   EVENTHANDLER_DEREGISTER(shutdown_pre_sync,
+   alq_eventhandler_tag);
ald_shutdown(NULL, 0);
mtx_destroy(ald_mtx);
} else {
___
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: r252326 - stable/9/sys/sys

2013-06-27 Thread Lawrence Stewart
Author: lstewart
Date: Fri Jun 28 03:22:43 2013
New Revision: 252326
URL: http://svnweb.freebsd.org/changeset/base/252326

Log:
  MFC r251682:
  
  Remove some duplicate code by making KHELP_DECLARE_MOD() a wrapper around
  KHELP_DECLARE_MOD_UMA().

Modified:
  stable/9/sys/sys/module_khelp.h
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/sys/   (props changed)

Modified: stable/9/sys/sys/module_khelp.h
==
--- stable/9/sys/sys/module_khelp.h Fri Jun 28 03:14:40 2013
(r252325)
+++ stable/9/sys/sys/module_khelp.h Fri Jun 28 03:22:43 2013
(r252326)
@@ -70,22 +70,6 @@ struct khelp_modevent_data {
uma_dtorumadtor;
 };
 
-#defineKHELP_DECLARE_MOD(hname, hdata, hhooks, version)
\
-   static struct khelp_modevent_data kmd_##hname = {   \
-   .name = #hname, \
-   .helper = hdata \
-   .hooks = hhooks,\
-   .nhooks = sizeof(hhooks) / sizeof(hhooks[0]),   \
-   };  \
-   static moduledata_t h_##hname = {   \
-   .name = #hname, \
-   .evhand = khelp_modevent,   \
-   .priv = kmd_##hname\
-   };  \
-   DECLARE_MODULE(hname, h_##hname, SI_SUB_PROTO_IFATTACHDOMAIN,   \
-   SI_ORDER_ANY);  \
-   MODULE_VERSION(hname, version)
-
 #defineKHELP_DECLARE_MOD_UMA(hname, hdata, hhooks, version, size, 
ctor, dtor) \
static struct khelp_modevent_data kmd_##hname = {   \
.name = #hname, \
@@ -105,6 +89,9 @@ struct khelp_modevent_data {
SI_ORDER_ANY);  \
MODULE_VERSION(hname, version)
 
+#defineKHELP_DECLARE_MOD(hname, hdata, hhooks, version)
\
+   KHELP_DECLARE_MOD_UMA(hname, hdata, hhooks, version, 0, NULL, NULL)
+
 intkhelp_modevent(module_t mod, int type, void *data);
 
 #endif /* _SYS_MODULE_KHELP_H_ */
___
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: r252327 - stable/8/sys/sys

2013-06-27 Thread Lawrence Stewart
Author: lstewart
Date: Fri Jun 28 03:23:24 2013
New Revision: 252327
URL: http://svnweb.freebsd.org/changeset/base/252327

Log:
  MFC r251682:
  
  Remove some duplicate code by making KHELP_DECLARE_MOD() a wrapper around
  KHELP_DECLARE_MOD_UMA().

Modified:
  stable/8/sys/sys/module_khelp.h
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/sys/   (props changed)

Modified: stable/8/sys/sys/module_khelp.h
==
--- stable/8/sys/sys/module_khelp.h Fri Jun 28 03:22:43 2013
(r252326)
+++ stable/8/sys/sys/module_khelp.h Fri Jun 28 03:23:24 2013
(r252327)
@@ -70,22 +70,6 @@ struct khelp_modevent_data {
uma_dtorumadtor;
 };
 
-#defineKHELP_DECLARE_MOD(hname, hdata, hhooks, version)
\
-   static struct khelp_modevent_data kmd_##hname = {   \
-   .name = #hname, \
-   .helper = hdata \
-   .hooks = hhooks,\
-   .nhooks = sizeof(hhooks) / sizeof(hhooks[0]),   \
-   };  \
-   static moduledata_t h_##hname = {   \
-   .name = #hname, \
-   .evhand = khelp_modevent,   \
-   .priv = kmd_##hname\
-   };  \
-   DECLARE_MODULE(hname, h_##hname, SI_SUB_PROTO_IFATTACHDOMAIN,   \
-   SI_ORDER_ANY);  \
-   MODULE_VERSION(hname, version)
-
 #defineKHELP_DECLARE_MOD_UMA(hname, hdata, hhooks, version, size, 
ctor, dtor) \
static struct khelp_modevent_data kmd_##hname = {   \
.name = #hname, \
@@ -105,6 +89,9 @@ struct khelp_modevent_data {
SI_ORDER_ANY);  \
MODULE_VERSION(hname, version)
 
+#defineKHELP_DECLARE_MOD(hname, hdata, hhooks, version)
\
+   KHELP_DECLARE_MOD_UMA(hname, hdata, hhooks, version, 0, NULL, NULL)
+
 intkhelp_modevent(module_t mod, int type, void *data);
 
 #endif /* _SYS_MODULE_KHELP_H_ */
___
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: r252328 - stable/9/sys/kern

2013-06-27 Thread Lawrence Stewart
Author: lstewart
Date: Fri Jun 28 03:39:54 2013
New Revision: 252328
URL: http://svnweb.freebsd.org/changeset/base/252328

Log:
  MFC r251725:
  
  Fix a potential NULL-pointer dereference that would trigger if the hhook
  registration site did not provide storage for a copy of the hhook_head struct.

Modified:
  stable/9/sys/kern/kern_hhook.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/kern/kern_hhook.c
==
--- stable/9/sys/kern/kern_hhook.c  Fri Jun 28 03:23:24 2013
(r252327)
+++ stable/9/sys/kern/kern_hhook.c  Fri Jun 28 03:39:54 2013
(r252328)
@@ -264,9 +264,10 @@ hhook_head_register(int32_t hhook_type, 
STAILQ_INIT(tmphhh-hhh_hooks);
HHH_LOCK_INIT(tmphhh);
 
-   if (hhh != NULL)
+   if (hhh != NULL) {
refcount_init(tmphhh-hhh_refcount, 1);
-   else
+   *hhh = tmphhh;
+   } else
refcount_init(tmphhh-hhh_refcount, 0);
 
if (flags  HHOOK_HEADISINVNET) {
@@ -278,8 +279,6 @@ hhook_head_register(int32_t hhook_type, 
/* XXXLAS: Add tmphhh to the non-virtualised list. */
}
 
-   *hhh = tmphhh;
-
return (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: r252329 - stable/8/sys/kern

2013-06-27 Thread Lawrence Stewart
Author: lstewart
Date: Fri Jun 28 03:41:23 2013
New Revision: 252329
URL: http://svnweb.freebsd.org/changeset/base/252329

Log:
  MFC r251725:
  
  Fix a potential NULL-pointer dereference that would trigger if the hhook
  registration site did not provide storage for a copy of the hhook_head struct.

Modified:
  stable/8/sys/kern/kern_hhook.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/kern/   (props changed)

Modified: stable/8/sys/kern/kern_hhook.c
==
--- stable/8/sys/kern/kern_hhook.c  Fri Jun 28 03:39:54 2013
(r252328)
+++ stable/8/sys/kern/kern_hhook.c  Fri Jun 28 03:41:23 2013
(r252329)
@@ -264,9 +264,10 @@ hhook_head_register(int32_t hhook_type, 
STAILQ_INIT(tmphhh-hhh_hooks);
HHH_LOCK_INIT(tmphhh);
 
-   if (hhh != NULL)
+   if (hhh != NULL) {
refcount_init(tmphhh-hhh_refcount, 1);
-   else
+   *hhh = tmphhh;
+   } else
refcount_init(tmphhh-hhh_refcount, 0);
 
if (flags  HHOOK_HEADISINVNET) {
@@ -278,8 +279,6 @@ hhook_head_register(int32_t hhook_type, 
/* XXXLAS: Add tmphhh to the non-virtualised list. */
}
 
-   *hhh = tmphhh;
-
return (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


Re: svn commit: r252032 - head/sys/amd64/include

2013-06-20 Thread Lawrence Stewart
Hi Kostik,

On 06/21/13 00:30, Konstantin Belousov wrote:
 Author: kib
 Date: Thu Jun 20 14:30:04 2013
 New Revision: 252032
 URL: http://svnweb.freebsd.org/changeset/base/252032
 
 Log:
   Allow immediate operand.
   
   Sponsored by:   The FreeBSD Foundation
 
 Modified:
   head/sys/amd64/include/counter.h
 
 Modified: head/sys/amd64/include/counter.h
 ==
 --- head/sys/amd64/include/counter.h  Thu Jun 20 14:20:03 2013
 (r252031)
 +++ head/sys/amd64/include/counter.h  Thu Jun 20 14:30:04 2013
 (r252032)
 @@ -44,7 +44,7 @@ counter_u64_add(counter_u64_t c, int64_t
  
   __asm __volatile(addq\t%1,%%gs:(%0)
   :
 - : r ((char *)c - (char *)__pcpu[0]), r (inc)
 + : r ((char *)c - (char *)__pcpu[0]), ri (inc)
   : memory, cc);
  }

For mere mortals like myself, a verbose explanation of what this does,
why it's necessary and what problem(s) it solves (if any) would be most
helpful :)

Cheers,
Lawrence
___
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: r252052 - head/share/man/man9

2013-06-20 Thread Lawrence Stewart
Author: lstewart
Date: Fri Jun 21 03:37:35 2013
New Revision: 252052
URL: http://svnweb.freebsd.org/changeset/base/252052

Log:
  Non-virtualised hhook points are supported as of r251732.
  
  MFC after:1 week
  X-MFC with:   251732

Modified:
  head/share/man/man9/hhook.9

Modified: head/share/man/man9/hhook.9
==
--- head/share/man/man9/hhook.9 Fri Jun 21 01:47:22 2013(r252051)
+++ head/share/man/man9/hhook.9 Fri Jun 21 03:37:35 2013(r252052)
@@ -30,7 +30,7 @@
 .\
 .\ $FreeBSD$
 .\
-.Dd February 15, 2011
+.Dd June 21, 2013
 .Dt HHOOK 9
 .Os
 .Sh NAME
@@ -380,9 +380,3 @@ This manual page was written by
 .An David Hayes Aq david.ha...@ieee.org
 and
 .An Lawrence Stewart Aq lstew...@freebsd.org .
-.Sh BUGS
-The framework does not currently support registering hook points in subsystems
-which have not been virtualised with VIMAGE.
-Fairly minimal internal changes to the
-.Nm
-implementation are required to address this.
___
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: r251984 - head/sys/kern

2013-06-18 Thread Lawrence Stewart
Author: lstewart
Date: Wed Jun 19 03:08:01 2013
New Revision: 251984
URL: http://svnweb.freebsd.org/changeset/base/251984

Log:
  When a previous call to sbsndptr() leaves sb-sb_sndptroff at the start of an
  mbuf that was fully consumed by the previous call, the mbuf ptr returned by 
the
  current call ends up being the previous mbuf in the sb chain to the one that
  contains the data we want.
  
  This does not cause any observable issues because the mbuf copy routines 
happily
  walk the mbuf chain to get to the data at the moff offset, which in this case
  means they effectively skip over the mbuf returned by sbsndptr().
  
  We can't adjust sb-sb_sndptr during the previous call for this case because 
the
  next mbuf in the chain may not exist yet. We therefore need to detect the
  condition and make the adjustment during the current call.
  
  Fix by detecting the special case of moff being at the start of the next mbuf 
in
  the chain and adjust the required accounting variables accordingly.
  
  Reviewed by:  andre
  MFC after:2 weeks

Modified:
  head/sys/kern/uipc_sockbuf.c

Modified: head/sys/kern/uipc_sockbuf.c
==
--- head/sys/kern/uipc_sockbuf.cWed Jun 19 02:30:32 2013
(r251983)
+++ head/sys/kern/uipc_sockbuf.cWed Jun 19 03:08:01 2013
(r251984)
@@ -942,6 +942,13 @@ sbsndptr(struct sockbuf *sb, u_int off, 
/* Return closest mbuf in chain for current offset. */
*moff = off - sb-sb_sndptroff;
m = ret = sb-sb_sndptr ? sb-sb_sndptr : sb-sb_mb;
+   if (*moff == m-m_len) {
+   *moff = 0;
+   sb-sb_sndptroff += m-m_len;
+   m = ret = m-m_next;
+   KASSERT(ret-m_len  0,
+   (mbuf %p in sockbuf %p chain has no valid data, ret, sb));
+   }
 
/* Advance by len to be as close as possible for the next transmit. */
for (off = off - sb-sb_sndptroff + len - 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: r251838 - head/sys/kern

2013-06-17 Thread Lawrence Stewart
Author: lstewart
Date: Mon Jun 17 09:49:07 2013
New Revision: 251838
URL: http://svnweb.freebsd.org/changeset/base/251838

Log:
  The fix committed in r250951 replaced the reported panic with a deadlock... 
gold
  star for me. EVENTHANDLER_DEREGISTER() attempts to acquire the lock which is
  held by the event handler framework while executing event handler functions,
  leading to deadlock.
  
  Move EVENTHANDLER_DEREGISTER() to alq_load_handler() and thus deregister the 
ALQ
  shutdown_pre_sync handler at module unload time, which takes care of the
  originally reported panic and fixes the deadlock introduced in r250951.
  
  Reported by:  Luiz Otavio O Souza
  MFC after:3 days
  X-MFC with:   250951

Modified:
  head/sys/kern/kern_alq.c

Modified: head/sys/kern/kern_alq.c
==
--- head/sys/kern/kern_alq.cMon Jun 17 08:57:09 2013(r251837)
+++ head/sys/kern/kern_alq.cMon Jun 17 09:49:07 2013(r251838)
@@ -229,8 +229,6 @@ ald_shutdown(void *arg, int howto)
 {
struct alq *alq;
 
-   EVENTHANDLER_DEREGISTER(shutdown_pre_sync, alq_eventhandler_tag);
-
ALD_LOCK();
 
/* Ensure no new queues can be created. */
@@ -938,6 +936,8 @@ alq_load_handler(module_t mod, int what,
if (LIST_FIRST(ald_queues) == NULL) {
ald_shutingdown = 1;
ALD_UNLOCK();
+   EVENTHANDLER_DEREGISTER(shutdown_pre_sync,
+   alq_eventhandler_tag);
ald_shutdown(NULL, 0);
mtx_destroy(ald_mtx);
} else {
___
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: r251887 - in head: share/man/man3 sys/sys

2013-06-17 Thread Lawrence Stewart
Author: lstewart
Date: Tue Jun 18 02:57:56 2013
New Revision: 251887
URL: http://svnweb.freebsd.org/changeset/base/251887

Log:
  Add new FOREACH_FROM variants of the queue(3) FOREACH macros which can
  optionally start the traversal from a previously found element by passing the
  element in as var. Passing a NULL var retains the same semantics as the
  regular FOREACH macros.
  
  Kudos to phk for suggesting the FROM suffix instead of my original proposal.
  
  Reviewed by:  jhb (previous version), rpaulo
  MFC after:1 week

Modified:
  head/share/man/man3/queue.3
  head/sys/sys/queue.h

Modified: head/share/man/man3/queue.3
==
--- head/share/man/man3/queue.3 Tue Jun 18 02:53:45 2013(r251886)
+++ head/share/man/man3/queue.3 Tue Jun 18 02:57:56 2013(r251887)
@@ -32,7 +32,7 @@
 .\@(#)queue.3 8.2 (Berkeley) 1/24/94
 .\ $FreeBSD$
 .\
-.Dd Sep 12, 2012
+.Dd June 17, 2013
 .Dt QUEUE 3
 .Os
 .Sh NAME
@@ -40,7 +40,9 @@
 .Nm SLIST_ENTRY ,
 .Nm SLIST_FIRST ,
 .Nm SLIST_FOREACH ,
+.Nm SLIST_FOREACH_FROM ,
 .Nm SLIST_FOREACH_SAFE ,
+.Nm SLIST_FOREACH_FROM_SAFE ,
 .Nm SLIST_HEAD ,
 .Nm SLIST_HEAD_INITIALIZER ,
 .Nm SLIST_INIT ,
@@ -56,7 +58,9 @@
 .Nm STAILQ_ENTRY ,
 .Nm STAILQ_FIRST ,
 .Nm STAILQ_FOREACH ,
+.Nm STAILQ_FOREACH_FROM ,
 .Nm STAILQ_FOREACH_SAFE ,
+.Nm STAILQ_FOREACH_FROM_SAFE ,
 .Nm STAILQ_HEAD ,
 .Nm STAILQ_HEAD_INITIALIZER ,
 .Nm STAILQ_INIT ,
@@ -73,7 +77,9 @@
 .Nm LIST_ENTRY ,
 .Nm LIST_FIRST ,
 .Nm LIST_FOREACH ,
+.Nm LIST_FOREACH_FROM ,
 .Nm LIST_FOREACH_SAFE ,
+.Nm LIST_FOREACH_FROM_SAFE ,
 .Nm LIST_HEAD ,
 .Nm LIST_HEAD_INITIALIZER ,
 .Nm LIST_INIT ,
@@ -89,9 +95,13 @@
 .Nm TAILQ_ENTRY ,
 .Nm TAILQ_FIRST ,
 .Nm TAILQ_FOREACH ,
+.Nm TAILQ_FOREACH_FROM ,
 .Nm TAILQ_FOREACH_SAFE ,
+.Nm TAILQ_FOREACH_FROM_SAFE ,
 .Nm TAILQ_FOREACH_REVERSE ,
+.Nm TAILQ_FOREACH_REVERSE_FROM ,
 .Nm TAILQ_FOREACH_REVERSE_SAFE ,
+.Nm TAILQ_FOREACH_REVERSE_FROM_SAFE ,
 .Nm TAILQ_HEAD ,
 .Nm TAILQ_HEAD_INITIALIZER ,
 .Nm TAILQ_INIT ,
@@ -113,7 +123,9 @@ lists and tail queues
 .Fn SLIST_ENTRY TYPE
 .Fn SLIST_FIRST SLIST_HEAD *head
 .Fn SLIST_FOREACH TYPE *var SLIST_HEAD *head SLIST_ENTRY NAME
+.Fn SLIST_FOREACH_FROM TYPE *var SLIST_HEAD *head SLIST_ENTRY NAME
 .Fn SLIST_FOREACH_SAFE TYPE *var SLIST_HEAD *head SLIST_ENTRY NAME TYPE 
*temp_var
+.Fn SLIST_FOREACH_FROM_SAFE TYPE *var SLIST_HEAD *head SLIST_ENTRY NAME 
TYPE *temp_var
 .Fn SLIST_HEAD HEADNAME TYPE
 .Fn SLIST_HEAD_INITIALIZER SLIST_HEAD head
 .Fn SLIST_INIT SLIST_HEAD *head
@@ -130,7 +142,9 @@ lists and tail queues
 .Fn STAILQ_ENTRY TYPE
 .Fn STAILQ_FIRST STAILQ_HEAD *head
 .Fn STAILQ_FOREACH TYPE *var STAILQ_HEAD *head STAILQ_ENTRY NAME
+.Fn STAILQ_FOREACH_FROM TYPE *var STAILQ_HEAD *head STAILQ_ENTRY NAME
 .Fn STAILQ_FOREACH_SAFE TYPE *var STAILQ_HEAD *head STAILQ_ENTRY NAME 
TYPE *temp_var
+.Fn STAILQ_FOREACH_FROM_SAFE TYPE *var STAILQ_HEAD *head STAILQ_ENTRY 
NAME TYPE *temp_var
 .Fn STAILQ_HEAD HEADNAME TYPE
 .Fn STAILQ_HEAD_INITIALIZER STAILQ_HEAD head
 .Fn STAILQ_INIT STAILQ_HEAD *head
@@ -148,7 +162,9 @@ lists and tail queues
 .Fn LIST_ENTRY TYPE
 .Fn LIST_FIRST LIST_HEAD *head
 .Fn LIST_FOREACH TYPE *var LIST_HEAD *head LIST_ENTRY NAME
+.Fn LIST_FOREACH_FROM TYPE *var LIST_HEAD *head LIST_ENTRY NAME
 .Fn LIST_FOREACH_SAFE TYPE *var LIST_HEAD *head LIST_ENTRY NAME TYPE 
*temp_var
+.Fn LIST_FOREACH_FROM_SAFE TYPE *var LIST_HEAD *head LIST_ENTRY NAME 
TYPE *temp_var
 .Fn LIST_HEAD HEADNAME TYPE
 .Fn LIST_HEAD_INITIALIZER LIST_HEAD head
 .Fn LIST_INIT LIST_HEAD *head
@@ -165,9 +181,13 @@ lists and tail queues
 .Fn TAILQ_ENTRY TYPE
 .Fn TAILQ_FIRST TAILQ_HEAD *head
 .Fn TAILQ_FOREACH TYPE *var TAILQ_HEAD *head TAILQ_ENTRY NAME
+.Fn TAILQ_FOREACH_FROM TYPE *var TAILQ_HEAD *head TAILQ_ENTRY NAME
 .Fn TAILQ_FOREACH_SAFE TYPE *var TAILQ_HEAD *head TAILQ_ENTRY NAME TYPE 
*temp_var
+.Fn TAILQ_FOREACH_FROM_SAFE TYPE *var TAILQ_HEAD *head TAILQ_ENTRY NAME 
TYPE *temp_var
 .Fn TAILQ_FOREACH_REVERSE TYPE *var TAILQ_HEAD *head HEADNAME 
TAILQ_ENTRY NAME
+.Fn TAILQ_FOREACH_REVERSE_FROM TYPE *var TAILQ_HEAD *head HEADNAME 
TAILQ_ENTRY NAME
 .Fn TAILQ_FOREACH_REVERSE_SAFE TYPE *var TAILQ_HEAD *head HEADNAME 
TAILQ_ENTRY NAME TYPE *temp_var
+.Fn TAILQ_FOREACH_REVERSE_FROM_SAFE TYPE *var TAILQ_HEAD *head HEADNAME 
TAILQ_ENTRY NAME TYPE *temp_var
 .Fn TAILQ_HEAD HEADNAME TYPE
 .Fn TAILQ_HEAD_INITIALIZER TAILQ_HEAD head
 .Fn TAILQ_INIT TAILQ_HEAD *head
@@ -365,6 +385,19 @@ turn to
 .Fa var .
 .Pp
 The macro
+.Nm SLIST_FOREACH_FROM
+behaves identically to
+.Nm SLIST_FOREACH
+when
+.Fa var
+is NULL, else it treats
+.Fa var
+as a previously found SLIST element and begins the loop at
+.Fa var
+instead of the first element in the SLIST referenced by
+.Fa head .
+.Pp
+The macro
 .Nm SLIST_FOREACH_SAFE
 traverses the list referenced by
 .Fa head
@@ -379,6 +412,19 @@ as well as free it from within the loop 
 traversal.
 .Pp
 The macro
+.Nm SLIST_FOREACH_FROM_SAFE
+behaves identically 

svn commit: r251778 - head/sys/kern

2013-06-15 Thread Lawrence Stewart
Author: lstewart
Date: Sat Jun 15 06:45:17 2013
New Revision: 251778
URL: http://svnweb.freebsd.org/changeset/base/251778

Log:
  Cleanup and simplification in khelp_{register|deregister}_helper(). No
  functional changes.
  
  MFC after:1 week

Modified:
  head/sys/kern/kern_khelp.c

Modified: head/sys/kern/kern_khelp.c
==
--- head/sys/kern/kern_khelp.c  Sat Jun 15 06:21:17 2013(r251777)
+++ head/sys/kern/kern_khelp.c  Sat Jun 15 06:45:17 2013(r251778)
@@ -72,34 +72,32 @@ khelp_register_helper(struct helper *h)
struct helper *tmph;
int error, i, inserted;
 
-   error = 0;
-   inserted = 0;
+   error = inserted = 0;
refcount_init(h-h_refcount, 0);
h-h_id = osd_register(OSD_KHELP, NULL, NULL);
 
/* It's only safe to add the hooks after osd_register(). */
-   if (h-h_nhooks  0) {
-   for (i = 0; i  h-h_nhooks  !error; i++) {
-   /* We don't require the module to assign hook_helper. */
-   h-h_hooks[i].hook_helper = h;
-   error = hhook_add_hook_lookup(h-h_hooks[i],
-   HHOOK_WAITOK);
-   }
-
-   if (error) {
-   for (i--; i = 0; i--)
-   hhook_remove_hook_lookup(h-h_hooks[i]);
-
-   osd_deregister(OSD_KHELP, h-h_id);
-   }
+   for (i = 0; i  h-h_nhooks  !error; i++) {
+   /* We don't require the module to assign hook_helper. */
+   h-h_hooks[i].hook_helper = h;
+   error = hhook_add_hook_lookup(h-h_hooks[i], HHOOK_WAITOK);
+   if (error)
+   printf(%s: \%s\ khelp module unable to 
+   hook type %d id %d due to error %d\n, __func__,
+   h-h_name, h-h_hooks[i].hook_type,
+   h-h_hooks[i].hook_id, error);
}
 
-   if (!error) {
+   if (error) {
+   for (i--; i = 0; i--)
+   hhook_remove_hook_lookup(h-h_hooks[i]);
+   osd_deregister(OSD_KHELP, h-h_id);
+   } else {
KHELP_LIST_WLOCK();
/*
 * Keep list of helpers sorted in descending h_id order. Due to
 * the way osd_set() works, a sorted list ensures
-* init_helper_osd() will operate with improved efficiency.
+* khelp_init_osd() will operate with improved efficiency.
 */
TAILQ_FOREACH(tmph, helpers, h_next) {
if (tmph-h_id  h-h_id) {
@@ -123,8 +121,6 @@ khelp_deregister_helper(struct helper *h
struct helper *tmph;
int error, i;
 
-   error = 0;
-
KHELP_LIST_WLOCK();
if (h-h_refcount  0)
error = EBUSY;
@@ -141,10 +137,8 @@ khelp_deregister_helper(struct helper *h
KHELP_LIST_WUNLOCK();
 
if (!error) {
-   if (h-h_nhooks  0) {
-   for (i = 0; i  h-h_nhooks; i++)
-   hhook_remove_hook_lookup(h-h_hooks[i]);
-   }
+   for (i = 0; i  h-h_nhooks; i++)
+   hhook_remove_hook_lookup(h-h_hooks[i]);
osd_deregister(OSD_KHELP, h-h_id);
}
 
___
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: r251787 - head/sys/kern

2013-06-15 Thread Lawrence Stewart
Author: lstewart
Date: Sat Jun 15 10:08:34 2013
New Revision: 251787
URL: http://svnweb.freebsd.org/changeset/base/251787

Log:
  Move hhook's per-vnet initialisation to an earlier SYSINIT SI_SUB stage to
  ensure all per-vnet related hhook initialisation is completed prior to any
  virtualised hhook points attempting registration.
  
  vnet_register_sysinit() requires that a stage later than SI_SUB_VNET be 
chosen.
  There are no per-vnet initialisors in the source tree at this time which run
  earlier than SI_SUB_INIT_IF. A quick audit of non-virtualised SYSINITs 
indicates
  there are no subsystems pre SI_SUB_MBUF that would likely be interested in
  registering a virtualised hhook point.
  
  Settle on SI_SUB_MBUF as hhook's per-vnet initialisation stage as it's the 
first
  overtly network-related initilisation stage to run after SI_SUB_VNET. If a
  subsystem that initialises earlier than SI_SUB_MBUF ends up wanting to 
register
  virtualised hhook points in future, hhook's use of SI_SUB_MBUF will need to be
  revisited and would probably warrant creating a dedicated SI_SUB_HHOOK which
  runs immediately after SI_SUB_VNET.
  
  MFC after:1 week

Modified:
  head/sys/kern/kern_hhook.c

Modified: head/sys/kern/kern_hhook.c
==
--- head/sys/kern/kern_hhook.c  Sat Jun 15 09:57:43 2013(r251786)
+++ head/sys/kern/kern_hhook.c  Sat Jun 15 10:08:34 2013(r251787)
@@ -509,7 +509,7 @@ hhook_vnet_uninit(const void *unused __u
 /*
  * When a vnet is created and being initialised, init the V_hhook_vhead_list.
  */
-VNET_SYSINIT(hhook_vnet_init, SI_SUB_PROTO_BEGIN, SI_ORDER_FIRST,
+VNET_SYSINIT(hhook_vnet_init, SI_SUB_MBUF, SI_ORDER_FIRST,
 hhook_vnet_init, NULL);
 
 /*
@@ -517,5 +517,5 @@ VNET_SYSINIT(hhook_vnet_init, SI_SUB_PRO
  * points to clean up on vnet tear down, but in case the KPI is misused,
  * provide a function to clean up and free memory for a vnet being destroyed.
  */
-VNET_SYSUNINIT(hhook_vnet_uninit, SI_SUB_PROTO_BEGIN, SI_ORDER_FIRST,
+VNET_SYSUNINIT(hhook_vnet_uninit, SI_SUB_MBUF, SI_ORDER_ANY,
 hhook_vnet_uninit, NULL);
___
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: r251789 - head/sys/sys

2013-06-15 Thread Lawrence Stewart
Author: lstewart
Date: Sat Jun 15 10:38:31 2013
New Revision: 251789
URL: http://svnweb.freebsd.org/changeset/base/251789

Log:
  Now that the necessary infrastructure is in place to ensure hhook points which
  register after a khelp module will get hooked, move khelp module 
initialisation
  to the earlier SI_SUB_KLD stage.
  
  MFC after:1 week

Modified:
  head/sys/sys/module_khelp.h

Modified: head/sys/sys/module_khelp.h
==
--- head/sys/sys/module_khelp.h Sat Jun 15 10:09:20 2013(r251788)
+++ head/sys/sys/module_khelp.h Sat Jun 15 10:38:31 2013(r251789)
@@ -85,8 +85,7 @@ struct khelp_modevent_data {
.evhand = khelp_modevent,   \
.priv = kmd_##hname\
};  \
-   DECLARE_MODULE(hname, h_##hname, SI_SUB_PROTO_IFATTACHDOMAIN,   \
-   SI_ORDER_ANY);  \
+   DECLARE_MODULE(hname, h_##hname, SI_SUB_KLD, SI_ORDER_ANY); \
MODULE_VERSION(hname, version)
 
 #defineKHELP_DECLARE_MOD(hname, hdata, hhooks, version)
\
___
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: r251752 - head/sys/kern

2013-06-14 Thread Lawrence Stewart
Author: lstewart
Date: Fri Jun 14 18:11:21 2013
New Revision: 251752
URL: http://svnweb.freebsd.org/changeset/base/251752

Log:
  Fix a major oversight in r251732 which causes non-VIMAGE kernels to trigger a
  KASSERT during TCP hhook registration at boot. Virtualised hook points only
  require extra housekeeping and sanity checking when options VIMAGE is 
present.
  
  Reported by:  bdrewery,jh,dhw
  Tested by:dhw
  MFC after:1 week
  X-MFC with:   251732

Modified:
  head/sys/kern/kern_hhook.c

Modified: head/sys/kern/kern_hhook.c
==
--- head/sys/kern/kern_hhook.c  Fri Jun 14 17:00:58 2013(r251751)
+++ head/sys/kern/kern_hhook.c  Fri Jun 14 18:11:21 2013(r251752)
@@ -267,9 +267,11 @@ hhook_head_register(int32_t hhook_type, 
HHHLIST_LOCK();
if (flags  HHOOK_HEADISINVNET) {
tmphhh-hhh_flags |= HHH_ISINVNET;
+#ifdef VIMAGE
KASSERT(curvnet != NULL, (curvnet is NULL));
tmphhh-hhh_vid = (uintptr_t)curvnet;
LIST_INSERT_HEAD(V_hhook_vhead_list, tmphhh, hhh_vnext);
+#endif
}
LIST_INSERT_HEAD(hhook_head_list, tmphhh, hhh_next);
HHHLIST_UNLOCK();
@@ -285,8 +287,10 @@ hhook_head_destroy(struct hhook_head *hh
HHHLIST_LOCK_ASSERT();
 
LIST_REMOVE(hhh, hhh_next);
+#ifdef VIMAGE
if (hhook_head_is_virtualised(hhh) == HHOOK_HEADISINVNET)
LIST_REMOVE(hhh, hhh_vnext);
+#endif
HHH_WLOCK(hhh);
STAILQ_FOREACH_SAFE(tmp, hhh-hhh_hooks, hhk_next, tmp2)
free(tmp, M_HHOOK);
@@ -347,12 +351,14 @@ hhook_head_get(int32_t hhook_type, int32
HHHLIST_LOCK();
LIST_FOREACH(hhh, hhook_head_list, hhh_next) {
if (hhh-hhh_type == hhook_type  hhh-hhh_id == hhook_id) {
+#ifdef VIMAGE
if (hhook_head_is_virtualised(hhh) ==
HHOOK_HEADISINVNET) {
KASSERT(curvnet != NULL, (curvnet is NULL));
if (hhh-hhh_vid != (uintptr_t)curvnet)
continue;
}
+#endif
refcount_acquire(hhh-hhh_refcount);
break;
}
___
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: r251770 - in head/sys: kern sys

2013-06-14 Thread Lawrence Stewart
Author: lstewart
Date: Sat Jun 15 04:03:40 2013
New Revision: 251770
URL: http://svnweb.freebsd.org/changeset/base/251770

Log:
  Internalise handling of virtualised hook points inside
  hhook_{add|remove}_hook_lookup() so that khelp (and other potential API
  consumers) do not have to care when they attempt to (un)hook a particular hook
  point identified by id and type.
  
  Reviewed by:  scottl
  MFC after:1 week

Modified:
  head/sys/kern/kern_hhook.c
  head/sys/kern/kern_khelp.c
  head/sys/sys/hhook.h

Modified: head/sys/kern/kern_hhook.c
==
--- head/sys/kern/kern_hhook.c  Sat Jun 15 03:55:04 2013(r251769)
+++ head/sys/kern/kern_hhook.c  Sat Jun 15 04:03:40 2013(r251770)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2010 Lawrence Stewart lstew...@freebsd.org
+ * Copyright (c) 2010,2013 Lawrence Stewart lstew...@freebsd.org
  * Copyright (c) 2010 The FreeBSD Foundation
  * All rights reserved.
  *
@@ -69,6 +69,9 @@ static struct mtx hhook_head_list_lock;
 MTX_SYSINIT(hhookheadlistlock, hhook_head_list_lock, hhook_head list lock,
 MTX_DEF);
 
+/* Protected by hhook_head_list_lock. */
+static uint32_t n_hhookheads;
+
 /* Private function prototypes. */
 static void hhook_head_destroy(struct hhook_head *hhh);
 
@@ -165,21 +168,71 @@ hhook_add_hook(struct hhook_head *hhh, s
 }
 
 /*
- * Lookup a helper hook point and register a new helper hook function with it.
+ * Register a helper hook function with a helper hook point (including all
+ * virtual instances of the hook point if it is virtualised).
+ *
+ * The logic is unfortunately far more complex than for
+ * hhook_remove_hook_lookup() because hhook_add_hook() can call malloc() with
+ * M_WAITOK and thus we cannot call hhook_add_hook() with the
+ * hhook_head_list_lock held.
+ *
+ * The logic assembles an array of hhook_head structs that correspond to the
+ * helper hook point being hooked and bumps the refcount on each (all done with
+ * the hhook_head_list_lock held). The hhook_head_list_lock is then dropped, 
and
+ * hhook_add_hook() is called and the refcount dropped for each hhook_head
+ * struct in the array.
  */
 int
 hhook_add_hook_lookup(struct hookinfo *hki, uint32_t flags)
 {
-   struct hhook_head *hhh;
-   int error;
+   struct hhook_head **heads_to_hook, *hhh;
+   int error, i, n_heads_to_hook;
 
-   hhh = hhook_head_get(hki-hook_type, hki-hook_id);
+tryagain:
+   error = i = 0;
+   /*
+* Accessing n_hhookheads without hhook_head_list_lock held opens up a
+* race with hhook_head_register() which we are unlikely to lose, but
+* nonetheless have to cope with - hence the complex goto logic.
+*/
+   n_heads_to_hook = n_hhookheads;
+   heads_to_hook = malloc(n_heads_to_hook * sizeof(struct hhook_head *),
+   M_HHOOK, flags  HHOOK_WAITOK ? M_WAITOK : M_NOWAIT);
+   if (heads_to_hook == NULL)
+   return (ENOMEM);
 
-   if (hhh == NULL)
-   return (ENOENT);
+   HHHLIST_LOCK();
+   LIST_FOREACH(hhh, hhook_head_list, hhh_next) {
+   if (hhh-hhh_type == hki-hook_type 
+   hhh-hhh_id == hki-hook_id) {
+   if (i  n_heads_to_hook) {
+   heads_to_hook[i] = hhh;
+   
refcount_acquire(heads_to_hook[i]-hhh_refcount);
+   i++;
+   } else {
+   /*
+* We raced with hhook_head_register() which
+* inserted a hhook_head that we need to hook
+* but did not malloc space for. Abort this run
+* and try again.
+*/
+   for (i--; i = 0; i--)
+   
refcount_release(heads_to_hook[i]-hhh_refcount);
+   free(heads_to_hook, M_HHOOK);
+   HHHLIST_UNLOCK();
+   goto tryagain;
+   }
+   }
+   }
+   HHHLIST_UNLOCK();
 
-   error = hhook_add_hook(hhh, hki, flags);
-   hhook_head_release(hhh);
+   for (i--; i = 0; i--) {
+   if (!error)
+   error = hhook_add_hook(heads_to_hook[i], hki, flags);
+   refcount_release(heads_to_hook[i]-hhh_refcount);
+   }
+
+   free(heads_to_hook, M_HHOOK);
 
return (error);
 }
@@ -211,20 +264,21 @@ hhook_remove_hook(struct hhook_head *hhh
 }
 
 /*
- * Lookup a helper hook point and remove a helper hook function from it.
+ * Remove a helper hook function from a helper hook point (including all
+ * virtual instances of the hook point if it is virtualised).
  */
 int
 hhook_remove_hook_lookup(struct hookinfo *hki)
 {
struct hhook_head *hhh

svn commit: r251774 - head/sys/kern

2013-06-14 Thread Lawrence Stewart
Author: lstewart
Date: Sat Jun 15 05:57:29 2013
New Revision: 251774
URL: http://svnweb.freebsd.org/changeset/base/251774

Log:
  Add a private KPI between hhook and khelp that allows khelp modules to insert
  hook functions into hhook points which register after the modules were loaded 
-
  potentially useful during boot or if hhook points are dynamically registered.
  
  MFC after:1 week

Modified:
  head/sys/kern/kern_hhook.c
  head/sys/kern/kern_khelp.c

Modified: head/sys/kern/kern_hhook.c
==
--- head/sys/kern/kern_hhook.c  Sat Jun 15 05:04:14 2013(r251773)
+++ head/sys/kern/kern_hhook.c  Sat Jun 15 05:57:29 2013(r251774)
@@ -74,6 +74,7 @@ static uint32_t n_hhookheads;
 
 /* Private function prototypes. */
 static void hhook_head_destroy(struct hhook_head *hhh);
+void khelp_new_hhook_registered(struct hhook_head *hhh, uint32_t flags);
 
 #defineHHHLIST_LOCK() mtx_lock(hhook_head_list_lock)
 #defineHHHLIST_UNLOCK() mtx_unlock(hhook_head_list_lock)
@@ -311,12 +312,7 @@ hhook_head_register(int32_t hhook_type, 
tmphhh-hhh_nhooks = 0;
STAILQ_INIT(tmphhh-hhh_hooks);
HHH_LOCK_INIT(tmphhh);
-
-   if (hhh != NULL) {
-   refcount_init(tmphhh-hhh_refcount, 1);
-   *hhh = tmphhh;
-   } else
-   refcount_init(tmphhh-hhh_refcount, 0);
+   refcount_init(tmphhh-hhh_refcount, 1);
 
HHHLIST_LOCK();
if (flags  HHOOK_HEADISINVNET) {
@@ -331,6 +327,13 @@ hhook_head_register(int32_t hhook_type, 
n_hhookheads++;
HHHLIST_UNLOCK();
 
+   khelp_new_hhook_registered(tmphhh, flags);
+
+   if (hhh != NULL)
+   *hhh = tmphhh;
+   else
+   refcount_release(tmphhh-hhh_refcount);
+
return (0);
 }
 

Modified: head/sys/kern/kern_khelp.c
==
--- head/sys/kern/kern_khelp.c  Sat Jun 15 05:04:14 2013(r251773)
+++ head/sys/kern/kern_khelp.c  Sat Jun 15 05:57:29 2013(r251774)
@@ -40,7 +40,6 @@ __FBSDID($FreeBSD$);
 #include sys/param.h
 #include sys/kernel.h
 #include sys/hhook.h
-#include sys/jail.h
 #include sys/khelp.h
 #include sys/lock.h
 #include sys/malloc.h
@@ -52,8 +51,6 @@ __FBSDID($FreeBSD$);
 #include sys/rwlock.h
 #include sys/systm.h
 
-#include net/vnet.h
-
 static struct rwlock khelp_list_lock;
 RW_SYSINIT(khelplistlock, khelp_list_lock, helper list lock);
 
@@ -61,6 +58,7 @@ static TAILQ_HEAD(helper_head, helper) h
 
 /* Private function prototypes. */
 static inline void khelp_remove_osd(struct helper *h, struct osd *hosd);
+void khelp_new_hhook_registered(struct hhook_head *hhh, uint32_t flags);
 
 #defineKHELP_LIST_WLOCK() rw_wlock(khelp_list_lock)
 #defineKHELP_LIST_WUNLOCK() rw_wunlock(khelp_list_lock)
@@ -289,6 +287,36 @@ khelp_remove_hhook(struct hookinfo *hki)
return (error);
 }
 
+/*
+ * Private KPI between hhook and khelp that allows khelp modules to insert hook
+ * functions into hhook points which register after the modules were loaded.
+ */
+void
+khelp_new_hhook_registered(struct hhook_head *hhh, uint32_t flags)
+{
+   struct helper *h;
+   int error, i;
+
+   KHELP_LIST_RLOCK();
+   TAILQ_FOREACH(h, helpers, h_next) {
+   for (i = 0; i  h-h_nhooks; i++) {
+   if (hhh-hhh_type != h-h_hooks[i].hook_type ||
+   hhh-hhh_id != h-h_hooks[i].hook_id)
+   continue;
+   error = hhook_add_hook(hhh, h-h_hooks[i], flags);
+   if (error) {
+   printf(%s: \%s\ khelp module unable to 
+   hook type %d id %d due to error %d\n,
+   __func__, h-h_name,
+   h-h_hooks[i].hook_type,
+   h-h_hooks[i].hook_id, error);
+   error = 0;
+   }
+   }
+   }
+   KHELP_LIST_RUNLOCK();
+}
+
 int
 khelp_modevent(module_t mod, int event_type, void *data)
 {
@@ -348,95 +376,3 @@ khelp_modevent(module_t mod, int event_t
 
return (error);
 }
-
-/*
- * This function is called in two separate situations:
- *
- * - When the kernel is booting, it is called directly by the SYSINIT framework
- * to allow Khelp modules which were compiled into the kernel or loaded by the
- * boot loader to insert their non-virtualised hook functions into the kernel.
- *
- * - When the kernel is booting or a vnet is created, this function is also
- * called indirectly through khelp_vnet_init() by the vnet initialisation code.
- * In this situation, Khelp modules are able to insert their virtualised hook
- * functions into the virtualised hook points in the vnet which is being
- * initialised. In the case where the kernel is not compiled 

svn commit: r251725 - head/sys/kern

2013-06-13 Thread Lawrence Stewart
Author: lstewart
Date: Fri Jun 14 02:25:40 2013
New Revision: 251725
URL: http://svnweb.freebsd.org/changeset/base/251725

Log:
  Fix a potential NULL-pointer dereference that would trigger if the hhook
  registration site did not provide storage for a copy of the hhook_head struct.
  
  MFC after:3 days

Modified:
  head/sys/kern/kern_hhook.c

Modified: head/sys/kern/kern_hhook.c
==
--- head/sys/kern/kern_hhook.c  Fri Jun 14 02:21:32 2013(r251724)
+++ head/sys/kern/kern_hhook.c  Fri Jun 14 02:25:40 2013(r251725)
@@ -264,9 +264,10 @@ hhook_head_register(int32_t hhook_type, 
STAILQ_INIT(tmphhh-hhh_hooks);
HHH_LOCK_INIT(tmphhh);
 
-   if (hhh != NULL)
+   if (hhh != NULL) {
refcount_init(tmphhh-hhh_refcount, 1);
-   else
+   *hhh = tmphhh;
+   } else
refcount_init(tmphhh-hhh_refcount, 0);
 
if (flags  HHOOK_HEADISINVNET) {
@@ -278,8 +279,6 @@ hhook_head_register(int32_t hhook_type, 
/* XXXLAS: Add tmphhh to the non-virtualised list. */
}
 
-   *hhh = tmphhh;
-
return (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: r251732 - in head/sys: kern sys

2013-06-13 Thread Lawrence Stewart
Author: lstewart
Date: Fri Jun 14 04:10:34 2013
New Revision: 251732
URL: http://svnweb.freebsd.org/changeset/base/251732

Log:
  Add support for non-virtualised hhook points, which are uniquely identified by
  type and id, as compared to virtualised hook points which are now uniquely
  identified by type, id and a vid (which for vimage is the pointer to the vnet
  that the hhook resides in).
  
  All hhook_head structs for both virtualised and non-virtualised hook points
  coexist in hhook_head_list, and a separate list is maintained for hhook points
  within each vnet to simplify some vimage-related housekeeping.
  
  Reviewed by:  scottl
  MFC after:1 week

Modified:
  head/sys/kern/kern_hhook.c
  head/sys/sys/hhook.h

Modified: head/sys/kern/kern_hhook.c
==
--- head/sys/kern/kern_hhook.c  Fri Jun 14 03:58:52 2013(r251731)
+++ head/sys/kern/kern_hhook.c  Fri Jun 14 04:10:34 2013(r251732)
@@ -61,8 +61,9 @@ struct hhook {
 static MALLOC_DEFINE(M_HHOOK, hhook, Helper hooks are linked off hhook_head 
lists);
 
 LIST_HEAD(hhookheadhead, hhook_head);
-VNET_DEFINE(struct hhookheadhead, hhook_head_list);
-#defineV_hhook_head_list VNET(hhook_head_list)
+struct hhookheadhead hhook_head_list;
+VNET_DEFINE(struct hhookheadhead, hhook_vhead_list);
+#defineV_hhook_vhead_list VNET(hhook_vhead_list)
 
 static struct mtx hhook_head_list_lock;
 MTX_SYSINIT(hhookheadlistlock, hhook_head_list_lock, hhook_head list lock,
@@ -245,13 +246,6 @@ hhook_head_register(int32_t hhook_type, 
return (EEXIST);
}
 
-   /* XXXLAS: Need to implement support for non-virtualised hooks. */
-   if ((flags  HHOOK_HEADISINVNET) == 0) {
-   printf(%s: only vnet-style virtualised hooks can be used\n,
-   __func__);
-   return (EINVAL);
-   }
-
tmphhh = malloc(sizeof(struct hhook_head), M_HHOOK,
M_ZERO | ((flags  HHOOK_WAITOK) ? M_WAITOK : M_NOWAIT));
 
@@ -270,14 +264,15 @@ hhook_head_register(int32_t hhook_type, 
} else
refcount_init(tmphhh-hhh_refcount, 0);
 
+   HHHLIST_LOCK();
if (flags  HHOOK_HEADISINVNET) {
tmphhh-hhh_flags |= HHH_ISINVNET;
-   HHHLIST_LOCK();
-   LIST_INSERT_HEAD(V_hhook_head_list, tmphhh, hhh_next);
-   HHHLIST_UNLOCK();
-   } else {
-   /* XXXLAS: Add tmphhh to the non-virtualised list. */
+   KASSERT(curvnet != NULL, (curvnet is NULL));
+   tmphhh-hhh_vid = (uintptr_t)curvnet;
+   LIST_INSERT_HEAD(V_hhook_vhead_list, tmphhh, hhh_vnext);
}
+   LIST_INSERT_HEAD(hhook_head_list, tmphhh, hhh_next);
+   HHHLIST_UNLOCK();
 
return (0);
 }
@@ -290,6 +285,8 @@ hhook_head_destroy(struct hhook_head *hh
HHHLIST_LOCK_ASSERT();
 
LIST_REMOVE(hhh, hhh_next);
+   if (hhook_head_is_virtualised(hhh) == HHOOK_HEADISINVNET)
+   LIST_REMOVE(hhh, hhh_vnext);
HHH_WLOCK(hhh);
STAILQ_FOREACH_SAFE(tmp, hhh-hhh_hooks, hhk_next, tmp2)
free(tmp, M_HHOOK);
@@ -347,10 +344,15 @@ hhook_head_get(int32_t hhook_type, int32
 {
struct hhook_head *hhh;
 
-   /* XXXLAS: Pick hhook_head_list based on hhook_head flags. */
HHHLIST_LOCK();
-   LIST_FOREACH(hhh, V_hhook_head_list, hhh_next) {
+   LIST_FOREACH(hhh, hhook_head_list, hhh_next) {
if (hhh-hhh_type == hhook_type  hhh-hhh_id == hhook_id) {
+   if (hhook_head_is_virtualised(hhh) ==
+   HHOOK_HEADISINVNET) {
+   KASSERT(curvnet != NULL, (curvnet is NULL));
+   if (hhh-hhh_vid != (uintptr_t)curvnet)
+   continue;
+   }
refcount_acquire(hhh-hhh_refcount);
break;
}
@@ -412,7 +414,7 @@ static void
 hhook_vnet_init(const void *unused __unused)
 {
 
-   LIST_INIT(V_hhook_head_list);
+   LIST_INIT(V_hhook_vhead_list);
 }
 
 /*
@@ -429,7 +431,7 @@ hhook_vnet_uninit(const void *unused __u
 * subsystem should have already called hhook_head_deregister().
 */
HHHLIST_LOCK();
-   LIST_FOREACH_SAFE(hhh, V_hhook_head_list, hhh_next, tmphhh) {
+   LIST_FOREACH_SAFE(hhh, V_hhook_vhead_list, hhh_vnext, tmphhh) {
printf(%s: hhook_head type=%d, id=%d cleanup required\n,
__func__, hhh-hhh_type, hhh-hhh_id);
hhook_head_destroy(hhh);
@@ -439,7 +441,7 @@ hhook_vnet_uninit(const void *unused __u
 
 
 /*
- * When a vnet is created and being initialised, init the V_hhook_head_list.
+ * When a vnet is created and being initialised, init the V_hhook_vhead_list.
  */
 VNET_SYSINIT(hhook_vnet_init, SI_SUB_PROTO_BEGIN, SI_ORDER_FIRST,
 hhook_vnet_init, 

Re: svn commit: r251297 - head/sys/dev/xen/netfront

2013-06-05 Thread Lawrence Stewart
On 06/03/13 23:00, Andre Oppermann wrote:
 Author: andre
 Date: Mon Jun  3 13:00:33 2013
 New Revision: 251297
 URL: http://svnweb.freebsd.org/changeset/base/251297
 
 Log:
   Specify a maximum TSO length limiting the segment chain to what the
   Xen host side can handle after defragmentation.
   
   This prevents the driver from throwing away too long TSO chains and
   improves the performance on Amazon AWS instances with 10GigE virtual
   interfaces to the normally expected throughput.
   
   Submitted by:   cperciva (earlier version)
   Reviewed by:cperciva
   Tested by:  cperciva
   MFC after:  1 week
 
 Modified:
   head/sys/dev/xen/netfront/netfront.c
 
 Modified: head/sys/dev/xen/netfront/netfront.c
 ==
 --- head/sys/dev/xen/netfront/netfront.c  Mon Jun  3 12:55:13 2013
 (r251296)
 +++ head/sys/dev/xen/netfront/netfront.c  Mon Jun  3 13:00:33 2013
 (r251297)
 @@ -134,6 +134,7 @@ static const int MODPARM_rx_flip = 0;
   * to mirror the Linux MAX_SKB_FRAGS constant.
   */
  #define  MAX_TX_REQ_FRAGS (65536 / PAGE_SIZE + 2)
 +#define  NF_TSO_MAXBURST ((IP_MAXPACKET / PAGE_SIZE) * MCLBYTES)

For posterity's sake, can you and/or Colin please elaborate on how this
value was determined and what it is dependent upon? Could a newer
version of Xen remove the need for this reduced limit?

Cheers,
Lawrence
___
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: r250951 - head/sys/kern

2013-05-23 Thread Lawrence Stewart
Author: lstewart
Date: Fri May 24 00:49:12 2013
New Revision: 250951
URL: http://svnweb.freebsd.org/changeset/base/250951

Log:
  Ensure alq's shutdown_pre_sync event handler is deregistered on module unload 
to
  avoid a dangling pointer and eventual panic on system shutdown.
  
  Reported by:  Ali comnetboy at gmail.com
  Tested by:Ali comnetboy at gmail.com
  MFC after:1 week

Modified:
  head/sys/kern/kern_alq.c

Modified: head/sys/kern/kern_alq.c
==
--- head/sys/kern/kern_alq.cThu May 23 22:52:21 2013(r250950)
+++ head/sys/kern/kern_alq.cFri May 24 00:49:12 2013(r250951)
@@ -99,6 +99,7 @@ static LIST_HEAD(, alq) ald_active;
 static int ald_shutingdown = 0;
 struct thread *ald_thread;
 static struct proc *ald_proc;
+static eventhandler_tag alq_eventhandler_tag = NULL;
 
 #defineALD_LOCK()  mtx_lock(ald_mtx)
 #defineALD_UNLOCK()mtx_unlock(ald_mtx)
@@ -194,8 +195,8 @@ ald_daemon(void)
 
ald_thread = FIRST_THREAD_IN_PROC(ald_proc);
 
-   EVENTHANDLER_REGISTER(shutdown_pre_sync, ald_shutdown, NULL,
-   SHUTDOWN_PRI_FIRST);
+   alq_eventhandler_tag = EVENTHANDLER_REGISTER(shutdown_pre_sync,
+   ald_shutdown, NULL, SHUTDOWN_PRI_FIRST);
 
ALD_LOCK();
 
@@ -228,6 +229,8 @@ ald_shutdown(void *arg, int howto)
 {
struct alq *alq;
 
+   EVENTHANDLER_DEREGISTER(shutdown_pre_sync, alq_eventhandler_tag);
+
ALD_LOCK();
 
/* Ensure no new queues can be created. */
___
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: r250140 - stable/9/sys/netinet

2013-05-01 Thread Lawrence Stewart
Author: lstewart
Date: Wed May  1 08:53:40 2013
New Revision: 250140
URL: http://svnweb.freebsd.org/changeset/base/250140

Log:
  MFC r245783:
  
  Simplify and fix a bug in cc_ack_received()'s are we congestion window 
limited
  logic (refer to [1] for associated discussion). snd_cwnd and snd_wnd are
  unsigned long and on 64 bit hosts, min() will truncate them to 32 bits and 
could
  therefore potentially corrupt the result (although under normal operation,
  neither variable should legitmately exceed 32 bits).
  
  [1] http://lists.freebsd.org/pipermail/freebsd-net/2013-January/034297.html
  
  Submitted by: jhb

Modified:
  stable/9/sys/netinet/tcp_input.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/netinet/tcp_input.c
==
--- stable/9/sys/netinet/tcp_input.cWed May  1 07:13:36 2013
(r250139)
+++ stable/9/sys/netinet/tcp_input.cWed May  1 08:53:40 2013
(r250140)
@@ -269,7 +269,7 @@ cc_ack_received(struct tcpcb *tp, struct
INP_WLOCK_ASSERT(tp-t_inpcb);
 
tp-ccv-bytes_this_ack = BYTES_THIS_ACK(tp, th);
-   if (tp-snd_cwnd == min(tp-snd_cwnd, tp-snd_wnd))
+   if (tp-snd_cwnd = tp-snd_wnd)
tp-ccv-flags |= CCF_CWND_LIMITED;
else
tp-ccv-flags = ~CCF_CWND_LIMITED;
___
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: r250141 - stable/8/sys/netinet

2013-05-01 Thread Lawrence Stewart
Author: lstewart
Date: Wed May  1 08:57:45 2013
New Revision: 250141
URL: http://svnweb.freebsd.org/changeset/base/250141

Log:
  MFC r245783:
  
  Simplify and fix a bug in cc_ack_received()'s are we congestion window 
limited
  logic (refer to [1] for associated discussion). snd_cwnd and snd_wnd are
  unsigned long and on 64 bit hosts, min() will truncate them to 32 bits and 
could
  therefore potentially corrupt the result (although under normal operation,
  neither variable should legitmately exceed 32 bits).
  
  [1] http://lists.freebsd.org/pipermail/freebsd-net/2013-January/034297.html
  
  Submitted by: jhb

Modified:
  stable/8/sys/netinet/tcp_input.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/netinet/   (props changed)

Modified: stable/8/sys/netinet/tcp_input.c
==
--- stable/8/sys/netinet/tcp_input.cWed May  1 08:53:40 2013
(r250140)
+++ stable/8/sys/netinet/tcp_input.cWed May  1 08:57:45 2013
(r250141)
@@ -269,7 +269,7 @@ cc_ack_received(struct tcpcb *tp, struct
INP_WLOCK_ASSERT(tp-t_inpcb);
 
tp-ccv-bytes_this_ack = BYTES_THIS_ACK(tp, th);
-   if (tp-snd_cwnd == min(tp-snd_cwnd, tp-snd_wnd))
+   if (tp-snd_cwnd = tp-snd_wnd)
tp-ccv-flags |= CCF_CWND_LIMITED;
else
tp-ccv-flags = ~CCF_CWND_LIMITED;
___
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: r248150 - stable/8/sys/netinet

2013-03-11 Thread Lawrence Stewart
Author: lstewart
Date: Mon Mar 11 08:21:43 2013
New Revision: 248150
URL: http://svnweb.freebsd.org/changeset/base/248150

Log:
  MFC r247906:
  
  The hashmask returned by hashinit() is a valid index in the returned
  hash array. Fix a siftr(4) potential memory leak and INVARIANTS
  triggered kernel panic in hashdestroy() by ensuring the last array index
  in the flow counter hash table is flushed of entries.
  
  Approved by:  re (kib)

Modified:
  stable/8/sys/netinet/siftr.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/netinet/   (props changed)

Modified: stable/8/sys/netinet/siftr.c
==
--- stable/8/sys/netinet/siftr.cMon Mar 11 07:55:49 2013
(r248149)
+++ stable/8/sys/netinet/siftr.cMon Mar 11 08:21:43 2013
(r248150)
@@ -1319,7 +1319,7 @@ siftr_manage_ops(uint8_t action)
 * flow seen and freeing any malloc'd memory.
 * The hash consists of an array of LISTs (man 3 queue).
 */
-   for (i = 0; i  siftr_hashmask; i++) {
+   for (i = 0; i = siftr_hashmask; i++) {
LIST_FOREACH_SAFE(counter, counter_hash + i, nodes,
tmp_counter) {
key = counter-key;
___
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: r247906 - head/sys/netinet

2013-03-06 Thread Lawrence Stewart
Author: lstewart
Date: Thu Mar  7 04:42:20 2013
New Revision: 247906
URL: http://svnweb.freebsd.org/changeset/base/247906

Log:
  The hashmask returned by hashinit() is a valid index in the returned hash 
array.
  Fix a siftr(4) potential memory leak and INVARIANTS triggered kernel panic in
  hashdestroy() by ensuring the last array index in the flow counter hash table 
is
  flushed of entries.
  
  MFC after:3 days

Modified:
  head/sys/netinet/siftr.c

Modified: head/sys/netinet/siftr.c
==
--- head/sys/netinet/siftr.cThu Mar  7 02:53:29 2013(r247905)
+++ head/sys/netinet/siftr.cThu Mar  7 04:42:20 2013(r247906)
@@ -1314,7 +1314,7 @@ siftr_manage_ops(uint8_t action)
 * flow seen and freeing any malloc'd memory.
 * The hash consists of an array of LISTs (man 3 queue).
 */
-   for (i = 0; i  siftr_hashmask; i++) {
+   for (i = 0; i = siftr_hashmask; i++) {
LIST_FOREACH_SAFE(counter, counter_hash + i, nodes,
tmp_counter) {
key = counter-key;
___
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: r245783 - head/sys/netinet

2013-01-22 Thread Lawrence Stewart
Author: lstewart
Date: Tue Jan 22 09:44:21 2013
New Revision: 245783
URL: http://svnweb.freebsd.org/changeset/base/245783

Log:
  Simplify and fix a bug in cc_ack_received()'s are we congestion window 
limited
  logic (refer to [1] for associated discussion). snd_cwnd and snd_wnd are
  unsigned long and on 64 bit hosts, min() will truncate them to 32 bits and 
could
  therefore potentially corrupt the result (although under normal operation,
  neither variable should legitmately exceed 32 bits).
  
  [1] http://lists.freebsd.org/pipermail/freebsd-net/2013-January/034297.html
  
  Submitted by: jhb
  MFC after:1 week

Modified:
  head/sys/netinet/tcp_input.c

Modified: head/sys/netinet/tcp_input.c
==
--- head/sys/netinet/tcp_input.cTue Jan 22 08:09:43 2013
(r245782)
+++ head/sys/netinet/tcp_input.cTue Jan 22 09:44:21 2013
(r245783)
@@ -285,7 +285,7 @@ cc_ack_received(struct tcpcb *tp, struct
INP_WLOCK_ASSERT(tp-t_inpcb);
 
tp-ccv-bytes_this_ack = BYTES_THIS_ACK(tp, th);
-   if (tp-snd_cwnd == min(tp-snd_cwnd, tp-snd_wnd))
+   if (tp-snd_cwnd = tp-snd_wnd)
tp-ccv-flags |= CCF_CWND_LIMITED;
else
tp-ccv-flags = ~CCF_CWND_LIMITED;
___
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


Re: svn commit: r239382 - in head/etc: defaults rc.d

2012-10-02 Thread Lawrence Stewart

Hi Jun,

On 08/19/12 18:15, Jun Kuriyama wrote:

Author: kuriyama
Date: Sun Aug 19 08:15:32 2012
New Revision: 239382
URL: http://svn.freebsd.org/changeset/base/239382

Log:
   - Allow to pass extra parameters for each jails.
   - To achieve above, convert jail(8) invocation to use new style
 command line -c flag.

   Reviewed at: freebsd-jail@

Modified:
   head/etc/defaults/rc.conf
   head/etc/rc.d/jail


Can this change be MFCed without raising any POLA issues (I suspect it 
can)? If yes, would you be willing to MFC it to stable/8 and stable/9?


Cheers,
Lawrence
___
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


Re: svn commit: r232059 - in head: sys/fs/devfs sys/fs/nullfs sys/kern sys/sys usr.sbin/jail

2012-10-02 Thread Lawrence Stewart

Hi Martin,

On 02/24/12 05:51, Martin Matuska wrote:

Author: mm
Date: Thu Feb 23 18:51:24 2012
New Revision: 232059
URL: http://svn.freebsd.org/changeset/base/232059

Log:
   To improve control over the use of mount(8) inside a jail(8), introduce
   a new jail parameter node with the following parameters:

   allow.mount.devfs:
allow mounting the devfs filesystem inside a jail

   allow.mount.nullfs:
allow mounting the nullfs filesystem inside a jail

   Both parameters are disabled by default (equals the behavior before
   devfs and nullfs in jails). Administrators have to explicitly allow
   mounting devfs and nullfs for each jail. The value -1 of the
   devfs_ruleset parameter is removed in favor of the new allow setting.

   Reviewed by: jamie
   Suggested by:pjd
   MFC after:   2 weeks


Is there any reason this and the other related commits (e.g. r232186, 
232247,232278,232291,230129 and maybe others I missed) haven't been 
MFCed to stable/8?


I'm seeing an interesting bug on an 8.3-STABLE (built mid August) 
machine whereby a zfs dataset with jailed=on can be managed and mounted 
inside the jail with enable_statfs=1, but shows up in the primary host's 
mount list instead of the jail's. I then can't zfs unmount the 
filesystem from within the jail or the primary host.


The same set up works fine on 9.1-RC1.

Would you mind MFCing all relevant jail-related ZFS commits to stable/8 
which are currently only in 9 and head?


Cheers,
Lawrence
___
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: r239550 - releng/9.1/sys/netinet/khelp

2012-08-21 Thread Lawrence Stewart
Author: lstewart
Date: Wed Aug 22 01:28:16 2012
New Revision: 239550
URL: http://svn.freebsd.org/changeset/base/239550

Log:
  MFC r239346:
  
  The TCP PAWS fix for kernels with fast tick rates (r231767) changed the TCP
  timestamp related stack variables to reference ms directly instead of ticks. 
The
  h_ertt(4) Khelp module relies on TCP timestamp information in order to 
calculate
  its enhanced RTT estimates, but was not updated as part of r231767.
  
  Consequently, h_ertt has not been calculating correct RTT estimates since
  r231767 was comitted, which in turn broke all delay-based congestion control
  algorithms because they rely on the h_ertt RTT estimates.
  
  Fix the breakage by switching h_ertt to use tcp_ts_getticks() in place of all
  previous uses of the ticks variable. This ensures all timestamp related
  variables in h_ertt use the same units as the TCP stack and therefore results 
in
  meaningful comparisons and RTT estimate calculations.
  
  Reported  tested by: Naeem Khademi (naeemk at ifi uio no)
  Discussed with:   bz
  Approved by:  re (kib)

Modified:
  releng/9.1/sys/netinet/khelp/h_ertt.c
Directory Properties:
  releng/9.1/sys/   (props changed)

Modified: releng/9.1/sys/netinet/khelp/h_ertt.c
==
--- releng/9.1/sys/netinet/khelp/h_ertt.c   Wed Aug 22 00:59:17 2012
(r239549)
+++ releng/9.1/sys/netinet/khelp/h_ertt.c   Wed Aug 22 01:28:16 2012
(r239550)
@@ -151,11 +151,13 @@ marked_packet_rtt(struct txseginfo *txsi
*prtt_bytes_adjust += *pmeasurenext_len;
} else {
if (mflag  FORCED_MEASUREMENT) {
-   e_t-markedpkt_rtt = ticks - *pmeasurenext + 1;
+   e_t-markedpkt_rtt = tcp_ts_getticks() -
+   *pmeasurenext + 1;
e_t-bytes_tx_in_marked_rtt = e_t-bytes_tx_in_rtt +
*pmeasurenext_len - *prtt_bytes_adjust;
} else {
-   e_t-markedpkt_rtt = ticks - txsi-tx_ts + 1;
+   e_t-markedpkt_rtt = tcp_ts_getticks() -
+   txsi-tx_ts + 1;
e_t-bytes_tx_in_marked_rtt = e_t-bytes_tx_in_rtt -
*prtt_bytes_adjust;
}
@@ -349,7 +351,7 @@ ertt_packet_measurement_hook(int hhook_t
 */
if (!e_t-dlyack_rx || multiack || new_sacked_bytes) {
/* Make an accurate new measurement. */
-   e_t-rtt = ticks - txsi-tx_ts + 1;
+   e_t-rtt = tcp_ts_getticks() - txsi-tx_ts + 1;
 
if (e_t-rtt  e_t-minrtt || e_t-minrtt == 0)
e_t-minrtt = e_t-rtt;
@@ -477,7 +479,7 @@ ertt_add_tx_segment_info_hook(int hhook_
tp-ts_offset;
txsi-rx_ts = ntohl(to-to_tsecr);
} else {
-   txsi-tx_ts = ticks;
+   txsi-tx_ts = tcp_ts_getticks();
txsi-rx_ts = 0; /* No received time stamp. */
}
TAILQ_INSERT_TAIL(e_t-txsegi_q, txsi, txsegi_lnk);
___
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: r239474 - stable/9/sys/netinet/khelp

2012-08-20 Thread Lawrence Stewart
Author: lstewart
Date: Tue Aug 21 02:17:06 2012
New Revision: 239474
URL: http://svn.freebsd.org/changeset/base/239474

Log:
  MFC r239346:
  
  The TCP PAWS fix for kernels with fast tick rates (r231767) changed the TCP
  timestamp related stack variables to reference ms directly instead of ticks.
  The h_ertt(4) Khelp module relies on TCP timestamp information in order to
  calculate its enhanced RTT estimates, but was not updated as part of r231767.
  
  Consequently, h_ertt has not been calculating correct RTT estimates since
  r231767 was comitted, which in turn broke all delay-based congestion control
  algorithms because they rely on the h_ertt RTT estimates.
  
  Fix the breakage by switching h_ertt to use tcp_ts_getticks() in place of all
  previous uses of the ticks variable. This ensures all timestamp related
  variables in h_ertt use the same units as the TCP stack and therefore results 
in
  meaningful comparisons and RTT estimate calculations.
  
  Reported  tested by: Naeem Khademi (naeemk at ifi uio no)
  Discussed with:   bz

Modified:
  stable/9/sys/netinet/khelp/h_ertt.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/netinet/khelp/h_ertt.c
==
--- stable/9/sys/netinet/khelp/h_ertt.c Tue Aug 21 00:05:44 2012
(r239473)
+++ stable/9/sys/netinet/khelp/h_ertt.c Tue Aug 21 02:17:06 2012
(r239474)
@@ -151,11 +151,13 @@ marked_packet_rtt(struct txseginfo *txsi
*prtt_bytes_adjust += *pmeasurenext_len;
} else {
if (mflag  FORCED_MEASUREMENT) {
-   e_t-markedpkt_rtt = ticks - *pmeasurenext + 1;
+   e_t-markedpkt_rtt = tcp_ts_getticks() -
+   *pmeasurenext + 1;
e_t-bytes_tx_in_marked_rtt = e_t-bytes_tx_in_rtt +
*pmeasurenext_len - *prtt_bytes_adjust;
} else {
-   e_t-markedpkt_rtt = ticks - txsi-tx_ts + 1;
+   e_t-markedpkt_rtt = tcp_ts_getticks() -
+   txsi-tx_ts + 1;
e_t-bytes_tx_in_marked_rtt = e_t-bytes_tx_in_rtt -
*prtt_bytes_adjust;
}
@@ -349,7 +351,7 @@ ertt_packet_measurement_hook(int hhook_t
 */
if (!e_t-dlyack_rx || multiack || new_sacked_bytes) {
/* Make an accurate new measurement. */
-   e_t-rtt = ticks - txsi-tx_ts + 1;
+   e_t-rtt = tcp_ts_getticks() - txsi-tx_ts + 1;
 
if (e_t-rtt  e_t-minrtt || e_t-minrtt == 0)
e_t-minrtt = e_t-rtt;
@@ -477,7 +479,7 @@ ertt_add_tx_segment_info_hook(int hhook_
tp-ts_offset;
txsi-rx_ts = ntohl(to-to_tsecr);
} else {
-   txsi-tx_ts = ticks;
+   txsi-tx_ts = tcp_ts_getticks();
txsi-rx_ts = 0; /* No received time stamp. */
}
TAILQ_INSERT_TAIL(e_t-txsegi_q, txsi, txsegi_lnk);
___
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: r239475 - stable/8/sys/netinet/khelp

2012-08-20 Thread Lawrence Stewart
Author: lstewart
Date: Tue Aug 21 02:52:25 2012
New Revision: 239475
URL: http://svn.freebsd.org/changeset/base/239475

Log:
  MFC r239346:
  
  The TCP PAWS fix for kernels with fast tick rates (r231767) changed the TCP
  timestamp related stack variables to reference ms directly instead of ticks.
  The h_ertt(4) Khelp module relies on TCP timestamp information in order to
  calculate its enhanced RTT estimates, but was not updated as part of r231767.
  
  Consequently, h_ertt has not been calculating correct RTT estimates since
  r231767 was comitted, which in turn broke all delay-based congestion control
  algorithms because they rely on the h_ertt RTT estimates.
  
  Fix the breakage by switching h_ertt to use tcp_ts_getticks() in place of all
  previous uses of the ticks variable. This ensures all timestamp related
  variables in h_ertt use the same units as the TCP stack and therefore results 
in
  meaningful comparisons and RTT estimate calculations.
  
  Reported  tested by: Naeem Khademi (naeemk at ifi uio no)
  Discussed with:   bz

Modified:
  stable/8/sys/netinet/khelp/h_ertt.c
Directory Properties:
  stable/8/sys/   (props changed)

Modified: stable/8/sys/netinet/khelp/h_ertt.c
==
--- stable/8/sys/netinet/khelp/h_ertt.c Tue Aug 21 02:17:06 2012
(r239474)
+++ stable/8/sys/netinet/khelp/h_ertt.c Tue Aug 21 02:52:25 2012
(r239475)
@@ -151,11 +151,13 @@ marked_packet_rtt(struct txseginfo *txsi
*prtt_bytes_adjust += *pmeasurenext_len;
} else {
if (mflag  FORCED_MEASUREMENT) {
-   e_t-markedpkt_rtt = ticks - *pmeasurenext + 1;
+   e_t-markedpkt_rtt = tcp_ts_getticks() -
+   *pmeasurenext + 1;
e_t-bytes_tx_in_marked_rtt = e_t-bytes_tx_in_rtt +
*pmeasurenext_len - *prtt_bytes_adjust;
} else {
-   e_t-markedpkt_rtt = ticks - txsi-tx_ts + 1;
+   e_t-markedpkt_rtt = tcp_ts_getticks() -
+   txsi-tx_ts + 1;
e_t-bytes_tx_in_marked_rtt = e_t-bytes_tx_in_rtt -
*prtt_bytes_adjust;
}
@@ -349,7 +351,7 @@ ertt_packet_measurement_hook(int hhook_t
 */
if (!e_t-dlyack_rx || multiack || new_sacked_bytes) {
/* Make an accurate new measurement. */
-   e_t-rtt = ticks - txsi-tx_ts + 1;
+   e_t-rtt = tcp_ts_getticks() - txsi-tx_ts + 1;
 
if (e_t-rtt  e_t-minrtt || e_t-minrtt == 0)
e_t-minrtt = e_t-rtt;
@@ -477,7 +479,7 @@ ertt_add_tx_segment_info_hook(int hhook_
tp-ts_offset;
txsi-rx_ts = ntohl(to-to_tsecr);
} else {
-   txsi-tx_ts = ticks;
+   txsi-tx_ts = tcp_ts_getticks();
txsi-rx_ts = 0; /* No received time stamp. */
}
TAILQ_INSERT_TAIL(e_t-txsegi_q, txsi, txsegi_lnk);
___
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: r239346 - head/sys/netinet/khelp

2012-08-16 Thread Lawrence Stewart
Author: lstewart
Date: Fri Aug 17 01:49:51 2012
New Revision: 239346
URL: http://svn.freebsd.org/changeset/base/239346

Log:
  The TCP PAWS fix for kernels with fast tick rates (r231767) changed the TCP
  timestamp related stack variables to reference ms directly instead of ticks.
  The h_ertt(4) Khelp module relies on TCP timestamp information in order to
  calculate its enhanced RTT estimates, but was not updated as part of r231767.
  
  Consequently, h_ertt has not been calculating correct RTT estimates since
  r231767 was comitted, which in turn broke all delay-based congestion control
  algorithms because they rely on the h_ertt RTT estimates.
  
  Fix the breakage by switching h_ertt to use tcp_ts_getticks() in place of all
  previous uses of the ticks variable. This ensures all timestamp related
  variables in h_ertt use the same units as the TCP stack and therefore results 
in
  meaningful comparisons and RTT estimate calculations.
  
  Reported  tested by: Naeem Khademi (naeemk at ifi uio no)
  Discussed with:   bz
  MFC after:3 days

Modified:
  head/sys/netinet/khelp/h_ertt.c

Modified: head/sys/netinet/khelp/h_ertt.c
==
--- head/sys/netinet/khelp/h_ertt.c Fri Aug 17 01:05:56 2012
(r239345)
+++ head/sys/netinet/khelp/h_ertt.c Fri Aug 17 01:49:51 2012
(r239346)
@@ -151,11 +151,13 @@ marked_packet_rtt(struct txseginfo *txsi
*prtt_bytes_adjust += *pmeasurenext_len;
} else {
if (mflag  FORCED_MEASUREMENT) {
-   e_t-markedpkt_rtt = ticks - *pmeasurenext + 1;
+   e_t-markedpkt_rtt = tcp_ts_getticks() -
+   *pmeasurenext + 1;
e_t-bytes_tx_in_marked_rtt = e_t-bytes_tx_in_rtt +
*pmeasurenext_len - *prtt_bytes_adjust;
} else {
-   e_t-markedpkt_rtt = ticks - txsi-tx_ts + 1;
+   e_t-markedpkt_rtt = tcp_ts_getticks() -
+   txsi-tx_ts + 1;
e_t-bytes_tx_in_marked_rtt = e_t-bytes_tx_in_rtt -
*prtt_bytes_adjust;
}
@@ -349,7 +351,7 @@ ertt_packet_measurement_hook(int hhook_t
 */
if (!e_t-dlyack_rx || multiack || new_sacked_bytes) {
/* Make an accurate new measurement. */
-   e_t-rtt = ticks - txsi-tx_ts + 1;
+   e_t-rtt = tcp_ts_getticks() - txsi-tx_ts + 1;
 
if (e_t-rtt  e_t-minrtt || e_t-minrtt == 0)
e_t-minrtt = e_t-rtt;
@@ -477,7 +479,7 @@ ertt_add_tx_segment_info_hook(int hhook_
tp-ts_offset;
txsi-rx_ts = ntohl(to-to_tsecr);
} else {
-   txsi-tx_ts = ticks;
+   txsi-tx_ts = tcp_ts_getticks();
txsi-rx_ts = 0; /* No received time stamp. */
}
TAILQ_INSERT_TAIL(e_t-txsegi_q, txsi, txsegi_lnk);
___
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: r238345 - head/lib/libc/sys

2012-07-10 Thread Lawrence Stewart
Author: lstewart
Date: Tue Jul 10 08:31:28 2012
New Revision: 238345
URL: http://svn.freebsd.org/changeset/base/238345

Log:
  Move the ffclock symbols from FBSD_1.2 to FBSD_1.3 where they should have been
  put initially. They were added to head during development of 10-CURRENT, not
  9-CURRENT.
  
  Submitted by: glebius
  Reviewed by:  kib

Modified:
  head/lib/libc/sys/Symbol.map

Modified: head/lib/libc/sys/Symbol.map
==
--- head/lib/libc/sys/Symbol.mapTue Jul 10 07:45:47 2012
(r238344)
+++ head/lib/libc/sys/Symbol.mapTue Jul 10 08:31:28 2012
(r238345)
@@ -365,9 +365,6 @@ FBSD_1.2 {
cap_getmode;
cap_new;
cap_getrights;
-   ffclock_getcounter;
-   ffclock_getestimate;
-   ffclock_setestimate;
getloginclass;
pdfork;
pdgetpid;
@@ -382,6 +379,9 @@ FBSD_1.2 {
 };
 
 FBSD_1.3 {
+   ffclock_getcounter;
+   ffclock_getestimate;
+   ffclock_setestimate;
posix_fadvise;
 };
 
___
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


Re: svn commit: r226113 - head/sys/netinet

2012-01-23 Thread Lawrence Stewart

Hi Andre,

On 10/08/11 03:39, Andre Oppermann wrote:

Author: andre
Date: Fri Oct  7 16:39:03 2011
New Revision: 226113
URL: http://svn.freebsd.org/changeset/base/226113

Log:
   Prevent TCP sessions from stalling indefinitely in reassembly
   when reaching the zone limit of reassembly queue entries.


[snip]

Any reason this was not MFCed to stable/8 and stable/7 when you MFCed to 
stable/9? As far as I can tell, both r226113 and r228016 need to be 
MFCed to 8 and 7.


Cheers,
Lawrence
___
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: r230412 - stable/9/share/man/man4

2012-01-20 Thread Lawrence Stewart
Author: lstewart
Date: Sat Jan 21 03:16:32 2012
New Revision: 230412
URL: http://svn.freebsd.org/changeset/base/230412

Log:
  MFC r230294:
  
  Specify the correct section (4 instead of 9) in the h_ertt man page's title 
and
  bump the document date.

Modified:
  stable/9/share/man/man4/h_ertt.4
Directory Properties:
  stable/9/share/man/   (props changed)
  stable/9/share/man/man4/   (props changed)

Modified: stable/9/share/man/man4/h_ertt.4
==
--- stable/9/share/man/man4/h_ertt.4Sat Jan 21 03:00:57 2012
(r230411)
+++ stable/9/share/man/man4/h_ertt.4Sat Jan 21 03:16:32 2012
(r230412)
@@ -29,8 +29,8 @@
 .\
 .\ $FreeBSD$
 .\
-.Dd February 15, 2011
-.Dt H_ERTT 9
+.Dd January 18, 2012
+.Dt H_ERTT 4
 .Os
 .Sh NAME
 .Nm h_ertt
___
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: r230413 - in stable/8: contrib/openbsm/libbsm lib/libc/gen share/man/man4 share/man/man9 tools/tools/ether_reflect usr.sbin/bsnmpd/modules/snmp_bridge usr.sbin/bsnmpd/modules/snmp_hostres

2012-01-20 Thread Lawrence Stewart
Author: lstewart
Date: Sat Jan 21 03:44:51 2012
New Revision: 230413
URL: http://svn.freebsd.org/changeset/base/230413

Log:
  MFC r86 (originally committed by ru):
  
  [mdoc] Fixed .Dt call.

Modified:
  stable/8/contrib/openbsm/libbsm/audit_submit.3
  stable/8/lib/libc/gen/feature_present.3
  stable/8/share/man/man4/h_ertt.4
  stable/8/share/man/man9/devfs_set_cdevpriv.9
  stable/8/share/man/man9/hhook.9
  stable/8/share/man/man9/khelp.9
  stable/8/tools/tools/ether_reflect/ether_reflect.1
  stable/8/usr.sbin/bsnmpd/modules/snmp_bridge/snmp_bridge.3
  stable/8/usr.sbin/bsnmpd/modules/snmp_hostres/snmp_hostres.3
Directory Properties:
  stable/8/contrib/openbsm/   (props changed)
  stable/8/lib/libc/   (props changed)
  stable/8/share/man/   (props changed)
  stable/8/share/man/man4/   (props changed)
  stable/8/share/man/man7/   (props changed)
  stable/8/share/man/man9/   (props changed)
  stable/8/tools/tools/ether_reflect/   (props changed)
  stable/8/usr.sbin/bsnmpd/   (props changed)

Modified: stable/8/contrib/openbsm/libbsm/audit_submit.3
==
--- stable/8/contrib/openbsm/libbsm/audit_submit.3  Sat Jan 21 03:16:32 
2012(r230412)
+++ stable/8/contrib/openbsm/libbsm/audit_submit.3  Sat Jan 21 03:44:51 
2012(r230413)
@@ -30,7 +30,7 @@
 .\ $P4: //depot/projects/trustedbsd/openbsm/libbsm/audit_submit.3#17 $
 .\
 .Dd January 18, 2008
-.Dt audit_submit 3
+.Dt AUDIT_SUBMIT 3
 .Os
 .Sh NAME
 .Nm audit_submit

Modified: stable/8/lib/libc/gen/feature_present.3
==
--- stable/8/lib/libc/gen/feature_present.3 Sat Jan 21 03:16:32 2012
(r230412)
+++ stable/8/lib/libc/gen/feature_present.3 Sat Jan 21 03:44:51 2012
(r230413)
@@ -29,7 +29,7 @@
 .\ $FreeBSD$
 .\
 .Dd January 8, 2008
-.Dt feature_present 3
+.Dt FEATURE_PRESENT 3
 .Os
 .Sh NAME
 .Nm feature_present

Modified: stable/8/share/man/man4/h_ertt.4
==
--- stable/8/share/man/man4/h_ertt.4Sat Jan 21 03:16:32 2012
(r230412)
+++ stable/8/share/man/man4/h_ertt.4Sat Jan 21 03:44:51 2012
(r230413)
@@ -30,7 +30,7 @@
 .\ $FreeBSD$
 .\
 .Dd February 15, 2011
-.Dt h_ertt 9
+.Dt H_ERTT 9
 .Os
 .Sh NAME
 .Nm h_ertt

Modified: stable/8/share/man/man9/devfs_set_cdevpriv.9
==
--- stable/8/share/man/man9/devfs_set_cdevpriv.9Sat Jan 21 03:16:32 
2012(r230412)
+++ stable/8/share/man/man9/devfs_set_cdevpriv.9Sat Jan 21 03:44:51 
2012(r230413)
@@ -25,7 +25,7 @@
 .\ $FreeBSD$
 .\
 .Dd September 8, 2008
-.Dt DEVFS_CDEVPRIV
+.Dt DEVFS_CDEVPRIV 9
 .Os
 .Sh NAME
 .Nm devfs_set_cdevpriv ,

Modified: stable/8/share/man/man9/hhook.9
==
--- stable/8/share/man/man9/hhook.9 Sat Jan 21 03:16:32 2012
(r230412)
+++ stable/8/share/man/man9/hhook.9 Sat Jan 21 03:44:51 2012
(r230413)
@@ -31,7 +31,7 @@
 .\ $FreeBSD$
 .\
 .Dd February 15, 2011
-.Dt hhook 9
+.Dt HHOOK 9
 .Os
 .Sh NAME
 .Nm hhook ,

Modified: stable/8/share/man/man9/khelp.9
==
--- stable/8/share/man/man9/khelp.9 Sat Jan 21 03:16:32 2012
(r230412)
+++ stable/8/share/man/man9/khelp.9 Sat Jan 21 03:44:51 2012
(r230413)
@@ -31,7 +31,7 @@
 .\ $FreeBSD$
 .\
 .Dd February 15, 2011
-.Dt khelp 9
+.Dt KHELP 9
 .Os
 .Sh NAME
 .Nm khelp ,

Modified: stable/8/tools/tools/ether_reflect/ether_reflect.1
==
--- stable/8/tools/tools/ether_reflect/ether_reflect.1  Sat Jan 21 03:16:32 
2012(r230412)
+++ stable/8/tools/tools/ether_reflect/ether_reflect.1  Sat Jan 21 03:44:51 
2012(r230413)
@@ -25,7 +25,7 @@
 .\ $FreeBSD$
 .\
 .Dd December 23, 2008
-.Dt ether_reflect 1
+.Dt ETHER_REFLECT 1
 .Os
 .Sh NAME
 .Nm ether_reflect

Modified: stable/8/usr.sbin/bsnmpd/modules/snmp_bridge/snmp_bridge.3
==
--- stable/8/usr.sbin/bsnmpd/modules/snmp_bridge/snmp_bridge.3  Sat Jan 21 
03:16:32 2012(r230412)
+++ stable/8/usr.sbin/bsnmpd/modules/snmp_bridge/snmp_bridge.3  Sat Jan 21 
03:44:51 2012(r230413)
@@ -26,7 +26,7 @@
 .\ $FreeBSD$
 .\
 .Dd August 6, 2007
-.Dt snmp_bridge 3
+.Dt SNMP_BRIDGE 3
 .Os
 .Sh NAME
 .Nm snmp_bridge

Modified: stable/8/usr.sbin/bsnmpd/modules/snmp_hostres/snmp_hostres.3
==
--- stable/8/usr.sbin/bsnmpd/modules/snmp_hostres/snmp_hostres.3Sat Jan 
21 03:16:32 2012(r230412)
+++ stable/8/usr.sbin/bsnmpd/modules/snmp_hostres/snmp_hostres.3Sat Jan 
21 03:44:51 2012

svn commit: r230414 - stable/8/share/man/man4

2012-01-20 Thread Lawrence Stewart
Author: lstewart
Date: Sat Jan 21 03:46:58 2012
New Revision: 230414
URL: http://svn.freebsd.org/changeset/base/230414

Log:
  MFC r230294:
  
  Specify the correct section (4 instead of 9) in the h_ertt man page's title 
and
  bump the document date.

Modified:
  stable/8/share/man/man4/h_ertt.4
Directory Properties:
  stable/8/share/man/   (props changed)
  stable/8/share/man/man4/   (props changed)

Modified: stable/8/share/man/man4/h_ertt.4
==
--- stable/8/share/man/man4/h_ertt.4Sat Jan 21 03:44:51 2012
(r230413)
+++ stable/8/share/man/man4/h_ertt.4Sat Jan 21 03:46:58 2012
(r230414)
@@ -29,8 +29,8 @@
 .\
 .\ $FreeBSD$
 .\
-.Dd February 15, 2011
-.Dt H_ERTT 9
+.Dd January 18, 2012
+.Dt H_ERTT 4
 .Os
 .Sh NAME
 .Nm h_ertt
___
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


  1   2   3   4   >