svn commit: r286066 - head/usr.sbin/pw

2015-07-29 Thread Baptiste Daroussin
Author: bapt
Date: Thu Jul 30 06:14:47 2015
New Revision: 286066
URL: https://svnweb.freebsd.org/changeset/base/286066

Log:
  Improve strtounum
  
  Fix many style bugs
  Better variable naming
  Use C99 'restrict' were apropriate
  Fix potential errno race
  
  Submitted by: bde

Modified:
  head/usr.sbin/pw/pw.h
  head/usr.sbin/pw/strtounum.c

Modified: head/usr.sbin/pw/pw.h
==
--- head/usr.sbin/pw/pw.h   Thu Jul 30 05:13:12 2015(r286065)
+++ head/usr.sbin/pw/pw.h   Thu Jul 30 06:14:47 2015(r286066)
@@ -103,5 +103,5 @@ char *pw_pwcrypt(char *password);
 extern const char *Modes[];
 extern const char *Which[];
 
-uintmax_t strtounum(const char *numstr, uintmax_t minval, uintmax_t maxval,
-const char **errmsg);
+uintmax_t strtounum(const char * __restrict, uintmax_t, uintmax_t,
+const char ** __restrict);

Modified: head/usr.sbin/pw/strtounum.c
==
--- head/usr.sbin/pw/strtounum.cThu Jul 30 05:13:12 2015
(r286065)
+++ head/usr.sbin/pw/strtounum.cThu Jul 30 06:14:47 2015
(r286066)
@@ -34,41 +34,38 @@ __FBSDID("$FreeBSD$");
 
 #include "pw.h"
 
-#define INVALID"invalid"
-#define TOOSMALL   "too small"
-#defineTOOLARGE"too large"
-
 uintmax_t
-strtounum(const char *numstr, uintmax_t minval, uintmax_t maxval,
-const char **errstrp)
+strtounum(const char * __restrict np, uintmax_t minval, uintmax_t maxval,
+const char ** __restrict errpp)
 {
-   uintmax_t ret = 0;
-   char *ep;
+   char *endp;
+   uintmax_t ret;
 
if (minval > maxval) {
errno = EINVAL;
-   if (errstrp != NULL)
-   *errstrp = INVALID;
+   if (errpp != NULL)
+   *errpp = "invalid";
return (0);
}
-
-   ret = strtoumax(numstr, &ep, 10);
-   if (errno == EINVAL || numstr == ep || *ep != '\0') {
+   errno = 0;
+   ret = strtoumax(np, &endp, 10);
+   if (endp == np || *endp != '\0') {
errno = EINVAL;
-   if (errstrp != NULL)
-   *errstrp = INVALID;
+   if (errpp != NULL)
+   *errpp = "invalid";
return (0);
-   } else if ((ret == 0 && errno == ERANGE) || ret < minval) {
+   }
+   if (ret < minval) {
errno = ERANGE;
-   if (errstrp != NULL)
-   *errstrp = TOOSMALL;
+   if (errpp != NULL)
+   *errpp = "too small";
return (0);
-   } else if ((ret == UINTMAX_MAX && errno == ERANGE) || ret > maxval) {
+   }
+   if (errno == ERANGE || ret > maxval) {
errno = ERANGE;
-   if (errstrp != NULL)
-   *errstrp = TOOLARGE;
+   if (errpp != NULL)
+   *errpp = "too large";
return (0);
}
-
return (ret);
 }
___
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: r285068 - in head/sys: conf modules/agp modules/geom/geom_part/geom_part_apm modules/geom/geom_part/geom_part_bsd modules/geom/geom_part/geom_part_bsd64 modules/geom/geom_part/geom_par

2015-07-29 Thread Bruce Evans

On Wed, 29 Jul 2015, Warner Losh wrote:


On Jul 29, 2015, at 9:46 AM, Hans Petter Selasky  wrote:
In this particular case one "find of /sys" takes 11-16 seconds over NFS, so 
building a single KMOD takes 16 seconds too. It's not possible to eliminate the find 
entirely during repeated builds?


16 seconds? That\xe2\x80\x99s a really slow NFS server and at least 11 seconds

 longer than it should take :(.

11 seconds?  Building full (FreeBSD-4) kernel takes 4.5 here seconds with
a tuned nfs, starting with a warm cache after "make depend".  makeworld
takes 130 seconds over nfs, with nfs costing about 15 seconds of that,
starting with a cold cache on the client and a warm cache on the server,
and doing sufficient "make depend" steps (most are optimized out in ny
version to save 10% with make -j1 and much more with make -j8; "make
depend" and "make install" are not parallelized so they are the slowest
parts of makeworld).  It is mysterious that makeworld starting with a
warm cache on the client is slightly slower.

This took some fighting with network latency and nfs's lack of caching
of attributes (it caches everything, but checks attributes on every
first-open).  For find, I think this results in an RPC or two for
opening every directory in the traversal, but the caching works for
regular files.  "find ." on /usr/src takes:

0.27 real 0.03 user 0.24 sys  on the server
3.27 real 0.05 user 0.40 sys  on the client (3x faster)
 Lookup Access Fsstat Getattr Other   Total  (client nfsstat delta:)
   1759408   6987   14374 1   23529

while cached du -a takes:

0.58 real 0.09 user 0.48 sys  on the server
   10.30 real 0.09 user 0.78 sys  on the client
 Lookup Access Fsstat Getattr Other   Total  (client nfsstat delta:)
  49655   6987   6986   13979 6   77613

/usr/src has 6986 directories and 49643 files.  There seems to be 1 Fsstat
and 2 Getattr's per directory, 1 Access per directory for du -a, and 1
Lookup per file for du -a.  The caching helped more for Lookup and Access
for "find ..

After mounting with -nocto:

find .:
1.20 real 0.04 user 0.32 sys
 Fsstat Other   Total
   6987167003

du -a:
6.83 real 0.04 user 0.69 sys
 Lookup Access Fsstat Other   Total
  42666237   6986 3   49892

There are still too many Fsstats.  This reminds me of an old
pessimization in opendir().  It calls fstatfs() for almost every
directory to support unionfs although unionfs never workded correctly
and is almost never used.  At least nfs3 never cached Fsstat in any
FreeBSD implementation, so "find ." has to do lots of Fsstat RPCs.
The caching works perfectly to avoid almost all other RPCs.

There are still too many Lookups.  The Lookup count for du -a now seems
to be the number of files less than the number of directories.
Apparently, lookups are only cached right for directories.  After
waiting a bit for cache timeouts to expire, du -a does 49000+ Lookups
to look up the directories too.

The files get cached if you read them.  This gives the silly behaviour
that tar cvvf runs much faster than du -a with a warm cache, since caching
actually works for it (except for Fsstat):

tar cvvf /dev/zero (nocto):
2.41 real 0.17 user 1.40 sys
 Fsstat Other   Total
   6986106996

I had to fudge this test a little to avoid cache timeouts.  I ran it
a few times and picked the fastest ones.  The default cache timeouts
are 3-30 seconds for files and 30-60 seconds for directories (depending
on the age of the file).  tar with a cold cache takes longer than that,
so it takes a few runs to get everything cached.  Caching everything
is only possible since the caching works for reads.  So the first run
of tar cvvf caches all the data so that subsequent runs have a chance
of completing faster than the attribute cache times out.  du -a has
without nocto a high variance since it takes a significant fraction
of the cache timeout.

I don't use nocto in production since it reduces robustness and I want
to make nfs caching work better without it.

Caching can also be improved and robustness unimproved by increasing the
cache timeouts.  These default and current settings of these are hard to
determine since their documentation is incorrect and mount(8) still
doesn't support retrieving any mount options that are not in old flags.

The default for acdirmin is still documented as being 30.  This was too
large, so it was changed to 3 in the code.  The man page hasn't caught
up with the change.  3 seems too low.  The default for acdirmax is still
60.

The defaults for nametimeo and negnametimeo are only documented as
manifest constants, so they they are always correct in the man page
because they are invisible there.  NFS_DEFAULT_NEGNAMETIMEO is too
long and has value 60.  For the ac* timeouts, there is a hint that
the actual timeout (between the min and the max) depends

svn commit: r286064 - stable/10/usr.sbin/jexec

2015-07-29 Thread Jamie Gritton
Author: jamie
Date: Thu Jul 30 04:53:53 2015
New Revision: 286064
URL: https://svnweb.freebsd.org/changeset/base/286064

Log:
  MFC r285420:
  
Run a shell in the jail when no command is specified.
Add a new flag, -l, for a clean environment, same as jail(8) exec.clean.
Change the GET_USER_INFO macro into a function.
  
  PR:   201300
  Submitted by: Willem Jan Withagen

Modified:
  stable/10/usr.sbin/jexec/jexec.8
  stable/10/usr.sbin/jexec/jexec.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/usr.sbin/jexec/jexec.8
==
--- stable/10/usr.sbin/jexec/jexec.8Thu Jul 30 04:01:00 2015
(r286063)
+++ stable/10/usr.sbin/jexec/jexec.8Thu Jul 30 04:53:53 2015
(r286064)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd May 27, 2009
+.Dd Jul 11, 2015
 .Dt JEXEC 8
 .Os
 .Sh NAME
@@ -33,8 +33,9 @@
 .Nd "execute a command inside an existing jail"
 .Sh SYNOPSIS
 .Nm
+.Op Fl l
 .Op Fl u Ar username | Fl U Ar username
-.Ar jail command ...
+.Ar jail Op Ar command ...
 .Sh DESCRIPTION
 The
 .Nm
@@ -43,9 +44,17 @@ utility executes
 inside the
 .Ar jail
 identified by its jid or name.
+If
+.Ar command
+is not specified then the user's shell is used.
 .Pp
 The following options are available:
 .Bl -tag -width indent
+.It Fl l
+Execute in a clean environment.
+The environment is discarded except for
+.Ev HOME , SHELL , TERM , USER ,
+and anything from the login class capability database for the user.
 .It Fl u Ar username
 The user name from host environment as whom the
 .Ar command

Modified: stable/10/usr.sbin/jexec/jexec.c
==
--- stable/10/usr.sbin/jexec/jexec.cThu Jul 30 04:01:00 2015
(r286063)
+++ stable/10/usr.sbin/jexec/jexec.cThu Jul 30 04:53:53 2015
(r286064)
@@ -40,49 +40,37 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 #include 
 #include 
 #include 
-#include 
 #include 
 
-static voidusage(void);
+extern char **environ;
 
-#define GET_USER_INFO do { \
-   pwd = getpwnam(username);   \
-   if (pwd == NULL) {  \
-   if (errno)  \
-   err(1, "getpwnam: %s", username);   \
-   else\
-   errx(1, "%s: no such user", username);  \
-   }   \
-   lcap = login_getpwclass(pwd);   \
-   if (lcap == NULL)   \
-   err(1, "getpwclass: %s", username); \
-   ngroups = ngroups_max;  \
-   if (getgrouplist(username, pwd->pw_gid, groups, &ngroups) != 0) \
-   err(1, "getgrouplist: %s", username);   \
-} while (0)
+static voidget_user_info(const char *username, const struct passwd **pwdp,
+login_cap_t **lcapp);
+static voidusage(void);
 
 int
 main(int argc, char *argv[])
 {
int jid;
login_cap_t *lcap = NULL;
-   struct passwd *pwd = NULL;
-   gid_t *groups = NULL;
-   int ch, ngroups, uflag, Uflag;
-   long ngroups_max;
-   char *username;
+   int ch, clean, uflag, Uflag;
+   char *cleanenv;
+   const struct passwd *pwd = NULL;
+   const char *username, *shell, *term;
 
-   ch = uflag = Uflag = 0;
+   ch = clean = uflag = Uflag = 0;
username = NULL;
-   ngroups_max = sysconf(_SC_NGROUPS_MAX) + 1;
-   if ((groups = malloc(sizeof(gid_t) * ngroups_max)) == NULL)
-   err(1, "malloc");
 
-   while ((ch = getopt(argc, argv, "nu:U:")) != -1) {
+   while ((ch = getopt(argc, argv, "lnu:U:")) != -1) {
switch (ch) {
+   case 'l':
+   clean = 1;
+   break;
case 'n':
/* Specified name, now unused */
break;
@@ -100,12 +88,15 @@ main(int argc, char *argv[])
}
argc -= optind;
argv += optind;
-   if (argc < 2)
+   if (argc < 1)
usage();
if (uflag && Uflag)
usage();
-   if (uflag)
-   GET_USER_INFO;
+   if (uflag || (clean && !Uflag))
+   /* User info from the home environment */
+   get_user_info(username, &pwd, &lcap);
+
+   /* Attach to the jail */
jid = jail_getid(argv[0]);
if (jid < 0)
errx(1, "%s", jail_errmsg);
@@ -113,28 +104,88 @@ main(int argc, char *argv[])
err(1, "jail_attach(%d)", jid);
if (chdir("/") == -1)
 

svn commit: r286063 - head/release/tools

2015-07-29 Thread Colin Percival
Author: cperciva
Date: Thu Jul 30 04:01:00 2015
New Revision: 286063
URL: https://svnweb.freebsd.org/changeset/base/286063

Log:
  Disable blkif indirect segment I/Os in EC2 by default due to performance
  issues on some EC2 instance types.  Users may want to experiment with
  removing this from loader.conf and measuring the performance impact on
  the EC2 instances they are using.

Modified:
  head/release/tools/ec2.conf

Modified: head/release/tools/ec2.conf
==
--- head/release/tools/ec2.conf Thu Jul 30 03:50:01 2015(r286062)
+++ head/release/tools/ec2.conf Thu Jul 30 04:01:00 2015(r286063)
@@ -70,6 +70,11 @@ vm_extra_pre_umount() {
# nodes, but apply the workaround just in case.
echo 'hw.broken_txfifo="1"' >> ${DESTDIR}/boot/loader.conf
 
+   # Some EC2 instances suffer a significant (~40%) reduction in
+   # throughput when using blkif indirect segment I/Os.  Disable this
+   # by default for now.
+   echo 'hw.xbd.xbd_enable_indirect="0"' >> ${DESTDIR}/boot/loader.conf
+
# The first time the AMI boots, the installed "first boot" scripts
# should be allowed to run:
# * ec2_configinit (download and process EC2 user-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: r286062 - in head/sys: dev/xen/blkfront xen/interface/io

2015-07-29 Thread Colin Percival
Author: cperciva
Date: Thu Jul 30 03:50:01 2015
New Revision: 286062
URL: https://svnweb.freebsd.org/changeset/base/286062

Log:
  Add support for Xen blkif indirect segment I/Os.  This makes it possible for
  the blkfront driver to perform I/Os of up to 2 MB, subject to support from
  the blkback to which it is connected and the initiation of such large I/Os
  by the rest of the kernel.  In practice, the I/O size is increased from 40 kB
  to 128 kB.
  
  The changes to xen/interface/io/blkif.h consist merely of merging updates
  from the upstream Xen repository.
  
  In dev/xen/blkfront/block.h we add some convenience macros and structure
  fields used for indirect-page I/Os: The device records its negotiated limit
  on the number of indirect pages used, while each I/O command structure gains
  permanently allocated page(s) for indirect page references and the Xen grant
  references for those pages.
  
  In dev/xen/blkfront/blkfront.c we now check in xbd_queue_cb whether a request
  is small enough to handle without an indirection page, and either follow the
  previous behaviour or use new code for issuing an indirect segment I/O.  In
  xbd_connect we read the size of indirect segment I/Os supported by the backend
  and select the maximum size we will use; then allocate the pages and Xen grant
  references for each I/O command structure.  In xbd_free those grants and pages
  are released.
  
  A new loader tunable, hw.xbd.xbd_enable_indirect, can be set to 0 in order to
  disable this functionality; it works by pretending that the backend does not
  support this feature.  Some backends exhibit a loss of performance with large
  I/Os, so users may wish to test with and without this functionality enabled.
  
  Reviewed by:  royger
  MFC after:3 days
  Relnotes: yes

Modified:
  head/sys/dev/xen/blkfront/blkfront.c
  head/sys/dev/xen/blkfront/block.h
  head/sys/xen/interface/io/blkif.h

Modified: head/sys/dev/xen/blkfront/blkfront.c
==
--- head/sys/dev/xen/blkfront/blkfront.cThu Jul 30 03:06:11 2015
(r286061)
+++ head/sys/dev/xen/blkfront/blkfront.cThu Jul 30 03:50:01 2015
(r286062)
@@ -84,6 +84,11 @@ static void xbd_startio(struct xbd_softc
 /* Global Static Data 
*/
 static MALLOC_DEFINE(M_XENBLOCKFRONT, "xbd", "Xen Block Front driver data");
 
+static int xbd_enable_indirect = 1;
+SYSCTL_NODE(_hw, OID_AUTO, xbd, CTLFLAG_RD, 0, "xbd driver parameters");
+SYSCTL_INT(_hw_xbd, OID_AUTO, xbd_enable_indirect, CTLFLAG_RDTUN,
+&xbd_enable_indirect, 0, "Enable xbd indirect segments");
+
 /* Command Processing 
*/
 static void
 xbd_freeze(struct xbd_softc *sc, xbd_flag_t xbd_flag)
@@ -205,7 +210,6 @@ xbd_queue_cb(void *arg, bus_dma_segment_
 {
struct xbd_softc *sc;
struct xbd_command *cm;
-   blkif_request_t *ring_req;
int op;
 
cm = arg;
@@ -218,22 +222,47 @@ xbd_queue_cb(void *arg, bus_dma_segment_
return;
}
 
-   KASSERT(nsegs <= BLKIF_MAX_SEGMENTS_PER_REQUEST,
+   KASSERT(nsegs <= sc->xbd_max_request_segments,
("Too many segments in a blkfront I/O"));
 
-   /* Fill out a communications ring structure. */
-   ring_req = RING_GET_REQUEST(&sc->xbd_ring, sc->xbd_ring.req_prod_pvt);
-   sc->xbd_ring.req_prod_pvt++;
-   ring_req->id = cm->cm_id;
-   ring_req->operation = cm->cm_operation;
-   ring_req->sector_number = cm->cm_sector_number;
-   ring_req->handle = (blkif_vdev_t)(uintptr_t)sc->xbd_disk;
-   ring_req->nr_segments = nsegs;
-   cm->cm_nseg = nsegs;
-   xbd_mksegarray(segs, nsegs, &cm->cm_gref_head,
-   xenbus_get_otherend_id(sc->xbd_dev),
-   cm->cm_operation == BLKIF_OP_WRITE,
-   cm->cm_sg_refs, ring_req->seg);
+   if (nsegs <= BLKIF_MAX_SEGMENTS_PER_REQUEST) {
+   blkif_request_t *ring_req;
+
+   /* Fill out a blkif_request_t structure. */
+   ring_req = (blkif_request_t *)
+   RING_GET_REQUEST(&sc->xbd_ring, sc->xbd_ring.req_prod_pvt);
+   sc->xbd_ring.req_prod_pvt++;
+   ring_req->id = cm->cm_id;
+   ring_req->operation = cm->cm_operation;
+   ring_req->sector_number = cm->cm_sector_number;
+   ring_req->handle = (blkif_vdev_t)(uintptr_t)sc->xbd_disk;
+   ring_req->nr_segments = nsegs;
+   cm->cm_nseg = nsegs;
+   xbd_mksegarray(segs, nsegs, &cm->cm_gref_head,
+   xenbus_get_otherend_id(sc->xbd_dev),
+   cm->cm_operation == BLKIF_OP_WRITE,
+   cm->cm_sg_refs, ring_req->seg);
+   } else {
+   blkif_request_indirect_t *ring_req;
+
+   /* Fill out a blkif_request_indirect_t structure. */
+   ring_req

svn commit: r286061 - releng/10.2/sys/dev/uart

2015-07-29 Thread Marius Strobl
Author: marius
Date: Thu Jul 30 03:06:11 2015
New Revision: 286061
URL: https://svnweb.freebsd.org/changeset/base/286061

Log:
  MFC: r285843 (r286059 in stable/10)
  
  - Since r253161, uart_intr() abuses FILTER_SCHEDULE_THREAD for signaling
uart_bus_attach() during its test that 20 iterations weren't sufficient
for clearing all pending interrupts, assuming this means that hardware
is broken and doesn't deassert interrupts. However, under pressure, 20
iterations also can be insufficient for clearing all pending interrupts,
leading to a panic as intr_event_handle() tries to schedule an interrupt
handler not registered. Solve this by introducing a flag that is set in
test mode and otherwise restores pre-r253161 behavior of uart_intr(). The
approach of additionally registering uart_intr() as handler as suggested
in PR 194979 is not taken as that in turn would abuse special pccard and
pccbb handling code of intr_event_handle(). [1]
  - Const'ify uart_driver_name.
  - Fix some minor style bugs.
  
  PR:   194979 [1]
  Reviewed by:  marcel (earlier version)
  Approved by:  re (gjb)

Modified:
  releng/10.2/sys/dev/uart/uart_bus.h
  releng/10.2/sys/dev/uart/uart_core.c
Directory Properties:
  releng/10.2/   (props changed)

Modified: releng/10.2/sys/dev/uart/uart_bus.h
==
--- releng/10.2/sys/dev/uart/uart_bus.h Thu Jul 30 02:45:35 2015
(r286060)
+++ releng/10.2/sys/dev/uart/uart_bus.h Thu Jul 30 03:06:11 2015
(r286061)
@@ -98,6 +98,7 @@ struct uart_softc {
int sc_polled:1;/* This UART has no interrupts. */
int sc_txbusy:1;/* This UART is transmitting. */
int sc_isquelch:1;  /* This UART has input squelched. */
+   int sc_testintr:1;  /* This UART is under int. testing. */
 
struct uart_devinfo *sc_sysdev; /* System device (or NULL). */
 
@@ -134,7 +135,7 @@ struct uart_softc {
 };
 
 extern devclass_t uart_devclass;
-extern char uart_driver_name[];
+extern const char uart_driver_name[];
 
 int uart_bus_attach(device_t dev);
 int uart_bus_detach(device_t dev);
@@ -156,14 +157,16 @@ void uart_tty_intr(void *arg);
 static __inline int
 uart_rx_empty(struct uart_softc *sc)
 {
+
return ((sc->sc_rxget == sc->sc_rxput) ? 1 : 0);
 }
 
 static __inline int
 uart_rx_full(struct uart_softc *sc)
 {
-   return ((sc->sc_rxput + 1 < sc->sc_rxbufsz)
-   ? (sc->sc_rxput + 1 == sc->sc_rxget) : (sc->sc_rxget == 0));
+
+   return ((sc->sc_rxput + 1 < sc->sc_rxbufsz) ?
+   (sc->sc_rxput + 1 == sc->sc_rxget) : (sc->sc_rxget == 0));
 }
 
 static __inline int

Modified: releng/10.2/sys/dev/uart/uart_core.c
==
--- releng/10.2/sys/dev/uart/uart_core.cThu Jul 30 02:45:35 2015
(r286060)
+++ releng/10.2/sys/dev/uart/uart_core.cThu Jul 30 03:06:11 2015
(r286061)
@@ -51,7 +51,7 @@ __FBSDID("$FreeBSD$");
 #include "uart_if.h"
 
 devclass_t uart_devclass;
-char uart_driver_name[] = "uart";
+const char uart_driver_name[] = "uart";
 
 SLIST_HEAD(uart_devinfo_list, uart_devinfo) uart_sysdevs =
 SLIST_HEAD_INITIALIZER(uart_sysdevs);
@@ -248,13 +248,14 @@ static int
 uart_intr(void *arg)
 {
struct uart_softc *sc = arg;
-   int cnt, ipend;
+   int cnt, ipend, testintr;
 
if (sc->sc_leaving)
return (FILTER_STRAY);
 
cnt = 0;
-   while (cnt < 20 && (ipend = UART_IPEND(sc)) != 0) {
+   testintr = sc->sc_testintr;
+   while ((!testintr || cnt < 20) && (ipend = UART_IPEND(sc)) != 0) {
cnt++;
if (ipend & SER_INT_OVERRUN)
uart_intr_overrun(sc);
@@ -265,7 +266,7 @@ uart_intr(void *arg)
if (ipend & SER_INT_SIGCHG)
uart_intr_sigchg(sc);
if (ipend & SER_INT_TXIDLE)
-   uart_intr_txidle(sc);   
+   uart_intr_txidle(sc);
}
 
if (sc->sc_polled) {
@@ -274,7 +275,8 @@ uart_intr(void *arg)
}
 
return ((cnt == 0) ? FILTER_STRAY :
-   ((cnt == 20) ? FILTER_SCHEDULE_THREAD : FILTER_HANDLED));
+   ((testintr && cnt == 20) ? FILTER_SCHEDULE_THREAD :
+   FILTER_HANDLED));
 }
 
 serdev_intr_t *
@@ -421,7 +423,7 @@ uart_bus_attach(device_t dev)
/*
 * Protect ourselves against interrupts while we're not completely
 * finished attaching and initializing. We don't expect interrupts
-* until after UART_ATTACH() though.
+* until after UART_ATTACH(), though.
 */
sc->sc_leaving = 1;
 
@@ -501,7 +503,9 @@ uart_bus_attach(device_t dev)
pps_init(&sc->sc_pps);
 
sc->sc_leaving = 0;
+   sc->sc_testintr = 1;
filt = uart_intr(sc);
+   sc->sc_testintr = 0;
 
 

Re: svn commit: r286042 - head

2015-07-29 Thread Glen Barber
On Wed, Jul 29, 2015 at 09:15:51PM +, Warner Losh wrote:
> Author: imp
> Date: Wed Jul 29 21:15:50 2015
> New Revision: 286042
> URL: https://svnweb.freebsd.org/changeset/base/286042
> 
> Log:
>   Clarify historical practice of not removing old entries. Add entry for
>   stable/10 branch that was forgotten when it was created. Update end
>   date to be correct.
> 
> Modified:
>   head/UPDATING
> 
> Modified: head/UPDATING
> ==
> --- head/UPDATING Wed Jul 29 20:50:48 2015(r286041)
> +++ head/UPDATING Wed Jul 29 21:15:50 2015(r286042)
> @@ -578,6 +578,10 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 11
> # pkg install pkg; ldd /usr/local/sbin/pkg | grep bsdyml
>  
>  20131010:
> + The stable/10 branch has been created in subversion from head
> + revision r256279.
> +
> +20131010:

Doh.  Thanks. :\

Glen



pgpJd3UbKA_rx.pgp
Description: PGP signature


svn commit: r286060 - in releng/10.2/sys: kern sparc64/include sparc64/sparc64

2015-07-29 Thread Marius Strobl
Author: marius
Date: Thu Jul 30 02:45:35 2015
New Revision: 286060
URL: https://svnweb.freebsd.org/changeset/base/286060

Log:
  MFC: r285839 (r286055 in stable/10)
  
  o Revert the other functional half of r239864, i. e. the merge of r134227
from x86 to use smp_ipi_mtx spin lock not only for smp_rendezvous_cpus()
but also for the MD cache invalidation, TLB demapping and remote register
reading IPIs due to the following reasons:
- The cross-IPI SMP deadlock x86 otherwise is subject to can't happen on
  sparc64. That's because on sparc64, spin locks don't disable interrupts
  completely but only raise the processor interrupt level to PIL_TICK. This
  means that IPIs still get delivered and direct dispatch IPIs such as the
  cache invalidation etc. IPIs in question are still executed.
- In smp_rendezvous_cpus(), smp_ipi_mtx is held not only while sending an
  IPI_RENDEZVOUS, but until all CPUs have processed smp_rendezvous_action().
  Consequently, smp_ipi_mtx may be locked for an extended amount of time as
  queued IPIs (as opposed to the direct ones) such as IPI_RENDEZVOUS are
  scheduled via a soft interrupt. Moreover, given that this soft interrupt
  is only delivered at PIL_RENDEZVOUS, processing of smp_rendezvous_action()
  on a target may be interrupted by f. e. a tick interrupt at PIL_TICK, in
  turn leading to the target in question trying to send an IPI by itself
  while IPI_RENDEZVOUS isn't fully handled, yet, and, thus, resulting in a
  deadlock.
  o As mentioned in the commit message of r245850, on least some sun4u platforms
concurrent sending of IPIs by different CPUs is fatal. Therefore, hold the
reintroduced MD ipi_mtx also while delivering cross-traps via MI helpers,
i. e. ipi_{all_but_self,cpu,selected}().
  o Akin to x86, let the last CPU to process cpu_mp_bootstrap() set smp_started
instead of the BSP in cpu_mp_unleash(). This ensures that all APs actually
are started, when smp_started is no longer 0.
  o In all MD and MI IPI helpers, check for smp_started == 1 rather than for
smp_cpus > 1 or nothing at all. This avoids races during boot causing IPIs
trying to be delivered to APs that in fact aren't up and running, yet.
While at it, move setting of the cpu_ipi_{selected,single}() pointers to
the appropriate delivery functions from mp_init() to cpu_mp_start() where
it's better suited and allows to get rid of the global isjbus variable.
  o Given that now concurrent IPI delivery no longer is possible, also nuke
the delays before completely disabling interrupts again in the CPU-specific
cross-trap delivery functions, previously giving other CPUs a window for
sending IPIs on their part. Actually, we now should be able to entirely get
rid of completely disabling interrupts in these functions. Such a change
needs more testing, though.
  o In {s,}tick_get_timecount_mp(), make the {s,}tick variable static. While not
necessary for correctness, this avoids page faults when accessing the stack
of a foreign CPU as {s,}tick now is locked into the TLBs as part of static
kernel data. Hence, {s,}tick_get_timecount_mp() always execute as fast as
possible, avoiding jitter.
  
  PR:   201245
  Approved by:  re (gjb)

Modified:
  releng/10.2/sys/kern/subr_witness.c
  releng/10.2/sys/sparc64/include/smp.h
  releng/10.2/sys/sparc64/sparc64/machdep.c
  releng/10.2/sys/sparc64/sparc64/mp_machdep.c
  releng/10.2/sys/sparc64/sparc64/tick.c
Directory Properties:
  releng/10.2/   (props changed)

Modified: releng/10.2/sys/kern/subr_witness.c
==
--- releng/10.2/sys/kern/subr_witness.c Thu Jul 30 02:23:09 2015
(r286059)
+++ releng/10.2/sys/kern/subr_witness.c Thu Jul 30 02:45:35 2015
(r286060)
@@ -666,6 +666,9 @@ static struct witness_order_list_entry o
 */
{ "intrcnt", &lock_class_mtx_spin },
{ "icu", &lock_class_mtx_spin },
+#if defined(SMP) && defined(__sparc64__)
+   { "ipi", &lock_class_mtx_spin },
+#endif
 #ifdef __i386__
{ "allpmaps", &lock_class_mtx_spin },
{ "descriptor tables", &lock_class_mtx_spin },

Modified: releng/10.2/sys/sparc64/include/smp.h
==
--- releng/10.2/sys/sparc64/include/smp.h   Thu Jul 30 02:23:09 2015
(r286059)
+++ releng/10.2/sys/sparc64/include/smp.h   Thu Jul 30 02:45:35 2015
(r286060)
@@ -39,13 +39,15 @@
 
 #ifndefLOCORE
 
+#include 
 #include 
+#include 
+#include 
 #include 
 #include 
 #include 
 
 #include 
-#include 
 #include 
 
 #defineIDR_BUSY0x0001ULL
@@ -96,6 +98,7 @@ struct ipi_tlb_args {
 };
 #defineita_va  ita_start
 
+struct pcb;
 struct pcpu;
 
 extern struct pcb stoppcbs[];
@@ -108,8 +111,9 @@ extern  cpu_ipi_selected_t *

svn commit: r286059 - stable/10/sys/dev/uart

2015-07-29 Thread Marius Strobl
Author: marius
Date: Thu Jul 30 02:23:09 2015
New Revision: 286059
URL: https://svnweb.freebsd.org/changeset/base/286059

Log:
  MFC: r285843
  
  - Since r253161, uart_intr() abuses FILTER_SCHEDULE_THREAD for signaling
uart_bus_attach() during its test that 20 iterations weren't sufficient
for clearing all pending interrupts, assuming this means that hardware
is broken and doesn't deassert interrupts. However, under pressure, 20
iterations also can be insufficient for clearing all pending interrupts,
leading to a panic as intr_event_handle() tries to schedule an interrupt
handler not registered. Solve this by introducing a flag that is set in
test mode and otherwise restores pre-r253161 behavior of uart_intr(). The
approach of additionally registering uart_intr() as handler as suggested
in PR 194979 is not taken as that in turn would abuse special pccard and
pccbb handling code of intr_event_handle(). [1]
  - Const'ify uart_driver_name.
  - Fix some minor style bugs.
  
  PR:   194979 [1]
  Reviewed by:  marcel (earlier version)

Modified:
  stable/10/sys/dev/uart/uart_bus.h
  stable/10/sys/dev/uart/uart_core.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/uart/uart_bus.h
==
--- stable/10/sys/dev/uart/uart_bus.h   Thu Jul 30 02:22:38 2015
(r286058)
+++ stable/10/sys/dev/uart/uart_bus.h   Thu Jul 30 02:23:09 2015
(r286059)
@@ -98,6 +98,7 @@ struct uart_softc {
int sc_polled:1;/* This UART has no interrupts. */
int sc_txbusy:1;/* This UART is transmitting. */
int sc_isquelch:1;  /* This UART has input squelched. */
+   int sc_testintr:1;  /* This UART is under int. testing. */
 
struct uart_devinfo *sc_sysdev; /* System device (or NULL). */
 
@@ -134,7 +135,7 @@ struct uart_softc {
 };
 
 extern devclass_t uart_devclass;
-extern char uart_driver_name[];
+extern const char uart_driver_name[];
 
 int uart_bus_attach(device_t dev);
 int uart_bus_detach(device_t dev);
@@ -156,14 +157,16 @@ void uart_tty_intr(void *arg);
 static __inline int
 uart_rx_empty(struct uart_softc *sc)
 {
+
return ((sc->sc_rxget == sc->sc_rxput) ? 1 : 0);
 }
 
 static __inline int
 uart_rx_full(struct uart_softc *sc)
 {
-   return ((sc->sc_rxput + 1 < sc->sc_rxbufsz)
-   ? (sc->sc_rxput + 1 == sc->sc_rxget) : (sc->sc_rxget == 0));
+
+   return ((sc->sc_rxput + 1 < sc->sc_rxbufsz) ?
+   (sc->sc_rxput + 1 == sc->sc_rxget) : (sc->sc_rxget == 0));
 }
 
 static __inline int

Modified: stable/10/sys/dev/uart/uart_core.c
==
--- stable/10/sys/dev/uart/uart_core.c  Thu Jul 30 02:22:38 2015
(r286058)
+++ stable/10/sys/dev/uart/uart_core.c  Thu Jul 30 02:23:09 2015
(r286059)
@@ -51,7 +51,7 @@ __FBSDID("$FreeBSD$");
 #include "uart_if.h"
 
 devclass_t uart_devclass;
-char uart_driver_name[] = "uart";
+const char uart_driver_name[] = "uart";
 
 SLIST_HEAD(uart_devinfo_list, uart_devinfo) uart_sysdevs =
 SLIST_HEAD_INITIALIZER(uart_sysdevs);
@@ -248,13 +248,14 @@ static int
 uart_intr(void *arg)
 {
struct uart_softc *sc = arg;
-   int cnt, ipend;
+   int cnt, ipend, testintr;
 
if (sc->sc_leaving)
return (FILTER_STRAY);
 
cnt = 0;
-   while (cnt < 20 && (ipend = UART_IPEND(sc)) != 0) {
+   testintr = sc->sc_testintr;
+   while ((!testintr || cnt < 20) && (ipend = UART_IPEND(sc)) != 0) {
cnt++;
if (ipend & SER_INT_OVERRUN)
uart_intr_overrun(sc);
@@ -265,7 +266,7 @@ uart_intr(void *arg)
if (ipend & SER_INT_SIGCHG)
uart_intr_sigchg(sc);
if (ipend & SER_INT_TXIDLE)
-   uart_intr_txidle(sc);   
+   uart_intr_txidle(sc);
}
 
if (sc->sc_polled) {
@@ -274,7 +275,8 @@ uart_intr(void *arg)
}
 
return ((cnt == 0) ? FILTER_STRAY :
-   ((cnt == 20) ? FILTER_SCHEDULE_THREAD : FILTER_HANDLED));
+   ((testintr && cnt == 20) ? FILTER_SCHEDULE_THREAD :
+   FILTER_HANDLED));
 }
 
 serdev_intr_t *
@@ -421,7 +423,7 @@ uart_bus_attach(device_t dev)
/*
 * Protect ourselves against interrupts while we're not completely
 * finished attaching and initializing. We don't expect interrupts
-* until after UART_ATTACH() though.
+* until after UART_ATTACH(), though.
 */
sc->sc_leaving = 1;
 
@@ -501,7 +503,9 @@ uart_bus_attach(device_t dev)
pps_init(&sc->sc_pps);
 
sc->sc_leaving = 0;
+   sc->sc_testintr = 1;
filt = uart_intr(sc);
+   sc->sc_testintr = 0;
 
/*
 * Don't use interrupts if we couldn't clear any pending int

svn commit: r286058 - releng/10.2/sys/dev/hyperv/netvsc

2015-07-29 Thread Wei Hu
Author: whu
Date: Thu Jul 30 02:22:38 2015
New Revision: 286058
URL: https://svnweb.freebsd.org/changeset/base/286058

Log:
  MFC r285928 Do not enable UDP checksum offloading when running on the
  Hyper-V on Windows Server 2012 and earlier hosts.
  
  Submitted by: whu
  Reviewed by: royger
  Approved by: re (gjb)
  Sponsored by: Microsoft OSTC
  Differential Revision: https://reviews.freebsd.org/D3102

Modified:
  releng/10.2/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
Directory Properties:
  releng/10.2/   (props changed)

Modified: releng/10.2/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
==
--- releng/10.2/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c   Thu Jul 30 
02:09:03 2015(r286057)
+++ releng/10.2/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c   Thu Jul 30 
02:22:38 2015(r286058)
@@ -343,7 +343,15 @@ netvsc_attach(device_t dev)
IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_MTU | IFCAP_HWCSUM | IFCAP_TSO;
ifp->if_capenable |=
IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_MTU | IFCAP_HWCSUM | IFCAP_TSO;
-   ifp->if_hwassist = CSUM_TCP | CSUM_UDP | CSUM_TSO;
+   /*
+* Only enable UDP checksum offloading when it is on 2012R2 or
+* later. UDP checksum offloading doesn't work on earlier
+* Windows releases.
+*/
+   if (hv_vmbus_protocal_version >= HV_VMBUS_VERSION_WIN8_1)
+   ifp->if_hwassist = CSUM_TCP | CSUM_UDP | CSUM_TSO;
+   else
+   ifp->if_hwassist = CSUM_TCP | CSUM_TSO;
 
ret = hv_rf_on_device_add(device_ctx, &device_info);
if (ret != 0) {
@@ -1110,7 +1118,17 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, 
ifp->if_hwassist &= ~(CSUM_TCP | CSUM_UDP);
} else {
ifp->if_capenable |= IFCAP_TXCSUM;
-   ifp->if_hwassist |= (CSUM_TCP | CSUM_UDP);
+   /*
+* Only enable UDP checksum offloading on
+* Windows Server 2012R2 or later releases.
+*/
+   if (hv_vmbus_protocal_version >=
+   HV_VMBUS_VERSION_WIN8_1) {
+   ifp->if_hwassist |=
+   (CSUM_TCP | CSUM_UDP);
+   } else {
+   ifp->if_hwassist |= CSUM_TCP;
+   }
}
}
 
___
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: r286057 - head/sys/net

2015-07-29 Thread Luiz Otavio O Souza
Author: loos
Date: Thu Jul 30 02:09:03 2015
New Revision: 286057
URL: https://svnweb.freebsd.org/changeset/base/286057

Log:
  Follow r256586 and rename the kernel version of the Free() macro to
  R_Free().  This matches the other macros and reduces the chances to clash
  with other headers.
  
  This also fixes the build of radix.c outside of the kernel environment.
  
  Reviewed by:  glebius

Modified:
  head/sys/net/radix.c
  head/sys/net/radix.h
  head/sys/net/route.c

Modified: head/sys/net/radix.c
==
--- head/sys/net/radix.cThu Jul 30 02:06:34 2015(r286056)
+++ head/sys/net/radix.cThu Jul 30 02:09:03 2015(r286057)
@@ -533,7 +533,7 @@ rn_addmask(void *n_arg, struct radix_nod
x = rn_insert(cp, maskhead, &maskduplicated, x);
if (maskduplicated) {
log(LOG_ERR, "rn_addmask: mask impossibly already in tree");
-   Free(saved_x);
+   R_Free(saved_x);
return (x);
}
/*
@@ -829,7 +829,7 @@ rn_delete(void *v_arg, void *netmask_arg
for (mp = &x->rn_mklist; (m = *mp); mp = &m->rm_mklist)
if (m == saved_m) {
*mp = m->rm_mklist;
-   Free(m);
+   R_Free(m);
break;
}
if (m == 0) {
@@ -920,7 +920,7 @@ on1:
struct radix_mask *mm = m->rm_mklist;
x->rn_mklist = 0;
if (--(m->rm_refs) < 0)
-   Free(m);
+   R_Free(m);
m = mm;
}
if (m)
@@ -1152,7 +1152,7 @@ rn_detachhead_internal(void **head)
rnh = *head;

/* Free  nodes. */
-   Free(rnh);
+   R_Free(rnh);
 
*head = NULL;
 }
@@ -1186,7 +1186,7 @@ rn_freeentry(struct radix_node *rn, void
 
x = (struct radix_node *)rn_delete(rn + 2, NULL, rnh);
if (x != NULL)
-   Free(x);
+   R_Free(x);
return (0);
 }
 

Modified: head/sys/net/radix.h
==
--- head/sys/net/radix.hThu Jul 30 02:06:34 2015(r286056)
+++ head/sys/net/radix.hThu Jul 30 02:09:03 2015(r286057)
@@ -137,7 +137,7 @@ struct radix_node_head {
 #else
 #define R_Malloc(p, t, n) (p = (t) malloc((unsigned long)(n), M_RTABLE, 
M_NOWAIT))
 #define R_Zalloc(p, t, n) (p = (t) malloc((unsigned long)(n), M_RTABLE, 
M_NOWAIT | M_ZERO))
-#define Free(p) free((caddr_t)p, M_RTABLE);
+#define R_Free(p) free((caddr_t)p, M_RTABLE);
 
 #defineRADIX_NODE_HEAD_LOCK_INIT(rnh)  \
 rw_init_flags(&(rnh)->rnh_lock, "radix node head", 0)

Modified: head/sys/net/route.c
==
--- head/sys/net/route.cThu Jul 30 02:06:34 2015(r286056)
+++ head/sys/net/route.cThu Jul 30 02:09:03 2015(r286057)
@@ -519,7 +519,7 @@ rtfree(struct rtentry *rt)
 * This also frees the gateway, as they are always malloc'd
 * together.
 */
-   Free(rt_key(rt));
+   R_Free(rt_key(rt));
 
/*
 * and the rtentry itself of course
@@ -1352,7 +1352,7 @@ rtrequest1_fib(int req, struct rt_addrin
if (rn_mpath_capable(rnh) &&
rt_mpath_conflict(rnh, rt, netmask)) {
ifa_free(rt->rt_ifa);
-   Free(rt_key(rt));
+   R_Free(rt_key(rt));
uma_zfree(V_rtzone, rt);
senderr(EEXIST);
}
@@ -1419,7 +1419,7 @@ rtrequest1_fib(int req, struct rt_addrin
 */
if (rn == NULL) {
ifa_free(rt->rt_ifa);
-   Free(rt_key(rt));
+   R_Free(rt_key(rt));
uma_zfree(V_rtzone, rt);
 #ifdef FLOWTABLE
if (rt0 != NULL)
@@ -1641,7 +1641,7 @@ rt_setgate(struct rtentry *rt, struct so
 * Free()/free() handle a NULL argument just fine.
 */
bcopy(dst, new, dlen);
-   Free(rt_key(rt));   /* free old block, if any */
+   R_Free(rt_key(rt)); /* free old block, if any */
rt_key(rt) = (struct sockaddr *)new;
rt->rt_gateway = (struct sockaddr *)(new + dlen);
}
___
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: r286056 - in stable/9/sys: kern sparc64/include sparc64/sparc64

2015-07-29 Thread Marius Strobl
Author: marius
Date: Thu Jul 30 02:06:34 2015
New Revision: 286056
URL: https://svnweb.freebsd.org/changeset/base/286056

Log:
  MFC: r285839
  
  o Revert the other functional half of r239864 (MFCed to stable/9 in r241681),
i. e. the merge of r134227 from x86 to use smp_ipi_mtx spin lock not only
for smp_rendezvous_cpus() but also for the MD cache invalidation, TLB
demapping and remote register reading IPIs due to the following reasons:
- The cross-IPI SMP deadlock x86 otherwise is subject to can't happen on
  sparc64. That's because on sparc64, spin locks don't disable interrupts
  completely but only raise the processor interrupt level to PIL_TICK. This
  means that IPIs still get delivered and direct dispatch IPIs such as the
  cache invalidation etc. IPIs in question are still executed.
- In smp_rendezvous_cpus(), smp_ipi_mtx is held not only while sending an
  IPI_RENDEZVOUS, but until all CPUs have processed smp_rendezvous_action().
  Consequently, smp_ipi_mtx may be locked for an extended amount of time as
  queued IPIs (as opposed to the direct ones) such as IPI_RENDEZVOUS are
  scheduled via a soft interrupt. Moreover, given that this soft interrupt
  is only delivered at PIL_RENDEZVOUS, processing of smp_rendezvous_action()
  on a target may be interrupted by f. e. a tick interrupt at PIL_TICK, in
  turn leading to the target in question trying to send an IPI by itself
  while IPI_RENDEZVOUS isn't fully handled, yet, and, thus, resulting in a
  deadlock.
  o As mentioned in the commit message of r245850, on least some sun4u platforms
concurrent sending of IPIs by different CPUs is fatal. Therefore, hold the
reintroduced MD ipi_mtx also while delivering cross-traps via MI helpers,
i. e. ipi_{all_but_self,cpu,selected}().
  o Akin to x86, let the last CPU to process cpu_mp_bootstrap() set smp_started
instead of the BSP in cpu_mp_unleash(). This ensures that all APs actually
are started, when smp_started is no longer 0.
  o In all MD and MI IPI helpers, check for smp_started == 1 rather than for
smp_cpus > 1 or nothing at all. This avoids races during boot causing IPIs
trying to be delivered to APs that in fact aren't up and running, yet.
While at it, move setting of the cpu_ipi_{selected,single}() pointers to
the appropriate delivery functions from mp_init() to cpu_mp_start() where
it's better suited and allows to get rid of the global isjbus variable.
  o Given that now concurrent IPI delivery no longer is possible, also nuke
the delays before completely disabling interrupts again in the CPU-specific
cross-trap delivery functions, previously giving other CPUs a window for
sending IPIs on their part. Actually, we now should be able to entirely get
rid of completely disabling interrupts in these functions. Such a change
needs more testing, though.
  o In {s,}tick_get_timecount_mp(), make the {s,}tick variable static. While not
necessary for correctness, this avoids page faults when accessing the stack
of a foreign CPU as {s,}tick now is locked into the TLBs as part of static
kernel data. Hence, {s,}tick_get_timecount_mp() always execute as fast as
possible, avoiding jitter.
  
  PR:   201245

Modified:
  stable/9/sys/kern/subr_witness.c
  stable/9/sys/sparc64/include/smp.h
  stable/9/sys/sparc64/sparc64/machdep.c
  stable/9/sys/sparc64/sparc64/mp_machdep.c
  stable/9/sys/sparc64/sparc64/tick.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/kern/subr_witness.c
==
--- stable/9/sys/kern/subr_witness.cThu Jul 30 02:06:29 2015
(r286055)
+++ stable/9/sys/kern/subr_witness.cThu Jul 30 02:06:34 2015
(r286056)
@@ -662,6 +662,9 @@ static struct witness_order_list_entry o
 */
{ "intrcnt", &lock_class_mtx_spin },
{ "icu", &lock_class_mtx_spin },
+#if defined(SMP) && defined(__sparc64__)
+   { "ipi", &lock_class_mtx_spin },
+#endif
 #ifdef __i386__
{ "allpmaps", &lock_class_mtx_spin },
{ "descriptor tables", &lock_class_mtx_spin },

Modified: stable/9/sys/sparc64/include/smp.h
==
--- stable/9/sys/sparc64/include/smp.h  Thu Jul 30 02:06:29 2015
(r286055)
+++ stable/9/sys/sparc64/include/smp.h  Thu Jul 30 02:06:34 2015
(r286056)
@@ -39,13 +39,15 @@
 
 #ifndefLOCORE
 
+#include 
 #include 
+#include 
+#include 
 #include 
 #include 
 #include 
 
 #include 
-#include 
 #include 
 
 #defineIDR_BUSY0x0001ULL
@@ -96,6 +98,7 @@ struct ipi_tlb_args {
 };
 #defineita_va  ita_start
 
+struct pcb;
 struct pcpu;
 
 extern struct pcb stoppcbs[];
@@ -108,8 +111,9 @@ extern  cpu_ipi_selected_t *cpu_ipi_selec
 typedefvoid cpu_ipi_single_t(u

svn commit: r286055 - in stable/10/sys: kern sparc64/include sparc64/sparc64

2015-07-29 Thread Marius Strobl
Author: marius
Date: Thu Jul 30 02:06:29 2015
New Revision: 286055
URL: https://svnweb.freebsd.org/changeset/base/286055

Log:
  MFC: r285839
  
  o Revert the other functional half of r239864, i. e. the merge of r134227
from x86 to use smp_ipi_mtx spin lock not only for smp_rendezvous_cpus()
but also for the MD cache invalidation, TLB demapping and remote register
reading IPIs due to the following reasons:
- The cross-IPI SMP deadlock x86 otherwise is subject to can't happen on
  sparc64. That's because on sparc64, spin locks don't disable interrupts
  completely but only raise the processor interrupt level to PIL_TICK. This
  means that IPIs still get delivered and direct dispatch IPIs such as the
  cache invalidation etc. IPIs in question are still executed.
- In smp_rendezvous_cpus(), smp_ipi_mtx is held not only while sending an
  IPI_RENDEZVOUS, but until all CPUs have processed smp_rendezvous_action().
  Consequently, smp_ipi_mtx may be locked for an extended amount of time as
  queued IPIs (as opposed to the direct ones) such as IPI_RENDEZVOUS are
  scheduled via a soft interrupt. Moreover, given that this soft interrupt
  is only delivered at PIL_RENDEZVOUS, processing of smp_rendezvous_action()
  on a target may be interrupted by f. e. a tick interrupt at PIL_TICK, in
  turn leading to the target in question trying to send an IPI by itself
  while IPI_RENDEZVOUS isn't fully handled, yet, and, thus, resulting in a
  deadlock.
  o As mentioned in the commit message of r245850, on least some sun4u platforms
concurrent sending of IPIs by different CPUs is fatal. Therefore, hold the
reintroduced MD ipi_mtx also while delivering cross-traps via MI helpers,
i. e. ipi_{all_but_self,cpu,selected}().
  o Akin to x86, let the last CPU to process cpu_mp_bootstrap() set smp_started
instead of the BSP in cpu_mp_unleash(). This ensures that all APs actually
are started, when smp_started is no longer 0.
  o In all MD and MI IPI helpers, check for smp_started == 1 rather than for
smp_cpus > 1 or nothing at all. This avoids races during boot causing IPIs
trying to be delivered to APs that in fact aren't up and running, yet.
While at it, move setting of the cpu_ipi_{selected,single}() pointers to
the appropriate delivery functions from mp_init() to cpu_mp_start() where
it's better suited and allows to get rid of the global isjbus variable.
  o Given that now concurrent IPI delivery no longer is possible, also nuke
the delays before completely disabling interrupts again in the CPU-specific
cross-trap delivery functions, previously giving other CPUs a window for
sending IPIs on their part. Actually, we now should be able to entirely get
rid of completely disabling interrupts in these functions. Such a change
needs more testing, though.
  o In {s,}tick_get_timecount_mp(), make the {s,}tick variable static. While not
necessary for correctness, this avoids page faults when accessing the stack
of a foreign CPU as {s,}tick now is locked into the TLBs as part of static
kernel data. Hence, {s,}tick_get_timecount_mp() always execute as fast as
possible, avoiding jitter.
  
  PR:   201245

Modified:
  stable/10/sys/kern/subr_witness.c
  stable/10/sys/sparc64/include/smp.h
  stable/10/sys/sparc64/sparc64/machdep.c
  stable/10/sys/sparc64/sparc64/mp_machdep.c
  stable/10/sys/sparc64/sparc64/tick.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/kern/subr_witness.c
==
--- stable/10/sys/kern/subr_witness.c   Thu Jul 30 00:28:32 2015
(r286054)
+++ stable/10/sys/kern/subr_witness.c   Thu Jul 30 02:06:29 2015
(r286055)
@@ -666,6 +666,9 @@ static struct witness_order_list_entry o
 */
{ "intrcnt", &lock_class_mtx_spin },
{ "icu", &lock_class_mtx_spin },
+#if defined(SMP) && defined(__sparc64__)
+   { "ipi", &lock_class_mtx_spin },
+#endif
 #ifdef __i386__
{ "allpmaps", &lock_class_mtx_spin },
{ "descriptor tables", &lock_class_mtx_spin },

Modified: stable/10/sys/sparc64/include/smp.h
==
--- stable/10/sys/sparc64/include/smp.h Thu Jul 30 00:28:32 2015
(r286054)
+++ stable/10/sys/sparc64/include/smp.h Thu Jul 30 02:06:29 2015
(r286055)
@@ -39,13 +39,15 @@
 
 #ifndefLOCORE
 
+#include 
 #include 
+#include 
+#include 
 #include 
 #include 
 #include 
 
 #include 
-#include 
 #include 
 
 #defineIDR_BUSY0x0001ULL
@@ -96,6 +98,7 @@ struct ipi_tlb_args {
 };
 #defineita_va  ita_start
 
+struct pcb;
 struct pcpu;
 
 extern struct pcb stoppcbs[];
@@ -108,8 +111,9 @@ extern  cpu_ipi_selected_t *cpu_ipi_selec
 typedefvoid cpu_ipi_single_t(u_int, u_long, u_long, u_lon

Re: svn commit: r285997 - head/usr.sbin/pw

2015-07-29 Thread Bruce Evans

On Wed, 29 Jul 2015, Baptiste Daroussin wrote:


Log:
 Actually add the new code


I shouldn't have asked for this.  It gives more to clean up.  It has 1
large bug and many style bugs.


Added: head/usr.sbin/pw/strtounum.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/usr.sbin/pw/strtounum.cWed Jul 29 06:23:06 2015
(r285997)
@@ -0,0 +1,73 @@
...
+#define INVALID"invalid"
+#define TOOSMALL   "too small"
+#defineTOOLARGE"too large"


Style bugs:
- space instead of tab after #define
- not even consistent space instead of tab after #define
- unsorted defines.

The unsorting is for bug compatible with strtonum.c.  strtonum.c doesn't
have the tab bugs.  It uses these definitions to obfuscate the code even
better.  Here the definintions are of string literals which are used only
once except for INVALID.  The obfuscation is to add a layer of indirection
to these literals.  This might save a few bytes of object code for a 1975
compiler by avoiding duplication of the "invalid".  strtonum.c uses the
larger obfuscation of indirection through a table.  This allows it to
have more compact code (basically by setting the index and falling through
to common code for returning).  This probably saves a few bytes of object
code even for current compilers.


+uintmax_t
+strtounum(const char *numstr, uintmax_t minval, uintmax_t maxval,
+const char **errstrp)
+{
+   uintmax_t ret = 0;


Style bug: initialization in declaration.  strtonum.c has the same bug.
The bug is larger here.  Here, the result of the initialization is not
even used.  In strtonum.c, it is part of the obfuscations.  The variable
must be inititialized early so that it is initialized after falling
through to the common code at the end.  But initializing in its
declaration obfuscates that it is being initialixed for this reason.


+   char *ep;


Style bug: unsorted declarations.  Pointers should be sorted before scalars.
strtonum.c has the same bug.

The rest of the initializations are much cleaner than in strtonum.c.  There
are no more, but strtonum has a mess to set up the table, and another
valriable initialized in its declaration to use after falling through.
The table is static and const, but is declared as auto and non-const.
This is a good pessimization for old compilers.  They will laboriously
construct it on every entry to the function.


+
+   if (minval > maxval) {
+   errno = EINVAL;
+   if (errstrp != NULL)
+   *errstrp = INVALID;
+   return (0);


strtonum.c uses its fall-through obfuscations here and elsewhere.  It
sets only an index variable here, and falls through to its general code
that looks up the errno and string associated with this index.

This is much better, except it should just set *errstrp to "invalid",
or better change the API by changing this string to something like
"doofus" to indicate that it is a programming error and not invalid
input.  The change is easier without the complications from the table
or an API to preserve.


+   }
+


Style bug: extra blank line.


+   ret = strtoumax(numstr, &ep, 10);


Large bug here.  The setting of errno to 0 is missing.  This bug is not
in strtonum.c.


+   if (errno == EINVAL || numstr == ep || *ep != '\0') {


Style bugs:
- unportable code
- dead code
- backwards order of check in dead code

Setting errno to EINVAL for certain errors is a POSIX extension.  It is
not in C99.  This style bug is made fatal by not setting errno to 0
before calling the function.  On success, errno has its previous value
which may be EINVAL.

All this unportability does is allow you to omit the numstr == ep check,
but the above doesn't even omit it.

Using the unportable check takes twice as much code for a non-broken
version, or 3 times as much with the redundancy:

Broken:
if (errno == EINVAL ...
Correct:
errno = 0; ...
if (errno == EINVAL ...
Broken and redundant:
if (errno == EINVAL || numstr == ep ...
Correct and redundant:
errno = 0; ...
if (errno == EINVAL || numstr == ep ...

except errno must be set to 0 in most uses so that the ERANGE check is
not broken and then using the unportability doesn't take more code.

The backwards order is numstr == ep instead of ep == numstr.


+   errno = EINVAL;
+   if (errstrp != NULL)
+   *errstrp = INVALID;


This is the only definition that is used twice.  It is still clearer to
return the literal "invalid".


+   return (0);
+   } else if ((ret == 0 && errno == ERANGE) || ret < minval) {


Style bug: redndant 'else'.  The 'if' clause always returns, so 'else' here
has no effect except to obfuscate that.  An 'else if' ladder with some
redundant else's can be clearer if in more complicated cases if it is
done consisten

svn commit: r286054 - stable/9/sys/dev/mii

2015-07-29 Thread Marius Strobl
Author: marius
Date: Thu Jul 30 00:28:32 2015
New Revision: 286054
URL: https://svnweb.freebsd.org/changeset/base/286054

Log:
  MFC: r284447, r284552
  
  Merge from NetBSD:
  o rev. 1.10: Nuke trailing whitespace.
  o rev. 1.15: Fix typo in comment.
  o rev. 1.16: Add the following registers from IEEE 802.3-2009 Clause 22:
   - PSE control register (0x0b)
   - PSE status register (0x0c)
   - MMD access control register (0x0d)
   - MMD access address data register (0x0e)
  o rev. 1.17 (comments only): The bit location of link ability is different
between 1000Base-X and others (see Annex 28B.2 and 28D).
  o rev. 1.18: Nuke dupe word.
  
  Obtained from:NetBSD
  Sponsored by: genua mbh

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

Modified: stable/9/sys/dev/mii/mii.h
==
--- stable/9/sys/dev/mii/mii.h  Thu Jul 30 00:28:27 2015(r286053)
+++ stable/9/sys/dev/mii/mii.h  Thu Jul 30 00:28:32 2015(r286054)
@@ -1,4 +1,4 @@
-/* $NetBSD: mii.h,v 1.9 2001/05/31 03:07:14 thorpej Exp $  */
+/* $NetBSD: mii.h,v 1.18 2014/06/16 14:43:22 msaitoh Exp $ */
 
 /*-
  * Copyright (c) 1997 Manuel Bouyer.  All rights reserved.
@@ -87,7 +87,7 @@
 /*
  * Note that the EXTSTAT bit indicates that there is extended status
  * info available in register 15, but 802.3 section 22.2.4.3 also
- * states that that all 1000 Mb/s capable PHYs will set this bit to 1.
+ * states that all 1000 Mb/s capable PHYs will set this bit to 1.
  */
 
 #defineBMSR_MEDIAMASK  (BMSR_100T4|BMSR_100TXFDX|BMSR_100TXHDX| \
@@ -111,6 +111,7 @@
 #define ANAR_NP0x8000  /* Next page (ro) */
 #defineANAR_ACK0x4000  /* link partner abilities acknowledged 
(ro) */
 #define ANAR_RF0x2000  /* remote fault (ro) */
+   /* Annex 28B.2 */
 #defineANAR_FC 0x0400  /* local device supports PAUSE */
 #define ANAR_T40x0200  /* local device supports 100bT4 */
 #define ANAR_TX_FD 0x0100  /* local device supports 100bTx FD */
@@ -123,6 +124,7 @@
 #defineANAR_PAUSE_ASYM (2 << 10)
 #defineANAR_PAUSE_TOWARDS  (3 << 10)
 
+   /* Annex 28D */
 #defineANAR_X_FD   0x0020  /* local device supports 1000BASE-X FD 
*/
 #defineANAR_X_HD   0x0040  /* local device supports 1000BASE-X HD 
*/
 #defineANAR_X_PAUSE_NONE   (0 << 7)
@@ -184,12 +186,47 @@
 #defineGTSR_MAN_MS_FLT 0x8000  /* master/slave config fault */
 #defineGTSR_MS_RES 0x4000  /* result: 1 = master, 0 = slave */
 #defineGTSR_LRS0x2000  /* local rx status, 1 = ok */
-#defineGTSR_RRS0x1000  /* remove rx status, 1 = ok */
+#defineGTSR_RRS0x1000  /* remote rx status, 1 = ok */
 #defineGTSR_LP_1000TFDX 0x0800 /* link partner 1000baseT FDX capable */
 #defineGTSR_LP_1000THDX 0x0400 /* link partner 1000baseT HDX capable */
 #defineGTSR_LP_ASM_DIR 0x0200  /* link partner asym. pause dir. 
capable */
 #defineGTSR_IDLE_ERR   0x00ff  /* IDLE error count */
 
+#defineMII_PSECR   0x0b/* PSE control register */
+#definePSECR_PACTLMASK 0x000c  /* pair control mask */
+#definePSECR_PSEENMASK 0x0003  /* PSE enable mask */
+#definePSECR_PINOUTB   0x0008  /* PSE pinout Alternative B */
+#definePSECR_PINOUTA   0x0004  /* PSE pinout Alternative A */
+#definePSECR_FOPOWTST  0x0002  /* Force Power Test Mode */
+#definePSECR_PSEEN 0x0001  /* PSE Enabled */
+#definePSECR_PSEDIS0x  /* PSE Disabled */
+
+#defineMII_PSESR   0x0c/* PSE status register */
+#definePSESR_PWRDENIED 0x1000  /* Power Denied */
+#definePSESR_VALSIG0x0800  /* Valid PD signature detected */
+#definePSESR_INVALSIG  0x0400  /* Invalid PD signature detected */
+#definePSESR_SHORTCIRC 0x0200  /* Short circuit condition detected */
+#definePSESR_OVERLOAD  0x0100  /* Overload condition detected */
+#definePSESR_MPSABSENT 0x0080  /* MPS absent condition detected */
+#definePSESR_PDCLMASK  0x0070  /* PD Class mask */
+#definePSESR_STATMASK  0x000e  /* PSE Status mask */
+#definePSESR_PAIRCTABL 0x0001  /* PAIR Control Ability */
+#definePSESR_PDCL_4(4 << 4)/* Class 4 */
+#definePSESR_PDCL_3(3 << 4)/* Class 3 */
+#definePSESR_PDCL_2(2 << 4)/* Class 2 */
+#definePSESR_PDCL_1(1 << 4)/* Class 1 */
+#definePSESR_PDCL_0(0 << 4)/* Class 0 */
+
+#defineMII_MMDACR  0x0d/* MMD access control register */
+#defineMMDACR_FUNCMASK 0xc000  /* function */
+#defineMMDACR_DADDRMASK 0x001f /* device ad

svn commit: r286053 - stable/10/sys/dev/mii

2015-07-29 Thread Marius Strobl
Author: marius
Date: Thu Jul 30 00:28:27 2015
New Revision: 286053
URL: https://svnweb.freebsd.org/changeset/base/286053

Log:
  MFC: r284447, r284552
  
  Merge from NetBSD:
  o rev. 1.10: Nuke trailing whitespace.
  o rev. 1.15: Fix typo in comment.
  o rev. 1.16: Add the following registers from IEEE 802.3-2009 Clause 22:
   - PSE control register (0x0b)
   - PSE status register (0x0c)
   - MMD access control register (0x0d)
   - MMD access address data register (0x0e)
  o rev. 1.17 (comments only): The bit location of link ability is different
between 1000Base-X and others (see Annex 28B.2 and 28D).
  o rev. 1.18: Nuke dupe word.
  
  Obtained from:NetBSD
  Sponsored by: genua mbh

Modified:
  stable/10/sys/dev/mii/mii.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/mii/mii.h
==
--- stable/10/sys/dev/mii/mii.h Thu Jul 30 00:24:21 2015(r286052)
+++ stable/10/sys/dev/mii/mii.h Thu Jul 30 00:28:27 2015(r286053)
@@ -1,4 +1,4 @@
-/* $NetBSD: mii.h,v 1.9 2001/05/31 03:07:14 thorpej Exp $  */
+/* $NetBSD: mii.h,v 1.18 2014/06/16 14:43:22 msaitoh Exp $ */
 
 /*-
  * Copyright (c) 1997 Manuel Bouyer.  All rights reserved.
@@ -87,7 +87,7 @@
 /*
  * Note that the EXTSTAT bit indicates that there is extended status
  * info available in register 15, but 802.3 section 22.2.4.3 also
- * states that that all 1000 Mb/s capable PHYs will set this bit to 1.
+ * states that all 1000 Mb/s capable PHYs will set this bit to 1.
  */
 
 #defineBMSR_MEDIAMASK  (BMSR_100T4|BMSR_100TXFDX|BMSR_100TXHDX| \
@@ -111,6 +111,7 @@
 #define ANAR_NP0x8000  /* Next page (ro) */
 #defineANAR_ACK0x4000  /* link partner abilities acknowledged 
(ro) */
 #define ANAR_RF0x2000  /* remote fault (ro) */
+   /* Annex 28B.2 */
 #defineANAR_FC 0x0400  /* local device supports PAUSE */
 #define ANAR_T40x0200  /* local device supports 100bT4 */
 #define ANAR_TX_FD 0x0100  /* local device supports 100bTx FD */
@@ -123,6 +124,7 @@
 #defineANAR_PAUSE_ASYM (2 << 10)
 #defineANAR_PAUSE_TOWARDS  (3 << 10)
 
+   /* Annex 28D */
 #defineANAR_X_FD   0x0020  /* local device supports 1000BASE-X FD 
*/
 #defineANAR_X_HD   0x0040  /* local device supports 1000BASE-X HD 
*/
 #defineANAR_X_PAUSE_NONE   (0 << 7)
@@ -184,12 +186,47 @@
 #defineGTSR_MAN_MS_FLT 0x8000  /* master/slave config fault */
 #defineGTSR_MS_RES 0x4000  /* result: 1 = master, 0 = slave */
 #defineGTSR_LRS0x2000  /* local rx status, 1 = ok */
-#defineGTSR_RRS0x1000  /* remove rx status, 1 = ok */
+#defineGTSR_RRS0x1000  /* remote rx status, 1 = ok */
 #defineGTSR_LP_1000TFDX 0x0800 /* link partner 1000baseT FDX capable */
 #defineGTSR_LP_1000THDX 0x0400 /* link partner 1000baseT HDX capable */
 #defineGTSR_LP_ASM_DIR 0x0200  /* link partner asym. pause dir. 
capable */
 #defineGTSR_IDLE_ERR   0x00ff  /* IDLE error count */
 
+#defineMII_PSECR   0x0b/* PSE control register */
+#definePSECR_PACTLMASK 0x000c  /* pair control mask */
+#definePSECR_PSEENMASK 0x0003  /* PSE enable mask */
+#definePSECR_PINOUTB   0x0008  /* PSE pinout Alternative B */
+#definePSECR_PINOUTA   0x0004  /* PSE pinout Alternative A */
+#definePSECR_FOPOWTST  0x0002  /* Force Power Test Mode */
+#definePSECR_PSEEN 0x0001  /* PSE Enabled */
+#definePSECR_PSEDIS0x  /* PSE Disabled */
+
+#defineMII_PSESR   0x0c/* PSE status register */
+#definePSESR_PWRDENIED 0x1000  /* Power Denied */
+#definePSESR_VALSIG0x0800  /* Valid PD signature detected */
+#definePSESR_INVALSIG  0x0400  /* Invalid PD signature detected */
+#definePSESR_SHORTCIRC 0x0200  /* Short circuit condition detected */
+#definePSESR_OVERLOAD  0x0100  /* Overload condition detected */
+#definePSESR_MPSABSENT 0x0080  /* MPS absent condition detected */
+#definePSESR_PDCLMASK  0x0070  /* PD Class mask */
+#definePSESR_STATMASK  0x000e  /* PSE Status mask */
+#definePSESR_PAIRCTABL 0x0001  /* PAIR Control Ability */
+#definePSESR_PDCL_4(4 << 4)/* Class 4 */
+#definePSESR_PDCL_3(3 << 4)/* Class 3 */
+#definePSESR_PDCL_2(2 << 4)/* Class 2 */
+#definePSESR_PDCL_1(1 << 4)/* Class 1 */
+#definePSESR_PDCL_0(0 << 4)/* Class 0 */
+
+#defineMII_MMDACR  0x0d/* MMD access control register */
+#defineMMDACR_FUNCMASK 0xc000  /* function */
+#defineMMDACR_DADDRMASK 0x001f /* device address */
+#defineMMDACR_FN_ADDR

svn commit: r286052 - stable/10/sys/arm/allwinner/a20

2015-07-29 Thread Marius Strobl
Author: marius
Date: Thu Jul 30 00:24:21 2015
New Revision: 286052
URL: https://svnweb.freebsd.org/changeset/base/286052

Log:
  MFC: r281752
  
  Make a comment reflect reality.

Modified:
  stable/10/sys/arm/allwinner/a20/a20_mp.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/arm/allwinner/a20/a20_mp.c
==
--- stable/10/sys/arm/allwinner/a20/a20_mp.cThu Jul 30 00:13:20 2015
(r286051)
+++ stable/10/sys/arm/allwinner/a20/a20_mp.cThu Jul 30 00:24:21 2015
(r286052)
@@ -25,6 +25,7 @@
 
 #include 
 __FBSDID("$FreeBSD$");
+
 #include 
 #include 
 #include 
@@ -68,7 +69,7 @@ platform_mp_setmaxid(void)
if (mp_ncpus != 0)
return;
 
-   /* Read current CP15 Cache Size ID Register */
+   /* Read the number of cores from the CP15 L2 Control Register. */
__asm __volatile("mrc p15, 1, %0, c9, c0, 2" : "=r" (ncpu));
ncpu = ((ncpu >> 24) & 0x3) + 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: r286051 - in head/sys/i386: i386 include

2015-07-29 Thread Konstantin Belousov
Author: kib
Date: Thu Jul 30 00:13:20 2015
New Revision: 286051
URL: https://svnweb.freebsd.org/changeset/base/286051

Log:
  Use private cache line for the locked nop in *mb() on i386.
  
  Suggested by: alc
  Reviewed by:  alc, bde
  Tested by:pho
  Sponsored by: The FreeBSD Foundation
  MFC after:2 weeks

Modified:
  head/sys/i386/i386/vm_machdep.c
  head/sys/i386/include/atomic.h

Modified: head/sys/i386/i386/vm_machdep.c
==
--- head/sys/i386/i386/vm_machdep.c Wed Jul 29 23:59:17 2015
(r286050)
+++ head/sys/i386/i386/vm_machdep.c Thu Jul 30 00:13:20 2015
(r286051)
@@ -111,8 +111,8 @@ _Static_assert(OFFSETOF_CURTHREAD == off
 "OFFSETOF_CURTHREAD does not correspond with offset of pc_curthread.");
 _Static_assert(OFFSETOF_CURPCB == offsetof(struct pcpu, pc_curpcb),
 "OFFSETOF_CURPCB does not correspond with offset of pc_curpcb.");
-_Static_assert(OFFSETOF_MONITORBUF == offsetof(struct pcpu, pc_monitorbuf),
-"OFFSETOF_MONINORBUF does not correspond with offset of pc_monitorbuf.");
+_Static_assert(__OFFSETOF_MONITORBUF == offsetof(struct pcpu, pc_monitorbuf),
+"__OFFSETOF_MONINORBUF does not correspond with offset of pc_monitorbuf.");
 
 static voidcpu_reset_real(void);
 #ifdef SMP

Modified: head/sys/i386/include/atomic.h
==
--- head/sys/i386/include/atomic.h  Wed Jul 29 23:59:17 2015
(r286050)
+++ head/sys/i386/include/atomic.h  Thu Jul 30 00:13:20 2015
(r286051)
@@ -37,9 +37,31 @@
 #include 
 #endif
 
-#definemb()__asm __volatile("lock; addl $0,(%%esp)" : : : 
"memory", "cc")
-#definewmb()   __asm __volatile("lock; addl $0,(%%esp)" : : : 
"memory", "cc")
-#definermb()   __asm __volatile("lock; addl $0,(%%esp)" : : : 
"memory", "cc")
+#ifndef __OFFSETOF_MONITORBUF
+/*
+ * __OFFSETOF_MONITORBUF == __pcpu_offset(pc_monitorbuf).
+ *
+ * The open-coded number is used instead of the symbolic expression to
+ * avoid a dependency on sys/pcpu.h in machine/atomic.h consumers.
+ * An assertion in i386/vm_machdep.c ensures that the value is correct.
+ */
+#define__OFFSETOF_MONITORBUF   0x180
+
+static __inline void
+__mbk(void)
+{
+
+   __asm __volatile("lock; addl $0,%%fs:%0"
+   : "+m" (*(u_int *)__OFFSETOF_MONITORBUF) : : "memory", "cc");
+}
+
+static __inline void
+__mbu(void)
+{
+
+   __asm __volatile("lock; addl $0,(%%esp)" : : : "memory", "cc");
+}
+#endif
 
 /*
  * Various simple operations on memory, each of which is atomic in the
@@ -246,40 +268,15 @@ atomic_testandset_int(volatile u_int *p,
  * reordering accesses in a way that violates the semantics of acquire
  * and release.
  */
-#if defined(_KERNEL)
-
-/*
- * OFFSETOF_MONITORBUF == __pcpu_offset(pc_monitorbuf).
- *
- * The open-coded number is used instead of the symbolic expression to
- * avoid a dependency on sys/pcpu.h in machine/atomic.h consumers.
- * An assertion in i386/vm_machdep.c ensures that the value is correct.
- */
-#defineOFFSETOF_MONITORBUF 0x180
 
+#if defined(_KERNEL)
 #if defined(SMP)
-static __inline void
-__storeload_barrier(void)
-{
-
-   __asm __volatile("lock; addl $0,%%fs:%0"
-   : "+m" (*(u_int *)OFFSETOF_MONITORBUF) : : "memory", "cc");
-}
+#define__storeload_barrier()   __mbk()
 #else /* _KERNEL && UP */
-static __inline void
-__storeload_barrier(void)
-{
-
-   __compiler_membar();
-}
+#define__storeload_barrier()   __compiler_membar()
 #endif /* SMP */
 #else /* !_KERNEL */
-static __inline void
-__storeload_barrier(void)
-{
-
-   __asm __volatile("lock; addl $0,(%%esp)" : : : "memory", "cc");
-}
+#define__storeload_barrier()   __mbu()
 #endif /* _KERNEL*/
 
 #defineATOMIC_LOAD(TYPE)   \
@@ -776,4 +773,14 @@ u_long atomic_swap_long(volatile u_long 
 
 #endif /* !WANT_FUNCTIONS */
 
+#if defined(_KERNEL)
+#definemb()__mbk()
+#definewmb()   __mbk()
+#definermb()   __mbk()
+#else
+#definemb()__mbu()
+#definewmb()   __mbu()
+#definermb()   __mbu()
+#endif
+
 #endif /* !_MACHINE_ATOMIC_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: r286050 - head/sys/i386/include

2015-07-29 Thread Konstantin Belousov
Author: kib
Date: Wed Jul 29 23:59:17 2015
New Revision: 286050
URL: https://svnweb.freebsd.org/changeset/base/286050

Log:
  MFamd64 r285934: Remove store/load (= full) barrier from the i386
  atomic_load_acq_*().
  
  Noted by: alc (long time ago)
  Reviewed by:  alc, bde
  Tested by:pho
  Sponsored by: The FreeBSD Foundation
  MFC after:2 weeks

Modified:
  head/sys/i386/include/atomic.h

Modified: head/sys/i386/include/atomic.h
==
--- head/sys/i386/include/atomic.h  Wed Jul 29 23:37:15 2015
(r286049)
+++ head/sys/i386/include/atomic.h  Wed Jul 29 23:59:17 2015
(r286050)
@@ -233,13 +233,13 @@ atomic_testandset_int(volatile u_int *p,
  * IA32 memory model, a simple store guarantees release semantics.
  *
  * However, a load may pass a store if they are performed on distinct
- * addresses, so for atomic_load_acq we introduce a Store/Load barrier
- * before the load in SMP kernels.  We use "lock addl $0,mem", as
- * recommended by the AMD Software Optimization Guide, and not mfence.
- * In the kernel, we use a private per-cpu cache line as the target
- * for the locked addition, to avoid introducing false data
- * dependencies.  In userspace, a word at the top of the stack is
- * utilized.
+ * addresses, so we need Store/Load barrier for sequentially
+ * consistent fences in SMP kernels.  We use "lock addl $0,mem" for a
+ * Store/Load barrier, as recommended by the AMD Software Optimization
+ * Guide, and not mfence.  In the kernel, we use a private per-cpu
+ * cache line as the target for the locked addition, to avoid
+ * introducing false data dependencies.  In userspace, a word at the
+ * top of the stack is utilized.
  *
  * For UP kernels, however, the memory of the single processor is
  * always consistent, so we only need to stop the compiler from
@@ -282,22 +282,12 @@ __storeload_barrier(void)
 }
 #endif /* _KERNEL*/
 
-/*
- * C11-standard acq/rel semantics only apply when the variable in the
- * call is the same for acq as it is for rel.  However, our previous
- * (x86) implementations provided much stronger ordering than required
- * (essentially what is called seq_cst order in C11).  This
- * implementation provides the historical strong ordering since some
- * callers depend on it.
- */
-
 #defineATOMIC_LOAD(TYPE)   \
 static __inline u_##TYPE   \
 atomic_load_acq_##TYPE(volatile u_##TYPE *p)   \
 {  \
u_##TYPE res;   \
\
-   __storeload_barrier();  \
res = *p;   \
__compiler_membar();\
return (res);   \
___
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: r286049 - head/sys/crypto/aesni

2015-07-29 Thread John-Mark Gurney
Author: jmg
Date: Wed Jul 29 23:37:15 2015
New Revision: 286049
URL: https://svnweb.freebsd.org/changeset/base/286049

Log:
  const'ify an arg that we don't update...

Modified:
  head/sys/crypto/aesni/aesni.h
  head/sys/crypto/aesni/aesni_ghash.c

Modified: head/sys/crypto/aesni/aesni.h
==
--- head/sys/crypto/aesni/aesni.h   Wed Jul 29 23:34:38 2015
(r286048)
+++ head/sys/crypto/aesni/aesni.h   Wed Jul 29 23:37:15 2015
(r286049)
@@ -104,7 +104,7 @@ void AES_GCM_encrypt(const unsigned char
 const unsigned char *key, int nr);
 int AES_GCM_decrypt(const unsigned char *in, unsigned char *out,
 const unsigned char *addt, const unsigned char *ivec,
-unsigned char *tag, uint32_t nbytes, uint32_t abytes, int ibytes,
+const unsigned char *tag, uint32_t nbytes, uint32_t abytes, int ibytes,
 const unsigned char *key, int nr);
 
 int aesni_cipher_setup_common(struct aesni_session *ses, const uint8_t *key,

Modified: head/sys/crypto/aesni/aesni_ghash.c
==
--- head/sys/crypto/aesni/aesni_ghash.c Wed Jul 29 23:34:38 2015
(r286048)
+++ head/sys/crypto/aesni/aesni_ghash.c Wed Jul 29 23:37:15 2015
(r286049)
@@ -528,7 +528,7 @@ AES_GCM_encrypt(const unsigned char *in,
 int
 AES_GCM_decrypt(const unsigned char *in, unsigned char *out,
const unsigned char *addt, const unsigned char *ivec,
-   unsigned char *tag, uint32_t nbytes, uint32_t abytes, int ibytes,
+   const unsigned char *tag, uint32_t nbytes, uint32_t abytes, int ibytes,
const unsigned char *key, int nr)
 {
int i, j ,k;
@@ -677,7 +677,7 @@ AES_GCM_decrypt(const unsigned char *in,
X = _mm_shuffle_epi8(X, BSWAP_MASK);
T = _mm_xor_si128(X, T);
 
-   if (!m128icmp(T, _mm_loadu_si128((__m128i*)tag)))
+   if (!m128icmp(T, _mm_loadu_si128((const __m128i*)tag)))
return 0; //in case the authentication failed
 
ctr1 = _mm_shuffle_epi8(Y, BSWAP_EPI64);
___
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: r286048 - releng/10.2/release

2015-07-29 Thread Glen Barber
Author: gjb
Date: Wed Jul 29 23:34:38 2015
New Revision: 286048
URL: https://svnweb.freebsd.org/changeset/base/286048

Log:
  Set the default VHD file format to the fixed-size image for the
  10.2-RELEASE, as the issue preventing the dynamic-size image from
  booting is not yet resolved.
  
  This is a direct commit to releng/10.2.
  
  Approved by:  re (kib)
  Sponsored by: The FreeBSD Foundation

Modified:
  releng/10.2/release/Makefile.vm

Modified: releng/10.2/release/Makefile.vm
==
--- releng/10.2/release/Makefile.vm Wed Jul 29 23:26:14 2015
(r286047)
+++ releng/10.2/release/Makefile.vm Wed Jul 29 23:34:38 2015
(r286048)
@@ -6,7 +6,7 @@
 #
 
 VMTARGETS= vm-image
-VMFORMATS?=vhd vmdk qcow2 raw
+VMFORMATS?=vhdf vmdk qcow2 raw
 VMSIZE?=   20G
 VMBASE?=   vm
 
___
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: r286047 - head/usr.sbin/pw

2015-07-29 Thread Baptiste Daroussin
Author: bapt
Date: Wed Jul 29 23:26:14 2015
New Revision: 286047
URL: https://svnweb.freebsd.org/changeset/base/286047

Log:
  Cleanup includes

Modified:
  head/usr.sbin/pw/rm_r.c

Modified: head/usr.sbin/pw/rm_r.c
==
--- head/usr.sbin/pw/rm_r.c Wed Jul 29 23:06:30 2015(r286046)
+++ head/usr.sbin/pw/rm_r.c Wed Jul 29 23:26:14 2015(r286047)
@@ -29,15 +29,12 @@ static const char rcsid[] =
   "$FreeBSD$";
 #endif /* not lint */
 
-#include 
-#include 
-#include 
-#include 
 #include 
-#include 
-#include 
+
 #include 
 #include 
+#include 
+#include 
 
 #include "pwupd.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: r286046 - head/sys/fs/nfsserver

2015-07-29 Thread Rick Macklem
Author: rmacklem
Date: Wed Jul 29 23:06:30 2015
New Revision: 286046
URL: https://svnweb.freebsd.org/changeset/base/286046

Log:
  This patch fixes a problem where, if the NFSv4 server has a previous
  unconfirmed clientid structure for the same client on the last hash list,
  this old entry would not be removed/deleted. I do not think this bug would 
have
  caused serious problems, since the new entry would have been before the old 
one
  on the list. This old entry would have eventually been scavenged/removed.
  Detected while reading the code looking for another bug.
  
  MFC after:3 days

Modified:
  head/sys/fs/nfsserver/nfs_nfsdstate.c

Modified: head/sys/fs/nfsserver/nfs_nfsdstate.c
==
--- head/sys/fs/nfsserver/nfs_nfsdstate.c   Wed Jul 29 22:51:54 2015
(r286045)
+++ head/sys/fs/nfsserver/nfs_nfsdstate.c   Wed Jul 29 23:06:30 2015
(r286046)
@@ -220,7 +220,8 @@ nfsrv_setclient(struct nfsrv_descript *n
break;
}
}
-   i++;
+   if (gotit == 0)
+   i++;
}
if (!gotit ||
(clp->lc_flags & (LCL_NEEDSCONFIRM | LCL_ADMINREVOKED))) {
___
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: r286045 - head/usr.sbin/pw

2015-07-29 Thread Baptiste Daroussin
Author: bapt
Date: Wed Jul 29 22:51:54 2015
New Revision: 286045
URL: https://svnweb.freebsd.org/changeset/base/286045

Log:
  Actually set the proper license
  
  Reported by:  trasz

Modified:
  head/usr.sbin/pw/strtounum.c

Modified: head/usr.sbin/pw/strtounum.c
==
--- head/usr.sbin/pw/strtounum.cWed Jul 29 21:41:15 2015
(r286044)
+++ head/usr.sbin/pw/strtounum.cWed Jul 29 22:51:54 2015
(r286045)
@@ -1,26 +1,27 @@
 /*-
  * Copyright (C) Baptiste Daroussin 
+ * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
  * 1. Redistributions of source code must retain the above copyright
- *notice, this list of conditions and the following disclaimer.
+ *notice, this list of conditions and the following disclaimer
+ *in this position and unchanged.
  * 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 DAVID L. NUGENT AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL DAVID L. NUGENT OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
 #include 
___
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: r286044 - head/tools/build/mk

2015-07-29 Thread Ed Maste
Author: emaste
Date: Wed Jul 29 21:41:15 2015
New Revision: 286044
URL: https://svnweb.freebsd.org/changeset/base/286044

Log:
  MK_ELFCOPY_AS_OBJCOPY should be a variable
  
  PR:   201978
  Submitted by: O. Hartmann
  Differential Revision:https://reviews.freebsd.org/D2887

Modified:
  head/tools/build/mk/OptionalObsoleteFiles.inc

Modified: head/tools/build/mk/OptionalObsoleteFiles.inc
==
--- head/tools/build/mk/OptionalObsoleteFiles.inc   Wed Jul 29 21:29:50 
2015(r286043)
+++ head/tools/build/mk/OptionalObsoleteFiles.inc   Wed Jul 29 21:41:15 
2015(r286044)
@@ -1651,7 +1651,7 @@ OLD_FILES+=usr/share/nls/uk_UA.KOI8-U/ee
 .endif
 
 .if ${MK_ELFTOOLCHAIN_TOOLS} == no || \
-(${MK_ELFTOOLCHAIN_TOOLS} != no && MK_ELFCOPY_AS_OBJCOPY != no)
+(${MK_ELFTOOLCHAIN_TOOLS} != no && ${MK_ELFCOPY_AS_OBJCOPY} != no)
 OLD_FILES+=usr/bin/elfcopy
 OLD_FILES+=usr/share/man/man1/elfcopy.1.gz
 .endif
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r286043 - head/sys/dev/nvme

2015-07-29 Thread Jim Harris
Author: jimharris
Date: Wed Jul 29 21:29:50 2015
New Revision: 286043
URL: https://svnweb.freebsd.org/changeset/base/286043

Log:
  nvme: do not notify a consumer about failures that occur during initialization
  
  MFC after:3 days
  Sponsored by: Intel

Modified:
  head/sys/dev/nvme/nvme.c

Modified: head/sys/dev/nvme/nvme.c
==
--- head/sys/dev/nvme/nvme.cWed Jul 29 21:15:50 2015(r286042)
+++ head/sys/dev/nvme/nvme.cWed Jul 29 21:29:50 2015(r286043)
@@ -390,6 +390,15 @@ nvme_notify_fail_consumers(struct nvme_c
struct nvme_consumer*cons;
uint32_ti;
 
+   /*
+* This controller failed during initialization (i.e. IDENTIFY
+*  command failed or timed out).  Do not notify any nvme
+*  consumers of the failure here, since the consumer does not
+*  even know about the controller yet.
+*/
+   if (!ctrlr->is_initialized)
+   return;
+
for (i = 0; i < NVME_MAX_CONSUMERS; i++) {
cons = &nvme_consumer[i];
if (cons->id != INVALID_CONSUMER_ID && cons->fail_fn != 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: r286042 - head

2015-07-29 Thread Warner Losh
Author: imp
Date: Wed Jul 29 21:15:50 2015
New Revision: 286042
URL: https://svnweb.freebsd.org/changeset/base/286042

Log:
  Clarify historical practice of not removing old entries. Add entry for
  stable/10 branch that was forgotten when it was created. Update end
  date to be correct.

Modified:
  head/UPDATING

Modified: head/UPDATING
==
--- head/UPDATING   Wed Jul 29 20:50:48 2015(r286041)
+++ head/UPDATING   Wed Jul 29 21:15:50 2015(r286042)
@@ -578,6 +578,10 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 11
  # pkg install pkg; ldd /usr/local/sbin/pkg | grep bsdyml
 
 20131010:
+   The stable/10 branch has been created in subversion from head
+   revision r256279.
+
+20131010:
The rc.d/jail script has been updated to support jail(8)
configuration file.  The "jail__*" rc.conf(5) variables
for per-jail configuration are automatically converted to
@@ -1120,6 +1124,13 @@ COMMON ITEMS:
around can lead to problems if pam has changed too much from your
starting point to allow continued authentication after the upgrade.
 
+   This file should be read as a log of events. When a later event changes
+   information of a prior event, the prior event should not be deleted.
+   Instead, a pointer to the entry with the new information should be
+   placed in the old entry. Readers of this file should also sanity check
+   older entries before relying on them blindly. Authors of new entries
+   should write them with this in mind.
+
ZFS notes
-
When upgrading the boot ZFS pool to a new version, always follow
@@ -1290,7 +1301,7 @@ FORMAT:
 
 This file contains a list, in reverse chronological order, of major
 breakages in tracking -current.  It is not guaranteed to be a complete
-list of such breakages, and only contains entries since October 10, 2007.
+list of such breakages, and only contains entries since September 23, 2011.
 If you need to see UPDATING entries from before that date, you will need
 to fetch an UPDATING file from an older FreeBSD release.
 
___
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: r286041 - head/sys/dev/mii

2015-07-29 Thread Sean Bruno
Author: sbruno
Date: Wed Jul 29 20:50:48 2015
New Revision: 286041
URL: https://svnweb.freebsd.org/changeset/base/286041

Log:
  Add support for BCM5466 PHY
  
  Differential Revision:D3232
  Submitted by: kevin.bowl...@kev009.com

Modified:
  head/sys/dev/mii/brgphy.c
  head/sys/dev/mii/miidevs

Modified: head/sys/dev/mii/brgphy.c
==
--- head/sys/dev/mii/brgphy.c   Wed Jul 29 20:47:27 2015(r286040)
+++ head/sys/dev/mii/brgphy.c   Wed Jul 29 20:50:48 2015(r286041)
@@ -131,6 +131,7 @@ static const struct mii_phydesc brgphys[
MII_PHY_DESC(BROADCOM, BCM5752),
MII_PHY_DESC(BROADCOM, BCM5780),
MII_PHY_DESC(BROADCOM, BCM5708C),
+   MII_PHY_DESC(BROADCOM, BCM5466),
MII_PHY_DESC(BROADCOM2, BCM5482),
MII_PHY_DESC(BROADCOM2, BCM5708S),
MII_PHY_DESC(BROADCOM2, BCM5709C),

Modified: head/sys/dev/mii/miidevs
==
--- head/sys/dev/mii/miidevsWed Jul 29 20:47:27 2015(r286040)
+++ head/sys/dev/mii/miidevsWed Jul 29 20:50:48 2015(r286041)
@@ -170,6 +170,7 @@ model BROADCOM BCM54K2  0x002e BCM54K2 1
 model BROADCOM BCM5714 0x0034 BCM5714 1000BASE-T media interface
 model BROADCOM BCM5780 0x0035 BCM5780 1000BASE-T media interface
 model BROADCOM BCM5708C0x0036 BCM5708C 1000BASE-T media 
interface
+model BROADCOM BCM5466 0x003b BCM5466 1000BASE-T media interface
 model BROADCOM2 BCM53250x0003 BCM5325 10/100 5-port PHY switch
 model BROADCOM2 BCM59060x0004 BCM5906 10/100baseTX media 
interface
 model BROADCOM2 BCM54810x000a BCM5481 1000BASE-T media 
interface
___
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: r286040 - in head/sys: arm/arm i386/i386 mips/mips

2015-07-29 Thread Sean Bruno
Author: sbruno
Date: Wed Jul 29 20:47:27 2015
New Revision: 286040
URL: https://svnweb.freebsd.org/changeset/base/286040

Log:
  Remove dead functions pmap_pvdump and pads.
  
  Differential Revision:D3206
  Submitted by: kevin.bowl...@kev009.com
  Reviewed by:  alc

Modified:
  head/sys/arm/arm/pmap-v6-new.c
  head/sys/i386/i386/pmap.c
  head/sys/mips/mips/pmap.c

Modified: head/sys/arm/arm/pmap-v6-new.c
==
--- head/sys/arm/arm/pmap-v6-new.c  Wed Jul 29 20:17:29 2015
(r286039)
+++ head/sys/arm/arm/pmap-v6-new.c  Wed Jul 29 20:47:27 2015
(r286040)
@@ -162,7 +162,6 @@ __FBSDID("$FreeBSD$");
 static void pmap_zero_page_check(vm_page_t m);
 void pmap_debug(int level);
 int pmap_pid_dump(int pid);
-void pmap_pvdump(vm_paddr_t pa);
 
 #define PDEBUG(_lev_,_stat_) \
if (pmap_debug_level >= (_lev_)) \
@@ -6345,62 +6344,6 @@ pmap_pid_dump(int pid)
return (npte2);
 }
 
-/*
- *  Print address space of pmap.
- */
-static void
-pads(pmap_t pmap)
-{
-   int i, j;
-   vm_paddr_t va;
-   pt1_entry_t pte1;
-   pt2_entry_t *pte2p, pte2;
-
-   if (pmap == kernel_pmap)
-   return;
-   for (i = 0; i < NPTE1_IN_PT1; i++) {
-   pte1 = pte1_load(&pmap->pm_pt1[i]);
-   if (pte1_is_section(pte1)) {
-   /*
-* QQQ: Do something here!
-*/
-   } else if (pte1_is_link(pte1)) {
-   for (j = 0; j < NPTE2_IN_PT2; j++) {
-   va = (i << PTE1_SHIFT) + (j << PAGE_SHIFT);
-   if (pmap == kernel_pmap && va < KERNBASE)
-   continue;
-   if (pmap != kernel_pmap && va >= KERNBASE &&
-   (va < UPT2V_MIN_ADDRESS ||
-   va >= UPT2V_MAX_ADDRESS))
-   continue;
-
-   pte2p = pmap_pte2(pmap, va);
-   pte2 = pte2_load(pte2p);
-   pmap_pte2_release(pte2p);
-   if (!pte2_is_valid(pte2))
-   continue;
-   printf("%x:%x ", va, pte2);
-   }
-   }
-   }
-}
-
-void
-pmap_pvdump(vm_paddr_t pa)
-{
-   pv_entry_t pv;
-   pmap_t pmap;
-   vm_page_t m;
-
-   printf("pa %x", pa);
-   m = PHYS_TO_VM_PAGE(pa);
-   TAILQ_FOREACH(pv, &m->md.pv_list, pv_next) {
-   pmap = PV_PMAP(pv);
-   printf(" -> pmap %p, va %x", (void *)pmap, pv->pv_va);
-   pads(pmap);
-   }
-   printf(" ");
-}
 #endif
 
 #ifdef DDB

Modified: head/sys/i386/i386/pmap.c
==
--- head/sys/i386/i386/pmap.c   Wed Jul 29 20:17:29 2015(r286039)
+++ head/sys/i386/i386/pmap.c   Wed Jul 29 20:47:27 2015(r286040)
@@ -5461,51 +5461,3 @@ pmap_pid_dump(int pid)
return (npte);
 }
 #endif
-
-#if defined(DEBUG)
-
-static voidpads(pmap_t pm);
-void   pmap_pvdump(vm_paddr_t pa);
-
-/* print address space of pmap*/
-static void
-pads(pmap_t pm)
-{
-   int i, j;
-   vm_paddr_t va;
-   pt_entry_t *ptep;
-
-   if (pm == kernel_pmap)
-   return;
-   for (i = 0; i < NPDEPTD; i++)
-   if (pm->pm_pdir[i])
-   for (j = 0; j < NPTEPG; j++) {
-   va = (i << PDRSHIFT) + (j << PAGE_SHIFT);
-   if (pm == kernel_pmap && va < KERNBASE)
-   continue;
-   if (pm != kernel_pmap && va > UPT_MAX_ADDRESS)
-   continue;
-   ptep = pmap_pte(pm, va);
-   if (pmap_pte_v(ptep))
-   printf("%x:%x ", va, *ptep);
-   };
-
-}
-
-void
-pmap_pvdump(vm_paddr_t pa)
-{
-   pv_entry_t pv;
-   pmap_t pmap;
-   vm_page_t m;
-
-   printf("pa %x", pa);
-   m = PHYS_TO_VM_PAGE(pa);
-   TAILQ_FOREACH(pv, &m->md.pv_list, pv_next) {
-   pmap = PV_PMAP(pv);
-   printf(" -> pmap %p, va %x", (void *)pmap, pv->pv_va);
-   pads(pmap);
-   }
-   printf(" ");
-}
-#endif

Modified: head/sys/mips/mips/pmap.c
==
--- head/sys/mips/mips/pmap.c   Wed Jul 29 20:17:29 2015(r286039)
+++ head/sys/mips/mips/pmap.c   Wed Jul 29 20:47:27 2015(r286040)
@@ -3294,56 +3294,6 @@ DB_SHOW_COMMAND(ptable, ddb_pid_dump)
 }
 #endif
 
-#if defined(DEBUG)
-
-static void pads(pmap_t pm);
-void pmap_pvdump(vm_offset_t pa);
-
-/* print 

svn commit: r286038 - releng/10.2/release/doc/en_US.ISO8859-1/hardware

2015-07-29 Thread Glen Barber
Author: gjb
Date: Wed Jul 29 20:17:26 2015
New Revision: 286038
URL: https://svnweb.freebsd.org/changeset/base/286038

Log:
  Update copyright after r286023.
  
  Approved by:  re (implicit)
  Sponsored by: The FreeBSD Foundation

Modified:
  releng/10.2/release/doc/en_US.ISO8859-1/hardware/article.xml

Modified: releng/10.2/release/doc/en_US.ISO8859-1/hardware/article.xml
==
--- releng/10.2/release/doc/en_US.ISO8859-1/hardware/article.xmlWed Jul 
29 20:10:36 2015(r286037)
+++ releng/10.2/release/doc/en_US.ISO8859-1/hardware/article.xmlWed Jul 
29 20:17:26 2015(r286038)
@@ -31,6 +31,7 @@
   2012
   2013
   2014
+  2015
   mailto:d...@freebsd.org";>The &os; Documentation
Project
 
___
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: r286039 - releng/10.2/release/doc/en_US.ISO8859-1/hardware

2015-07-29 Thread Glen Barber
Author: gjb
Date: Wed Jul 29 20:17:29 2015
New Revision: 286039
URL: https://svnweb.freebsd.org/changeset/base/286039

Log:
  Add ixl(4) to the hardware notes.
  
  Approved by:  re (implicit)
  Sponsored by: The FreeBSD Foundation

Modified:
  releng/10.2/release/doc/en_US.ISO8859-1/hardware/article.xml

Modified: releng/10.2/release/doc/en_US.ISO8859-1/hardware/article.xml
==
--- releng/10.2/release/doc/en_US.ISO8859-1/hardware/article.xmlWed Jul 
29 20:17:26 2015(r286038)
+++ releng/10.2/release/doc/en_US.ISO8859-1/hardware/article.xmlWed Jul 
29 20:17:29 2015(r286039)
@@ -900,6 +900,8 @@
 
   &hwlist.ixgbe;
 
+  &hwlist.ixl;
+
   &hwlist.jme;
 
   &hwlist.kue;
___
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: r286037 - head/sys/netinet

2015-07-29 Thread Ermal Luçi
Author: eri
Date: Wed Jul 29 20:10:36 2015
New Revision: 286037
URL: https://svnweb.freebsd.org/changeset/base/286037

Log:
  Avoid double reference decrement when firewalls force relooping of packets
  
  When firewalls force a reloop of packets and the caller supplied a route the 
reference to the route might be reduced twice creating issues.
  This is especially the scenario when a packet is looped because of operation 
in the firewall but the new route lookup gives a down route.
  
  Differential Revision:https://reviews.freebsd.org/D3037
  Reviewed by:  gnn
  Approved by:  gnn(mentor)

Modified:
  head/sys/netinet/ip_output.c

Modified: head/sys/netinet/ip_output.c
==
--- head/sys/netinet/ip_output.cWed Jul 29 20:02:20 2015
(r286036)
+++ head/sys/netinet/ip_output.cWed Jul 29 20:10:36 2015
(r286037)
@@ -681,6 +681,13 @@ sendit:
 done:
if (ro == &iproute)
RO_RTFREE(ro);
+   else if (rte == NULL)
+   /*
+* If the caller supplied a route but somehow the reference
+* to it has been released need to prevent the caller
+* calling RTFREE on it again.
+*/
+   ro->ro_rt = NULL;
if (have_ia_ref)
ifa_free(&ia->ia_ifa);
return (error);
___
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: r286036 - head/tools/build/options

2015-07-29 Thread Ed Maste
Author: emaste
Date: Wed Jul 29 20:02:20 2015
New Revision: 286036
URL: https://svnweb.freebsd.org/changeset/base/286036

Log:
  Remove mention of non-existent gconv tool
  
  I believe this is a typo of gcov, but gcov is not controlled by
  WITHOUT_BINUTILS anyhow.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  head/tools/build/options/WITHOUT_BINUTILS

Modified: head/tools/build/options/WITHOUT_BINUTILS
==
--- head/tools/build/options/WITHOUT_BINUTILS   Wed Jul 29 19:37:32 2015
(r286035)
+++ head/tools/build/options/WITHOUT_BINUTILS   Wed Jul 29 20:02:20 2015
(r286036)
@@ -1,5 +1,5 @@
 .\" $FreeBSD$
-Set to not build or install binutils (as, c++-filt, gconv,
+Set to not build or install binutils (as, c++-filt,
 ld, nm, objcopy, objdump, readelf, size and strip) as part
 of the normal system build.
 The resulting system cannot build programs from source.
___
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: r286000 - head/sys/netipsec

2015-07-29 Thread John-Mark Gurney
Ermal Lui wrote this message on Wed, Jul 29, 2015 at 19:23 +0200:
> On Wed, Jul 29, 2015 at 5:40 PM, John-Mark Gurney  wrote:
> 
> > Ermal Lui wrote this message on Wed, Jul 29, 2015 at 14:53 +0200:
> > > this was forgotten part on my patches merge from gnn@.
> > > Can it be fixed by correcting the patches rather than re-introducing
> > this?
> > >
> > > Most probably the constant definition is wrong on the transforms and also
> > > some part of code removal was missed.
> >
> > No, it cannot be fixed by changing opencrypto/xform.c to truncate the
> > hash size...  The reason it cannot be is that OCF is not an IPsec only
> > framework...
> >
> > Geli also uses the HMAC constructions, and I have not confirmed if they
> > use the full hash size or not...  I would be open to adding a field to
> > the crypto descriptor that limited how much of the hash is copied out...
> >
> > It would have been helpful to comment more of these changes...  If you
> > make a change for a reason (RFC, etc), then throw that in the comments,
> > which allows someone following to understand why and prevent their
> > removal...  At least if they were commented as to why they changed, we
> > would have known to rework the change...
> >
> Yes you are right but according to me this is standard practice being done
> allover SSL/IPSec
> I am not sure which standard GELI follows to comment on that!

This also depends upon all future protocols following that standard,
and no one needing those extra bits for validation, etc.

> Also then it would be better to review the declarations on the transform
> since they are apparently not generic, no?

The declarations in xform.c need to be what the algorithm specifies,
not what gets used by the various protocols...  Any deviation from
the algorithm specification should be delt with in protocol code,
not here...

This prevenst a future problem where a prtocol doesn't use that
convention, and then it becomes a mess to unwind where these changes
were, and fix them all...

It's stuff like this which is part of the reason I decided to call
GCM, NIST_GCM...  OpenBSD has a hacked version that is only good for
IPsec, apparently TLS and anything else that does the crazy lets put
part of the IV w/ the key...

The xform tables are already terribly overloaded, and I wanted to split
them out into parameters and implementation, but because IPsec and others
reach into those tables, it makes it more difficult...

> > > On Wed, Jul 29, 2015 at 9:15 AM, John-Mark Gurney 
> > wrote:
> > >
> > > > Author: jmg
> > > > Date: Wed Jul 29 07:15:16 2015
> > > > New Revision: 286000
> > > > URL: https://svnweb.freebsd.org/changeset/base/286000
> > > >
> > > > Log:
> > > >   RFC4868 section 2.3 requires that the output be half...  This fixes
> > > >   problems that was introduced in r285336...  I have verified that
> > > >   HMAC-SHA2-256 both ah only and w/ AES-CBC interoperate w/ a NetBSD
> > > >   6.1.5 vm...
> > > >
> > > >   Reviewed by:  gnn

-- 
  John-Mark Gurney  Voice: +1 415 225 5579

 "All that I will do, has been done, All that I have, has not."
___
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: r286035 - in stable/9/contrib/llvm: include/llvm/CodeGen lib/CodeGen/SelectionDAG lib/Target/X86 patches

2015-07-29 Thread Dimitry Andric
Author: dim
Date: Wed Jul 29 19:37:32 2015
New Revision: 286035
URL: https://svnweb.freebsd.org/changeset/base/286035

Log:
  Merge r286033 from stable/10:
  
  Reapply r286007, modified to compile with pre-C++11 compilers:
  
  Pull in r219009 from upstream llvm trunk (by Adam Nemet):
  
[ISel] Keep matching state consistent when folding during X86 address match
  
In the X86 backend, matching an address is initiated by the 'addr' complex
pattern and its friends.  During this process we may reassociate 
and-of-shift
into shift-of-and (FoldMaskedShiftToScaledMask) to allow folding of the
shift into the scale of the address.
  
However as demonstrated by the testcase, this can trigger CSE of not only 
the
shift and the AND which the code is prepared for but also the underlying 
load
node.  In the testcase this node is sitting in the RecordedNode and 
MatchScope
data structures of the matcher and becomes a deleted node upon CSE.  
Returning
from the complex pattern function, we try to access it again hitting an 
assert
because the node is no longer a load even though this was checked before.
  
Now obviously changing the DAG this late is bending the rules but I think it
makes sense somewhat.  Outside of addresses we prefer and-of-shift because 
it
may lead to smaller immediates (FoldMaskAndShiftToScale is an even better
example because it create a non-canonical node).  We currently don't 
recognize
addresses during DAGCombiner where arguably this canonicalization should be
performed.  On the other hand, having this in the matcher allows us to cover
all the cases where an address can be used in an instruction.
  
I've also talked a little bit to Dan Gohman on llvm-dev who added the RAUW 
for
the new shift node in FoldMaskedShiftToScaledMask.  This RAUW is responsible
for initiating the recursive CSE on users
(http://lists.cs.uiuc.edu/pipermail/llvmdev/2014-September/076903.html) but 
it
is not strictly necessary since the shift is hooked into the visited user.  
Of
course it's safer to keep the DAG consistent at all times (e.g. for accurate
number of uses, etc.).
  
So rather than changing the fundamentals, I've decided to continue along the
previous patches and detect the CSE.  This patch installs a very targeted
DAGUpdateListener for the duration of a complex-pattern match and updates 
the
matching state accordingly.  (Previous patches used HandleSDNode to detect 
the
CSE but that's not practical here).  The listener is only installed on X86.
  
I tested that there is no measurable overhead due to this while running
through the spec2k BC files with llc.  The only thing we pay for is the
creation of the listener.  The callback never ever triggers in spec2k since
this is a corner case.
  
Fixes rdar://problem/18206171
  
  This fixes a possible crash in x86 code generation when compiling recent
  llvm/clang trunk sources.
  
  Direct commit to stable/10, since head already has llvm/clang 3.6.1,
  which includes this fix.
  
  Reported by:  jonathan, theraven
  Upstream PR:  https://llvm.org/bugs/show_bug.cgi?id=24249
  
  Merge r286034 from stable/10:
  
  Add updated llvm patch corresponding to r286033.

Added:
  
stable/9/contrib/llvm/patches/patch-r286033-llvm-r219009-x86-codegen-crash.diff
 - copied unchanged from r286034, 
stable/10/contrib/llvm/patches/patch-r286033-llvm-r219009-x86-codegen-crash.diff
Modified:
  stable/9/contrib/llvm/include/llvm/CodeGen/SelectionDAGISel.h
  stable/9/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
  stable/9/contrib/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
Directory Properties:
  stable/9/   (props changed)
  stable/9/contrib/   (props changed)
  stable/9/contrib/llvm/   (props changed)

Modified: stable/9/contrib/llvm/include/llvm/CodeGen/SelectionDAGISel.h
==
--- stable/9/contrib/llvm/include/llvm/CodeGen/SelectionDAGISel.h   Wed Jul 
29 19:27:57 2015(r286034)
+++ stable/9/contrib/llvm/include/llvm/CodeGen/SelectionDAGISel.h   Wed Jul 
29 19:37:32 2015(r286035)
@@ -238,6 +238,12 @@ public:
const unsigned char *MatcherTable,
unsigned TableSize);
 
+  /// \brief Return true if complex patterns for this target can mutate the
+  /// DAG.
+  virtual bool ComplexPatternFuncMutatesDAG() const {
+return false;
+  }
+
 private:
 
   // Calls to these functions are generated by tblgen.

Modified: stable/9/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
==
--- stable/9/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Wed Jul 
29 19:27:57 2015(r286034)
+++ stable/9/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Wed Jul 
29 19:37:32 2015(r286035)
@@

svn commit: r286034 - stable/10/contrib/llvm/patches

2015-07-29 Thread Dimitry Andric
Author: dim
Date: Wed Jul 29 19:27:57 2015
New Revision: 286034
URL: https://svnweb.freebsd.org/changeset/base/286034

Log:
  Add updated llvm patch corresponding to r286033.

Added:
  
stable/10/contrib/llvm/patches/patch-r286033-llvm-r219009-x86-codegen-crash.diff

Added: 
stable/10/contrib/llvm/patches/patch-r286033-llvm-r219009-x86-codegen-crash.diff
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ 
stable/10/contrib/llvm/patches/patch-r286033-llvm-r219009-x86-codegen-crash.diff
Wed Jul 29 19:27:57 2015(r286034)
@@ -0,0 +1,217 @@
+Pull in r219009 from upstream llvm trunk (by Adam Nemet):
+
+  [ISel] Keep matching state consistent when folding during X86 address match
+
+  In the X86 backend, matching an address is initiated by the 'addr' complex
+  pattern and its friends.  During this process we may reassociate and-of-shift
+  into shift-of-and (FoldMaskedShiftToScaledMask) to allow folding of the
+  shift into the scale of the address.
+
+  However as demonstrated by the testcase, this can trigger CSE of not only the
+  shift and the AND which the code is prepared for but also the underlying load
+  node.  In the testcase this node is sitting in the RecordedNode and 
MatchScope
+  data structures of the matcher and becomes a deleted node upon CSE.  
Returning
+  from the complex pattern function, we try to access it again hitting an 
assert
+  because the node is no longer a load even though this was checked before.
+
+  Now obviously changing the DAG this late is bending the rules but I think it
+  makes sense somewhat.  Outside of addresses we prefer and-of-shift because it
+  may lead to smaller immediates (FoldMaskAndShiftToScale is an even better
+  example because it create a non-canonical node).  We currently don't 
recognize
+  addresses during DAGCombiner where arguably this canonicalization should be
+  performed.  On the other hand, having this in the matcher allows us to cover
+  all the cases where an address can be used in an instruction.
+
+  I've also talked a little bit to Dan Gohman on llvm-dev who added the RAUW 
for
+  the new shift node in FoldMaskedShiftToScaledMask.  This RAUW is responsible
+  for initiating the recursive CSE on users
+  (http://lists.cs.uiuc.edu/pipermail/llvmdev/2014-September/076903.html) but 
it
+  is not strictly necessary since the shift is hooked into the visited user.  
Of
+  course it's safer to keep the DAG consistent at all times (e.g. for accurate
+  number of uses, etc.).
+
+  So rather than changing the fundamentals, I've decided to continue along the
+  previous patches and detect the CSE.  This patch installs a very targeted
+  DAGUpdateListener for the duration of a complex-pattern match and updates the
+  matching state accordingly.  (Previous patches used HandleSDNode to detect 
the
+  CSE but that's not practical here).  The listener is only installed on X86.
+
+  I tested that there is no measurable overhead due to this while running
+  through the spec2k BC files with llc.  The only thing we pay for is the
+  creation of the listener.  The callback never ever triggers in spec2k since
+  this is a corner case.
+
+  Fixes rdar://problem/18206171
+
+This fixes a possible crash in x86 code generation when compiling recent
+llvm/clang trunk sources.
+
+Introduced here: http://svnweb.freebsd.org/changeset/base/286033
+
+Index: include/llvm/CodeGen/SelectionDAGISel.h
+===
+--- include/llvm/CodeGen/SelectionDAGISel.h
 include/llvm/CodeGen/SelectionDAGISel.h
+@@ -238,6 +238,12 @@ class SelectionDAGISel : public MachineFunctionPas
+const unsigned char *MatcherTable,
+unsigned TableSize);
+ 
++  /// \brief Return true if complex patterns for this target can mutate the
++  /// DAG.
++  virtual bool ComplexPatternFuncMutatesDAG() const {
++return false;
++  }
++
+ private:
+ 
+   // Calls to these functions are generated by tblgen.
+Index: lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
+===
+--- lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
 lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
+@@ -2345,6 +2345,45 @@ struct MatchScope {
+   bool HasChainNodesMatched, HasGlueResultNodesMatched;
+ };
+ 
++/// \\brief A DAG update listener to keep the matching state
++/// (i.e. RecordedNodes and MatchScope) uptodate if the target is allowed to
++/// change the DAG while matching.  X86 addressing mode matcher is an example
++/// for this.
++class MatchStateUpdater : public SelectionDAG::DAGUpdateListener
++{
++  SmallVectorImpl > &RecordedNodes;
++  SmallVectorImpl &MatchScopes;
++public:
++  MatchStateUpdater(SelectionDAG &DAG,
++SmallVectorImpl > &RN,
++SmallVectorImpl &MS) :
++SelectionDAG::DAGUpdateList

svn commit: r286033 - in stable/10/contrib/llvm: include/llvm/CodeGen lib/CodeGen/SelectionDAG lib/Target/X86

2015-07-29 Thread Dimitry Andric
Author: dim
Date: Wed Jul 29 19:25:28 2015
New Revision: 286033
URL: https://svnweb.freebsd.org/changeset/base/286033

Log:
  Reapply r286007, modified to compile with pre-C++11 compilers:
  
  Pull in r219009 from upstream llvm trunk (by Adam Nemet):
  
[ISel] Keep matching state consistent when folding during X86 address match
  
In the X86 backend, matching an address is initiated by the 'addr' complex
pattern and its friends.  During this process we may reassociate 
and-of-shift
into shift-of-and (FoldMaskedShiftToScaledMask) to allow folding of the
shift into the scale of the address.
  
However as demonstrated by the testcase, this can trigger CSE of not only 
the
shift and the AND which the code is prepared for but also the underlying 
load
node.  In the testcase this node is sitting in the RecordedNode and 
MatchScope
data structures of the matcher and becomes a deleted node upon CSE.  
Returning
from the complex pattern function, we try to access it again hitting an 
assert
because the node is no longer a load even though this was checked before.
  
Now obviously changing the DAG this late is bending the rules but I think it
makes sense somewhat.  Outside of addresses we prefer and-of-shift because 
it
may lead to smaller immediates (FoldMaskAndShiftToScale is an even better
example because it create a non-canonical node).  We currently don't 
recognize
addresses during DAGCombiner where arguably this canonicalization should be
performed.  On the other hand, having this in the matcher allows us to cover
all the cases where an address can be used in an instruction.
  
I've also talked a little bit to Dan Gohman on llvm-dev who added the RAUW 
for
the new shift node in FoldMaskedShiftToScaledMask.  This RAUW is responsible
for initiating the recursive CSE on users
(http://lists.cs.uiuc.edu/pipermail/llvmdev/2014-September/076903.html) but 
it
is not strictly necessary since the shift is hooked into the visited user.  
Of
course it's safer to keep the DAG consistent at all times (e.g. for accurate
number of uses, etc.).
  
So rather than changing the fundamentals, I've decided to continue along the
previous patches and detect the CSE.  This patch installs a very targeted
DAGUpdateListener for the duration of a complex-pattern match and updates 
the
matching state accordingly.  (Previous patches used HandleSDNode to detect 
the
CSE but that's not practical here).  The listener is only installed on X86.
  
I tested that there is no measurable overhead due to this while running
through the spec2k BC files with llc.  The only thing we pay for is the
creation of the listener.  The callback never ever triggers in spec2k since
this is a corner case.
  
Fixes rdar://problem/18206171
  
  This fixes a possible crash in x86 code generation when compiling recent
  llvm/clang trunk sources.
  
  Direct commit to stable/10, since head already has llvm/clang 3.6.1,
  which includes this fix.
  
  Reported by:  jonathan, theraven
  Upstream PR:  https://llvm.org/bugs/show_bug.cgi?id=24249

Modified:
  stable/10/contrib/llvm/include/llvm/CodeGen/SelectionDAGISel.h
  stable/10/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
  stable/10/contrib/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp

Modified: stable/10/contrib/llvm/include/llvm/CodeGen/SelectionDAGISel.h
==
--- stable/10/contrib/llvm/include/llvm/CodeGen/SelectionDAGISel.h  Wed Jul 
29 19:06:53 2015(r286032)
+++ stable/10/contrib/llvm/include/llvm/CodeGen/SelectionDAGISel.h  Wed Jul 
29 19:25:28 2015(r286033)
@@ -238,6 +238,12 @@ public:
const unsigned char *MatcherTable,
unsigned TableSize);
 
+  /// \brief Return true if complex patterns for this target can mutate the
+  /// DAG.
+  virtual bool ComplexPatternFuncMutatesDAG() const {
+return false;
+  }
+
 private:
 
   // Calls to these functions are generated by tblgen.

Modified: stable/10/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
==
--- stable/10/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
Wed Jul 29 19:06:53 2015(r286032)
+++ stable/10/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
Wed Jul 29 19:25:28 2015(r286033)
@@ -2345,6 +2345,45 @@ struct MatchScope {
   bool HasChainNodesMatched, HasGlueResultNodesMatched;
 };
 
+/// \\brief A DAG update listener to keep the matching state
+/// (i.e. RecordedNodes and MatchScope) uptodate if the target is allowed to
+/// change the DAG while matching.  X86 addressing mode matcher is an example
+/// for this.
+class MatchStateUpdater : public SelectionDAG::DAGUpdateListener
+{
+  SmallVectorImpl > &RecordedNodes

svn commit: r286032 - head/share/mk

2015-07-29 Thread Ed Maste
Author: emaste
Date: Wed Jul 29 19:06:53 2015
New Revision: 286032
URL: https://svnweb.freebsd.org/changeset/base/286032

Log:
  Use default CLANG build options for ARM
  
  We previously disabled CLANG_FULL on (little-endian) ARM because the
  build failed.  This is no longer the case and as of Clang 3.5 we cannot
  build any part of the in-tree Clang with in-tree GCC, so it's no longer
  necessary to disable CLANG_FULL.
  
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D2525

Modified:
  head/share/mk/src.opts.mk

Modified: head/share/mk/src.opts.mk
==
--- head/share/mk/src.opts.mk   Wed Jul 29 18:55:51 2015(r286031)
+++ head/share/mk/src.opts.mk   Wed Jul 29 19:06:53 2015(r286032)
@@ -214,15 +214,11 @@ __TT=${MACHINE}
 # If the compiler is not C++11 capable, disable clang and use gcc instead.
 __DEFAULT_YES_OPTIONS+=GCC GCC_BOOTSTRAP GNUCXX
 __DEFAULT_NO_OPTIONS+=CLANG CLANG_BOOTSTRAP CLANG_FULL CLANG_IS_CC
-.elif ${__T} == "aarch64" || ${__T} == "amd64" || ${__T} == "i386"
-# On x86 and arm64, clang is enabled, and will be installed as the default cc.
+.elif ${__T} == "aarch64" || ${__T} == "amd64" || ${__TT} == "arm" || \
+${__T} == "i386"
+# On x86 and arm, clang is enabled, and will be installed as the default cc.
 __DEFAULT_YES_OPTIONS+=CLANG CLANG_BOOTSTRAP CLANG_FULL CLANG_IS_CC
 __DEFAULT_NO_OPTIONS+=GCC GCC_BOOTSTRAP GNUCXX
-.elif ${__TT} == "arm"
-# On arm, clang is enabled, and it is installed as the default cc, but
-# since gcc is unable to build the full clang, disable it by default.
-__DEFAULT_YES_OPTIONS+=CLANG CLANG_BOOTSTRAP CLANG_IS_CC
-__DEFAULT_NO_OPTIONS+=CLANG_FULL GCC GCC_BOOTSTRAP GNUCXX
 .elif ${__T:Mpowerpc*}
 # On powerpc, clang is enabled, but gcc is installed as the default cc.
 __DEFAULT_YES_OPTIONS+=CLANG CLANG_FULL GCC GCC_BOOTSTRAP GNUCXX
___
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: r286031 - head/share/man/man5

2015-07-29 Thread Ed Maste
Author: emaste
Date: Wed Jul 29 18:55:51 2015
New Revision: 286031
URL: https://svnweb.freebsd.org/changeset/base/286031

Log:
  Regenerate src.conf(5) after r286016 and r286030

Modified:
  head/share/man/man5/src.conf.5

Modified: head/share/man/man5/src.conf.5
==
--- head/share/man/man5/src.conf.5  Wed Jul 29 18:45:38 2015
(r286030)
+++ head/share/man/man5/src.conf.5  Wed Jul 29 18:55:51 2015
(r286031)
@@ -1,7 +1,7 @@
 .\" DO NOT EDIT-- this file is automatically generated.
-.\" from FreeBSD: head/tools/build/options/makeman 255964 2013-10-01 07:22:04Z 
des
+.\" from FreeBSD: head/tools/build/options/makeman 284708 2015-06-22 20:21:57Z 
sjg
 .\" $FreeBSD$
-.Dd June 22, 2015
+.Dd July 29, 2015
 .Dt SRC.CONF 5
 .Os
 .Sh NAME
@@ -127,7 +127,7 @@ Set to not build
 .Xr autofs 4
 related programs, libraries, and kernel modules.
 .It Va WITH_AUTO_OBJ
-.\" $FreeBSD$
+.\" from FreeBSD: head/tools/build/options/WITH_AUTO_OBJ 284708 2015-06-22 
20:21:57Z sjg
 Enable automatic creation of objdirs.
 .It Va WITHOUT_BHYVE
 .\" from FreeBSD: head/tools/build/options/WITHOUT_BHYVE 277727 2015-01-26 
06:44:48Z ngie
@@ -142,6 +142,9 @@ Set to not build or install binutils (as
 ld, nm, objcopy, objdump, readelf, size and strip) as part
 of the normal system build.
 The resulting system cannot build programs from source.
+.Pp
+It is a default setting on
+arm64/aarch64.
 .It Va WITHOUT_BINUTILS_BOOTSTRAP
 .\" from FreeBSD: head/tools/build/options/WITHOUT_BINUTILS_BOOTSTRAP 264660 
2014-04-18 17:03:58Z imp
 Set to not build binutils (as, c++-filt, gconv,
@@ -151,6 +154,9 @@ as part of the bootstrap process.
 The option does not work for build targets unless some alternative
 toolchain is provided.
 .Ef
+.Pp
+It is a default setting on
+arm64/aarch64.
 .It Va WITHOUT_BLUETOOTH
 .\" from FreeBSD: head/tools/build/options/WITHOUT_BLUETOOTH 156932 2006-03-21 
07:50:50Z ru
 Set to not build Bluetooth related kernel modules, programs and libraries.
@@ -243,7 +249,7 @@ When set, it also enforces the following
 Set to build the Clang C/C++ compiler during the normal phase of the build.
 .Pp
 It is a default setting on
-amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm/armv6hf, i386/i386, pc98/i386, 
powerpc/powerpc and powerpc/powerpc64.
+amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm/armv6hf, arm64/aarch64, 
i386/i386, pc98/i386, powerpc/powerpc and powerpc/powerpc64.
 .It Va WITHOUT_CLANG_BOOTSTRAP
 .\" from FreeBSD: head/tools/build/options/WITHOUT_CLANG_BOOTSTRAP 273177 
2014-10-16 18:28:11Z skreuzer
 Set to not build the Clang C/C++ compiler during the bootstrap phase of the 
build.
@@ -258,7 +264,7 @@ mips/mipsel, mips/mips, mips/mips64el, m
 Set to build the Clang C/C++ compiler during the bootstrap phase of the build.
 .Pp
 It is a default setting on
-amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm/armv6hf, i386/i386 and 
pc98/i386.
+amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm/armv6hf, arm64/aarch64, 
i386/i386 and pc98/i386.
 .It Va WITH_CLANG_EXTRAS
 .\" from FreeBSD: head/tools/build/options/WITH_CLANG_EXTRAS 231057 2012-02-05 
23:56:22Z dim
 Set to build additional clang and llvm tools, such as bugpoint.
@@ -275,7 +281,7 @@ Set to build the ARCMigrate, Rewriter an
 Clang C/C++ compiler.
 .Pp
 It is a default setting on
-amd64/amd64, i386/i386, pc98/i386, powerpc/powerpc and powerpc/powerpc64.
+amd64/amd64, arm64/aarch64, i386/i386, pc98/i386, powerpc/powerpc and 
powerpc/powerpc64.
 .It Va WITHOUT_CLANG_IS_CC
 .\" from FreeBSD: head/tools/build/options/WITHOUT_CLANG_IS_CC 242629 
2012-11-05 21:53:23Z brooks
 Set to install the GCC compiler as
@@ -295,7 +301,7 @@ and
 .Pa /usr/bin/cpp .
 .Pp
 It is a default setting on
-amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm/armv6hf, i386/i386 and 
pc98/i386.
+amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm/armv6hf, arm64/aarch64, 
i386/i386 and pc98/i386.
 .It Va WITHOUT_CPP
 .\" from FreeBSD: head/tools/build/options/WITHOUT_CPP 156932 2006-03-21 
07:50:50Z ru
 Set to not build
@@ -396,7 +402,7 @@ and are located automatically by
 .\" from FreeBSD: head/tools/build/options/WITHOUT_DICT 156932 2006-03-21 
07:50:50Z ru
 Set to not build the Webster dictionary files.
 .It Va WITH_DIRDEPS_CACHE
-.\" $FreeBSD$
+.\" from FreeBSD: head/tools/build/options/WITH_DIRDEPS_CACHE 284708 
2015-06-22 20:21:57Z sjg
 Cache result of dirdeps.mk which can save significant time
 for subsequent builds.
 Depends on
@@ -429,11 +435,29 @@ and related programs.
 .It Va WITH_EISA
 .\" from FreeBSD: head/tools/build/options/WITH_EISA 264654 2014-04-18 
16:53:06Z imp
 Set to build EISA kernel modules.
+.It Va WITHOUT_ELFCOPY_AS_OBJCOPY
+.\" from FreeBSD: head/tools/build/options/WITHOUT_ELFCOPY_AS_OBJCOPY 286030 
2015-07-29 18:45:38Z emaste
+Set to build and install
+.Xr objcopy 1
+from GNU Binutils, instead of the one from ELF Tool Chain.
+.Pp
+It is a default setting on
+amd64/amd64, arm/arm, arm/armeb

Re: svn commit: r286027 - in head/sys: netinet sys

2015-07-29 Thread Patrick Kelsey
On Wed, Jul 29, 2015 at 2:43 PM, Shawn Webb 
wrote:

> On Wednesday, 29 July 2015 05:59:14 PM Patrick Kelsey wrote:
> > Author: pkelsey
> > Date: Wed Jul 29 17:59:13 2015
> > New Revision: 286027
> > URL: https://svnweb.freebsd.org/changeset/base/286027
> >
> > Log:
> >   Revert r265338, r271089 and r271123 as those changes do not handle
> >   non-inline urgent data and introduce an mbuf exhaustion attack vector
> >   similar to FreeBSD-SA-15:15.tcp, but not requiring VNETs.
> >
> >   Address the issue described in FreeBSD-SA-15:15.tcp.
> >
> >   Reviewed by:glebius
> >   Approved by:so
> >   Approved by:jmallett (mentor)
> >   Security:   FreeBSD-SA-15:15.tcp
> >   Sponsored by:   Norse Corp, Inc.
>
> Does this commit need to be MFC'd to stable/10? Or is this only for HEAD?
>

The reverted revisions were only on HEAD after stable/10 was created and
never MFC'd.  stable/10 only required the fix for FreeBSD-SA-15:15.tcp,
which was committed in r285976.

-Patrick
___
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: r286030 - in head: gnu/usr.bin/binutils share/mk tools/build/mk tools/build/options usr.bin/elfcopy

2015-07-29 Thread Ed Maste
Author: emaste
Date: Wed Jul 29 18:45:38 2015
New Revision: 286030
URL: https://svnweb.freebsd.org/changeset/base/286030

Log:
  Allow ELF Tool Chain elfcopy to be installed as objcopy
  
  ELF Tool Chain elfcopy is nearly a drop-in replacement for GNU objcopy,
  but does not currently support PE output which is needed for building
  x86 UEFI bits.
  
  Add a src.conf knob to allow installing it as objcopy and set it by
  default for aarch64 only, where we don't have a native binutils.
  
  Reviewed by:  bapt
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D2887

Added:
  head/tools/build/options/WITHOUT_ELFCOPY_AS_OBJCOPY   (contents, props 
changed)
  head/tools/build/options/WITH_ELFCOPY_AS_OBJCOPY   (contents, props changed)
Modified:
  head/gnu/usr.bin/binutils/Makefile
  head/share/mk/src.opts.mk
  head/tools/build/mk/OptionalObsoleteFiles.inc
  head/usr.bin/elfcopy/Makefile

Modified: head/gnu/usr.bin/binutils/Makefile
==
--- head/gnu/usr.bin/binutils/Makefile  Wed Jul 29 18:33:11 2015
(r286029)
+++ head/gnu/usr.bin/binutils/Makefile  Wed Jul 29 18:45:38 2015
(r286030)
@@ -11,7 +11,7 @@ SUBDIR=   doc\
as \
ld \
${_nm} \
-   objcopy \
+   ${_objcopy} \
objdump \
${_readelf} \
${_size} \
@@ -26,5 +26,8 @@ _size=size
 _strings=  strings
 _strip=strip
 .endif
+.if ${MK_ELFTOOLCHAIN_TOOLS} == "no" || ${MK_ELFCOPY_AS_OBJCOPY} == "no"
+_objcopy=  objcopy
+.endif
 
 .include 

Modified: head/share/mk/src.opts.mk
==
--- head/share/mk/src.opts.mk   Wed Jul 29 18:33:11 2015(r286029)
+++ head/share/mk/src.opts.mk   Wed Jul 29 18:45:38 2015(r286030)
@@ -234,6 +234,9 @@ __DEFAULT_NO_OPTIONS+=CLANG CLANG_BOOTST
 .endif
 .if ${__T} == "aarch64"
 BROKEN_OPTIONS+=BINUTILS BINUTILS_BOOTSTRAP GCC GCC_BOOTSTRAP GDB
+__DEFAULT_YES_OPTIONS+=ELFCOPY_AS_OBJCOPY
+.else
+__DEFAULT_NO_OPTIONS+=ELFCOPY_AS_OBJCOPY
 .endif
 # LLVM lacks support for FreeBSD 64-bit atomic operations for ARMv4/ARMv5
 .if ${__T} == "arm" || ${__T} == "armeb"

Modified: head/tools/build/mk/OptionalObsoleteFiles.inc
==
--- head/tools/build/mk/OptionalObsoleteFiles.inc   Wed Jul 29 18:33:11 
2015(r286029)
+++ head/tools/build/mk/OptionalObsoleteFiles.inc   Wed Jul 29 18:45:38 
2015(r286030)
@@ -184,7 +184,9 @@ OLD_DIRS+=usr/share/examples/bhyve
 .if ${MK_BINUTILS} == no
 OLD_FILES+=usr/bin/as
 OLD_FILES+=usr/bin/ld
+.if ${MK_ELFTOOLCHAIN_TOOLS} != no && ${MK_ELFCOPY_AS_OBJCOPY} == no
 OLD_FILES+=usr/bin/objcopy
+.endif
 OLD_FILES+=usr/bin/objdump
 OLD_FILES+=usr/libdata/ldscripts/elf_x86_64_fbsd.x
 OLD_FILES+=usr/libdata/ldscripts/elf_x86_64_fbsd.xbn
@@ -201,7 +203,9 @@ OLD_FILES+=usr/libdata/ldscripts/elf_x86
 OLD_FILES+=usr/libdata/ldscripts/elf_x86_64_fbsd.xw
 OLD_FILES+=usr/share/man/man1/as.1.gz
 OLD_FILES+=usr/share/man/man1/ld.1.gz
+.if ${MK_ELFTOOLCHAIN_TOOLS} != no && ${MK_ELFCOPY_AS_OBJCOPY} == no
 OLD_FILES+=usr/share/man/man1/objcopy.1.gz
+.endif
 OLD_FILES+=usr/share/man/man1/objdump.1.gz
 OLD_FILES+=usr/share/man/man7/as.7.gz
 OLD_FILES+=usr/share/man/man7/ld.7.gz
@@ -1646,7 +1650,8 @@ OLD_FILES+=usr/share/nls/ru_RU.KOI8-R/ee
 OLD_FILES+=usr/share/nls/uk_UA.KOI8-U/ee.cat
 .endif
 
-.if ${MK_ELFTOOLCHAIN_TOOLS} == no
+.if ${MK_ELFTOOLCHAIN_TOOLS} == no || \
+(${MK_ELFTOOLCHAIN_TOOLS} != no && MK_ELFCOPY_AS_OBJCOPY != no)
 OLD_FILES+=usr/bin/elfcopy
 OLD_FILES+=usr/share/man/man1/elfcopy.1.gz
 .endif

Added: head/tools/build/options/WITHOUT_ELFCOPY_AS_OBJCOPY
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tools/build/options/WITHOUT_ELFCOPY_AS_OBJCOPY Wed Jul 29 18:45:38 
2015(r286030)
@@ -0,0 +1,4 @@
+.\" $FreeBSD$
+Set to build and install
+.Xr objcopy 1
+from GNU Binutils, instead of the one from ELF Tool Chain.

Added: head/tools/build/options/WITH_ELFCOPY_AS_OBJCOPY
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tools/build/options/WITH_ELFCOPY_AS_OBJCOPYWed Jul 29 18:45:38 
2015(r286030)
@@ -0,0 +1,4 @@
+.\" $FreeBSD$
+Set to build and install ELF Tool Chain's elfcopy as
+.Xr objcopy 1 ,
+instead of the one from GNU Binutils.

Modified: head/usr.bin/elfcopy/Makefile
==
--- head/usr.bin/elfcopy/Makefile   Wed Jul 29 18:33:11 2015
(r286029)
+++ head/usr.bin/elfcopy/Makefile   Wed Jul 29 18:45:38 2015
(r286030)
@@ -7,7 +7,15 @@ ELFCOPYDIR=${ELFTCDIR}/elfcopy
 
 .PATH: ${

Re: svn commit: r286027 - in head/sys: netinet sys

2015-07-29 Thread Shawn Webb
On Wednesday, 29 July 2015 05:59:14 PM Patrick Kelsey wrote:
> Author: pkelsey
> Date: Wed Jul 29 17:59:13 2015
> New Revision: 286027
> URL: https://svnweb.freebsd.org/changeset/base/286027
> 
> Log:
>   Revert r265338, r271089 and r271123 as those changes do not handle
>   non-inline urgent data and introduce an mbuf exhaustion attack vector
>   similar to FreeBSD-SA-15:15.tcp, but not requiring VNETs.
> 
>   Address the issue described in FreeBSD-SA-15:15.tcp.
> 
>   Reviewed by:glebius
>   Approved by:so
>   Approved by:jmallett (mentor)
>   Security:   FreeBSD-SA-15:15.tcp
>   Sponsored by:   Norse Corp, Inc.

Does this commit need to be MFC'd to stable/10? Or is this only for HEAD?

Thanks,

-- 
Shawn Webb
HardenedBSD

GPG Key ID:0x6A84658F52456EEE
GPG Key Fingerprint: 2ABA B6BD EF6A F486 BE89  3D9E 6A84 658F 5245 6EEE

signature.asc
Description: This is a digitally signed message part.


svn commit: r286029 - head/tools/build/mk

2015-07-29 Thread Ed Maste
Author: emaste
Date: Wed Jul 29 18:33:11 2015
New Revision: 286029
URL: https://svnweb.freebsd.org/changeset/base/286029

Log:
  Update OLD_FILES for tools provided by ELF Tool Chain or Binutils
  
  Sponsored by: The FreeBSD Foundation

Modified:
  head/tools/build/mk/OptionalObsoleteFiles.inc

Modified: head/tools/build/mk/OptionalObsoleteFiles.inc
==
--- head/tools/build/mk/OptionalObsoleteFiles.inc   Wed Jul 29 18:04:01 
2015(r286028)
+++ head/tools/build/mk/OptionalObsoleteFiles.inc   Wed Jul 29 18:33:11 
2015(r286029)
@@ -186,7 +186,6 @@ OLD_FILES+=usr/bin/as
 OLD_FILES+=usr/bin/ld
 OLD_FILES+=usr/bin/objcopy
 OLD_FILES+=usr/bin/objdump
-OLD_FILES+=usr/bin/readelf
 OLD_FILES+=usr/libdata/ldscripts/elf_x86_64_fbsd.x
 OLD_FILES+=usr/libdata/ldscripts/elf_x86_64_fbsd.xbn
 OLD_FILES+=usr/libdata/ldscripts/elf_x86_64_fbsd.xc
@@ -204,7 +203,6 @@ OLD_FILES+=usr/share/man/man1/as.1.gz
 OLD_FILES+=usr/share/man/man1/ld.1.gz
 OLD_FILES+=usr/share/man/man1/objcopy.1.gz
 OLD_FILES+=usr/share/man/man1/objdump.1.gz
-OLD_FILES+=usr/share/man/man1/readelf.1.gz
 OLD_FILES+=usr/share/man/man7/as.7.gz
 OLD_FILES+=usr/share/man/man7/ld.7.gz
 OLD_FILES+=usr/share/man/man7/ldint.7.gz
@@ -1653,6 +1651,21 @@ OLD_FILES+=usr/bin/elfcopy
 OLD_FILES+=usr/share/man/man1/elfcopy.1.gz
 .endif
 
+.if ${MK_ELFTOOLCHAIN_TOOLS} == no && ${MK_BINUTILS} == no
+OLD_FILES+=usr/bin/addr2line
+OLD_FILES+=usr/bin/nm
+OLD_FILES+=usr/bin/readelf
+OLD_FILES+=usr/bin/size
+OLD_FILES+=usr/bin/strings
+OLD_FILES+=usr/bin/strip
+OLD_FILES+=usr/share/man/man1/addr2line.1.gz
+OLD_FILES+=usr/share/man/man1/nm.1.gz
+OLD_FILES+=usr/share/man/man1/readelf.1.gz
+OLD_FILES+=usr/share/man/man1/size.1.gz
+OLD_FILES+=usr/share/man/man1/strings.1.gz
+OLD_FILES+=usr/share/man/man1/strip.1.gz
+.endif
+
 #.if ${MK_EXAMPLES} == no
 # to be filled in
 #.endif
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r286028 - head/sys/netinet

2015-07-29 Thread Ermal Luçi
Author: eri
Date: Wed Jul 29 18:04:01 2015
New Revision: 286028
URL: https://svnweb.freebsd.org/changeset/base/286028

Log:
  ip_output normalization and fixes
  
  ip_output has a big chunk of code used to handle special cases with pfil 
consumers which also forces a reloop on it.
  Gather all this code together to make it readable and properly handle the 
reloop cases.
  
  Some of the issues identified:
  
  M_IP_NEXTHOP is not handled properly in existing code.
  route reference leaking is possible with in FIB number change
  route flags checking is not consistent in the function
  
  Differential Revision:https://reviews.freebsd.org/D3022
  Reviewed by:  gnn
  Approved by:  gnn(mentor)
  MFC after:4 weeks

Modified:
  head/sys/netinet/ip_output.c

Modified: head/sys/netinet/ip_output.c
==
--- head/sys/netinet/ip_output.cWed Jul 29 17:59:13 2015
(r286027)
+++ head/sys/netinet/ip_output.cWed Jul 29 18:04:01 2015
(r286028)
@@ -106,6 +106,94 @@ static voidip_mloopback
 extern int in_mcast_loop;
 extern struct protosw inetsw[];
 
+static inline int
+ip_output_pfil(struct mbuf *m, struct ifnet *ifp, struct inpcb *inp,
+   struct sockaddr_in *dst, int *fibnum, int *error)
+{
+   struct m_tag *fwd_tag = NULL;
+   struct in_addr odst;
+   struct ip *ip;
+
+   ip = mtod(m, struct ip *);
+
+   /* Run through list of hooks for output packets. */
+   odst.s_addr = ip->ip_dst.s_addr;
+   *error = pfil_run_hooks(&V_inet_pfil_hook, &m, ifp, PFIL_OUT, inp);
+   if ((*error) != 0 || m == NULL)
+   return 1; /* Finished */
+
+   ip = mtod(m, struct ip *);
+
+   /* See if destination IP address was changed by packet filter. */
+   if (odst.s_addr != ip->ip_dst.s_addr) {
+   m->m_flags |= M_SKIP_FIREWALL;
+   /* If destination is now ourself drop to ip_input(). */
+   if (in_localip(ip->ip_dst)) {
+   m->m_flags |= M_FASTFWD_OURS;
+   if (m->m_pkthdr.rcvif == NULL)
+   m->m_pkthdr.rcvif = V_loif;
+   if (m->m_pkthdr.csum_flags & CSUM_DELAY_DATA) {
+   m->m_pkthdr.csum_flags |=
+   CSUM_DATA_VALID | CSUM_PSEUDO_HDR;
+   m->m_pkthdr.csum_data = 0x;
+   }
+   m->m_pkthdr.csum_flags |=
+   CSUM_IP_CHECKED | CSUM_IP_VALID;
+#ifdef SCTP
+   if (m->m_pkthdr.csum_flags & CSUM_SCTP)
+   m->m_pkthdr.csum_flags |= CSUM_SCTP_VALID;
+#endif
+   *error = netisr_queue(NETISR_IP, m);
+   return 1; /* Finished */
+   }
+
+   bzero(dst, sizeof(*dst));
+   dst->sin_family = AF_INET;
+   dst->sin_len = sizeof(*dst);
+   dst->sin_addr = ip->ip_dst;
+
+   return -1; /* Reloop */
+   }
+   /* See if fib was changed by packet filter. */
+   if ((*fibnum) != M_GETFIB(m)) {
+   m->m_flags |= M_SKIP_FIREWALL;
+   *fibnum = M_GETFIB(m);
+   return -1; /* Reloop for FIB change */
+   }
+
+   /* See if local, if yes, send it to netisr with IP_FASTFWD_OURS. */
+   if (m->m_flags & M_FASTFWD_OURS) {
+   if (m->m_pkthdr.rcvif == NULL)
+   m->m_pkthdr.rcvif = V_loif;
+   if (m->m_pkthdr.csum_flags & CSUM_DELAY_DATA) {
+   m->m_pkthdr.csum_flags |=
+   CSUM_DATA_VALID | CSUM_PSEUDO_HDR;
+   m->m_pkthdr.csum_data = 0x;
+   }
+#ifdef SCTP
+   if (m->m_pkthdr.csum_flags & CSUM_SCTP)
+   m->m_pkthdr.csum_flags |= CSUM_SCTP_VALID;
+#endif
+   m->m_pkthdr.csum_flags |=
+   CSUM_IP_CHECKED | CSUM_IP_VALID;
+
+   *error = netisr_queue(NETISR_IP, m);
+   return 1; /* Finished */
+   }
+   /* Or forward to some other address? */
+   if ((m->m_flags & M_IP_NEXTHOP) &&
+   ((fwd_tag = m_tag_find(m, PACKET_TAG_IPFORWARD, NULL)) != NULL)) {
+   bcopy((fwd_tag+1), dst, sizeof(struct sockaddr_in));
+   m->m_flags |= M_SKIP_FIREWALL;
+   m->m_flags &= ~M_IP_NEXTHOP;
+   m_tag_delete(m, fwd_tag);
+
+   return -1; /* Reloop for CHANGE of dst */
+   }
+
+   return 0;
+}
+
 /*
  * IP output.  The packet in mbuf chain m contains a skeletal IP
  * header (with len, off, ttl, proto, tos, src, dst).
@@ -136,11 +224,8 @@ ip_output(struct mbuf *m, struct mbuf *o
uint16_t ip_len, ip_off;
struct route iproute;
struct rtentry *rte;/* cache for ro->ro_rt */
-   struct in_add

svn commit: r286027 - in head/sys: netinet sys

2015-07-29 Thread Patrick Kelsey
Author: pkelsey
Date: Wed Jul 29 17:59:13 2015
New Revision: 286027
URL: https://svnweb.freebsd.org/changeset/base/286027

Log:
  Revert r265338, r271089 and r271123 as those changes do not handle
  non-inline urgent data and introduce an mbuf exhaustion attack vector
  similar to FreeBSD-SA-15:15.tcp, but not requiring VNETs.
  
  Address the issue described in FreeBSD-SA-15:15.tcp.
  
  Reviewed by:  glebius
  Approved by:  so
  Approved by:  jmallett (mentor)
  Security: FreeBSD-SA-15:15.tcp
  Sponsored by: Norse Corp, Inc.

Modified:
  head/sys/netinet/tcp_input.c
  head/sys/netinet/tcp_reass.c
  head/sys/netinet/tcp_subr.c
  head/sys/netinet/tcp_usrreq.c
  head/sys/netinet/tcp_var.h
  head/sys/sys/mbuf.h

Modified: head/sys/netinet/tcp_input.c
==
--- head/sys/netinet/tcp_input.cWed Jul 29 17:50:14 2015
(r286026)
+++ head/sys/netinet/tcp_input.cWed Jul 29 17:59:13 2015
(r286027)
@@ -1665,7 +1665,8 @@ tcp_do_segment(struct mbuf *m, struct tc
tp->snd_nxt == tp->snd_max &&
tiwin && tiwin == tp->snd_wnd && 
((tp->t_flags & (TF_NEEDSYN|TF_NEEDFIN)) == 0) &&
-   tp->t_segq == NULL && ((to.to_flags & TOF_TS) == 0 ||
+   LIST_EMPTY(&tp->t_segq) &&
+   ((to.to_flags & TOF_TS) == 0 ||
 TSTMP_GEQ(to.to_tsval, tp->ts_recent)) ) {
 
/*
@@ -2903,7 +2904,8 @@ dodata:   
/* XXX */
 * immediately when segments are out of order (so
 * fast retransmit can work).
 */
-   if (th->th_seq == tp->rcv_nxt && tp->t_segq == NULL &&
+   if (th->th_seq == tp->rcv_nxt &&
+   LIST_EMPTY(&tp->t_segq) &&
TCPS_HAVEESTABLISHED(tp->t_state)) {
if (DELAY_ACK(tp, tlen))
tp->t_flags |= TF_DELACK;

Modified: head/sys/netinet/tcp_reass.c
==
--- head/sys/netinet/tcp_reass.cWed Jul 29 17:50:14 2015
(r286026)
+++ head/sys/netinet/tcp_reass.cWed Jul 29 17:59:13 2015
(r286027)
@@ -71,33 +71,80 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#ifdef TCPDEBUG
+#include 
+#endif /* TCPDEBUG */
+
+static SYSCTL_NODE(_net_inet_tcp, OID_AUTO, reass, CTLFLAG_RW, 0,
+"TCP Segment Reassembly Queue");
+
+static int tcp_reass_maxseg = 0;
+SYSCTL_INT(_net_inet_tcp_reass, OID_AUTO, maxsegments, CTLFLAG_RDTUN,
+&tcp_reass_maxseg, 0,
+"Global maximum number of TCP Segments in Reassembly Queue");
+
+static uma_zone_t tcp_reass_zone;
+SYSCTL_UMA_CUR(_net_inet_tcp_reass, OID_AUTO, cursegments, CTLFLAG_VNET,
+&tcp_reass_zone,
+"Global number of TCP Segments currently in Reassembly Queue");
+
+/* Initialize TCP reassembly queue */
+static void
+tcp_reass_zone_change(void *tag)
+{
+
+   /* Set the zone limit and read back the effective value. */
+   tcp_reass_maxseg = nmbclusters / 16;
+   tcp_reass_maxseg = uma_zone_set_max(tcp_reass_zone,
+   tcp_reass_maxseg);
+}
+
+void
+tcp_reass_global_init(void)
+{
+
+   tcp_reass_maxseg = nmbclusters / 16;
+   TUNABLE_INT_FETCH("net.inet.tcp.reass.maxsegments",
+   &tcp_reass_maxseg);
+   tcp_reass_zone = uma_zcreate("tcpreass", sizeof (struct tseg_qent),
+   NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE);
+   /* Set the zone limit and read back the effective value. */
+   tcp_reass_maxseg = uma_zone_set_max(tcp_reass_zone,
+   tcp_reass_maxseg);
+   EVENTHANDLER_REGISTER(nmbclusters_change,
+   tcp_reass_zone_change, NULL, EVENTHANDLER_PRI_ANY);
+}
 
 void
 tcp_reass_flush(struct tcpcb *tp)
 {
-   struct mbuf *m;
+   struct tseg_qent *qe;
 
INP_WLOCK_ASSERT(tp->t_inpcb);
 
-   while ((m = tp->t_segq) != NULL) {
-   tp->t_segq = m->m_nextpkt;
-   tp->t_segqlen -= m->m_pkthdr.len;
-   m_freem(m);
+   while ((qe = LIST_FIRST(&tp->t_segq)) != NULL) {
+   LIST_REMOVE(qe, tqe_q);
+   m_freem(qe->tqe_m);
+   uma_zfree(tcp_reass_zone, qe);
+   tp->t_segqlen--;
}
 
KASSERT((tp->t_segqlen == 0),
-   ("TCP reass queue %p length is %d instead of 0 after flush.",
+   ("TCP reass queue %p segment count is %d instead of 0 after flush.",
tp, tp->t_segqlen));
 }
 
-#defineM_TCPHDR(m) ((struct tcphdr *)((m)->m_pkthdr.pkt_tcphdr))
-
 int
 tcp_reass(struct tcpcb *tp, struct tcphdr *th, int *tlenp, struct mbuf *m)
 {
+   struct tseg_qent *q;
+   struct tseg_qent *p = NULL;
+   struct tseg_qent *nq;
+   struct tseg_qent *te = NULL;
struct socket *so = tp->t_inpcb->inp_socket;
-   struct mbuf *mq, *mp;
-   int flags, wakeup;
+  

svn commit: r286026 - stable/10/sys/netinet

2015-07-29 Thread Ermal Luçi
Author: eri
Date: Wed Jul 29 17:50:14 2015
New Revision: 286026
URL: https://svnweb.freebsd.org/changeset/base/286026

Log:
  MFC 285325
  Correct issue presented in r285051 by properly initializing variable.
  
  Differential Revision: https://reviews.freebsd.org/D3036

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

Modified: stable/10/sys/netinet/ip_input.c
==
--- stable/10/sys/netinet/ip_input.cWed Jul 29 17:46:16 2015
(r286025)
+++ stable/10/sys/netinet/ip_input.cWed Jul 29 17:50:14 2015
(r286026)
@@ -1382,7 +1382,8 @@ ip_forward(struct mbuf *m, int srcrt)
if (ro.ro_rt != NULL) {
ia = ifatoia(ro.ro_rt->rt_ifa);
ifa_ref(&ia->ia_ifa);
-   }
+   } else
+   ia = NULL;
 #ifndef IPSEC
/*
 * 'ia' may be NULL if there is no route for this destination.
___
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: r286025 - stable/10/sys/netinet

2015-07-29 Thread Ermal Luçi
Author: eri
Date: Wed Jul 29 17:46:16 2015
New Revision: 286025
URL: https://svnweb.freebsd.org/changeset/base/286025

Log:
  MFC r285051
  Avoid doing multiple route lookups for the same destination IP during 
forwarding.
  
  Differential Revision:https://reviews.freebsd.org/D2964

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

Modified: stable/10/sys/netinet/ip_input.c
==
--- stable/10/sys/netinet/ip_input.cWed Jul 29 17:34:26 2015
(r286024)
+++ stable/10/sys/netinet/ip_input.cWed Jul 29 17:46:16 2015
(r286025)
@@ -1345,6 +1345,7 @@ ip_forward(struct mbuf *m, int srcrt)
struct ip *ip = mtod(m, struct ip *);
struct in_ifaddr *ia;
struct mbuf *mcopy;
+   struct sockaddr_in *sin;
struct in_addr dest;
struct route ro;
int error, type = 0, code = 0, mtu = 0;
@@ -1366,7 +1367,22 @@ ip_forward(struct mbuf *m, int srcrt)
}
 #endif
 
-   ia = ip_rtaddr(ip->ip_dst, M_GETFIB(m));
+   bzero(&ro, sizeof(ro));
+   sin = (struct sockaddr_in *)&ro.ro_dst;
+   sin->sin_family = AF_INET;
+   sin->sin_len = sizeof(*sin);
+   sin->sin_addr = ip->ip_dst;
+#ifdef RADIX_MPATH
+   rtalloc_mpath_fib(&ro,
+   ntohl(ip->ip_src.s_addr ^ ip->ip_dst.s_addr),
+   M_GETFIB(m));
+#else
+   in_rtalloc_ign(&ro, 0, M_GETFIB(m));
+#endif
+   if (ro.ro_rt != NULL) {
+   ia = ifatoia(ro.ro_rt->rt_ifa);
+   ifa_ref(&ia->ia_ifa);
+   }
 #ifndef IPSEC
/*
 * 'ia' may be NULL if there is no route for this destination.
@@ -1375,6 +1391,7 @@ ip_forward(struct mbuf *m, int srcrt)
 */
if (!srcrt && ia == NULL) {
icmp_error(m, ICMP_UNREACH, ICMP_UNREACH_HOST, 0, 0);
+   RO_RTFREE(&ro);
return;
}
 #endif
@@ -1431,16 +1448,8 @@ ip_forward(struct mbuf *m, int srcrt)
dest.s_addr = 0;
if (!srcrt && V_ipsendredirects &&
ia != NULL && ia->ia_ifp == m->m_pkthdr.rcvif) {
-   struct sockaddr_in *sin;
struct rtentry *rt;
 
-   bzero(&ro, sizeof(ro));
-   sin = (struct sockaddr_in *)&ro.ro_dst;
-   sin->sin_family = AF_INET;
-   sin->sin_len = sizeof(*sin);
-   sin->sin_addr = ip->ip_dst;
-   in_rtalloc_ign(&ro, 0, M_GETFIB(m));
-
rt = ro.ro_rt;
 
if (rt && (rt->rt_flags & (RTF_DYNAMIC|RTF_MODIFIED)) == 0 &&
@@ -1459,16 +1468,8 @@ ip_forward(struct mbuf *m, int srcrt)
code = ICMP_REDIRECT_HOST;
}
}
-   if (rt)
-   RTFREE(rt);
}
 
-   /*
-* Try to cache the route MTU from ip_output so we can consider it for
-* the ICMP_UNREACH_NEEDFRAG "Next-Hop MTU" field described in RFC1191.
-*/
-   bzero(&ro, sizeof(ro));
-
error = ip_output(m, NULL, &ro, IP_FORWARDING, NULL, NULL);
 
if (error == EMSGSIZE && ro.ro_rt)
___
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: r286024 - head/usr.bin/ar

2015-07-29 Thread Ed Maste
Author: emaste
Date: Wed Jul 29 17:34:26 2015
New Revision: 286024
URL: https://svnweb.freebsd.org/changeset/base/286024

Log:
  ar: Fix deterministic mode default with options other than -q or -r
  
  Reported by:  jhibbits
  Reviewed by:  jhibbits
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D3237

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

Modified: head/usr.bin/ar/ar.c
==
--- head/usr.bin/ar/ar.cWed Jul 29 17:28:04 2015(r286023)
+++ head/usr.bin/ar/ar.cWed Jul 29 17:34:26 2015(r286024)
@@ -100,12 +100,12 @@ main(int argc, char **argv)
struct bsdar*bsdar, bsdar_storage;
char*p;
size_t   len;
-   int  i, opt;
+   int  i, opt, Dflag, Uflag;
 
bsdar = &bsdar_storage;
memset(bsdar, 0, sizeof(*bsdar));
-   /* Enable deterministic mode by default. */
-   bsdar->options |= AR_D;
+   Dflag = 0;
+   Uflag = 0;
 
if ((bsdar->progname = getprogname()) == NULL)
bsdar->progname = "ar";
@@ -122,10 +122,12 @@ main(int argc, char **argv)
/* Ignored. */
break;
case 'D':
-   bsdar->options |= AR_D;
+   Dflag = 1;
+   Uflag = 0;
break;
case 'U':
-   bsdar->options &= ~AR_D;
+   Uflag = 1;
+   Dflag = 0;
break;
case 'V':
ranlib_version();
@@ -182,7 +184,8 @@ main(int argc, char **argv)
set_mode(bsdar, opt);
break;
case 'D':
-   bsdar->options |= AR_D;
+   Dflag = 1;
+   Uflag = 0;
break;
case 'f':
case 'T':
@@ -222,7 +225,8 @@ main(int argc, char **argv)
set_mode(bsdar, opt);
break;
case 'U':
-   bsdar->options &= ~AR_D;
+   Uflag = 1;
+   Dflag = 0;
break;
case 'u':
bsdar->options |= AR_U;
@@ -275,6 +279,10 @@ main(int argc, char **argv)
argv++;
}
 
+   /* Set determinstic mode for -D, and by default without -U. */
+   if (Dflag || (Uflag == 0 && (bsdar->mode == 'q' || bsdar->mode == 'r')))
+   bsdar->options |= AR_D;
+
if (bsdar->options & AR_A)
only_mode(bsdar, "-a", "mqr");
if (bsdar->options & AR_B)
@@ -283,8 +291,10 @@ main(int argc, char **argv)
only_mode(bsdar, "-c", "qr");
if (bsdar->options & AR_CC)
only_mode(bsdar, "-C", "x");
-   if (bsdar->options & AR_D)
+   if (Dflag)
only_mode(bsdar, "-D", "qr");
+   if (Uflag)
+   only_mode(bsdar, "-U", "qr");
if (bsdar->options & AR_O)
only_mode(bsdar, "-o", "x");
if (bsdar->options & AR_SS)
___
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: r286023 - releng/10.2/release/doc/en_US.ISO8859-1/hardware

2015-07-29 Thread Christian Brueffer
Author: brueffer
Date: Wed Jul 29 17:28:04 2015
New Revision: 286023
URL: https://svnweb.freebsd.org/changeset/base/286023

Log:
  MFC: r285859 (via r286019)
  
  Auto-generate hardware notes for pms(4).
  
  Approved by:  re (gjb)

Modified:
  releng/10.2/release/doc/en_US.ISO8859-1/hardware/article.xml
Directory Properties:
  releng/10.2/   (props changed)

Modified: releng/10.2/release/doc/en_US.ISO8859-1/hardware/article.xml
==
--- releng/10.2/release/doc/en_US.ISO8859-1/hardware/article.xmlWed Jul 
29 17:25:18 2015(r286022)
+++ releng/10.2/release/doc/en_US.ISO8859-1/hardware/article.xmlWed Jul 
29 17:28:04 2015(r286023)
@@ -765,6 +765,8 @@
 
   &hwlist.nsp;
 
+  &hwlist.pms;
+
   &hwlist.pst;
 
   &hwlist.siis;
___
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: r286022 - releng/10.2/share/man/man4

2015-07-29 Thread Christian Brueffer
Author: brueffer
Date: Wed Jul 29 17:25:18 2015
New Revision: 286022
URL: https://svnweb.freebsd.org/changeset/base/286022

Log:
  MFC: r285858, r286017
  
  Add a basic manpage for the pms driver.
  
  Approved by:  re (gjb)

Added:
  releng/10.2/share/man/man4/pms.4
 - copied unchanged from r286018, stable/10/share/man/man4/pms.4
Modified:
  releng/10.2/share/man/man4/Makefile
Directory Properties:
  releng/10.2/   (props changed)

Modified: releng/10.2/share/man/man4/Makefile
==
--- releng/10.2/share/man/man4/Makefile Wed Jul 29 17:18:27 2015
(r286021)
+++ releng/10.2/share/man/man4/Makefile Wed Jul 29 17:25:18 2015
(r286022)
@@ -382,6 +382,7 @@ MAN=aac.4 \
${_pflog.4} \
${_pfsync.4} \
pim.4 \
+   pms.4 \
polling.4 \
ppbus.4 \
ppc.4 \

Copied: releng/10.2/share/man/man4/pms.4 (from r286018, 
stable/10/share/man/man4/pms.4)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ releng/10.2/share/man/man4/pms.4Wed Jul 29 17:25:18 2015
(r286022, copy of r286018, stable/10/share/man/man4/pms.4)
@@ -0,0 +1,126 @@
+.\" Copyright (c) 2015 Christian Brueffer
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\"notice, this list of conditions and the following disclaimer in the
+.\"documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 29, 2015
+.Dt PMS 4
+.Os
+.Sh NAME
+.Nm pms
+.Nd "PMC-Sierra PM8001/8081/8088/8089/8074/8076/8077 SAS/SATA HBA Controller 
driver"
+.Sh SYNOPSIS
+To compile the driver into the kernel,
+place the following line in the
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device pms"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+pms_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for the PMC-Sierra PM8001/8081/8088/8089/8074/8076/8077
+range of SAS/SATA HBA controllers.
+.Sh HARDWARE
+The
+.Nm
+driver supports the following hardware:
+.Pp
+.Bl -bullet -compact
+.It
+Tachyon TS Fibre Channel Card
+.It
+Tachyon TL Fibre Channel Card
+.It
+Tachyon XL2 Fibre Channel Card
+.It
+Tachyon DX2 Fibre Channel Card
+.It
+Tachyon DX2+ Fibre Channel Card
+.It
+Tachyon DX4+ Fibre Channel Card
+.It
+Tachyon QX2 Fibre Channel Card
+.It
+Tachyon QX4 Fibre Channel Card
+.It
+Tachyon DE4 Fibre Channel Card
+.It
+Tachyon QE4 Fibre Channel Card
+.It
+Tachyon XL10 Fibre Channel Card
+.It
+PMC Sierra SPC SAS-SATA Card
+.It
+PMC Sierra SPC-V SAS-SATA Card
+.It
+PMC Sierra SPC-VE SAS-SATA Card
+.It
+PMC Sierra SPC-V 16 Port SAS-SATA Card
+.It
+PMC Sierra SPC-VE 16 Port SAS-SATA Card
+.It
+PMC Sierra SPC-V SAS-SATA Card 12Gig
+.It
+PMC Sierra SPC-VE SAS-SATA Card 12Gig
+.It
+PMC Sierra SPC-V 16 Port SAS-SATA Card 12Gig
+.It
+PMC Sierra SPC-VE 16 Port SAS-SATA Card 12Gig
+.It
+Adaptec Hialeah 4/8 Port SAS-SATA HBA Card 6Gig
+.It
+Adaptec Hialeah 4/8 Port SAS-SATA RAID Card 6Gig
+.It
+Adaptec Hialeah 8/16 Port SAS-SATA HBA Card 6Gig
+.It
+Adaptec Hialeah 8/16 Port SAS-SATA RAID Card 6Gig
+.It
+Adaptec Hialeah 8/16 Port SAS-SATA HBA Encryption Card 6Gig
+.It
+Adaptec Hialeah 8/16 Port SAS-SATA RAID Encryption Card 6Gig
+.It
+Adaptec Delray 8 Port SAS-SATA HBA Card 12Gig
+.It
+Adaptec Delray 8 Port SAS-SATA HBA Encryption Card 12Gig
+.It
+Adaptec Delray 16 Port SAS-SATA HBA Card 12Gig
+.It
+Adaptec Delray 16 Port SAS-SATA HBA Encryption Card 12Gig
+.El
+.Sh SEE ALSO
+.Xr cam 4 ,
+.Xr camcontrol 8
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 10.2 .
___
svn-src-all@freebsd.org m

Re: svn commit: r286000 - head/sys/netipsec

2015-07-29 Thread Ermal Luçi
On Wed, Jul 29, 2015 at 5:40 PM, John-Mark Gurney  wrote:

> Ermal Lui wrote this message on Wed, Jul 29, 2015 at 14:53 +0200:
> > this was forgotten part on my patches merge from gnn@.
> > Can it be fixed by correcting the patches rather than re-introducing
> this?
> >
> > Most probably the constant definition is wrong on the transforms and also
> > some part of code removal was missed.
>
> No, it cannot be fixed by changing opencrypto/xform.c to truncate the
> hash size...  The reason it cannot be is that OCF is not an IPsec only
> framework...
>
> Geli also uses the HMAC constructions, and I have not confirmed if they
> use the full hash size or not...  I would be open to adding a field to
> the crypto descriptor that limited how much of the hash is copied out...
>
> It would have been helpful to comment more of these changes...  If you
> make a change for a reason (RFC, etc), then throw that in the comments,
> which allows someone following to understand why and prevent their
> removal...  At least if they were commented as to why they changed, we
> would have known to rework the change...
>
>
Yes you are right but according to me this is standard practice being done
allover SSL/IPSec
I am not sure which standard GELI follows to comment on that!

Also then it would be better to review the declarations on the transform
since they are apparently not generic, no?



> > On Wed, Jul 29, 2015 at 9:15 AM, John-Mark Gurney 
> wrote:
> >
> > > Author: jmg
> > > Date: Wed Jul 29 07:15:16 2015
> > > New Revision: 286000
> > > URL: https://svnweb.freebsd.org/changeset/base/286000
> > >
> > > Log:
> > >   RFC4868 section 2.3 requires that the output be half...  This fixes
> > >   problems that was introduced in r285336...  I have verified that
> > >   HMAC-SHA2-256 both ah only and w/ AES-CBC interoperate w/ a NetBSD
> > >   6.1.5 vm...
> > >
> > >   Reviewed by:  gnn
>
> --
>   John-Mark Gurney  Voice: +1 415 225 5579
>
>  "All that I will do, has been done, All that I have, has not."
>



-- 
Ermal
___
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: r286021 - in head/sys: compat/cloudabi compat/linux kern sys

2015-07-29 Thread Ed Schouten
Author: ed
Date: Wed Jul 29 17:18:27 2015
New Revision: 286021
URL: https://svnweb.freebsd.org/changeset/base/286021

Log:
  Make pipes in CloudABI work.
  
  Summary:
  Pipes in CloudABI are unidirectional. The reason for this is that
  CloudABI attempts to provide a uniform runtime environment across
  different flavours of UNIX.
  
  Instead of implementing a custom pipe that is unidirectional, we can
  simply reuse Capsicum permission bits to support this. This is nice,
  because CloudABI already attempts to restrict permission bits to
  correspond with the operations that apply to a certain file descriptor.
  
  Replace kern_pipe() and kern_pipe2() by a single kern_pipe() that takes
  a pair of filecaps. These filecaps are passed to the newly introduced
  falloc_caps() function that creates the descriptors with rights in
  place.
  
  Test Plan:
  CloudABI pipes seem to be created with proper rights in place:
  
  
https://github.com/NuxiNL/cloudlibc/blob/master/src/libc/unistd/pipe_test.c#L44
  
  Reviewers: jilles, mjg
  
  Reviewed By: mjg
  
  Subscribers: imp
  
  Differential Revision: https://reviews.freebsd.org/D3236

Modified:
  head/sys/compat/cloudabi/cloudabi_fd.c
  head/sys/compat/linux/linux_file.c
  head/sys/kern/sys_pipe.c
  head/sys/sys/syscallsubr.h

Modified: head/sys/compat/cloudabi/cloudabi_fd.c
==
--- head/sys/compat/cloudabi/cloudabi_fd.c  Wed Jul 29 17:16:53 2015
(r286020)
+++ head/sys/compat/cloudabi/cloudabi_fd.c  Wed Jul 29 17:18:27 2015
(r286021)
@@ -120,10 +120,24 @@ int
 cloudabi_sys_fd_create2(struct thread *td,
 struct cloudabi_sys_fd_create2_args *uap)
 {
+   struct filecaps fcaps1 = {}, fcaps2 = {};
int fds[2];
int error;
 
switch (uap->type) {
+   case CLOUDABI_FILETYPE_FIFO:
+   /*
+* CloudABI pipes are unidirectional. Restrict rights on
+* the pipe to simulate this.
+*/
+   cap_rights_init(&fcaps1.fc_rights, CAP_EVENT, CAP_FCNTL,
+   CAP_FSTAT, CAP_READ);
+   fcaps1.fc_fcntls = CAP_FCNTL_SETFL;
+   cap_rights_init(&fcaps2.fc_rights, CAP_EVENT, CAP_FCNTL,
+   CAP_FSTAT, CAP_WRITE);
+   fcaps2.fc_fcntls = CAP_FCNTL_SETFL;
+   error = kern_pipe(td, fds, 0, &fcaps1, &fcaps2);
+   break;
case CLOUDABI_FILETYPE_SOCKET_DGRAM:
error = kern_socketpair(td, AF_UNIX, SOCK_DGRAM, 0, fds);
break;

Modified: head/sys/compat/linux/linux_file.c
==
--- head/sys/compat/linux/linux_file.c  Wed Jul 29 17:16:53 2015
(r286020)
+++ head/sys/compat/linux/linux_file.c  Wed Jul 29 17:18:27 2015
(r286021)
@@ -1582,7 +1582,7 @@ linux_pipe(struct thread *td, struct lin
printf(ARGS(pipe, "*"));
 #endif
 
-   error = kern_pipe2(td, fildes, 0);
+   error = kern_pipe(td, fildes, 0, NULL, NULL);
if (error)
return (error);
 
@@ -1609,7 +1609,7 @@ linux_pipe2(struct thread *td, struct li
flags |= O_NONBLOCK;
if ((args->flags & LINUX_O_CLOEXEC) != 0)
flags |= O_CLOEXEC;
-   error = kern_pipe2(td, fildes, flags);
+   error = kern_pipe(td, fildes, flags, NULL, NULL);
if (error)
return (error);
 

Modified: head/sys/kern/sys_pipe.c
==
--- head/sys/kern/sys_pipe.cWed Jul 29 17:16:53 2015(r286020)
+++ head/sys/kern/sys_pipe.cWed Jul 29 17:18:27 2015(r286021)
@@ -397,14 +397,8 @@ pipe_dtor(struct pipe *dpipe)
  * the zone pick up the pieces via pipeclose().
  */
 int
-kern_pipe(struct thread *td, int fildes[2])
-{
-
-   return (kern_pipe2(td, fildes, 0));
-}
-
-int
-kern_pipe2(struct thread *td, int fildes[2], int flags)
+kern_pipe(struct thread *td, int fildes[2], int flags, struct filecaps *fcaps1,
+struct filecaps *fcaps2)
 {
struct file *rf, *wf;
struct pipe *rpipe, *wpipe;
@@ -414,13 +408,13 @@ kern_pipe2(struct thread *td, int fildes
pipe_paircreate(td, &pp);
rpipe = &pp->pp_rpipe;
wpipe = &pp->pp_wpipe;
-   error = falloc(td, &rf, &fd, flags);
+   error = falloc_caps(td, &rf, &fd, flags, fcaps1);
if (error) {
pipeclose(rpipe);
pipeclose(wpipe);
return (error);
}
-   /* An extra reference on `rf' has been held for us by falloc(). */
+   /* An extra reference on `rf' has been held for us by falloc_caps(). */
fildes[0] = fd;
 
fflags = FREAD | FWRITE;
@@ -434,7 +428,7 @@ kern_pipe2(struct thread *td, int fildes
 * side while we are blocked trying to allocate the write side.
 */
finit(rf, fflags, DTYP

Re: svn commit: r285068 - in head/sys: conf modules/agp modules/geom/geom_part/geom_part_apm modules/geom/geom_part/geom_part_bsd modules/geom/geom_part/geom_part_bsd64 modules/geom/geom_part/geom_par

2015-07-29 Thread Hans Petter Selasky

On 07/29/15 18:59, Warner Losh wrote:



On Jul 29, 2015, at 9:46 AM, Hans Petter Selasky  wrote:

On 07/29/15 16:24, Warner Losh wrote:



On Jul 29, 2015, at 4:19 AM, Hans Petter Selasky  wrote:

On 07/03/15 22:15, Warner Losh wrote:



On Jul 3, 2015, at 11:35 AM, Roger Pau Monné  wrote:

El 03/07/15 a les 19.26, Adrian Chadd ha escrit:

ok, so why's it make NFS builds so slow?


AFAICT it makes the build process spawn a bunch of concurrent "find"
processes that weren't previously there.


OK. I’ll fix it. I knew it might slow things down a little, but this is quite a 
bit more than “a little”.

Warner



Hi,

Is there a fix for this issue yet? At Mellanox we're also seeing that NFS 
mounted shares are extremely slow building even a single module. Maybe the 
output from the find can be cached in a file somehow?


Committed the fix within a day of this message (so three weeks ago):

https://svnweb.freebsd.org/base?view=revision&revision=285124

Is it not working? this is the first negative report I’ve heard since Adrian 
and Roger posted. I spiked the test-build with a find that recorded every time 
it ran. W/o the fix, it runs a lot. With the fix it ran once. Is this not the 
case still?


Hi,

In this particular case one "find of /sys" takes 11-16 seconds over NFS, so 
building a single KMOD takes 16 seconds too. It's not possible to eliminate the find 
entirely during repeated builds?


16 seconds? That’s a really slow NFS server and at least 11 seconds longer than 
it should take :(.


Hi,

I think it is a local NFS caching issue. Else it would be faster.

BTW: I think I see a small typo there:


Index: kmod.mk
===
--- kmod.mk (revision 286002)
+++ kmod.mk (working copy)
@@ -361,7 +361,7 @@
 .endif
 .PATH.m: ${_MPATH}
 .for _s in ${SRCS:M*_if.[ch]}
-.if eixsts(${_s:R}.m})
+.if exists(${_s:R}.m})
 CLEANFILES+=   ${_s}
 .endif
 .endfor # _s




Make doesn’t really have the ability to cache results run-to-run, but I’ll poke 
at other options. In the mean time, you can do something like:
setenv _MPATH `(cd $MAKEOBJDIRPREFIX/path/sys/GENERIC; make -V _MPATH)`


I'll pass it on.


to cache the value. Not ideal, but likely good enough for repeated module 
builds. If I can’t come up with anything clever, I’ll just commit the current 
list…
I hate doing that, but I also hadn’t counted upon find taking so stinkin’ 
long...


I think "find" is fine, tough maybe store the result in a file or 
something which is checked into the svn 


--HPS

___
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: r286020 - in head/sys: kern sys

2015-07-29 Thread Ed Schouten
Author: ed
Date: Wed Jul 29 17:16:53 2015
New Revision: 286020
URL: https://svnweb.freebsd.org/changeset/base/286020

Log:
  Introduce falloc_caps() to create descriptors with capabilties in place.
  
  falloc_noinstall() followed by finstall() allows you to create and
  install file descriptors with custom capabilities. Add falloc_caps()
  that can do both of these actions in one go.
  
  This will be used by CloudABI to create pipes with custom capabilities.
  
  Reviewed by:  mjg

Modified:
  head/sys/kern/kern_descrip.c
  head/sys/sys/filedesc.h

Modified: head/sys/kern/kern_descrip.c
==
--- head/sys/kern/kern_descrip.cWed Jul 29 17:05:42 2015
(r286019)
+++ head/sys/kern/kern_descrip.cWed Jul 29 17:16:53 2015
(r286020)
@@ -1707,7 +1707,8 @@ fdallocn(struct thread *td, int minfd, i
  * release the FILEDESC lock.
  */
 int
-falloc(struct thread *td, struct file **resultfp, int *resultfd, int flags)
+falloc_caps(struct thread *td, struct file **resultfp, int *resultfd, int 
flags,
+struct filecaps *fcaps)
 {
struct file *fp;
int error, fd;
@@ -1716,7 +1717,7 @@ falloc(struct thread *td, struct file **
if (error)
return (error); /* no reference held on error */
 
-   error = finstall(td, fp, &fd, flags, NULL);
+   error = finstall(td, fp, &fd, flags, fcaps);
if (error) {
fdrop(fp, td);  /* one reference (fp only) */
return (error);

Modified: head/sys/sys/filedesc.h
==
--- head/sys/sys/filedesc.h Wed Jul 29 17:05:42 2015(r286019)
+++ head/sys/sys/filedesc.h Wed Jul 29 17:16:53 2015(r286020)
@@ -146,6 +146,10 @@ enum {
 /* Flags for kern_dup(). */
 #defineFDDUP_FLAG_CLOEXEC  0x1 /* Atomically set UF_EXCLOSE. */
 
+/* For backward compatibility. */
+#definefalloc(td, resultfp, resultfd, flags) \
+   falloc_caps(td, resultfp, resultfd, flags, NULL)
+
 struct thread;
 
 void   filecaps_init(struct filecaps *fcaps);
@@ -156,8 +160,8 @@ voidfilecaps_free(struct filecaps *fcap
 intclosef(struct file *fp, struct thread *td);
 intdupfdopen(struct thread *td, struct filedesc *fdp, int dfd, int mode,
int openerror, int *indxp);
-intfalloc(struct thread *td, struct file **resultfp, int *resultfd,
-   int flags);
+intfalloc_caps(struct thread *td, struct file **resultfp, int *resultfd,
+   int flags, struct filecaps *fcaps);
 intfalloc_noinstall(struct thread *td, struct file **resultfp);
 void   _finstall(struct filedesc *fdp, struct file *fp, int fd, int flags,
struct filecaps *fcaps);
___
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: r285051 - head/sys/netinet

2015-07-29 Thread Ermal Luçi
On Wed, Jul 29, 2015 at 6:48 PM, George Neville-Neil 
wrote:

>
>
> On 29 Jul 2015, at 11:05, Gleb Smirnoff wrote:
>
>  Ermal,
>>
>> On Wed, Jul 29, 2015 at 03:00:59PM +0200, Ermal Luçi wrote:
>> E> > E> @@ -934,6 +950,7 @@ ip_forward(struct mbuf *m, int srcrt)
>> E> > E>   */
>> E> > E>  if (!srcrt && ia == NULL) {
>> E> > E>  icmp_error(m, ICMP_UNREACH, ICMP_UNREACH_HOST, 0, 0);
>> E> > E> +RO_RTFREE(&ro);
>> E> > E>  return;
>> E> > E>  }
>> E> >
>> E> > Here the ifa reference is leaked upon return.
>> E> >
>> E> >
>> E> Gleb,
>> E>
>> E> the improvement on the ifa_ref not needed is something to look at but
>> the
>> E> ifa_ref here is not lost since ia == NULL, no?
>> E> Maybe i am missing something else.
>>
>> Sure you are right. Mea culpa.
>>
>> E> Also can we put this on a review?
>>
>> It is possible. Let's just wait for Olivier to return and ask him to
>> do a benchmark :)
>>
>>
> Olivier isnt' the only one that can do a benchmark.  I can chuck this up
> in the
> Sentex lab, that's what it's for.  Give me a brief outline and I'll code
> something
> up in Conductor.
>

The outline is simple.
Just forwarding performance in terms of PPS for normal forwarding with the
patch suggested from Gleb builtin.
pmcstat data would be useful as well during this bench :)


>
> Best,
> George
>



-- 
Ermal
___
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: r286010 - head/usr.bin/ar

2015-07-29 Thread Ed Maste
>> Author: emaste
>> Date: Wed Jul 29 13:36:17 2015
>> New Revision: 286010
>> URL: https://svnweb.freebsd.org/changeset/base/286010
>>
>> Log:
>>   ar: enable deterministic mode by default
>
> This breaks ports building.  When building ports-mgmt/pkg:
>
> ar: fatal: Option -D is not permitted in mode -x

Indeed, sorry about that. A possible fix in review:
https://reviews.freebsd.org/D3237
___
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: r286019 - stable/10/release/doc/en_US.ISO8859-1/hardware

2015-07-29 Thread Christian Brueffer
Author: brueffer
Date: Wed Jul 29 17:05:42 2015
New Revision: 286019
URL: https://svnweb.freebsd.org/changeset/base/286019

Log:
  MFC: r285859
  
  Auto-generate hardware notes for pms(4).

Modified:
  stable/10/release/doc/en_US.ISO8859-1/hardware/article.xml
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/release/doc/en_US.ISO8859-1/hardware/article.xml
==
--- stable/10/release/doc/en_US.ISO8859-1/hardware/article.xml  Wed Jul 29 
16:40:48 2015(r286018)
+++ stable/10/release/doc/en_US.ISO8859-1/hardware/article.xml  Wed Jul 29 
17:05:42 2015(r286019)
@@ -765,6 +765,8 @@
 
   &hwlist.nsp;
 
+  &hwlist.pms;
+
   &hwlist.pst;
 
   &hwlist.siis;
___
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: r284345 - in head: . bin/cat bin/chflags bin/chio bin/chmod bin/cp bin/csh bin/date bin/dd bin/df bin/domainname bin/echo bin/ed bin/expr bin/freebsd-version bin/getfacl bin/hostname b

2015-07-29 Thread Warner Losh

> On Jul 26, 2015, at 2:49 PM, Baptiste Daroussin  wrote:
> 
> On Sat, Jun 13, 2015 at 07:20:58PM +, Simon J. Gerraty wrote:
>> Author: sjg
>> Date: Sat Jun 13 19:20:56 2015
>> New Revision: 284345
>> URL: https://svnweb.freebsd.org/changeset/base/284345
>> 
>> Log:
>>  Add META_MODE support.
>> 
>>  Off by default, build behaves normally.
>>  WITH_META_MODE we get auto objdir creation, the ability to
>>  start build from anywhere in the tree.
>> 
>>  Still need to add real targets under targets/ to build packages.
>> 
>>  Differential Revision:   D2796
>>  Reviewed by: brooks imp
> 
> This breaks using fmake from ports because of usage of :U in sys.mk
> 
> fmake has to be supported until 9 is EOLed otherwise this is a major pain for
> all developers, having the ability to use fmake allows people to ensure syntax
> is compatible with FreeBSD 9 (not that I'm just speaking about sys.mk not 
> other
> parts)

It looks like this fixes things. Anybody have any objections to it? We can kill 
it when we EOL FreeBSD 9 here in a bit.

https://reviews.freebsd.org/D3228


Warner



signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: svn commit: r285068 - in head/sys: conf modules/agp modules/geom/geom_part/geom_part_apm modules/geom/geom_part/geom_part_bsd modules/geom/geom_part/geom_part_bsd64 modules/geom/geom_part/geom_par

2015-07-29 Thread Warner Losh

> On Jul 29, 2015, at 9:46 AM, Hans Petter Selasky  wrote:
> 
> On 07/29/15 16:24, Warner Losh wrote:
>> 
>>> On Jul 29, 2015, at 4:19 AM, Hans Petter Selasky  wrote:
>>> 
>>> On 07/03/15 22:15, Warner Losh wrote:
 
> On Jul 3, 2015, at 11:35 AM, Roger Pau Monné  wrote:
> 
> El 03/07/15 a les 19.26, Adrian Chadd ha escrit:
>> ok, so why's it make NFS builds so slow?
> 
> AFAICT it makes the build process spawn a bunch of concurrent "find"
> processes that weren't previously there.
 
 OK. I’ll fix it. I knew it might slow things down a little, but this is 
 quite a bit more than “a little”.
 
 Warner
 
>>> 
>>> Hi,
>>> 
>>> Is there a fix for this issue yet? At Mellanox we're also seeing that NFS 
>>> mounted shares are extremely slow building even a single module. Maybe the 
>>> output from the find can be cached in a file somehow?
>> 
>> Committed the fix within a day of this message (so three weeks ago):
>> 
>> https://svnweb.freebsd.org/base?view=revision&revision=285124
>> 
>> Is it not working? this is the first negative report I’ve heard since Adrian 
>> and Roger posted. I spiked the test-build with a find that recorded every 
>> time it ran. W/o the fix, it runs a lot. With the fix it ran once. Is this 
>> not the case still?
> 
> Hi,
> 
> In this particular case one "find of /sys" takes 11-16 seconds over NFS, so 
> building a single KMOD takes 16 seconds too. It's not possible to eliminate 
> the find entirely during repeated builds?

16 seconds? That’s a really slow NFS server and at least 11 seconds longer than 
it should take :(.

Make doesn’t really have the ability to cache results run-to-run, but I’ll poke 
at other options. In the mean time, you can do something like:
setenv _MPATH `(cd $MAKEOBJDIRPREFIX/path/sys/GENERIC; make -V _MPATH)`
to cache the value. Not ideal, but likely good enough for repeated module 
builds. If I can’t come up with anything clever, I’ll just commit the current 
list… I hate doing that, but I also hadn’t counted upon find taking so stinkin’ 
long...

Warner


signature.asc
Description: Message signed with OpenPGP using GPGMail


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

2015-07-29 Thread George Neville-Neil



On 29 Jul 2015, at 11:05, Gleb Smirnoff wrote:


Ermal,

On Wed, Jul 29, 2015 at 03:00:59PM +0200, Ermal Luçi wrote:
E> > E> @@ -934,6 +950,7 @@ ip_forward(struct mbuf *m, int srcrt)
E> > E>   */
E> > E>  if (!srcrt && ia == NULL) {
E> > E>  icmp_error(m, ICMP_UNREACH, ICMP_UNREACH_HOST, 0, 
0);

E> > E> +RO_RTFREE(&ro);
E> > E>  return;
E> > E>  }
E> >
E> > Here the ifa reference is leaked upon return.
E> >
E> >
E> Gleb,
E>
E> the improvement on the ifa_ref not needed is something to look at 
but the

E> ifa_ref here is not lost since ia == NULL, no?
E> Maybe i am missing something else.

Sure you are right. Mea culpa.

E> Also can we put this on a review?

It is possible. Let's just wait for Olivier to return and ask him to
do a benchmark :)



Olivier isnt' the only one that can do a benchmark.  I can chuck this up 
in the
Sentex lab, that's what it's for.  Give me a brief outline and I'll code 
something

up in Conductor.

Best,
George
___
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: r286010 - head/usr.bin/ar

2015-07-29 Thread Justin Hibbits
This breaks ports building.  When building ports-mgmt/pkg:

ar: fatal: Option -D is not permitted in mode -x

- Justin

On Wed, Jul 29, 2015 at 6:36 AM, Ed Maste  wrote:
> Author: emaste
> Date: Wed Jul 29 13:36:17 2015
> New Revision: 286010
> URL: https://svnweb.freebsd.org/changeset/base/286010
>
> Log:
>   ar: enable deterministic mode by default
>
>   Ar cannot handle UIDs with more than 6 digits, and storing the mtime,
>   uid, gid and mode provides little to negative value anyhow for ar's
>   uses. Turn on deterministic (-D) mode by default; it can be disabled by
>   the user with -U.
>
>   PR:   196929
>   Relnotes: Yes
>   Sponsored by: The FreeBSD Foundation
>   Differential Revision:https://reviews.freebsd.org/D3190
>
> Modified:
>   head/usr.bin/ar/ar.1
>   head/usr.bin/ar/ar.c
>
> Modified: head/usr.bin/ar/ar.1
> ==
> --- head/usr.bin/ar/ar.1Wed Jul 29 13:14:34 2015(r286009)
> +++ head/usr.bin/ar/ar.1Wed Jul 29 13:36:17 2015(r286010)
> @@ -210,6 +210,7 @@ and 0644 instead of file mode from the m
>  .Ar .
>  This ensures that checksums on the resulting archives are reproducible
>  when member contents are identical.
> +This option is enabled by default.
>  If multiple
>  .Fl D
>  and
>
> Modified: head/usr.bin/ar/ar.c
> ==
> --- head/usr.bin/ar/ar.cWed Jul 29 13:14:34 2015(r286009)
> +++ head/usr.bin/ar/ar.cWed Jul 29 13:36:17 2015(r286010)
> @@ -104,6 +104,8 @@ main(int argc, char **argv)
>
> bsdar = &bsdar_storage;
> memset(bsdar, 0, sizeof(*bsdar));
> +   /* Enable deterministic mode by default. */
> +   bsdar->options |= AR_D;
>
> if ((bsdar->progname = getprogname()) == NULL)
> bsdar->progname = "ar";
>
___
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: r286018 - stable/10/share/man/man4

2015-07-29 Thread Christian Brueffer
Author: brueffer
Date: Wed Jul 29 16:40:48 2015
New Revision: 286018
URL: https://svnweb.freebsd.org/changeset/base/286018

Log:
  MFC: r285858, r286017
  
  Add a basic manpage for the pms driver.

Added:
  stable/10/share/man/man4/pms.4
 - copied, changed from r285858, head/share/man/man4/pms.4
Modified:
  stable/10/share/man/man4/Makefile
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/share/man/man4/Makefile
==
--- stable/10/share/man/man4/Makefile   Wed Jul 29 16:37:36 2015
(r286017)
+++ stable/10/share/man/man4/Makefile   Wed Jul 29 16:40:48 2015
(r286018)
@@ -382,6 +382,7 @@ MAN=aac.4 \
${_pflog.4} \
${_pfsync.4} \
pim.4 \
+   pms.4 \
polling.4 \
ppbus.4 \
ppc.4 \

Copied and modified: stable/10/share/man/man4/pms.4 (from r285858, 
head/share/man/man4/pms.4)
==
--- head/share/man/man4/pms.4   Fri Jul 24 21:48:53 2015(r285858, copy 
source)
+++ stable/10/share/man/man4/pms.4  Wed Jul 29 16:40:48 2015
(r286018)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd July 23, 2015
+.Dd July 29, 2015
 .Dt PMS 4
 .Os
 .Sh NAME
@@ -124,5 +124,3 @@ The
 .Nm
 device driver first appeared in
 .Fx 10.2 .
-.Sh AUTHORS
-.An Achim Leubner Aq Mt achim.leub...@pmcs.com
___
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: r286017 - head/share/man/man4

2015-07-29 Thread Christian Brueffer
Author: brueffer
Date: Wed Jul 29 16:37:36 2015
New Revision: 286017
URL: https://svnweb.freebsd.org/changeset/base/286017

Log:
  Remove the AUTHORS section until it's clear who exactly wrote the driver.

Modified:
  head/share/man/man4/pms.4

Modified: head/share/man/man4/pms.4
==
--- head/share/man/man4/pms.4   Wed Jul 29 15:42:22 2015(r286016)
+++ head/share/man/man4/pms.4   Wed Jul 29 16:37:36 2015(r286017)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd July 23, 2015
+.Dd July 29, 2015
 .Dt PMS 4
 .Os
 .Sh NAME
@@ -124,5 +124,3 @@ The
 .Nm
 device driver first appeared in
 .Fx 10.2 .
-.Sh AUTHORS
-.An Achim Leubner Aq Mt achim.leub...@pmcs.com
___
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: r285068 - in head/sys: conf modules/agp modules/geom/geom_part/geom_part_apm modules/geom/geom_part/geom_part_bsd modules/geom/geom_part/geom_part_bsd64 modules/geom/geom_part/geom_par

2015-07-29 Thread Hans Petter Selasky

On 07/29/15 16:24, Warner Losh wrote:



On Jul 29, 2015, at 4:19 AM, Hans Petter Selasky  wrote:

On 07/03/15 22:15, Warner Losh wrote:



On Jul 3, 2015, at 11:35 AM, Roger Pau Monné  wrote:

El 03/07/15 a les 19.26, Adrian Chadd ha escrit:

ok, so why's it make NFS builds so slow?


AFAICT it makes the build process spawn a bunch of concurrent "find"
processes that weren't previously there.


OK. I’ll fix it. I knew it might slow things down a little, but this is quite a 
bit more than “a little”.

Warner



Hi,

Is there a fix for this issue yet? At Mellanox we're also seeing that NFS 
mounted shares are extremely slow building even a single module. Maybe the 
output from the find can be cached in a file somehow?


Committed the fix within a day of this message (so three weeks ago):

https://svnweb.freebsd.org/base?view=revision&revision=285124

Is it not working? this is the first negative report I’ve heard since Adrian 
and Roger posted. I spiked the test-build with a find that recorded every time 
it ran. W/o the fix, it runs a lot. With the fix it ran once. Is this not the 
case still?


Hi,

In this particular case one "find of /sys" takes 11-16 seconds over NFS, 
so building a single KMOD takes 16 seconds too. It's not possible to 
eliminate the find entirely during repeated builds?


--HPS

___
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: r286016 - head/tools/build/options

2015-07-29 Thread Ed Maste
Author: emaste
Date: Wed Jul 29 15:42:22 2015
New Revision: 286016
URL: https://svnweb.freebsd.org/changeset/base/286016

Log:
  Include c++filt and readelf in WITHOUT_ELFTOOLCHAIN_TOOLS

Modified:
  head/tools/build/options/WITHOUT_ELFTOOLCHAIN_TOOLS

Modified: head/tools/build/options/WITHOUT_ELFTOOLCHAIN_TOOLS
==
--- head/tools/build/options/WITHOUT_ELFTOOLCHAIN_TOOLS Wed Jul 29 15:32:59 
2015(r286015)
+++ head/tools/build/options/WITHOUT_ELFTOOLCHAIN_TOOLS Wed Jul 29 15:42:22 
2015(r286016)
@@ -1,7 +1,9 @@
 .\" $FreeBSD$
 Set to use
 .Xr addr2line 1 ,
+.Xr c++filt 1 ,
 .Xr nm 1 ,
+.Xr readelf 1 ,
 .Xr size 1 ,
 .Xr strings 1 ,
 and
___
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: r286000 - head/sys/netipsec

2015-07-29 Thread John-Mark Gurney
Ermal Lui wrote this message on Wed, Jul 29, 2015 at 14:53 +0200:
> this was forgotten part on my patches merge from gnn@.
> Can it be fixed by correcting the patches rather than re-introducing this?
> 
> Most probably the constant definition is wrong on the transforms and also
> some part of code removal was missed.

No, it cannot be fixed by changing opencrypto/xform.c to truncate the
hash size...  The reason it cannot be is that OCF is not an IPsec only
framework...

Geli also uses the HMAC constructions, and I have not confirmed if they
use the full hash size or not...  I would be open to adding a field to
the crypto descriptor that limited how much of the hash is copied out...

It would have been helpful to comment more of these changes...  If you
make a change for a reason (RFC, etc), then throw that in the comments,
which allows someone following to understand why and prevent their
removal...  At least if they were commented as to why they changed, we
would have known to rework the change...

> On Wed, Jul 29, 2015 at 9:15 AM, John-Mark Gurney  wrote:
> 
> > Author: jmg
> > Date: Wed Jul 29 07:15:16 2015
> > New Revision: 286000
> > URL: https://svnweb.freebsd.org/changeset/base/286000
> >
> > Log:
> >   RFC4868 section 2.3 requires that the output be half...  This fixes
> >   problems that was introduced in r285336...  I have verified that
> >   HMAC-SHA2-256 both ah only and w/ AES-CBC interoperate w/ a NetBSD
> >   6.1.5 vm...
> >
> >   Reviewed by:  gnn

-- 
  John-Mark Gurney  Voice: +1 415 225 5579

 "All that I will do, has been done, All that I have, has not."
___
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: r286015 - in head/sys/mips: conf rmi rmi/dev/iic

2015-07-29 Thread Sean Bruno
Author: sbruno
Date: Wed Jul 29 15:32:59 2015
New Revision: 286015
URL: https://svnweb.freebsd.org/changeset/base/286015

Log:
  Make Broadcom XLR use shared ds1374 RTC driver.
  
  Remove its identical and redundant ds1374u version.
  
  Differential Revision:D3225
  Submitted by: kevin.bowl...@kev009.com

Deleted:
  head/sys/mips/rmi/dev/iic/ds1374u.c
Modified:
  head/sys/mips/conf/XLR
  head/sys/mips/conf/XLR64
  head/sys/mips/conf/XLRN32
  head/sys/mips/rmi/files.xlr
  head/sys/mips/rmi/xlr_i2c.c

Modified: head/sys/mips/conf/XLR
==
--- head/sys/mips/conf/XLR  Wed Jul 29 14:16:25 2015(r286014)
+++ head/sys/mips/conf/XLR  Wed Jul 29 15:32:59 2015(r286015)
@@ -135,7 +135,7 @@ device  ic
 device iic
 device iicbb
 device iicbus
-device ds1374u # RTC on XLR boards
+device ds1374  # RTC on XLR boards
 device max6657 # Temparature sensor on XLR boards
 device at24co2n# EEPROM on XLR boards
 

Modified: head/sys/mips/conf/XLR64
==
--- head/sys/mips/conf/XLR64Wed Jul 29 14:16:25 2015(r286014)
+++ head/sys/mips/conf/XLR64Wed Jul 29 15:32:59 2015(r286015)
@@ -109,7 +109,7 @@ device  ic
 device iic
 device iicbb
 device iicbus
-device ds1374u # RTC on XLR boards
+device ds1374  # RTC on XLR boards
 device max6657 # Temparature sensor on XLR boards
 device at24co2n# EEPROM on XLR boards
 

Modified: head/sys/mips/conf/XLRN32
==
--- head/sys/mips/conf/XLRN32   Wed Jul 29 14:16:25 2015(r286014)
+++ head/sys/mips/conf/XLRN32   Wed Jul 29 15:32:59 2015(r286015)
@@ -113,7 +113,7 @@ device  ic
 device iic
 device iicbb
 device iicbus
-device ds1374u # RTC on XLR boards
+device ds1374  # RTC on XLR boards
 device max6657 # Temparature sensor on XLR boards
 device at24co2n# EEPROM on XLR boards
 

Modified: head/sys/mips/rmi/files.xlr
==
--- head/sys/mips/rmi/files.xlr Wed Jul 29 14:16:25 2015(r286014)
+++ head/sys/mips/rmi/files.xlr Wed Jul 29 15:32:59 2015(r286015)
@@ -22,6 +22,5 @@ mips/rmi/dev/sec/rmisec.c optional rmi
 mips/rmi/dev/sec/rmilib.c  optional rmisec
 mips/rmi/dev/xlr/rge.c optional rge
 mips/rmi/dev/nlge/if_nlge.coptional nlge
-mips/rmi/dev/iic/ds1374u.c optional ds1374u 
 mips/rmi/dev/iic/max6657.c optional max6657 
 mips/rmi/dev/iic/at24co2n.coptional at24co2n 

Modified: head/sys/mips/rmi/xlr_i2c.c
==
--- head/sys/mips/rmi/xlr_i2c.c Wed Jul 29 14:16:25 2015(r286014)
+++ head/sys/mips/rmi/xlr_i2c.c Wed Jul 29 15:32:59 2015(r286015)
@@ -187,7 +187,7 @@ xlr_i2c_attach(device_t dev)
return -1;
}
if(xlr_board_info.xlr_i2c_device[I2C_RTC].enabled == 1) {
-   tmpd = device_add_child(sc->iicbus, "ds1374u", 0);
+   tmpd = device_add_child(sc->iicbus, "ds1374_rtc", 0);
device_set_ivars(tmpd, &xlr_board_info.xlr_i2c_device[I2C_RTC]);
}
if(xlr_board_info.xlr_i2c_device[I2C_THERMAL].enabled == 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"


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

2015-07-29 Thread Gleb Smirnoff
  Ermal,

On Wed, Jul 29, 2015 at 03:00:59PM +0200, Ermal Luçi wrote:
E> > E> @@ -934,6 +950,7 @@ ip_forward(struct mbuf *m, int srcrt)
E> > E>   */
E> > E>  if (!srcrt && ia == NULL) {
E> > E>  icmp_error(m, ICMP_UNREACH, ICMP_UNREACH_HOST, 0, 0);
E> > E> +RO_RTFREE(&ro);
E> > E>  return;
E> > E>  }
E> >
E> > Here the ifa reference is leaked upon return.
E> >
E> >
E> Gleb,
E> 
E> the improvement on the ifa_ref not needed is something to look at but the
E> ifa_ref here is not lost since ia == NULL, no?
E> Maybe i am missing something else.

Sure you are right. Mea culpa.

E> Also can we put this on a review?

It is possible. Let's just wait for Olivier to return and ask him to
do a benchmark :)

-- 
Totus tuus, Glebius.
___
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: r285068 - in head/sys: conf modules/agp modules/geom/geom_part/geom_part_apm modules/geom/geom_part/geom_part_bsd modules/geom/geom_part/geom_part_bsd64 modules/geom/geom_part/geom_par

2015-07-29 Thread Warner Losh

> On Jul 29, 2015, at 4:19 AM, Hans Petter Selasky  wrote:
> 
> On 07/03/15 22:15, Warner Losh wrote:
>> 
>>> On Jul 3, 2015, at 11:35 AM, Roger Pau Monné  wrote:
>>> 
>>> El 03/07/15 a les 19.26, Adrian Chadd ha escrit:
 ok, so why's it make NFS builds so slow?
>>> 
>>> AFAICT it makes the build process spawn a bunch of concurrent "find"
>>> processes that weren't previously there.
>> 
>> OK. I’ll fix it. I knew it might slow things down a little, but this is 
>> quite a bit more than “a little”.
>> 
>> Warner
>> 
> 
> Hi,
> 
> Is there a fix for this issue yet? At Mellanox we're also seeing that NFS 
> mounted shares are extremely slow building even a single module. Maybe the 
> output from the find can be cached in a file somehow?

Committed the fix within a day of this message (so three weeks ago):

https://svnweb.freebsd.org/base?view=revision&revision=285124

Is it not working? this is the first negative report I’ve heard since Adrian 
and Roger posted. I spiked the test-build with a find that recorded every time 
it ran. W/o the fix, it runs a lot. With the fix it ran once. Is this not the 
case still?

Warner



signature.asc
Description: Message signed with OpenPGP using GPGMail


svn commit: r286014 - in releng/10.2/sys: net netpfil/pf

2015-07-29 Thread Gleb Smirnoff
Author: glebius
Date: Wed Jul 29 14:16:25 2015
New Revision: 286014
URL: https://svnweb.freebsd.org/changeset/base/286014

Log:
  Merge r285939-285941,285943,286004 from stable/10:
  - Protect against ioctl() vs ioctl() races.
  - Always lock hash row of a source node when updating
its 'states' counter. [1]
  - Don't dereference NULL is pf_get_mtag() fails. [2]
  - During module unload drop locks before destroying UMA zone.
  
  PR:   182401 [1]
  PR:   200222 [2]
  Approved by:  re (gjb)

Modified:
  releng/10.2/sys/net/pfvar.h
  releng/10.2/sys/netpfil/pf/pf.c
  releng/10.2/sys/netpfil/pf/pf_ioctl.c
Directory Properties:
  releng/10.2/   (props changed)

Modified: releng/10.2/sys/net/pfvar.h
==
--- releng/10.2/sys/net/pfvar.h Wed Jul 29 14:07:43 2015(r286013)
+++ releng/10.2/sys/net/pfvar.h Wed Jul 29 14:16:25 2015(r286014)
@@ -1549,7 +1549,6 @@ extern struct pf_state*pf_find_state_a
 extern struct pf_src_node  *pf_find_src_node(struct pf_addr *,
struct pf_rule *, sa_family_t, int);
 extern void pf_unlink_src_node(struct pf_src_node *);
-extern void pf_unlink_src_node_locked(struct pf_src_node 
*);
 extern u_intpf_free_src_nodes(struct pf_src_node_list *);
 extern void pf_print_state(struct pf_state *);
 extern void pf_print_flags(u_int8_t);

Modified: releng/10.2/sys/netpfil/pf/pf.c
==
--- releng/10.2/sys/netpfil/pf/pf.c Wed Jul 29 14:07:43 2015
(r286013)
+++ releng/10.2/sys/netpfil/pf/pf.c Wed Jul 29 14:16:25 2015
(r286014)
@@ -655,7 +655,10 @@ pf_find_src_node(struct pf_addr *src, st
((af == AF_INET && n->addr.v4.s_addr == src->v4.s_addr) ||
(af == AF_INET6 && bcmp(&n->addr, src, sizeof(*src)) == 0)))
break;
-   if (n != NULL || returnlocked == 0)
+   if (n != NULL) {
+   n->states++;
+   PF_HASHROW_UNLOCK(sh);
+   } else if (returnlocked == 0)
PF_HASHROW_UNLOCK(sh);
 
return (n);
@@ -699,6 +702,7 @@ pf_insert_src_node(struct pf_src_node **
LIST_INSERT_HEAD(&sh->nodes, *sn, entry);
(*sn)->creation = time_uptime;
(*sn)->ruletype = rule->action;
+   (*sn)->states = 1;
if ((*sn)->rule.ptr != NULL)
counter_u64_add((*sn)->rule.ptr->src_nodes, 1);
PF_HASHROW_UNLOCK(sh);
@@ -715,37 +719,13 @@ pf_insert_src_node(struct pf_src_node **
 }
 
 void
-pf_unlink_src_node_locked(struct pf_src_node *src)
+pf_unlink_src_node(struct pf_src_node *src)
 {
-#ifdef INVARIANTS
-   struct pf_srchash *sh;
 
-   sh = &V_pf_srchash[pf_hashsrc(&src->addr, src->af)];
-   PF_HASHROW_ASSERT(sh);
-#endif
+   PF_HASHROW_ASSERT(&V_pf_srchash[pf_hashsrc(&src->addr, src->af)]);
LIST_REMOVE(src, entry);
if (src->rule.ptr)
counter_u64_add(src->rule.ptr->src_nodes, -1);
-   counter_u64_add(V_pf_status.scounters[SCNT_SRC_NODE_REMOVALS], 1);
-}
-
-void
-pf_unlink_src_node(struct pf_src_node *src)
-{
-   struct pf_srchash *sh;
-
-   sh = &V_pf_srchash[pf_hashsrc(&src->addr, src->af)];
-   PF_HASHROW_LOCK(sh);
-   pf_unlink_src_node_locked(src);
-   PF_HASHROW_UNLOCK(sh);
-}
-
-static void
-pf_free_src_node(struct pf_src_node *sn)
-{
-
-   KASSERT(sn->states == 0, ("%s: %p has refs", __func__, sn));
-   uma_zfree(V_pf_sources_z, sn);
 }
 
 u_int
@@ -755,10 +735,12 @@ pf_free_src_nodes(struct pf_src_node_lis
u_int count = 0;
 
LIST_FOREACH_SAFE(sn, head, entry, tmp) {
-   pf_free_src_node(sn);
+   uma_zfree(V_pf_sources_z, sn);
count++;
}
 
+   counter_u64_add(V_pf_status.scounters[SCNT_SRC_NODE_REMOVALS], count);
+
return (count);
 }
 
@@ -1550,7 +1532,7 @@ pf_purge_expired_src_nodes()
PF_HASHROW_LOCK(sh);
LIST_FOREACH_SAFE(cur, &sh->nodes, entry, next)
if (cur->states == 0 && cur->expire <= time_uptime) {
-   pf_unlink_src_node_locked(cur);
+   pf_unlink_src_node(cur);
LIST_INSERT_HEAD(&freelist, cur, entry);
} else if (cur->rule.ptr != NULL)
cur->rule.ptr->rule_flag |= PFRULE_REFS;
@@ -1565,27 +1547,31 @@ pf_purge_expired_src_nodes()
 static void
 pf_src_tree_remove_state(struct pf_state *s)
 {
-   u_int32_t timeout;
+   struct pf_src_node *sn;
+   struct pf_srchash *sh;
+   uint32_t timeout;
+
+   timeout = s->rule.ptr->timeout[PFTM_SRC_NODE] ?
+   s->rule.ptr->timeout[PFTM_SRC_NODE] :
+   V_pf_default_rule.timeout[PFTM

svn commit: r286013 - in head/sys: net netinet netinet6

2015-07-29 Thread Andrey V. Elsukov
Author: ae
Date: Wed Jul 29 14:07:43 2015
New Revision: 286013
URL: https://svnweb.freebsd.org/changeset/base/286013

Log:
  Eliminate the use of m_copydata() in gif_encapcheck().
  
  ip_encap already has inspected mbuf's data, at least an IP header.
  And it is safe to use mtod() and do direct access to needed fields.
  Add M_ASSERTPKTHDR() to gif_encapcheck(), since the code expects that
  mbuf has a packet header.
  Move the code from gif_validate[46] into in[6]_gif_encapcheck(), also
  remove "martian filters" checks. According to RFC 4213 it is enough to
  verify that the source address is the address of the encapsulator, as
  configured on the decapsulator.
  
  Reviewed by:  melifaro
  Obtained from:Yandex LLC
  Sponsored by: Yandex LLC

Modified:
  head/sys/net/if_gif.c
  head/sys/netinet/in_gif.c
  head/sys/netinet6/in6_gif.c

Modified: head/sys/net/if_gif.c
==
--- head/sys/net/if_gif.c   Wed Jul 29 14:07:29 2015(r286012)
+++ head/sys/net/if_gif.c   Wed Jul 29 14:07:43 2015(r286013)
@@ -280,9 +280,9 @@ int
 gif_encapcheck(const struct mbuf *m, int off, int proto, void *arg)
 {
GIF_RLOCK_TRACKER;
+   const struct ip *ip;
struct gif_softc *sc;
int ret;
-   uint8_t ver;
 
sc = (struct gif_softc *)arg;
if (sc == NULL || (GIF2IFP(sc)->if_flags & IFF_UP) == 0)
@@ -309,11 +309,12 @@ gif_encapcheck(const struct mbuf *m, int
}
 
/* Bail on short packets */
+   M_ASSERTPKTHDR(m);
if (m->m_pkthdr.len < sizeof(struct ip))
goto done;
 
-   m_copydata(m, 0, 1, &ver);
-   switch (ver >> 4) {
+   ip = mtod(m, const struct ip *);
+   switch (ip->ip_v) {
 #ifdef INET
case 4:
if (sc->gif_family != AF_INET)

Modified: head/sys/netinet/in_gif.c
==
--- head/sys/netinet/in_gif.c   Wed Jul 29 14:07:29 2015(r286012)
+++ head/sys/netinet/in_gif.c   Wed Jul 29 14:07:43 2015(r286013)
@@ -67,8 +67,6 @@ __FBSDID("$FreeBSD$");
 
 #include 
 
-static int gif_validate4(const struct ip *, struct gif_softc *,
-   struct ifnet *);
 static int in_gif_input(struct mbuf **, int *, int);
 
 extern  struct domain inetdomain;
@@ -163,16 +161,22 @@ in_gif_input(struct mbuf **mp, int *offp
 }
 
 /*
- * validate outer address.
+ * we know that we are in IFF_UP, outer address available, and outer family
+ * matched the physical addr family.  see gif_encapcheck().
  */
-static int
-gif_validate4(const struct ip *ip, struct gif_softc *sc, struct ifnet *ifp)
+int
+in_gif_encapcheck(const struct mbuf *m, int off, int proto, void *arg)
 {
+   const struct ip *ip;
+   struct gif_softc *sc;
int ret;
 
+   /* sanity check done in caller */
+   sc = (struct gif_softc *)arg;
GIF_RLOCK_ASSERT(sc);
 
/* check for address match */
+   ip = mtod(m, const struct ip *);
if (sc->gif_iphdr->ip_src.s_addr != ip->ip_dst.s_addr)
return (0);
ret = 32;
@@ -182,18 +186,8 @@ gif_validate4(const struct ip *ip, struc
} else
ret += 32;
 
-   /* martian filters on outer source - NOT done in ip_input! */
-   if (IN_MULTICAST(ntohl(ip->ip_src.s_addr)))
-   return (0);
-   switch ((ntohl(ip->ip_src.s_addr) & 0xff00) >> 24) {
-   case 0:
-   case 127:
-   case 255:
-   return (0);
-   }
-
/* ingress filters on outer source */
-   if ((GIF2IFP(sc)->if_flags & IFF_LINK2) == 0 && ifp) {
+   if ((GIF2IFP(sc)->if_flags & IFF_LINK2) == 0) {
struct sockaddr_in sin;
struct rtentry *rt;
 
@@ -204,8 +198,8 @@ gif_validate4(const struct ip *ip, struc
/* XXX MRT  check for the interface we would use on output */
rt = in_rtalloc1((struct sockaddr *)&sin, 0,
0UL, sc->gif_fibnum);
-   if (!rt || rt->rt_ifp != ifp) {
-   if (rt)
+   if (rt == NULL || rt->rt_ifp != m->m_pkthdr.rcvif) {
+   if (rt != NULL)
RTFREE_LOCKED(rt);
return (0);
}
@@ -214,26 +208,6 @@ gif_validate4(const struct ip *ip, struc
return (ret);
 }
 
-/*
- * we know that we are in IFF_UP, outer address available, and outer family
- * matched the physical addr family.  see gif_encapcheck().
- */
-int
-in_gif_encapcheck(const struct mbuf *m, int off, int proto, void *arg)
-{
-   struct ip ip;
-   struct gif_softc *sc;
-   struct ifnet *ifp;
-
-   /* sanity check done in caller */
-   sc = (struct gif_softc *)arg;
-   GIF_RLOCK_ASSERT(sc);
-
-   m_copydata(m, 0, sizeof(ip), (caddr_t)&ip);
-   ifp = ((m->m_flags & M_PKTHDR) != 0) ? m->m_pkthdr.rcvif : NULL;
-   return (g

svn commit: r286012 - in stable: 10/contrib/llvm/include/llvm/CodeGen 10/contrib/llvm/lib/CodeGen/SelectionDAG 10/contrib/llvm/lib/Target/X86 10/contrib/llvm/patches 9/contrib/llvm/include/llvm/Cod...

2015-07-29 Thread Dimitry Andric
Author: dim
Date: Wed Jul 29 14:07:29 2015
New Revision: 286012
URL: https://svnweb.freebsd.org/changeset/base/286012

Log:
  Revert r286007-r286009 for now, until I can figure out how to make the
  fix compile with older gcc and libstdc++.

Deleted:
  
stable/10/contrib/llvm/patches/patch-r286007-llvm-r219009-x86-codegen-crash.diff
Modified:
  stable/10/contrib/llvm/include/llvm/CodeGen/SelectionDAGISel.h
  stable/10/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
  stable/10/contrib/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp

Changes in other areas also in this revision:
Deleted:
  
stable/9/contrib/llvm/patches/patch-r286007-llvm-r219009-x86-codegen-crash.diff
Modified:
  stable/9/contrib/llvm/include/llvm/CodeGen/SelectionDAGISel.h
  stable/9/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
  stable/9/contrib/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
Directory Properties:
  stable/9/   (props changed)
  stable/9/contrib/   (props changed)
  stable/9/contrib/llvm/   (props changed)

Modified: stable/10/contrib/llvm/include/llvm/CodeGen/SelectionDAGISel.h
==
--- stable/10/contrib/llvm/include/llvm/CodeGen/SelectionDAGISel.h  Wed Jul 
29 13:49:34 2015(r286011)
+++ stable/10/contrib/llvm/include/llvm/CodeGen/SelectionDAGISel.h  Wed Jul 
29 14:07:29 2015(r286012)
@@ -238,12 +238,6 @@ public:
const unsigned char *MatcherTable,
unsigned TableSize);
 
-  /// \brief Return true if complex patterns for this target can mutate the
-  /// DAG.
-  virtual bool ComplexPatternFuncMutatesDAG() const {
-return false;
-  }
-
 private:
 
   // Calls to these functions are generated by tblgen.

Modified: stable/10/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
==
--- stable/10/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
Wed Jul 29 13:49:34 2015(r286011)
+++ stable/10/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
Wed Jul 29 14:07:29 2015(r286012)
@@ -2345,42 +2345,6 @@ struct MatchScope {
   bool HasChainNodesMatched, HasGlueResultNodesMatched;
 };
 
-/// \\brief A DAG update listener to keep the matching state
-/// (i.e. RecordedNodes and MatchScope) uptodate if the target is allowed to
-/// change the DAG while matching.  X86 addressing mode matcher is an example
-/// for this.
-class MatchStateUpdater : public SelectionDAG::DAGUpdateListener
-{
-  SmallVectorImpl > &RecordedNodes;
-  SmallVectorImpl &MatchScopes;
-public:
-  MatchStateUpdater(SelectionDAG &DAG,
-SmallVectorImpl > &RN,
-SmallVectorImpl &MS) :
-SelectionDAG::DAGUpdateListener(DAG),
-RecordedNodes(RN), MatchScopes(MS) { }
-
-  void NodeDeleted(SDNode *N, SDNode *E) {
-// Some early-returns here to avoid the search if we deleted the node or
-// if the update comes from MorphNodeTo (MorphNodeTo is the last thing we
-// do, so it's unnecessary to update matching state at that point).
-// Neither of these can occur currently because we only install this
-// update listener during matching a complex patterns.
-if (!E || E->isMachineOpcode())
-  return;
-// Performing linear search here does not matter because we almost never
-// run this code.  You'd have to have a CSE during complex pattern
-// matching.
-for (auto &I : RecordedNodes)
-  if (I.first.getNode() == N)
-I.first.setNode(E);
-
-for (auto &I : MatchScopes)
-  for (auto &J : I.NodeStack)
-if (J.getNode() == N)
-  J.setNode(E);
-  }
-};
 }
 
 SDNode *SelectionDAGISel::
@@ -2635,14 +2599,6 @@ SelectCodeCommon(SDNode *NodeToMatch, co
   unsigned CPNum = MatcherTable[MatcherIndex++];
   unsigned RecNo = MatcherTable[MatcherIndex++];
   assert(RecNo < RecordedNodes.size() && "Invalid CheckComplexPat");
-
-  // If target can modify DAG during matching, keep the matching state
-  // consistent.
-  std::unique_ptr MSU;
-  if (ComplexPatternFuncMutatesDAG())
-MSU.reset(new MatchStateUpdater(*CurDAG, RecordedNodes,
-MatchScopes));
-
   if (!CheckComplexPattern(NodeToMatch, RecordedNodes[RecNo].second,
RecordedNodes[RecNo].first, CPNum,
RecordedNodes))

Modified: stable/10/contrib/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
==
--- stable/10/contrib/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp   Wed Jul 29 
13:49:34 2015(r286011)
+++ stable/10/contrib/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp   Wed Jul 29 
14:07:29 2015(r286012)
@@ -290,13 +290,6 @@ namespace {
 const X86InstrInfo *getInstrInfo() const {
   return getTargetMachine().g

svn commit: r286012 - in stable: 10/contrib/llvm/include/llvm/CodeGen 10/contrib/llvm/lib/CodeGen/SelectionDAG 10/contrib/llvm/lib/Target/X86 10/contrib/llvm/patches 9/contrib/llvm/include/llvm/Cod...

2015-07-29 Thread Dimitry Andric
Author: dim
Date: Wed Jul 29 14:07:29 2015
New Revision: 286012
URL: https://svnweb.freebsd.org/changeset/base/286012

Log:
  Revert r286007-r286009 for now, until I can figure out how to make the
  fix compile with older gcc and libstdc++.

Deleted:
  
stable/9/contrib/llvm/patches/patch-r286007-llvm-r219009-x86-codegen-crash.diff
Modified:
  stable/9/contrib/llvm/include/llvm/CodeGen/SelectionDAGISel.h
  stable/9/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
  stable/9/contrib/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
Directory Properties:
  stable/9/   (props changed)
  stable/9/contrib/   (props changed)
  stable/9/contrib/llvm/   (props changed)

Changes in other areas also in this revision:
Deleted:
  
stable/10/contrib/llvm/patches/patch-r286007-llvm-r219009-x86-codegen-crash.diff
Modified:
  stable/10/contrib/llvm/include/llvm/CodeGen/SelectionDAGISel.h
  stable/10/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
  stable/10/contrib/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp

Modified: stable/9/contrib/llvm/include/llvm/CodeGen/SelectionDAGISel.h
==
--- stable/9/contrib/llvm/include/llvm/CodeGen/SelectionDAGISel.h   Wed Jul 
29 13:49:34 2015(r286011)
+++ stable/9/contrib/llvm/include/llvm/CodeGen/SelectionDAGISel.h   Wed Jul 
29 14:07:29 2015(r286012)
@@ -238,12 +238,6 @@ public:
const unsigned char *MatcherTable,
unsigned TableSize);
 
-  /// \brief Return true if complex patterns for this target can mutate the
-  /// DAG.
-  virtual bool ComplexPatternFuncMutatesDAG() const {
-return false;
-  }
-
 private:
 
   // Calls to these functions are generated by tblgen.

Modified: stable/9/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
==
--- stable/9/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Wed Jul 
29 13:49:34 2015(r286011)
+++ stable/9/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Wed Jul 
29 14:07:29 2015(r286012)
@@ -2345,42 +2345,6 @@ struct MatchScope {
   bool HasChainNodesMatched, HasGlueResultNodesMatched;
 };
 
-/// \\brief A DAG update listener to keep the matching state
-/// (i.e. RecordedNodes and MatchScope) uptodate if the target is allowed to
-/// change the DAG while matching.  X86 addressing mode matcher is an example
-/// for this.
-class MatchStateUpdater : public SelectionDAG::DAGUpdateListener
-{
-  SmallVectorImpl > &RecordedNodes;
-  SmallVectorImpl &MatchScopes;
-public:
-  MatchStateUpdater(SelectionDAG &DAG,
-SmallVectorImpl > &RN,
-SmallVectorImpl &MS) :
-SelectionDAG::DAGUpdateListener(DAG),
-RecordedNodes(RN), MatchScopes(MS) { }
-
-  void NodeDeleted(SDNode *N, SDNode *E) {
-// Some early-returns here to avoid the search if we deleted the node or
-// if the update comes from MorphNodeTo (MorphNodeTo is the last thing we
-// do, so it's unnecessary to update matching state at that point).
-// Neither of these can occur currently because we only install this
-// update listener during matching a complex patterns.
-if (!E || E->isMachineOpcode())
-  return;
-// Performing linear search here does not matter because we almost never
-// run this code.  You'd have to have a CSE during complex pattern
-// matching.
-for (auto &I : RecordedNodes)
-  if (I.first.getNode() == N)
-I.first.setNode(E);
-
-for (auto &I : MatchScopes)
-  for (auto &J : I.NodeStack)
-if (J.getNode() == N)
-  J.setNode(E);
-  }
-};
 }
 
 SDNode *SelectionDAGISel::
@@ -2635,14 +2599,6 @@ SelectCodeCommon(SDNode *NodeToMatch, co
   unsigned CPNum = MatcherTable[MatcherIndex++];
   unsigned RecNo = MatcherTable[MatcherIndex++];
   assert(RecNo < RecordedNodes.size() && "Invalid CheckComplexPat");
-
-  // If target can modify DAG during matching, keep the matching state
-  // consistent.
-  std::unique_ptr MSU;
-  if (ComplexPatternFuncMutatesDAG())
-MSU.reset(new MatchStateUpdater(*CurDAG, RecordedNodes,
-MatchScopes));
-
   if (!CheckComplexPattern(NodeToMatch, RecordedNodes[RecNo].second,
RecordedNodes[RecNo].first, CPNum,
RecordedNodes))

Modified: stable/9/contrib/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
==
--- stable/9/contrib/llvm/lib/Target/X86/X86ISelDAGToDAG.cppWed Jul 29 
13:49:34 2015(r286011)
+++ stable/9/contrib/llvm/lib/Target/X86/X86ISelDAGToDAG.cppWed Jul 29 
14:07:29 2015(r286012)
@@ -290,13 +290,6 @@ namespace {
 const X86InstrInfo *getInstrInfo() const {
   return getTargetMachine().getInstrInfo();

svn commit: r286011 - head/tests/sys/kern

2015-07-29 Thread Sergey Kandaurov
Author: pluknet
Date: Wed Jul 29 13:49:34 2015
New Revision: 286011
URL: https://svnweb.freebsd.org/changeset/base/286011

Log:
  Fixed shutdown(2) unix(4) tests for SOCK_SEQPACKET after r285910 (by ed).

Modified:
  head/tests/sys/kern/unix_seqpacket_test.c

Modified: head/tests/sys/kern/unix_seqpacket_test.c
==
--- head/tests/sys/kern/unix_seqpacket_test.c   Wed Jul 29 13:36:17 2015
(r286010)
+++ head/tests/sys/kern/unix_seqpacket_test.c   Wed Jul 29 13:49:34 2015
(r286011)
@@ -751,35 +751,79 @@ ATF_TC_BODY(send_recv_with_connect, tc)
 ATF_TC_WITHOUT_HEAD(shutdown_send);
 ATF_TC_BODY(shutdown_send, tc)
 {
-   int s;
-   const char data[] = "data";
+   struct sockaddr_un sun;
+   /* ATF's isolation mechanisms will guarantee uniqueness of this file */
+   const char *path = "sock";
+   const char *data = "data";
ssize_t ssize;
+   int s, err, s2;
 
s = socket(PF_LOCAL, SOCK_SEQPACKET, 0);
ATF_REQUIRE(s >= 0);
-   ATF_CHECK_EQ(0, shutdown(s, SHUT_RDWR));
+
+   bzero(&sun, sizeof(sun));
+   sun.sun_family = AF_LOCAL;
+   sun.sun_len = sizeof(sun);
+   strlcpy(sun.sun_path, path, sizeof(sun.sun_path));
+   err = bind(s, (struct sockaddr *)&sun, sizeof(sun));
+   err = listen(s, -1);
+   ATF_CHECK_EQ(0, err);
+
+   /* Create the other socket */
+   s2 = socket(PF_LOCAL, SOCK_SEQPACKET, 0);
+   ATF_REQUIRE(s2 >= 0);
+   err = connect(s2, (struct sockaddr*)&sun, sizeof(sun));
+   if (err != 0) {
+   perror("connect");
+   atf_tc_fail("connect(2) failed");
+   }
+
+   ATF_CHECK_EQ(0, shutdown(s2, SHUT_RDWR));
/* USE MSG_NOSIGNAL so we don't get SIGPIPE */
-   ssize = send(s, data, sizeof(data), MSG_EOR | MSG_NOSIGNAL);
+   ssize = send(s2, data, sizeof(data), MSG_EOR | MSG_NOSIGNAL);
ATF_CHECK_EQ(EPIPE, errno);
ATF_CHECK_EQ(-1, ssize);
close(s);
+   close(s2);
 }
 
 /* send(2) should cause SIGPIPE on a shutdown socket */
 ATF_TC_WITHOUT_HEAD(shutdown_send_sigpipe);
 ATF_TC_BODY(shutdown_send_sigpipe, tc)
 {
-   int s;
-   const char data[] = "data";
+   struct sockaddr_un sun;
+   /* ATF's isolation mechanisms will guarantee uniqueness of this file */
+   const char *path = "sock";
+   const char *data = "data";
ssize_t ssize;
+   int s, err, s2;
 
s = socket(PF_LOCAL, SOCK_SEQPACKET, 0);
ATF_REQUIRE(s >= 0);
-   ATF_CHECK_EQ(0, shutdown(s, SHUT_RDWR));
+
+   bzero(&sun, sizeof(sun));
+   sun.sun_family = AF_LOCAL;
+   sun.sun_len = sizeof(sun);
+   strlcpy(sun.sun_path, path, sizeof(sun.sun_path));
+   err = bind(s, (struct sockaddr *)&sun, sizeof(sun));
+   err = listen(s, -1);
+   ATF_CHECK_EQ(0, err);
+
+   /* Create the other socket */
+   s2 = socket(PF_LOCAL, SOCK_SEQPACKET, 0);
+   ATF_REQUIRE(s2 >= 0);
+   err = connect(s2, (struct sockaddr*)&sun, sizeof(sun));
+   if (err != 0) {
+   perror("connect");
+   atf_tc_fail("connect(2) failed");
+   }
+
+   ATF_CHECK_EQ(0, shutdown(s2, SHUT_RDWR));
ATF_REQUIRE(SIG_ERR != signal(SIGPIPE, shutdown_send_sigpipe_handler));
-   ssize = send(s, data, sizeof(data), MSG_EOR);
+   ssize = send(s2, data, sizeof(data), MSG_EOR);
ATF_CHECK_EQ(1, got_sigpipe);
close(s);
+   close(s2);
 }
 
 /* nonblocking send(2) and recv(2) a single short record */
___
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: r286010 - head/usr.bin/ar

2015-07-29 Thread Ed Maste
Author: emaste
Date: Wed Jul 29 13:36:17 2015
New Revision: 286010
URL: https://svnweb.freebsd.org/changeset/base/286010

Log:
  ar: enable deterministic mode by default
  
  Ar cannot handle UIDs with more than 6 digits, and storing the mtime,
  uid, gid and mode provides little to negative value anyhow for ar's
  uses. Turn on deterministic (-D) mode by default; it can be disabled by
  the user with -U.
  
  PR:   196929
  Relnotes: Yes
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D3190

Modified:
  head/usr.bin/ar/ar.1
  head/usr.bin/ar/ar.c

Modified: head/usr.bin/ar/ar.1
==
--- head/usr.bin/ar/ar.1Wed Jul 29 13:14:34 2015(r286009)
+++ head/usr.bin/ar/ar.1Wed Jul 29 13:36:17 2015(r286010)
@@ -210,6 +210,7 @@ and 0644 instead of file mode from the m
 .Ar .
 This ensures that checksums on the resulting archives are reproducible
 when member contents are identical.
+This option is enabled by default.
 If multiple
 .Fl D
 and

Modified: head/usr.bin/ar/ar.c
==
--- head/usr.bin/ar/ar.cWed Jul 29 13:14:34 2015(r286009)
+++ head/usr.bin/ar/ar.cWed Jul 29 13:36:17 2015(r286010)
@@ -104,6 +104,8 @@ main(int argc, char **argv)
 
bsdar = &bsdar_storage;
memset(bsdar, 0, sizeof(*bsdar));
+   /* Enable deterministic mode by default. */
+   bsdar->options |= AR_D;
 
if ((bsdar->progname = getprogname()) == NULL)
bsdar->progname = "ar";
___
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: r286007 - in stable/10/contrib/llvm: include/llvm/CodeGen lib/CodeGen/SelectionDAG lib/Target/X86

2015-07-29 Thread Dimitry Andric
On 29 Jul 2015, at 15:21, Ed Schouten  wrote:
> 2015-07-29 14:59 GMT+02:00 Dimitry Andric :
>> +  std::unique_ptr MSU;
> 
> Is it safe to use std::unique_ptr<> in FreeBSD 10 sources? As in,
> would it still allow upgrading to 10.2 from 9.x and 10.{0,1}?

Hmm, that's a good one.  I keep forgetting that this needs to be
buildable with obsolete compilers. :-(

I'll have a look if this can be fixed using pre-C++11 constructs, or
otherwise revert the fix.  This could make it more difficult to upgrade
later, though I did not see the crash reported by Jonathan myself.

-Dimitry



signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: svn commit: r286007 - in stable/10/contrib/llvm: include/llvm/CodeGen lib/CodeGen/SelectionDAG lib/Target/X86

2015-07-29 Thread Ed Schouten
Hi Dimitry,

2015-07-29 14:59 GMT+02:00 Dimitry Andric :
> +  std::unique_ptr MSU;

Is it safe to use std::unique_ptr<> in FreeBSD 10 sources? As in,
would it still allow upgrading to 10.2 from 9.x and 10.{0,1}?

-- 
Ed Schouten 
Nuxi, 's-Hertogenbosch, the Netherlands
KvK/VAT number: 62051717
___
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: r286009 - in stable/9/contrib/llvm: include/llvm/CodeGen lib/CodeGen/SelectionDAG lib/Target/X86 patches

2015-07-29 Thread Dimitry Andric
Author: dim
Date: Wed Jul 29 13:14:34 2015
New Revision: 286009
URL: https://svnweb.freebsd.org/changeset/base/286009

Log:
  Merge r286007 from stable/10:
  
  Pull in r219009 from upstream llvm trunk (by Adam Nemet):
  
[ISel] Keep matching state consistent when folding during X86 address match
  
In the X86 backend, matching an address is initiated by the 'addr' complex
pattern and its friends.  During this process we may reassociate 
and-of-shift
into shift-of-and (FoldMaskedShiftToScaledMask) to allow folding of the
shift into the scale of the address.
  
However as demonstrated by the testcase, this can trigger CSE of not only 
the
shift and the AND which the code is prepared for but also the underlying 
load
node.  In the testcase this node is sitting in the RecordedNode and 
MatchScope
data structures of the matcher and becomes a deleted node upon CSE.  
Returning
from the complex pattern function, we try to access it again hitting an 
assert
because the node is no longer a load even though this was checked before.
  
Now obviously changing the DAG this late is bending the rules but I think it
makes sense somewhat.  Outside of addresses we prefer and-of-shift because 
it
may lead to smaller immediates (FoldMaskAndShiftToScale is an even better
example because it create a non-canonical node).  We currently don't 
recognize
addresses during DAGCombiner where arguably this canonicalization should be
performed.  On the other hand, having this in the matcher allows us to cover
all the cases where an address can be used in an instruction.
  
I've also talked a little bit to Dan Gohman on llvm-dev who added the RAUW 
for
the new shift node in FoldMaskedShiftToScaledMask.  This RAUW is responsible
for initiating the recursive CSE on users
(http://lists.cs.uiuc.edu/pipermail/llvmdev/2014-September/076903.html) but 
it
is not strictly necessary since the shift is hooked into the visited user.  
Of
course it's safer to keep the DAG consistent at all times (e.g. for accurate
number of uses, etc.).
  
So rather than changing the fundamentals, I've decided to continue along the
previous patches and detect the CSE.  This patch installs a very targeted
DAGUpdateListener for the duration of a complex-pattern match and updates 
the
matching state accordingly.  (Previous patches used HandleSDNode to detect 
the
CSE but that's not practical here).  The listener is only installed on X86.
  
I tested that there is no measurable overhead due to this while running
through the spec2k BC files with llc.  The only thing we pay for is the
creation of the listener.  The callback never ever triggers in spec2k since
this is a corner case.
  
Fixes rdar://problem/18206171
  
  This fixes a possible crash in x86 code generation when compiling recent
  llvm/clang trunk sources.
  
  Direct commit to stable/10, since head already has llvm/clang 3.6.1,
  which includes this fix.
  
  Reported by:  jonathan, theraven
  Upstream PR:  https://llvm.org/bugs/show_bug.cgi?id=24249
  
  Merge r286008 from stable/10:
  
  Add llvm patch corresponding to r286007.

Added:
  
stable/9/contrib/llvm/patches/patch-r286007-llvm-r219009-x86-codegen-crash.diff
 - copied unchanged from r286008, 
stable/10/contrib/llvm/patches/patch-r286007-llvm-r219009-x86-codegen-crash.diff
Modified:
  stable/9/contrib/llvm/include/llvm/CodeGen/SelectionDAGISel.h
  stable/9/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
  stable/9/contrib/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
Directory Properties:
  stable/9/   (props changed)
  stable/9/contrib/   (props changed)
  stable/9/contrib/llvm/   (props changed)

Modified: stable/9/contrib/llvm/include/llvm/CodeGen/SelectionDAGISel.h
==
--- stable/9/contrib/llvm/include/llvm/CodeGen/SelectionDAGISel.h   Wed Jul 
29 13:07:18 2015(r286008)
+++ stable/9/contrib/llvm/include/llvm/CodeGen/SelectionDAGISel.h   Wed Jul 
29 13:14:34 2015(r286009)
@@ -238,6 +238,12 @@ public:
const unsigned char *MatcherTable,
unsigned TableSize);
 
+  /// \brief Return true if complex patterns for this target can mutate the
+  /// DAG.
+  virtual bool ComplexPatternFuncMutatesDAG() const {
+return false;
+  }
+
 private:
 
   // Calls to these functions are generated by tblgen.

Modified: stable/9/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
==
--- stable/9/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Wed Jul 
29 13:07:18 2015(r286008)
+++ stable/9/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Wed Jul 
29 13:14:34 2015(r286009)
@@ -2345,6 +2345,42 @@ struct MatchScope {
   bool HasChainNodesMatched, HasGl

svn commit: r286008 - stable/10/contrib/llvm/patches

2015-07-29 Thread Dimitry Andric
Author: dim
Date: Wed Jul 29 13:07:18 2015
New Revision: 286008
URL: https://svnweb.freebsd.org/changeset/base/286008

Log:
  Add llvm patch corresponding to r286007.

Added:
  
stable/10/contrib/llvm/patches/patch-r286007-llvm-r219009-x86-codegen-crash.diff

Added: 
stable/10/contrib/llvm/patches/patch-r286007-llvm-r219009-x86-codegen-crash.diff
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ 
stable/10/contrib/llvm/patches/patch-r286007-llvm-r219009-x86-codegen-crash.diff
Wed Jul 29 13:07:18 2015(r286008)
@@ -0,0 +1,214 @@
+Pull in r219009 from upstream llvm trunk (by Adam Nemet):
+
+  [ISel] Keep matching state consistent when folding during X86 address match
+
+  In the X86 backend, matching an address is initiated by the 'addr' complex
+  pattern and its friends.  During this process we may reassociate and-of-shift
+  into shift-of-and (FoldMaskedShiftToScaledMask) to allow folding of the
+  shift into the scale of the address.
+
+  However as demonstrated by the testcase, this can trigger CSE of not only the
+  shift and the AND which the code is prepared for but also the underlying load
+  node.  In the testcase this node is sitting in the RecordedNode and 
MatchScope
+  data structures of the matcher and becomes a deleted node upon CSE.  
Returning
+  from the complex pattern function, we try to access it again hitting an 
assert
+  because the node is no longer a load even though this was checked before.
+
+  Now obviously changing the DAG this late is bending the rules but I think it
+  makes sense somewhat.  Outside of addresses we prefer and-of-shift because it
+  may lead to smaller immediates (FoldMaskAndShiftToScale is an even better
+  example because it create a non-canonical node).  We currently don't 
recognize
+  addresses during DAGCombiner where arguably this canonicalization should be
+  performed.  On the other hand, having this in the matcher allows us to cover
+  all the cases where an address can be used in an instruction.
+
+  I've also talked a little bit to Dan Gohman on llvm-dev who added the RAUW 
for
+  the new shift node in FoldMaskedShiftToScaledMask.  This RAUW is responsible
+  for initiating the recursive CSE on users
+  (http://lists.cs.uiuc.edu/pipermail/llvmdev/2014-September/076903.html) but 
it
+  is not strictly necessary since the shift is hooked into the visited user.  
Of
+  course it's safer to keep the DAG consistent at all times (e.g. for accurate
+  number of uses, etc.).
+
+  So rather than changing the fundamentals, I've decided to continue along the
+  previous patches and detect the CSE.  This patch installs a very targeted
+  DAGUpdateListener for the duration of a complex-pattern match and updates the
+  matching state accordingly.  (Previous patches used HandleSDNode to detect 
the
+  CSE but that's not practical here).  The listener is only installed on X86.
+
+  I tested that there is no measurable overhead due to this while running
+  through the spec2k BC files with llc.  The only thing we pay for is the
+  creation of the listener.  The callback never ever triggers in spec2k since
+  this is a corner case.
+
+  Fixes rdar://problem/18206171
+
+This fixes a possible crash in x86 code generation when compiling recent
+llvm/clang trunk sources.
+
+Introduced here: http://svnweb.freebsd.org/changeset/base/286007
+
+Index: include/llvm/CodeGen/SelectionDAGISel.h
+===
+--- include/llvm/CodeGen/SelectionDAGISel.h
 include/llvm/CodeGen/SelectionDAGISel.h
+@@ -238,6 +238,12 @@ class SelectionDAGISel : public MachineFunctionPas
+const unsigned char *MatcherTable,
+unsigned TableSize);
+ 
++  /// \brief Return true if complex patterns for this target can mutate the
++  /// DAG.
++  virtual bool ComplexPatternFuncMutatesDAG() const {
++return false;
++  }
++
+ private:
+ 
+   // Calls to these functions are generated by tblgen.
+Index: lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
+===
+--- lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
 lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
+@@ -2345,6 +2345,42 @@ struct MatchScope {
+   bool HasChainNodesMatched, HasGlueResultNodesMatched;
+ };
+ 
++/// \\brief A DAG update listener to keep the matching state
++/// (i.e. RecordedNodes and MatchScope) uptodate if the target is allowed to
++/// change the DAG while matching.  X86 addressing mode matcher is an example
++/// for this.
++class MatchStateUpdater : public SelectionDAG::DAGUpdateListener
++{
++  SmallVectorImpl > &RecordedNodes;
++  SmallVectorImpl &MatchScopes;
++public:
++  MatchStateUpdater(SelectionDAG &DAG,
++SmallVectorImpl > &RN,
++SmallVectorImpl &MS) :
++SelectionDAG::DAGUpdateListener(DAG

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

2015-07-29 Thread Ermal Luçi
On Tue, Jul 28, 2015 at 2:42 PM, Gleb Smirnoff  wrote:

>   Ermal,
>
>   see comments inlined,
>
> On Thu, Jul 02, 2015 at 06:10:42PM +, Ermal Luçi wrote:
> E> Author: eri
> E> Date: Thu Jul  2 18:10:41 2015
> E> New Revision: 285051
> E> URL: https://svnweb.freebsd.org/changeset/base/285051
> E>
> E> Log:
> E>   Avoid doing multiple route lookups for the same destination IP during
> forwarding
> E>
> E>   ip_forward() does a route lookup for testing this packet can be sent
> to a known destination,
> E>   it also can do another route lookup if it detects that an ICMP
> redirect is needed,
> E>   it forgets all of this and handovers to ip_output() to do the same
> lookup yet again.
> E>
> E>   This optimisation just does one route lookup during the forwarding
> path and handovers that to be considered by ip_output().
> E>
> E>   Differential Revision: https://reviews.freebsd.org/D2964
> E>   Approved by:   ae, gnn(mentor)
> E>   MFC after: 1 week
> E>
> E> Modified:
> E>   head/sys/netinet/ip_input.c
> E>
> E> Modified: head/sys/netinet/ip_input.c
> E>
> ==
> E> --- head/sys/netinet/ip_input.c  Thu Jul  2 17:30:59 2015
> (r285050)
> E> +++ head/sys/netinet/ip_input.c  Thu Jul  2 18:10:41 2015
> (r285051)
> E> @@ -897,6 +897,7 @@ ip_forward(struct mbuf *m, int srcrt)
> E>  struct ip *ip = mtod(m, struct ip *);
> E>  struct in_ifaddr *ia;
> E>  struct mbuf *mcopy;
> E> +struct sockaddr_in *sin;
> E>  struct in_addr dest;
> E>  struct route ro;
> E>  int error, type = 0, code = 0, mtu = 0;
> E> @@ -925,7 +926,22 @@ ip_forward(struct mbuf *m, int srcrt)
> E>  }
> E>  #endif
> E>
> E> -ia = ip_rtaddr(ip->ip_dst, M_GETFIB(m));
> E> +bzero(&ro, sizeof(ro));
> E> +sin = (struct sockaddr_in *)&ro.ro_dst;
> E> +sin->sin_family = AF_INET;
> E> +sin->sin_len = sizeof(*sin);
> E> +sin->sin_addr = ip->ip_dst;
> E> +#ifdef RADIX_MPATH
> E> +rtalloc_mpath_fib(&ro,
> E> +ntohl(ip->ip_src.s_addr ^ ip->ip_dst.s_addr),
> E> +M_GETFIB(m));
> E> +#else
> E> +in_rtalloc_ign(&ro, 0, M_GETFIB(m));
> E> +#endif
> E> +if (ro.ro_rt != NULL) {
> E> +ia = ifatoia(ro.ro_rt->rt_ifa);
> E> +ifa_ref(&ia->ia_ifa);
> E> +}
> E>  #ifndef IPSEC
> E>  /*
> E>   * 'ia' may be NULL if there is no route for this destination.
> E> @@ -934,6 +950,7 @@ ip_forward(struct mbuf *m, int srcrt)
> E>   */
> E>  if (!srcrt && ia == NULL) {
> E>  icmp_error(m, ICMP_UNREACH, ICMP_UNREACH_HOST, 0, 0);
> E> +RO_RTFREE(&ro);
> E>  return;
> E>  }
>
> Here the ifa reference is leaked upon return.
>
>
Gleb,

the improvement on the ifa_ref not needed is something to look at but the
ifa_ref here is not lost since ia == NULL, no?

Maybe i am missing something else.
Also can we put this on a review?


>
> But don't hurry with fixing that :) Actually you don't need to ifa_ref()
> in this function. You acquired a reference on rtentry in in_rtalloc_ign()
> and hold it until RO_RTFREE(). And the rtentry itself always holds a
> reference on the ifa. So, there is no reason to put extra reference on
> the ifa.
>
> The ip_output() was already improved in r262747. And ip_forward() can
> also be. The only place that touches ia after RO_RTFREE() is EMSGSIZE
> handling, this can be moved up before RO_RTFREE().
>
> Here is suggested patch. Ermal and Oliver, can you please test/benchmark
> it?
>
> --
> Totus tuus, Glebius.
>



-- 
Ermal
___
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: r286007 - in stable/10/contrib/llvm: include/llvm/CodeGen lib/CodeGen/SelectionDAG lib/Target/X86

2015-07-29 Thread Dimitry Andric
Author: dim
Date: Wed Jul 29 12:59:16 2015
New Revision: 286007
URL: https://svnweb.freebsd.org/changeset/base/286007

Log:
  Pull in r219009 from upstream llvm trunk (by Adam Nemet):
  
[ISel] Keep matching state consistent when folding during X86 address match
  
In the X86 backend, matching an address is initiated by the 'addr' complex
pattern and its friends.  During this process we may reassociate 
and-of-shift
into shift-of-and (FoldMaskedShiftToScaledMask) to allow folding of the
shift into the scale of the address.
  
However as demonstrated by the testcase, this can trigger CSE of not only 
the
shift and the AND which the code is prepared for but also the underlying 
load
node.  In the testcase this node is sitting in the RecordedNode and 
MatchScope
data structures of the matcher and becomes a deleted node upon CSE.  
Returning
from the complex pattern function, we try to access it again hitting an 
assert
because the node is no longer a load even though this was checked before.
  
Now obviously changing the DAG this late is bending the rules but I think it
makes sense somewhat.  Outside of addresses we prefer and-of-shift because 
it
may lead to smaller immediates (FoldMaskAndShiftToScale is an even better
example because it create a non-canonical node).  We currently don't 
recognize
addresses during DAGCombiner where arguably this canonicalization should be
performed.  On the other hand, having this in the matcher allows us to cover
all the cases where an address can be used in an instruction.
  
I've also talked a little bit to Dan Gohman on llvm-dev who added the RAUW 
for
the new shift node in FoldMaskedShiftToScaledMask.  This RAUW is responsible
for initiating the recursive CSE on users
(http://lists.cs.uiuc.edu/pipermail/llvmdev/2014-September/076903.html) but 
it
is not strictly necessary since the shift is hooked into the visited user.  
Of
course it's safer to keep the DAG consistent at all times (e.g. for accurate
number of uses, etc.).
  
So rather than changing the fundamentals, I've decided to continue along the
previous patches and detect the CSE.  This patch installs a very targeted
DAGUpdateListener for the duration of a complex-pattern match and updates 
the
matching state accordingly.  (Previous patches used HandleSDNode to detect 
the
CSE but that's not practical here).  The listener is only installed on X86.
  
I tested that there is no measurable overhead due to this while running
through the spec2k BC files with llc.  The only thing we pay for is the
creation of the listener.  The callback never ever triggers in spec2k since
this is a corner case.
  
Fixes rdar://problem/18206171
  
  This fixes a possible crash in x86 code generation when compiling recent
  llvm/clang trunk sources.
  
  Direct commit to stable/10, since head already has llvm/clang 3.6.1,
  which includes this fix.
  
  Reported by:  jonathan, theraven
  Upstream PR:  https://llvm.org/bugs/show_bug.cgi?id=24249

Modified:
  stable/10/contrib/llvm/include/llvm/CodeGen/SelectionDAGISel.h
  stable/10/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
  stable/10/contrib/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp

Modified: stable/10/contrib/llvm/include/llvm/CodeGen/SelectionDAGISel.h
==
--- stable/10/contrib/llvm/include/llvm/CodeGen/SelectionDAGISel.h  Wed Jul 
29 12:42:45 2015(r286006)
+++ stable/10/contrib/llvm/include/llvm/CodeGen/SelectionDAGISel.h  Wed Jul 
29 12:59:16 2015(r286007)
@@ -238,6 +238,12 @@ public:
const unsigned char *MatcherTable,
unsigned TableSize);
 
+  /// \brief Return true if complex patterns for this target can mutate the
+  /// DAG.
+  virtual bool ComplexPatternFuncMutatesDAG() const {
+return false;
+  }
+
 private:
 
   // Calls to these functions are generated by tblgen.

Modified: stable/10/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
==
--- stable/10/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
Wed Jul 29 12:42:45 2015(r286006)
+++ stable/10/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
Wed Jul 29 12:59:16 2015(r286007)
@@ -2345,6 +2345,42 @@ struct MatchScope {
   bool HasChainNodesMatched, HasGlueResultNodesMatched;
 };
 
+/// \\brief A DAG update listener to keep the matching state
+/// (i.e. RecordedNodes and MatchScope) uptodate if the target is allowed to
+/// change the DAG while matching.  X86 addressing mode matcher is an example
+/// for this.
+class MatchStateUpdater : public SelectionDAG::DAGUpdateListener
+{
+  SmallVectorImpl > &RecordedNodes;
+  SmallVectorImpl &MatchScopes;
+public:
+  MatchStateUpdater

Re: svn commit: r286000 - head/sys/netipsec

2015-07-29 Thread Ermal Luçi
Hello John-Mark,

this was forgotten part on my patches merge from gnn@.
Can it be fixed by correcting the patches rather than re-introducing this?

Most probably the constant definition is wrong on the transforms and also
some part of code removal was missed.




On Wed, Jul 29, 2015 at 9:15 AM, John-Mark Gurney  wrote:

> Author: jmg
> Date: Wed Jul 29 07:15:16 2015
> New Revision: 286000
> URL: https://svnweb.freebsd.org/changeset/base/286000
>
> Log:
>   RFC4868 section 2.3 requires that the output be half...  This fixes
>   problems that was introduced in r285336...  I have verified that
>   HMAC-SHA2-256 both ah only and w/ AES-CBC interoperate w/ a NetBSD
>   6.1.5 vm...
>
>   Reviewed by:  gnn
>
> Modified:
>   head/sys/netipsec/xform.h
>   head/sys/netipsec/xform_ah.c
>   head/sys/netipsec/xform_esp.c
>
> Modified: head/sys/netipsec/xform.h
>
> ==
> --- head/sys/netipsec/xform.h   Wed Jul 29 06:35:36 2015(r285999)
> +++ head/sys/netipsec/xform.h   Wed Jul 29 07:15:16 2015(r286000)
> @@ -105,6 +105,7 @@ struct xformsw {
>  #ifdef _KERNEL
>  extern void xform_register(struct xformsw*);
>  extern int xform_init(struct secasvar *sav, int xftype);
> +extern int xform_ah_authsize(struct auth_hash *esph);
>
>  struct cryptoini;
>
>
> Modified: head/sys/netipsec/xform_ah.c
>
> ==
> --- head/sys/netipsec/xform_ah.cWed Jul 29 06:35:36 2015
> (r285999)
> +++ head/sys/netipsec/xform_ah.cWed Jul 29 07:15:16 2015
> (r286000)
> @@ -85,8 +85,8 @@
>   * Return authenticator size in bytes, based on a field in the
>   * algorithm descriptor.
>   */
> -#defineAUTHSIZE(sav)   \
> -   ((sav->flags & SADB_X_EXT_OLD) ? 16 :
> (sav)->tdb_authalgxform->hashsize)
> +#defineAUTHSIZE(sav)   ((sav->flags & SADB_X_EXT_OLD) ? 16 :   \
> +xform_ah_authsize((sav)->tdb_authalgxform))
>
>  VNET_DEFINE(int, ah_enable) = 1;   /* control flow of packets with AH
> */
>  VNET_DEFINE(int, ah_cleartos) = 1; /* clear ip_tos when doing AH calc
> */
> @@ -112,6 +112,35 @@ static unsigned char ipseczeroes[256]; /
>  static int ah_input_cb(struct cryptop*);
>  static int ah_output_cb(struct cryptop*);
>
> +int
> +xform_ah_authsize(struct auth_hash *esph)
> +{
> +   int alen;
> +
> +   if (esph == NULL)
> +   return 0;
> +
> +   switch (esph->type) {
> +   case CRYPTO_SHA2_256_HMAC:
> +   case CRYPTO_SHA2_384_HMAC:
> +   case CRYPTO_SHA2_512_HMAC:
> +   alen = esph->hashsize / 2;  /* RFC4868 2.3 */
> +   break;
> +
> +   case CRYPTO_AES_128_NIST_GMAC:
> +   case CRYPTO_AES_192_NIST_GMAC:
> +   case CRYPTO_AES_256_NIST_GMAC:
> +   alen = esph->hashsize;
> +   break;
> +
> +   default:
> +   alen = AH_HMAC_HASHLEN;
> +   break;
> +   }
> +
> +   return alen;
> +}
> +
>  /*
>   * NB: this is public for use by the PF_KEY support.
>   */
>
> Modified: head/sys/netipsec/xform_esp.c
>
> ==
> --- head/sys/netipsec/xform_esp.c   Wed Jul 29 06:35:36 2015
> (r285999)
> +++ head/sys/netipsec/xform_esp.c   Wed Jul 29 07:15:16 2015
> (r286000)
> @@ -320,7 +320,6 @@ esp_input(struct mbuf *m, struct secasva
> IPSEC_ASSERT(sav != NULL, ("null SA"));
> IPSEC_ASSERT(sav->tdb_encalgxform != NULL, ("null encoding
> xform"));
>
> -   alen = 0;
> /* Valid IP Packet length ? */
> if ( (skip&3) || (m->m_pkthdr.len&3) ){
> DPRINTF(("%s: misaligned packet, skip %u pkt len %u",
> @@ -335,13 +334,13 @@ esp_input(struct mbuf *m, struct secasva
> esph = sav->tdb_authalgxform;
> espx = sav->tdb_encalgxform;
>
> -   /* Determine the ESP header length */
> +   /* Determine the ESP header and auth length */
> if (sav->flags & SADB_X_EXT_OLD)
> hlen = sizeof (struct esp) + sav->ivlen;
> else
> hlen = sizeof (struct newesp) + sav->ivlen;
> -   /* Authenticator hash size */
> -   alen = esph ? esph->hashsize : 0;
> +
> +   alen = xform_ah_authsize(esph);
>
> /*
>  * Verify payload length is multiple of encryption algorithm
> @@ -530,7 +529,7 @@ esp_input_cb(struct cryptop *crp)
>
> /* If authentication was performed, check now. */
> if (esph != NULL) {
> -   alen = esph->hashsize;
> +   alen = xform_ah_authsize(esph);
> AHSTAT_INC(ahs_hist[sav->alg_auth]);
> /* Copy the authenticator from the packet */
> m_copydata(m, m->m_pkthdr.len - alen, alen, aalg);
> @@ -700,10 +699,7 @@ esp_output(struct mbuf *m, struct ipsecr
> /* XXX clamp padding length a la KAME??? */
> padding = ((blks

svn commit: r286006 - head/sys/compat/cloudabi

2015-07-29 Thread Ed Schouten
Author: ed
Date: Wed Jul 29 12:42:45 2015
New Revision: 286006
URL: https://svnweb.freebsd.org/changeset/base/286006

Log:
  Split up Capsicum to CloudABI rights conversion into two separate routines.
  
  CloudABI's openat() ensures that files are opened with the smallest set
  of relevant rights. For example, when opening a FIFO, unrelated rights
  like CAP_RECV are automatically removed. To remove unrelated rights, we
  can just reuse the code for this that was already present in the rights
  conversion function.

Modified:
  head/sys/compat/cloudabi/cloudabi_fd.c

Modified: head/sys/compat/cloudabi/cloudabi_fd.c
==
--- head/sys/compat/cloudabi/cloudabi_fd.c  Wed Jul 29 11:22:19 2015
(r286005)
+++ head/sys/compat/cloudabi/cloudabi_fd.c  Wed Jul 29 12:42:45 2015
(r286006)
@@ -266,24 +266,11 @@ cloudabi_convert_filetype(const struct f
}
 }
 
-/*
- * Converts FreeBSD's Capsicum rights to CloudABI's set of rights.
- */
+/* Removes rights that conflict with the file descriptor type. */
 static void
-convert_capabilities(const cap_rights_t *capabilities,
-cloudabi_filetype_t filetype, cloudabi_rights_t *base,
-cloudabi_rights_t *inheriting)
+cloudabi_remove_conflicting_rights(cloudabi_filetype_t filetype,
+cloudabi_rights_t *base, cloudabi_rights_t *inheriting)
 {
-   cloudabi_rights_t rights;
-
-   /* Convert FreeBSD bits to CloudABI bits. */
-   rights = 0;
-#define MAPPING(cloudabi, ...) do {\
-   if (cap_rights_is_set(capabilities, ##__VA_ARGS__)) \
-   rights |= (cloudabi);   \
-} while (0);
-   RIGHTS_MAPPINGS
-#undef MAPPING
 
/*
 * CloudABI has a small number of additional rights bits to
@@ -303,7 +290,7 @@ convert_capabilities(const cap_rights_t 
 */
switch (filetype) {
case CLOUDABI_FILETYPE_DIRECTORY:
-   *base = rights & (CLOUDABI_RIGHT_FD_STAT_PUT_FLAGS |
+   *base &= CLOUDABI_RIGHT_FD_STAT_PUT_FLAGS |
CLOUDABI_RIGHT_FD_SYNC | CLOUDABI_RIGHT_FILE_ADVISE |
CLOUDABI_RIGHT_FILE_CREATE_DIRECTORY |
CLOUDABI_RIGHT_FILE_CREATE_FILE |
@@ -323,29 +310,77 @@ convert_capabilities(const cap_rights_t 
CLOUDABI_RIGHT_FILE_UNLINK |
CLOUDABI_RIGHT_POLL_FD_READWRITE |
CLOUDABI_RIGHT_SOCK_BIND_DIRECTORY |
-   CLOUDABI_RIGHT_SOCK_CONNECT_DIRECTORY);
-   *inheriting = rights;
+   CLOUDABI_RIGHT_SOCK_CONNECT_DIRECTORY;
+   *inheriting &= CLOUDABI_RIGHT_FD_DATASYNC |
+   CLOUDABI_RIGHT_FD_READ |
+   CLOUDABI_RIGHT_FD_SEEK |
+   CLOUDABI_RIGHT_FD_STAT_PUT_FLAGS |
+   CLOUDABI_RIGHT_FD_SYNC |
+   CLOUDABI_RIGHT_FD_TELL |
+   CLOUDABI_RIGHT_FD_WRITE |
+   CLOUDABI_RIGHT_FILE_ADVISE |
+   CLOUDABI_RIGHT_FILE_ALLOCATE |
+   CLOUDABI_RIGHT_FILE_CREATE_DIRECTORY |
+   CLOUDABI_RIGHT_FILE_CREATE_FILE |
+   CLOUDABI_RIGHT_FILE_CREATE_FIFO |
+   CLOUDABI_RIGHT_FILE_LINK_SOURCE |
+   CLOUDABI_RIGHT_FILE_LINK_TARGET |
+   CLOUDABI_RIGHT_FILE_OPEN |
+   CLOUDABI_RIGHT_FILE_READDIR |
+   CLOUDABI_RIGHT_FILE_READLINK |
+   CLOUDABI_RIGHT_FILE_RENAME_SOURCE |
+   CLOUDABI_RIGHT_FILE_RENAME_TARGET |
+   CLOUDABI_RIGHT_FILE_STAT_FGET |
+   CLOUDABI_RIGHT_FILE_STAT_FPUT_SIZE |
+   CLOUDABI_RIGHT_FILE_STAT_FPUT_TIMES |
+   CLOUDABI_RIGHT_FILE_STAT_GET |
+   CLOUDABI_RIGHT_FILE_STAT_PUT_TIMES |
+   CLOUDABI_RIGHT_FILE_SYMLINK |
+   CLOUDABI_RIGHT_FILE_UNLINK |
+   CLOUDABI_RIGHT_MEM_MAP |
+   CLOUDABI_RIGHT_MEM_MAP_EXEC |
+   CLOUDABI_RIGHT_POLL_FD_READWRITE |
+   CLOUDABI_RIGHT_PROC_EXEC |
+   CLOUDABI_RIGHT_SOCK_BIND_DIRECTORY |
+   CLOUDABI_RIGHT_SOCK_CONNECT_DIRECTORY;
break;
case CLOUDABI_FILETYPE_FIFO:
-   *base = rights & ~(CLOUDABI_RIGHT_FILE_ADVISE |
-   CLOUDABI_RIGHT_FILE_ALLOCATE |
-   CLOUDABI_RIGHT_FILE_READDIR);
+   *base &= CLOUDABI_RIGHT_FD_READ |
+   CLOUDABI_RIGHT_FD_STAT_PUT_FLAGS |
+   CLOUDABI_RIGHT_FD_WRITE |
+   CLOUDABI_RIGHT_FILE_STAT_FGET |
+   CLOUDABI_RIGHT_POLL_FD_READWRITE;
*inheriting = 0;
break;
case CLOUDABI_FILETYPE_POLL:
-   *base = rights & ~CLOUDABI_RIGHT_FILE_ADVISE;
+  

svn commit: r286005 - head/sys/arm64/arm64

2015-07-29 Thread Zbigniew Bodek
Author: zbb
Date: Wed Jul 29 11:22:19 2015
New Revision: 286005
URL: https://svnweb.freebsd.org/changeset/base/286005

Log:
  Add quirk for ThunderX ITS device table size
  
  Limit the number of supported device IDs to 0x10
  in order to decrease the size of the ITS device table so
  that it matches with the HW capabilities.
  
  Obtained from: Semihalf
  Sponsored by:  The FreeBSD Foundation
  Differential Revision: https://reviews.freebsd.org/D3131

Modified:
  head/sys/arm64/arm64/gic_v3_its.c
  head/sys/arm64/arm64/gic_v3_var.h

Modified: head/sys/arm64/arm64/gic_v3_its.c
==
--- head/sys/arm64/arm64/gic_v3_its.c   Wed Jul 29 11:12:56 2015
(r286004)
+++ head/sys/arm64/arm64/gic_v3_its.c   Wed Jul 29 11:22:19 2015
(r286005)
@@ -101,6 +101,8 @@ static void its_cmd_mapi(struct gic_v3_i
 static void its_cmd_inv(struct gic_v3_its_softc *, struct its_dev *, uint32_t);
 static void its_cmd_invall(struct gic_v3_its_softc *, struct its_col *);
 
+static uint32_t its_get_devbits(device_t);
+
 static void lpi_init_conftable(struct gic_v3_its_softc *);
 static void lpi_bitmap_init(struct gic_v3_its_softc *);
 static void lpi_init_cpu(struct gic_v3_its_softc *);
@@ -142,13 +144,19 @@ const char *its_ptab_type[] = {
  */
 
 /* Cavium ThunderX PCI devid acquire function */
+static uint32_t its_get_devbits_thunder(device_t);
 static uint32_t its_get_devid_thunder(device_t);
 
 static const struct its_quirks its_quirks[] = {
{
+   /*
+* Hardware:Cavium ThunderX
+* Chip revision:   Pass 1.0, Pass 1.1
+*/
.cpuid =CPU_ID_RAW(CPU_IMPL_CAVIUM, CPU_PART_THUNDER, 
0, 0),
.cpuid_mask =   CPU_IMPL_MASK | CPU_PART_MASK,
.devid_func =   its_get_devid_thunder,
+   .devbits_func = its_get_devbits_thunder,
},
 };
 
@@ -299,7 +307,6 @@ its_alloc_tables(struct gic_v3_its_softc
 {
uint64_t gits_baser, gits_tmp;
uint64_t type, esize, cache, share, psz;
-   uint64_t gits_typer;
size_t page_size, npages, nitspages, nidents, tn;
size_t its_tbl_size;
vm_offset_t ptab_vaddr;
@@ -308,9 +315,6 @@ its_alloc_tables(struct gic_v3_its_softc
 
page_size = PAGE_SIZE_64K;
 
-   /* Read features first */
-   gits_typer = gic_its_read(sc, 8, GITS_TYPER);
-
for (tn = 0; tn < GITS_BASER_NUM; tn++) {
gits_baser = gic_its_read(sc, 8, GITS_BASER(tn));
type = GITS_BASER_TYPE(gits_baser);
@@ -324,7 +328,7 @@ its_alloc_tables(struct gic_v3_its_softc
case GITS_BASER_TYPE_RES7:
continue;
case GITS_BASER_TYPE_DEV:
-   nidents = (1 << GITS_TYPER_DEVB(gits_typer));
+   nidents = (1 << its_get_devbits(sc->dev));
its_tbl_size = esize * nidents;
its_tbl_size = roundup2(its_tbl_size, page_size);
npages = howmany(its_tbl_size, PAGE_SIZE);
@@ -1447,6 +1451,68 @@ its_get_devid_thunder(device_t pci_dev)
return (0);
 }
 
+static uint32_t
+its_get_devbits_thunder(device_t dev)
+{
+   uint32_t devid_bits;
+
+   /*
+* GITS_TYPER[17:13] of ThunderX reports that device IDs
+* are to be 21 bits in length.
+* The entry size of the ITS table can be read from GITS_BASERn[52:48]
+* and on ThunderX is supposed to be 8 bytes in length (for device
+* table). Finally the page size that is to be used by ITS to access
+* this table will be set to 64KB.
+*
+* This gives 0x20 entries of size 0x8 bytes covered by 256 pages
+* each of which 64KB in size. The number of pages (minus 1) should
+* then be written to GITS_BASERn[7:0]. In that case this value would
+* be 0xFF but on ThunderX the maximum value that HW accepts is 0xFD.
+*
+* Set arbitrary number of device ID bits to 20 in order to limit
+* the number of entries in ITS device table to 0x10 and hence
+* the table size to 8MB.
+*/
+   devid_bits = 20;
+   if (bootverbose) {
+   device_printf(dev,
+   "Limiting number of Device ID bits implemented to %d\n",
+   devid_bits);
+   }
+
+   return (devid_bits);
+}
+
+static __inline uint32_t
+its_get_devbits_default(device_t dev)
+{
+   uint64_t gits_typer;
+   struct gic_v3_its_softc *sc;
+
+   sc = device_get_softc(dev);
+
+   gits_typer = gic_its_read(sc, 8, GITS_TYPER);
+
+   return (GITS_TYPER_DEVB(gits_typer));
+}
+
+static uint32_t
+its_get_devbits(device_t dev)
+{
+   const struct its_quirks *quirk;
+   size_t i;
+
+   for (i = 0; i < nitems(its_quirks); i++) {
+   quirk = &its_quirks[i];
+   if (CPU_MATCH_RA

svn commit: r286004 - stable/10/sys/netpfil/pf

2015-07-29 Thread Gleb Smirnoff
Author: glebius
Date: Wed Jul 29 11:12:56 2015
New Revision: 286004
URL: https://svnweb.freebsd.org/changeset/base/286004

Log:
  Merge r285944: fix typo: delete nsn if we were the last reference.

Modified:
  stable/10/sys/netpfil/pf/pf.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/netpfil/pf/pf.c
==
--- stable/10/sys/netpfil/pf/pf.c   Wed Jul 29 10:53:42 2015
(r286003)
+++ stable/10/sys/netpfil/pf/pf.c   Wed Jul 29 11:12:56 2015
(r286004)
@@ -3679,7 +3679,7 @@ csfailed:
 
sh = &V_pf_srchash[pf_hashsrc(&nsn->addr, nsn->af)];
PF_HASHROW_LOCK(sh);
-   if (--nsn->states == 1 && nsn->expire == 0) {
+   if (--nsn->states == 0 && nsn->expire == 0) {
pf_unlink_src_node(nsn);
uma_zfree(V_pf_sources_z, nsn);
counter_u64_add(
___
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: r286003 - head/sys/netpfil/ipfw

2015-07-29 Thread Andrey V. Elsukov
Author: ae
Date: Wed Jul 29 10:53:42 2015
New Revision: 286003
URL: https://svnweb.freebsd.org/changeset/base/286003

Log:
  Reduce overhead of ipfw's me6 opcode.
  
  Skip checks for IPv6 multicast addresses.
  Use in6_localip() for global unicast.
  And for IPv6 link-local addresses do search in the IPv6 addresses list.
  Since LLA are stored in the kernel internal form, use
  IN6_ARE_MASKED_ADDR_EQUAL() macro with lla_mask for addresses comparison.
  lla_mask has zero bits in the second word, where we keep sin6_scope_id.
  
  Obtained from:Yandex LLC
  Sponsored by: Yandex LLC

Modified:
  head/sys/netpfil/ipfw/ip_fw2.c

Modified: head/sys/netpfil/ipfw/ip_fw2.c
==
--- head/sys/netpfil/ipfw/ip_fw2.c  Wed Jul 29 09:57:34 2015
(r286002)
+++ head/sys/netpfil/ipfw/ip_fw2.c  Wed Jul 29 10:53:42 2015
(r286003)
@@ -503,31 +503,35 @@ flow6id_match( int curr_flow, ipfw_insn_
 }
 
 /* support for IP6_*_ME opcodes */
+static const struct in6_addr lla_mask = {{{
+   0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
+   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
+}}};
+
 static int
-search_ip6_addr_net (struct in6_addr * ip6_addr)
+ipfw_localip6(struct in6_addr *in6)
 {
-   struct ifnet *mdc;
-   struct ifaddr *mdc2;
-   struct in6_ifaddr *fdm;
-   struct in6_addr copia;
-
-   TAILQ_FOREACH(mdc, &V_ifnet, if_link) {
-   if_addr_rlock(mdc);
-   TAILQ_FOREACH(mdc2, &mdc->if_addrhead, ifa_link) {
-   if (mdc2->ifa_addr->sa_family == AF_INET6) {
-   fdm = (struct in6_ifaddr *)mdc2;
-   copia = fdm->ia_addr.sin6_addr;
-   /* need for leaving scope_id in the sock_addr */
-   in6_clearscope(&copia);
-   if (IN6_ARE_ADDR_EQUAL(ip6_addr, &copia)) {
-   if_addr_runlock(mdc);
-   return 1;
-   }
-   }
+   struct rm_priotracker in6_ifa_tracker;
+   struct in6_ifaddr *ia;
+
+   if (IN6_IS_ADDR_MULTICAST(in6))
+   return (0);
+
+   if (!IN6_IS_ADDR_LINKLOCAL(in6))
+   return (in6_localip(in6));
+
+   IN6_IFADDR_RLOCK(&in6_ifa_tracker);
+   TAILQ_FOREACH(ia, &V_in6_ifaddrhead, ia_link) {
+   if (!IN6_IS_ADDR_LINKLOCAL(&ia->ia_addr.sin6_addr))
+   continue;
+   if (IN6_ARE_MASKED_ADDR_EQUAL(&ia->ia_addr.sin6_addr,
+   in6, &lla_mask)) {
+   IN6_IFADDR_RUNLOCK(&in6_ifa_tracker);
+   return (1);
}
-   if_addr_runlock(mdc);
}
-   return 0;
+   IN6_IFADDR_RUNLOCK(&in6_ifa_tracker);
+   return (0);
 }
 
 static int
@@ -1597,7 +1601,7 @@ do {  
\
 #ifdef INET6
/* FALLTHROUGH */
case O_IP6_SRC_ME:
-   match= is_ipv6 && 
search_ip6_addr_net(&args->f_id.src_ip6);
+   match= is_ipv6 && 
ipfw_localip6(&args->f_id.src_ip6);
 #endif
break;
 
@@ -1636,7 +1640,7 @@ do {  
\
 #ifdef INET6
/* FALLTHROUGH */
case O_IP6_DST_ME:
-   match= is_ipv6 && 
search_ip6_addr_net(&args->f_id.dst_ip6);
+   match= is_ipv6 && 
ipfw_localip6(&args->f_id.dst_ip6);
 #endif
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"


Re: svn commit: r285068 - in head/sys: conf modules/agp modules/geom/geom_part/geom_part_apm modules/geom/geom_part/geom_part_bsd modules/geom/geom_part/geom_part_bsd64 modules/geom/geom_part/geom_par

2015-07-29 Thread Hans Petter Selasky

On 07/03/15 22:15, Warner Losh wrote:



On Jul 3, 2015, at 11:35 AM, Roger Pau Monné  wrote:

El 03/07/15 a les 19.26, Adrian Chadd ha escrit:

ok, so why's it make NFS builds so slow?


AFAICT it makes the build process spawn a bunch of concurrent "find"
processes that weren't previously there.


OK. I’ll fix it. I knew it might slow things down a little, but this is quite a 
bit more than “a little”.

Warner



Hi,

Is there a fix for this issue yet? At Mellanox we're also seeing that 
NFS mounted shares are extremely slow building even a single module. 
Maybe the output from the find can be cached in a file somehow?


--HPS
___
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: r286002 - head/sys/kern

2015-07-29 Thread Konstantin Belousov
Author: kib
Date: Wed Jul 29 09:57:34 2015
New Revision: 286002
URL: https://svnweb.freebsd.org/changeset/base/286002

Log:
  Move bufshutdown() out of the #ifdef INVARIANTS block.

Modified:
  head/sys/kern/vfs_bio.c

Modified: head/sys/kern/vfs_bio.c
==
--- head/sys/kern/vfs_bio.c Wed Jul 29 08:12:05 2015(r286001)
+++ head/sys/kern/vfs_bio.c Wed Jul 29 09:57:34 2015(r286002)
@@ -958,6 +958,22 @@ vfs_buf_check_mapped(struct buf *bp)
KASSERT(bp->b_data < unmapped_buf || bp->b_data > unmapped_buf +
MAXPHYS, ("b_data + b_offset unmapped %p", bp));
 }
+
+static inline void
+vfs_buf_check_unmapped(struct buf *bp)
+{
+
+   KASSERT(bp->b_data == unmapped_buf,
+   ("unmapped buf: corrupted b_data %p", bp));
+}
+
+#defineBUF_CHECK_MAPPED(bp) vfs_buf_check_mapped(bp)
+#defineBUF_CHECK_UNMAPPED(bp) vfs_buf_check_unmapped(bp)
+#else
+#defineBUF_CHECK_MAPPED(bp) do {} while (0)
+#defineBUF_CHECK_UNMAPPED(bp) do {} while (0)
+#endif
+
 static int
 isbufbusy(struct buf *bp)
 {
@@ -1087,21 +1103,6 @@ bufshutdown(int show_busybufs)
DELAY(10);  /* wait for console output to finish */
 }
 
-static inline void
-vfs_buf_check_unmapped(struct buf *bp)
-{
-
-   KASSERT(bp->b_data == unmapped_buf,
-   ("unmapped buf: corrupted b_data %p", bp));
-}
-
-#defineBUF_CHECK_MAPPED(bp) vfs_buf_check_mapped(bp)
-#defineBUF_CHECK_UNMAPPED(bp) vfs_buf_check_unmapped(bp)
-#else
-#defineBUF_CHECK_MAPPED(bp) do {} while (0)
-#defineBUF_CHECK_UNMAPPED(bp) do {} while (0)
-#endif
-
 static void
 bpmap_qenter(struct buf *bp)
 {
___
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: r286001 - in head/sys: dev/cxgbe/tom net netinet netinet6

2015-07-29 Thread Andrey V. Elsukov
Author: ae
Date: Wed Jul 29 08:12:05 2015
New Revision: 286001
URL: https://svnweb.freebsd.org/changeset/base/286001

Log:
  Convert in_ifaddr_lock and in6_ifaddr_lock to rmlock.
  
  Both are used to protect access to IP addresses lists and they can be
  acquired for reading several times per packet. To reduce lock contention
  it is better to use rmlock here.
  
  Reviewed by:  gnn (previous version)
  Obtained from:Yandex LLC
  Sponsored by: Yandex LLC
  Differential Revision:https://reviews.freebsd.org/D3149

Modified:
  head/sys/dev/cxgbe/tom/t4_tom.c
  head/sys/net/if_spppsubr.c
  head/sys/net/if_stf.c
  head/sys/netinet/if_ether.c
  head/sys/netinet/igmp.c
  head/sys/netinet/in.c
  head/sys/netinet/in_mcast.c
  head/sys/netinet/in_pcb.c
  head/sys/netinet/in_var.h
  head/sys/netinet/ip_icmp.c
  head/sys/netinet/ip_input.c
  head/sys/netinet/ip_output.c
  head/sys/netinet/raw_ip.c
  head/sys/netinet6/in6.c
  head/sys/netinet6/in6_ifattach.c
  head/sys/netinet6/in6_src.c
  head/sys/netinet6/in6_var.h
  head/sys/netinet6/ip6_input.c

Modified: head/sys/dev/cxgbe/tom/t4_tom.c
==
--- head/sys/dev/cxgbe/tom/t4_tom.c Wed Jul 29 07:15:16 2015
(r286000)
+++ head/sys/dev/cxgbe/tom/t4_tom.c Wed Jul 29 08:12:05 2015
(r286001)
@@ -36,9 +36,11 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -762,6 +764,7 @@ t4_clip_task(void *arg, int count)
 static void
 update_clip_table(struct adapter *sc, struct tom_data *td)
 {
+   struct rm_priotracker in6_ifa_tracker;
struct in6_ifaddr *ia;
struct in6_addr *lip, tlip;
struct clip_head stale;
@@ -770,7 +773,7 @@ update_clip_table(struct adapter *sc, st
 
ASSERT_SYNCHRONIZED_OP(sc);
 
-   IN6_IFADDR_RLOCK();
+   IN6_IFADDR_RLOCK(&in6_ifa_tracker);
mtx_lock(&td->clip_table_lock);
 
if (gen == td->clip_gen)
@@ -862,7 +865,7 @@ next:
td->clip_gen = gen;
 done:
mtx_unlock(&td->clip_table_lock);
-   IN6_IFADDR_RUNLOCK();
+   IN6_IFADDR_RUNLOCK(&in6_ifa_tracker);
 }
 
 static void

Modified: head/sys/net/if_spppsubr.c
==
--- head/sys/net/if_spppsubr.c  Wed Jul 29 07:15:16 2015(r286000)
+++ head/sys/net/if_spppsubr.c  Wed Jul 29 08:12:05 2015(r286001)
@@ -28,7 +28,9 @@
 
 #include 
 #include 
+#include 
 #include 
+#include 
 #include 
 #include 
 #include 

Modified: head/sys/net/if_stf.c
==
--- head/sys/net/if_stf.c   Wed Jul 29 07:15:16 2015(r286000)
+++ head/sys/net/if_stf.c   Wed Jul 29 08:12:05 2015(r286001)
@@ -84,10 +84,12 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -530,6 +532,7 @@ stf_checkaddr4(sc, in, inifp)
struct in_addr *in;
struct ifnet *inifp;/* incoming interface */
 {
+   struct rm_priotracker in_ifa_tracker;
struct in_ifaddr *ia4;
 
/*
@@ -553,16 +556,16 @@ stf_checkaddr4(sc, in, inifp)
/*
 * reject packets with broadcast
 */
-   IN_IFADDR_RLOCK();
+   IN_IFADDR_RLOCK(&in_ifa_tracker);
TAILQ_FOREACH(ia4, &V_in_ifaddrhead, ia_link) {
if ((ia4->ia_ifa.ifa_ifp->if_flags & IFF_BROADCAST) == 0)
continue;
if (in->s_addr == ia4->ia_broadaddr.sin_addr.s_addr) {
-   IN_IFADDR_RUNLOCK();
+   IN_IFADDR_RUNLOCK(&in_ifa_tracker);
return -1;
}
}
-   IN_IFADDR_RUNLOCK();
+   IN_IFADDR_RUNLOCK(&in_ifa_tracker);
 
/*
 * perform ingress filter

Modified: head/sys/netinet/if_ether.c
==
--- head/sys/netinet/if_ether.c Wed Jul 29 07:15:16 2015(r286000)
+++ head/sys/netinet/if_ether.c Wed Jul 29 08:12:05 2015(r286001)
@@ -42,12 +42,14 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -563,6 +565,7 @@ SYSCTL_INT(_net_link_ether_inet, OID_AUT
 static void
 in_arpinput(struct mbuf *m)
 {
+   struct rm_priotracker in_ifa_tracker;
struct arphdr *ah;
struct ifnet *ifp = m->m_pkthdr.rcvif;
struct llentry *la = NULL;
@@ -621,7 +624,7 @@ in_arpinput(struct mbuf *m)
 * of the receive interface. (This will change slightly
 * when we have clusters of interfaces).
 */
-   IN_IFADDR_RLOCK();
+   IN_IFADDR_RLOCK(&in_ifa_tracker);
LIST_FOREACH(ia, INADDR_HASH(itaddr.s_addr), ia_hash) {
if (((bridged && 

svn commit: r286000 - head/sys/netipsec

2015-07-29 Thread John-Mark Gurney
Author: jmg
Date: Wed Jul 29 07:15:16 2015
New Revision: 286000
URL: https://svnweb.freebsd.org/changeset/base/286000

Log:
  RFC4868 section 2.3 requires that the output be half...  This fixes
  problems that was introduced in r285336...  I have verified that
  HMAC-SHA2-256 both ah only and w/ AES-CBC interoperate w/ a NetBSD
  6.1.5 vm...
  
  Reviewed by:  gnn

Modified:
  head/sys/netipsec/xform.h
  head/sys/netipsec/xform_ah.c
  head/sys/netipsec/xform_esp.c

Modified: head/sys/netipsec/xform.h
==
--- head/sys/netipsec/xform.h   Wed Jul 29 06:35:36 2015(r285999)
+++ head/sys/netipsec/xform.h   Wed Jul 29 07:15:16 2015(r286000)
@@ -105,6 +105,7 @@ struct xformsw {
 #ifdef _KERNEL
 extern void xform_register(struct xformsw*);
 extern int xform_init(struct secasvar *sav, int xftype);
+extern int xform_ah_authsize(struct auth_hash *esph);
 
 struct cryptoini;
 

Modified: head/sys/netipsec/xform_ah.c
==
--- head/sys/netipsec/xform_ah.cWed Jul 29 06:35:36 2015
(r285999)
+++ head/sys/netipsec/xform_ah.cWed Jul 29 07:15:16 2015
(r286000)
@@ -85,8 +85,8 @@
  * Return authenticator size in bytes, based on a field in the
  * algorithm descriptor.
  */
-#defineAUTHSIZE(sav)   \
-   ((sav->flags & SADB_X_EXT_OLD) ? 16 : (sav)->tdb_authalgxform->hashsize)
+#defineAUTHSIZE(sav)   ((sav->flags & SADB_X_EXT_OLD) ? 16 :   \
+xform_ah_authsize((sav)->tdb_authalgxform))
 
 VNET_DEFINE(int, ah_enable) = 1;   /* control flow of packets with AH */
 VNET_DEFINE(int, ah_cleartos) = 1; /* clear ip_tos when doing AH calc */
@@ -112,6 +112,35 @@ static unsigned char ipseczeroes[256]; /
 static int ah_input_cb(struct cryptop*);
 static int ah_output_cb(struct cryptop*);
 
+int
+xform_ah_authsize(struct auth_hash *esph)
+{
+   int alen;
+
+   if (esph == NULL)
+   return 0;
+
+   switch (esph->type) {
+   case CRYPTO_SHA2_256_HMAC:
+   case CRYPTO_SHA2_384_HMAC:
+   case CRYPTO_SHA2_512_HMAC:
+   alen = esph->hashsize / 2;  /* RFC4868 2.3 */
+   break;
+
+   case CRYPTO_AES_128_NIST_GMAC:
+   case CRYPTO_AES_192_NIST_GMAC:
+   case CRYPTO_AES_256_NIST_GMAC:
+   alen = esph->hashsize;
+   break;
+
+   default:
+   alen = AH_HMAC_HASHLEN;
+   break;
+   }
+
+   return alen;
+}
+
 /*
  * NB: this is public for use by the PF_KEY support.
  */

Modified: head/sys/netipsec/xform_esp.c
==
--- head/sys/netipsec/xform_esp.c   Wed Jul 29 06:35:36 2015
(r285999)
+++ head/sys/netipsec/xform_esp.c   Wed Jul 29 07:15:16 2015
(r286000)
@@ -320,7 +320,6 @@ esp_input(struct mbuf *m, struct secasva
IPSEC_ASSERT(sav != NULL, ("null SA"));
IPSEC_ASSERT(sav->tdb_encalgxform != NULL, ("null encoding xform"));
 
-   alen = 0;
/* Valid IP Packet length ? */
if ( (skip&3) || (m->m_pkthdr.len&3) ){
DPRINTF(("%s: misaligned packet, skip %u pkt len %u",
@@ -335,13 +334,13 @@ esp_input(struct mbuf *m, struct secasva
esph = sav->tdb_authalgxform;
espx = sav->tdb_encalgxform;
 
-   /* Determine the ESP header length */
+   /* Determine the ESP header and auth length */
if (sav->flags & SADB_X_EXT_OLD)
hlen = sizeof (struct esp) + sav->ivlen;
else
hlen = sizeof (struct newesp) + sav->ivlen;
-   /* Authenticator hash size */
-   alen = esph ? esph->hashsize : 0;
+
+   alen = xform_ah_authsize(esph);
 
/*
 * Verify payload length is multiple of encryption algorithm
@@ -530,7 +529,7 @@ esp_input_cb(struct cryptop *crp)
 
/* If authentication was performed, check now. */
if (esph != NULL) {
-   alen = esph->hashsize;
+   alen = xform_ah_authsize(esph);
AHSTAT_INC(ahs_hist[sav->alg_auth]);
/* Copy the authenticator from the packet */
m_copydata(m, m->m_pkthdr.len - alen, alen, aalg);
@@ -700,10 +699,7 @@ esp_output(struct mbuf *m, struct ipsecr
/* XXX clamp padding length a la KAME??? */
padding = ((blks - ((rlen + 2) % blks)) % blks) + 2;
 
-   if (esph)
-   alen = esph->hashsize;
-   else
-   alen = 0;
+   alen = xform_ah_authsize(esph);
 
ESPSTAT_INC(esps_output);
 
@@ -983,21 +979,7 @@ esp_output_cb(struct cryptop *crp)
if (esph !=  NULL) {
int alen;
 
-   switch (esph->type) {
-   case CRYPTO_SHA2_256_HMAC:
-   case CRYPTO_SHA2_384_HMAC:
-   case CRYPTO_SHA2_512_HMA