Re: svn commit: r339350 - head/contrib/elftoolchain/elfcopy

2018-10-15 Thread Antoine Brodin
On Mon, Oct 15, 2018 at 3:53 PM Ed Maste  wrote:
> On Mon, 15 Oct 2018 at 07:13, Ed Maste  wrote:
> > Hi Antoine, did you bisect to this rev or does it just look like the
> > most probable candidate? Can you copy a pair of differing .o files
> > (say, gcc/cc1plus-checksum.o) from the work dir to freefall?
>
> Antoine provided a tarball of the work dir to me, and pointed out that
> the *-checksum.o files are not interesting - they are warnings only
> and are present prior to the identified change.
>
> Comparing one of the other differing files, e.g.
> stage{2,3}-gcc/expmed.o, demonstrates the problem. Gcc's build
> machinery is reasonably obfuscated so I'm not sure of the exact set of
> operations, but I can infer that the stage2/stage3 comparison is
> running strip on the object files and then comparing the result. Gcc
> is encountering this part of my strip/objcopy change:
>
> > Stripping binaries with relocations
> > referencing removed symbols was already broken, and after this change
> > may still be broken in a different way.
>
> Stripping symbols and relocations from an object file is not a
> particularly useful operation, since the object then can't be linked
> or otherwise used. But it seems Gcc's stage comparison relies on this.
> I did try running "strip --strip-debug" on stage{2,3}-gcc/expmed.o (a
> reasonable operation on object files) and that produced identical
> output.
>
> It may well be that a further change to ELF Tool Chain's strip is
> warranted, but I suspect the most straightforward and reliable fix
> here will be to just have gcc use GNU strip.

The attached patch for the gcc ports fixes the failures for me.

Antoine
Index: lang/gcc48/Makefile
===
--- lang/gcc48/Makefile	(revision 482165)
+++ lang/gcc48/Makefile	(working copy)
@@ -33,6 +33,7 @@
 SUFFIX=		${PORTVERSION:C/([0-9]+).([0-9]+).*/\1\2/}
 USES=		compiler cpe gmake iconv libtool makeinfo perl5 tar:bzip2
 USE_BINUTILS=	yes
+BINARY_ALIAS=	strip=${LOCALBASE}/bin/strip
 USE_PERL5=	build
 SSP_UNSAFE=	yes
 
Index: lang/gcc49/Makefile
===
--- lang/gcc49/Makefile	(revision 482165)
+++ lang/gcc49/Makefile	(working copy)
@@ -33,6 +33,7 @@
 SUFFIX=		${PORTVERSION:C/([0-9]+).([0-9]+).*/\1\2/}
 USES=		compiler cpe gmake iconv libtool makeinfo perl5 tar:bzip2
 USE_BINUTILS=	yes
+BINARY_ALIAS=	strip=${LOCALBASE}/bin/strip
 USE_PERL5=	build
 SSP_UNSAFE=	yes
 
Index: lang/gcc5/Makefile
===
--- lang/gcc5/Makefile	(revision 482165)
+++ lang/gcc5/Makefile	(working copy)
@@ -34,6 +34,7 @@
 SUFFIX=		${PORTVERSION:C/([0-9]+).*/\1/}
 USES=		compiler cpe gmake iconv libtool makeinfo perl5 tar:xz
 USE_BINUTILS=	yes
+BINARY_ALIAS=	strip=${LOCALBASE}/bin/strip
 USE_PERL5=	build
 SSP_UNSAFE=	yes
 
Index: lang/gcc6/Makefile
===
--- lang/gcc6/Makefile	(revision 482165)
+++ lang/gcc6/Makefile	(working copy)
@@ -35,6 +35,7 @@
 SUFFIX=		${PORTVERSION:C/([0-9]+).*/\1/}
 USES=		compiler cpe gmake iconv libtool makeinfo perl5 tar:xz
 USE_BINUTILS=	yes
+BINARY_ALIAS=	strip=${LOCALBASE}/bin/strip
 USE_PERL5=	build
 SSP_UNSAFE=	yes
 CFLAGS:=	${CFLAGS:N-mretpoline}
Index: lang/gcc6-devel/Makefile
===
--- lang/gcc6-devel/Makefile	(revision 482165)
+++ lang/gcc6-devel/Makefile	(working copy)
@@ -40,6 +40,7 @@
 SUFFIX=		${PORTVERSION:C/([0-9]+).*/\1/}
 USES=		compiler cpe gmake iconv libtool makeinfo perl5 tar:xz
 USE_BINUTILS=	yes
+BINARY_ALIAS=	strip=${LOCALBASE}/bin/strip
 USE_PERL5=	build
 SSP_UNSAFE=	yes
 
Index: lang/gcc7/Makefile
===
--- lang/gcc7/Makefile	(revision 482165)
+++ lang/gcc7/Makefile	(working copy)
@@ -34,6 +34,7 @@
 SUFFIX=		${PORTVERSION:C/([0-9]+).*/\1/}
 USES=		compiler cpe gmake iconv libtool makeinfo perl5 tar:xz
 USE_BINUTILS=	yes
+BINARY_ALIAS=	strip=${LOCALBASE}/bin/strip
 USE_PERL5=	build
 SSP_UNSAFE=	yes
 CFLAGS:=	${CFLAGS:N-mretpoline}
Index: lang/gcc7-devel/Makefile
===
--- lang/gcc7-devel/Makefile	(revision 482165)
+++ lang/gcc7-devel/Makefile	(working copy)
@@ -40,6 +40,7 @@
 SUFFIX=		${PORTVERSION:C/([0-9]+).*/\1/}
 USES=		compiler cpe gmake iconv libtool makeinfo perl5 tar:xz
 USE_BINUTILS=	yes
+BINARY_ALIAS=	strip=${LOCALBASE}/bin/strip
 USE_PERL5=	build
 SSP_UNSAFE=	yes
 
Index: lang/gcc8/Makefile
===
--- lang/gcc8/Makefile	(revision 482165)
+++ lang/gcc8/Makefile	(working copy)
@@ -34,6 +34,7 @@
 SUFFIX=		${PORTVERSION:C/([0-9]+).*/\1/}
 USES=		compiler cpe gmake iconv libtool makeinfo perl5 tar:xz
 USE_BINUTILS=	yes
+BINARY_ALIAS=	strip=${LOCALBASE}/bin/strip
 USE_PERL5=	build
 SSP_UNSAFE=	yes
 CFLAGS:=	${CFLAGS:N-mretpoline}

svn commit: r339375 - head/sys/contrib/ck/src

2018-10-15 Thread Jonathan T. Looney
Author: jtl
Date: Tue Oct 16 02:30:13 2018
New Revision: 339375
URL: https://svnweb.freebsd.org/changeset/base/339375

Log:
  Import CK as of commit 5221ae2f3722a78c7fc41e47069ad94983d3bccb.
  This fixes two problems, one where epoch calls could occur before all
  the readers had exited the epoch section, and one where the epoch calls
  could be unnecessarily delayed.
  
  Approved by:  re (glebius)

Modified:
  head/sys/contrib/ck/src/ck_epoch.c
Directory Properties:
  head/sys/contrib/ck/   (props changed)

Modified: head/sys/contrib/ck/src/ck_epoch.c
==
--- head/sys/contrib/ck/src/ck_epoch.c  Tue Oct 16 00:50:00 2018
(r339374)
+++ head/sys/contrib/ck/src/ck_epoch.c  Tue Oct 16 02:30:13 2018
(r339375)
@@ -127,6 +127,14 @@
  */
 #define CK_EPOCH_GRACE 3U
 
+/*
+ * CK_EPOCH_LENGTH must be a power-of-2 (because (CK_EPOCH_LENGTH - 1) is used
+ * as a mask, and it must be at least 3 (see comments above).
+ */
+#if (CK_EPOCH_LENGTH < 3 || (CK_EPOCH_LENGTH & (CK_EPOCH_LENGTH - 1)) != 0)
+#error "CK_EPOCH_LENGTH must be a power of 2 and >= 3"
+#endif
+
 enum {
CK_EPOCH_STATE_USED = 0,
CK_EPOCH_STATE_FREE = 1
@@ -348,7 +356,7 @@ ck_epoch_scan(struct ck_epoch *global,
return NULL;
 }
 
-static void
+static unsigned int
 ck_epoch_dispatch(struct ck_epoch_record *record, unsigned int e, ck_stack_t 
*deferred)
 {
unsigned int epoch = e & (CK_EPOCH_LENGTH - 1);
@@ -366,6 +374,7 @@ ck_epoch_dispatch(struct ck_epoch_record *record, unsi
ck_stack_push_spnc(deferred, >stack_entry);
else
entry->function(entry);
+
i++;
}
 
@@ -381,7 +390,7 @@ ck_epoch_dispatch(struct ck_epoch_record *record, unsi
ck_pr_sub_uint(>n_pending, i);
}
 
-   return;
+   return i;
 }
 
 /*
@@ -560,16 +569,28 @@ ck_epoch_poll_deferred(struct ck_epoch_record *record,
unsigned int epoch;
struct ck_epoch_record *cr = NULL;
struct ck_epoch *global = record->global;
+   unsigned int n_dispatch;
 
epoch = ck_pr_load_uint(>epoch);
 
/* Serialize epoch snapshots with respect to global epoch. */
ck_pr_fence_memory();
+
+   /*
+* At this point, epoch is the current global epoch value.
+* There may or may not be active threads which observed epoch - 1.
+* (ck_epoch_scan() will tell us that). However, there should be
+* no active threads which observed epoch - 2.
+*
+* Note that checking epoch - 2 is necessary, as race conditions can
+* allow another thread to increment the global epoch before this
+* thread runs.
+*/
+   n_dispatch = ck_epoch_dispatch(record, epoch - 2, deferred);
+
cr = ck_epoch_scan(global, cr, epoch, );
-   if (cr != NULL) {
-   record->epoch = epoch;
-   return false;
-   }
+   if (cr != NULL)
+   return (n_dispatch > 0);
 
/* We are at a grace period if all threads are inactive. */
if (active == false) {
@@ -580,10 +601,17 @@ ck_epoch_poll_deferred(struct ck_epoch_record *record,
return true;
}
 
-   /* If an active thread exists, rely on epoch observation. */
+   /*
+* If an active thread exists, rely on epoch observation.
+*
+* All the active threads entered the epoch section during
+* the current epoch. Therefore, we can now run the handlers
+* for the immediately preceding epoch and attempt to
+* advance the epoch if it hasn't been already.
+*/
(void)ck_pr_cas_uint(>epoch, epoch, epoch + 1);
 
-   ck_epoch_dispatch(record, epoch + 1, deferred);
+   ck_epoch_dispatch(record, epoch - 1, deferred);
return true;
 }
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r339372 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2018-10-15 Thread Alexander Motin
Author: mav
Date: Mon Oct 15 21:59:24 2018
New Revision: 339372
URL: https://svnweb.freebsd.org/changeset/base/339372

Log:
  Skip VDEV_IO_DONE stage only for ZIO_TYPE_FREE.
  
  Device removal code uses zio_vdev_child_io() with ZIO_TYPE_NULL parent,
  that never happened before.  It confused FreeBSD-specific TRIM code,
  which does not use VDEV_IO_DONE for logical ZIO_TYPE_FREE ZIOs.  As
  result of that stage being skipped device removal ZIOs leaked references
  and memory that supposed to be freed by VDEV_IO_DONE, making it stuck.
  
  It is a quick patch rather then a nice fix, but hopefully we'll be able
  to drop it all together when alternative TRIM implementation finally get
  landed.
  
  PR:   228750, 229007
  Discussed with:   allanjude, avg, smh
  Approved by:  re (delphij)
  MFC after:5 days
  Sponsored by: iXsystems, Inc.

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c   Mon Oct 15 
21:35:57 2018(r339371)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c   Mon Oct 15 
21:59:24 2018(r339372)
@@ -1180,7 +1180,8 @@ zio_vdev_child_io(zio_t *pio, blkptr_t *bp, vdev_t *vd
}
 
/* Not all IO types require vdev io done stage e.g. free */
-   if (!(pio->io_pipeline & ZIO_STAGE_VDEV_IO_DONE))
+   if (type == ZIO_TYPE_FREE &&
+   !(pio->io_pipeline & ZIO_STAGE_VDEV_IO_DONE))
pipeline &= ~ZIO_STAGE_VDEV_IO_DONE;
 
if (vd->vdev_ops->vdev_op_leaf) {
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r339371 - in head/sys: compat/freebsd32 kern

2018-10-15 Thread Kyle Evans
Author: kevans
Date: Mon Oct 15 21:35:57 2018
New Revision: 339371
URL: https://svnweb.freebsd.org/changeset/base/339371

Log:
  Correct COMPAT* macro names in syscalls.master
  
  Both ^/sys/compat/freebsd32/syscalls.master and ^/sys/kern/syscalls.master
  cited "COMPAT[n] #ifdef" instead of "COMPAT_FREEBSD[n] #ifdef" in places.
  
  Approved by:  re (glebius)

Modified:
  head/sys/compat/freebsd32/syscalls.master
  head/sys/kern/syscalls.master

Modified: head/sys/compat/freebsd32/syscalls.master
==
--- head/sys/compat/freebsd32/syscalls.master   Mon Oct 15 20:20:57 2018
(r339370)
+++ head/sys/compat/freebsd32/syscalls.master   Mon Oct 15 21:35:57 2018
(r339371)
@@ -26,11 +26,11 @@
 ; types:
 ;  STD always included
 ;  COMPAT  included on COMPAT #ifdef
-;  COMPAT4 included on COMPAT4 #ifdef (FreeBSD 4 compat)
-;  COMPAT6 included on COMPAT6 #ifdef (FreeBSD 6 compat)
-;  COMPAT7 included on COMPAT7 #ifdef (FreeBSD 7 compat)
-;  COMPAT10 included on COMPAT10 #ifdef (FreeBSD 10 compat)
-;  COMPAT11 included on COMPAT11 #ifdef (FreeBSD 11 compat)
+;  COMPAT4 included on COMPAT_FREEBSD4 #ifdef (FreeBSD 4 compat)
+;  COMPAT6 included on COMPAT_FREEBSD6 #ifdef (FreeBSD 6 compat)
+;  COMPAT7 included on COMPAT_FREEBSD7 #ifdef (FreeBSD 7 compat)
+;  COMPAT10 included on COMPAT_FREEBSD10 #ifdef (FreeBSD 10 compat)
+;  COMPAT11 included on COMPAT_FREEBSD11 #ifdef (FreeBSD 11 compat)
 ;  OBSOL   obsolete, not included in system, only specifies name
 ;  UNIMPL  not implemented, placeholder only
 ;  NOSTD   implemented but as a lkm that can be statically

Modified: head/sys/kern/syscalls.master
==
--- head/sys/kern/syscalls.master   Mon Oct 15 20:20:57 2018
(r339370)
+++ head/sys/kern/syscalls.master   Mon Oct 15 21:35:57 2018
(r339371)
@@ -29,7 +29,7 @@
 ;  COMPAT6 included on COMPAT_FREEBSD6 #ifdef (FreeBSD 6 compat)
 ;  COMPAT7 included on COMPAT_FREEBSD7 #ifdef (FreeBSD 7 compat)
 ;  COMPAT10 included on COMPAT_FREEBSD10 #ifdef (FreeBSD 10 compat)
-;  COMPAT11 included on COMPAT11 #ifdef (FreeBSD 11 compat)
+;  COMPAT11 included on COMPAT_FREEBSD11 #ifdef (FreeBSD 11 compat)
 ;  OBSOL   obsolete, not included in system, only specifies name
 ;  UNIMPL  not implemented, placeholder only
 ;  NOSTD   implemented but as a lkm that can be statically
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r339370 - head/lib/libc/string

2018-10-15 Thread Gleb Smirnoff
Author: glebius
Date: Mon Oct 15 20:20:57 2018
New Revision: 339370
URL: https://svnweb.freebsd.org/changeset/base/339370

Log:
  Avoid OOB reads in memmem(3).
  
  commit 51bdcdc424bd7169c8cccdc2de7cad17f5ea0f70
  Author: Alexander Monakov 
  Date:   Fri Jun 30 00:35:33 2017 +0300
  
  fix OOB reads in Xbyte_memmem
  
  Reported by Leah Neukirchen.
  
  Reviewed by:  emaste
  Approved by:  re (kib)

Modified:
  head/lib/libc/string/memmem.c

Modified: head/lib/libc/string/memmem.c
==
--- head/lib/libc/string/memmem.c   Mon Oct 15 20:11:53 2018
(r339369)
+++ head/lib/libc/string/memmem.c   Mon Oct 15 20:20:57 2018
(r339370)
@@ -31,27 +31,27 @@ __FBSDID("$FreeBSD$");
 static char *twobyte_memmem(const unsigned char *h, size_t k, const unsigned 
char *n)
 {
uint16_t nw = n[0]<<8 | n[1], hw = h[0]<<8 | h[1];
-   for (h++, k--; k; k--, hw = hw<<8 | *++h)
-   if (hw == nw) return (char *)h-1;
-   return 0;
+   for (h+=2, k-=2; k; k--, hw = hw<<8 | *h++)
+   if (hw == nw) return (char *)h-2;
+   return hw == nw ? (char *)h-2 : 0;
 }
 
 static char *threebyte_memmem(const unsigned char *h, size_t k, const unsigned 
char *n)
 {
uint32_t nw = n[0]<<24 | n[1]<<16 | n[2]<<8;
uint32_t hw = h[0]<<24 | h[1]<<16 | h[2]<<8;
-   for (h+=2, k-=2; k; k--, hw = (hw|*++h)<<8)
-   if (hw == nw) return (char *)h-2;
-   return 0;
+   for (h+=3, k-=3; k; k--, hw = (hw|*h++)<<8)
+   if (hw == nw) return (char *)h-3;
+   return hw == nw ? (char *)h-3 : 0;
 }
 
 static char *fourbyte_memmem(const unsigned char *h, size_t k, const unsigned 
char *n)
 {
uint32_t nw = n[0]<<24 | n[1]<<16 | n[2]<<8 | n[3];
uint32_t hw = h[0]<<24 | h[1]<<16 | h[2]<<8 | h[3];
-   for (h+=3, k-=3; k; k--, hw = hw<<8 | *++h)
-   if (hw == nw) return (char *)h-3;
-   return 0;
+   for (h+=4, k-=4; k; k--, hw = hw<<8 | *h++)
+   if (hw == nw) return (char *)h-4;
+   return hw == nw ? (char *)h-4 : 0;
 }
 
 #define MAX(a,b) ((a)>(b)?(a):(b))
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2018-10-15 Thread Yuri Pankov
Author: yuripv
Date: Mon Oct 15 20:11:53 2018
New Revision: 339369
URL: https://svnweb.freebsd.org/changeset/base/339369

Log:
  pw: respect path specified using -V when writing pw.conf, and -C is not
  explicitly specified.  -V path is already used to determine which file
  to read default values from, so it's only logical to write them to the
  same file.
  
  PR:   231653
  Reviewed by:  eugen, bapt
  Approved by:  re (gjb), kib (mentor)
  Differential Revision:https://reviews.freebsd.org/D17566

Modified:
  head/usr.sbin/pw/pw.h
  head/usr.sbin/pw/pw_conf.c
  head/usr.sbin/pw/pw_utils.c

Modified: head/usr.sbin/pw/pw.h
==
--- head/usr.sbin/pw/pw.h   Mon Oct 15 19:48:36 2018(r339368)
+++ head/usr.sbin/pw/pw.h   Mon Oct 15 20:11:53 2018(r339369)
@@ -64,6 +64,7 @@ enum _which
 };
 
 #define_DEF_DIRMODE(S_IRWXU | S_IRWXG | S_IRWXO)
+#define_PW_CONF"pw.conf"
 #define _PATH_PW_CONF  "/etc/pw.conf"
 #define _UC_MAXLINE1024
 #define _UC_MAXSHELLS  32

Modified: head/usr.sbin/pw/pw_conf.c
==
--- head/usr.sbin/pw/pw_conf.c  Mon Oct 15 19:48:36 2018(r339368)
+++ head/usr.sbin/pw/pw_conf.c  Mon Oct 15 20:11:53 2018(r339369)
@@ -417,9 +417,13 @@ write_userconfig(struct userconf *cnf, const char *fil
int i, j;
struct sbuf *buf;
FILE   *fp;
+   charcfgfile[MAXPATHLEN];
 
-   if (file == NULL)
-   file = _PATH_PW_CONF;
+   if (file == NULL) {
+   snprintf(cfgfile, sizeof(cfgfile), "%s/" _PW_CONF,
+   conf.etcpath);
+   file = cfgfile;
+   }
 
if ((fd = open(file, O_CREAT|O_RDWR|O_TRUNC|O_EXLOCK, 0644)) == -1)
return (0);

Modified: head/usr.sbin/pw/pw_utils.c
==
--- head/usr.sbin/pw/pw_utils.c Mon Oct 15 19:48:36 2018(r339368)
+++ head/usr.sbin/pw/pw_utils.c Mon Oct 15 20:11:53 2018(r339369)
@@ -71,7 +71,7 @@ get_userconfig(const char *config)
 
if (config != NULL)
return (read_userconfig(config));
-   snprintf(defaultcfg, sizeof(defaultcfg), "%s/pw.conf", conf.etcpath);
+   snprintf(defaultcfg, sizeof(defaultcfg), "%s/" _PW_CONF, conf.etcpath);
return (read_userconfig(defaultcfg));
 }
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r339349 - in head/sys/amd64: amd64 include

2018-10-15 Thread Mateusz Guzik
On 10/15/18, Gleb Smirnoff  wrote:
>   Mateusz,
>
> On Sat, Oct 13, 2018 at 09:18:32PM +, Mateusz Guzik wrote:
> M>   Return is almost always 0. The change replaces 3 branches with 1 in the
> common
> M>   case.
>
> This isn't true. For a webserver working with blocking sockets
> returning EAGAIN for a very large number of syscalls is normal.
>
> I just dtraced on a random Netflix server and in our case we
> get 12% of syscalls with non zero error. But our clients are
> special, they request data in small chunks. I believe a regular
> web server that serves mostly open ended requests will have a
> greater ratio of non-zero returns, up to 50%.
>
> Here is script:
>
> #!/usr/sbin/dtrace -s
>
> fbt::cpu_set_syscall_retval:entry
> {
> @[args[1]] = count();
> }
>
> I would be interested if anybody reports results on a busy
> web server running nginx.
>
> So, I doubt that using __predict_true() is an optimisation here.

This should be a win even for your somewhat degenerate case.

Code handling all cases is disjoint - regardless of my change it has
to jump over something.

The previous code tests 3 conditions. The case o errno EAGAIN or
similar is handled by the last. So returning zero requires 3 tests
and 0 jumps. Returning EAGAIN requires 3 tests and 1 jump.

With the committed patch returning zero requires 1 test and 0
jumps. Returning EAGAIN requires 3 tests and 2 jumps.

Given how much more frequent returning zero is, I think it's a net
win. However, the code can be further modified to just get rid of the
second jump.

Either way, the entire syscall path is extremely pessimized.

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


svn commit: r339368 - head/lib/libc/net

2018-10-15 Thread Edward Tomasz Napierala
Author: trasz
Date: Mon Oct 15 19:48:36 2018
New Revision: 339368
URL: https://svnweb.freebsd.org/changeset/base/339368

Log:
  Prevent flex(1) from generating calls to isatty(3) - and, in turn,
  TIOCGETA ioctls - when parsing nsswitch.conf(5).
  
  Reviewed by:  imp, markj
  Approved by:  re (gjb)
  MFC after:2 weeks
  Sponsored by: DARPA, AFRL
  Differential Revision:https://reviews.freebsd.org/D17564

Modified:
  head/lib/libc/net/nslexer.l

Modified: head/lib/libc/net/nslexer.l
==
--- head/lib/libc/net/nslexer.l Mon Oct 15 18:56:54 2018(r339367)
+++ head/lib/libc/net/nslexer.l Mon Oct 15 19:48:36 2018(r339368)
@@ -50,6 +50,7 @@ static char *rcsid = 
 
 %}
 
+%option never-interactive
 %option noinput
 %option nounput
 %option yylineno
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r339349 - in head/sys/amd64: amd64 include

2018-10-15 Thread Gleb Smirnoff
  Mateusz,

On Sat, Oct 13, 2018 at 09:18:32PM +, Mateusz Guzik wrote:
M>   Return is almost always 0. The change replaces 3 branches with 1 in the 
common
M>   case.

This isn't true. For a webserver working with blocking sockets
returning EAGAIN for a very large number of syscalls is normal.

I just dtraced on a random Netflix server and in our case we
get 12% of syscalls with non zero error. But our clients are
special, they request data in small chunks. I believe a regular
web server that serves mostly open ended requests will have a
greater ratio of non-zero returns, up to 50%.

Here is script:

#!/usr/sbin/dtrace -s

fbt::cpu_set_syscall_retval:entry
{
@[args[1]] = count();
}

I would be interested if anybody reports results on a busy
web server running nginx.

So, I doubt that using __predict_true() is an optimisation here.

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


svn commit: r339367 - in head/sys: cddl/dev/fbt/riscv riscv/include riscv/riscv

2018-10-15 Thread John Baldwin
Author: jhb
Date: Mon Oct 15 18:56:54 2018
New Revision: 339367
URL: https://svnweb.freebsd.org/changeset/base/339367

Log:
  Various fixes for TLB management on RISC-V.
  
  - Remove the arm64-specific cpu_*cache* and cpu_tlb_flush* functions.
Instead, add RISC-V specific inline functions in cpufunc.h for the
fence.i and sfence.vma instructions.
  - Catch up to changes in the arm64 pmap and remove all the cpu_dcache_*
calls, pmap_is_current, pmap_l3_valid_cacheable, and PTE_NEXT bits from
pmap.
  - Remove references to the unimplemented riscv_setttb().
  - Remove unused cpu_nullop.
  - Add a link to the SBI doc to sbi.h.
  - Add support for a 4th argument in SBI calls.  It's not documented but
it seems implied for the asid argument to SBI_REMOVE_SFENCE_VMA_ASID.
  - Pass the arguments from sbi_remote_sfence*() to the SEE.  BBL ignores
them so this is just cosmetic.
  - Flush icaches on other CPUs when they resume from kdb in case the
debugger wrote any breakpoints while the CPUs were paused in the IPI_STOP
handler.
  - Add SMP vs UP versions of pmap_invalidate_* similar to amd64.  The
UP versions just use simple fences.  The SMP versions use the
sbi_remove_sfence*() functions to perform TLB shootdowns.  Since we
don't have a valid pm_active field in the riscv pmap, just IPI all
CPUs for all invalidations for now.
  - Remove an extraneous TLB flush from the end of pmap_bootstrap().
  - Don't do a TLB flush when writing new mappings in pmap_enter(), only if
modifying an existing mapping.  Note that for COW faults a TLB flush is
only performed after explicitly clearing the old mapping as is done in
other pmaps.
  - Sync the i-cache on all harts before updating the PTE for executable
mappings in pmap_enter and pmap_enter_quick.  Previously the i-cache was
only sync'd after updating the PTE in pmap_enter.
  - Use sbi_remote_fence() instead of smp_rendezvous in pmap_sync_icache().
  
  Reviewed by:  markj
  Approved by:  re (gjb, kib)
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D17414

Modified:
  head/sys/cddl/dev/fbt/riscv/fbt_isa.c
  head/sys/riscv/include/cpufunc.h
  head/sys/riscv/include/kdb.h
  head/sys/riscv/include/sbi.h
  head/sys/riscv/riscv/cpufunc_asm.S
  head/sys/riscv/riscv/db_interface.c
  head/sys/riscv/riscv/mp_machdep.c
  head/sys/riscv/riscv/pmap.c

Modified: head/sys/cddl/dev/fbt/riscv/fbt_isa.c
==
--- head/sys/cddl/dev/fbt/riscv/fbt_isa.c   Mon Oct 15 18:39:33 2018
(r339366)
+++ head/sys/cddl/dev/fbt/riscv/fbt_isa.c   Mon Oct 15 18:56:54 2018
(r339367)
@@ -78,11 +78,11 @@ fbt_patch_tracepoint(fbt_probe_t *fbt, fbt_patchval_t 
switch(fbt->fbtp_patchval) {
case FBT_C_PATCHVAL:
*(uint16_t *)fbt->fbtp_patchpoint = (uint16_t)val;
-   cpu_icache_sync_range((vm_offset_t)fbt->fbtp_patchpoint, 2);
+   fence_i();
break;
case FBT_PATCHVAL:
*fbt->fbtp_patchpoint = val;
-   cpu_icache_sync_range((vm_offset_t)fbt->fbtp_patchpoint, 4);
+   fence_i();
break;
};
 }

Modified: head/sys/riscv/include/cpufunc.h
==
--- head/sys/riscv/include/cpufunc.hMon Oct 15 18:39:33 2018
(r339366)
+++ head/sys/riscv/include/cpufunc.hMon Oct 15 18:56:54 2018
(r339367)
@@ -81,29 +81,32 @@ intr_enable(void)
);
 }
 
-#definecpu_nullop()riscv_nullop()
-#definecpufunc_nullop()riscv_nullop()
-#definecpu_setttb(a)   riscv_setttb(a)
+/* NB: fence() is defined as a macro in . */
 
-#definecpu_tlb_flushID()   riscv_tlb_flushID()
-#definecpu_tlb_flushID_SE(e)   riscv_tlb_flushID_SE(e)
+static __inline void
+fence_i(void)
+{
 
-#definecpu_dcache_wbinv_range(a, s)riscv_dcache_wbinv_range((a), 
(s))
-#definecpu_dcache_inv_range(a, s)  riscv_dcache_inv_range((a), (s))
-#definecpu_dcache_wb_range(a, s)   riscv_dcache_wb_range((a), (s))
+   __asm __volatile("fence.i" ::: "memory");
+}
 
-#definecpu_idcache_wbinv_range(a, s)   riscv_idcache_wbinv_range((a), 
(s))
-#definecpu_icache_sync_range(a, s) riscv_icache_sync_range((a), 
(s))
+static __inline void
+sfence_vma(void)
+{
 
+   __asm __volatile("sfence.vma" ::: "memory");
+}
+
+static __inline void
+sfence_vma_page(uintptr_t addr)
+{
+
+   __asm __volatile("sfence.vma %0" :: "r" (addr) : "memory");
+}
+
+#definecpufunc_nullop()riscv_nullop()
+
 void riscv_nullop(void);
-void riscv_setttb(vm_offset_t);
-void riscv_tlb_flushID(void);
-void riscv_tlb_flushID_SE(vm_offset_t);
-void riscv_icache_sync_range(vm_offset_t, vm_size_t);
-void 

svn commit: r339366 - head/sys/dev/bxe

2018-10-15 Thread David C Somayajulu
Author: davidcs
Date: Mon Oct 15 18:39:33 2018
New Revision: 339366
URL: https://svnweb.freebsd.org/changeset/base/339366

Log:
  Add support for Error Recovery
  
  Submitted by:vaishali.kulka...@cavium.com
  Approved by:re(kib)
  MFC after:5 days

Modified:
  head/sys/dev/bxe/bxe.c
  head/sys/dev/bxe/bxe.h
  head/sys/dev/bxe/bxe_stats.c

Modified: head/sys/dev/bxe/bxe.c
==
--- head/sys/dev/bxe/bxe.c  Mon Oct 15 18:28:34 2018(r339365)
+++ head/sys/dev/bxe/bxe.c  Mon Oct 15 18:39:33 2018(r339366)
@@ -202,6 +202,7 @@ static int bxe_attach(device_t);
 static int bxe_detach(device_t);
 static int bxe_shutdown(device_t);
 
+
 /*
  * FreeBSD KLD module/device interface event handler method.
  */
@@ -705,6 +706,9 @@ static voidbxe_interrupt_detach(struct bxe_softc *
 static voidbxe_set_rx_mode(struct bxe_softc *sc);
 static int bxe_init_locked(struct bxe_softc *sc);
 static int bxe_stop_locked(struct bxe_softc *sc);
+static voidbxe_sp_err_timeout_task(void *arg, int pending);
+void   bxe_parity_recover(struct bxe_softc *sc);
+void   bxe_handle_error(struct bxe_softc *sc);
 static __noinline int bxe_nic_load(struct bxe_softc *sc,
int  load_mode);
 static __noinline int bxe_nic_unload(struct bxe_softc *sc,
@@ -3486,16 +3490,12 @@ bxe_watchdog(struct bxe_softc*sc,
 }
 
 BLOGE(sc, "TX watchdog timeout on fp[%02d], resetting!\n", fp->index);
-if(sc->trigger_grcdump) {
- /* taking grcdump */
- bxe_grc_dump(sc);
-}
 
 BXE_FP_TX_UNLOCK(fp);
+BXE_SET_ERROR_BIT(sc, BXE_ERR_TXQ_STUCK);
+taskqueue_enqueue_timeout(taskqueue_thread,
+>sp_err_timeout_task, hz/10);
 
-atomic_store_rel_long(>chip_tq_flags, CHIP_TQ_REINIT);
-taskqueue_enqueue(sc->chip_tq, >chip_tq_task);
-
 return (-1);
 }
 
@@ -4250,6 +4250,7 @@ bxe_nic_unload(struct bxe_softc *sc,
 struct bxe_fastpath *fp;
 
 fp = >fp[i];
+   fp->watchdog_timer = 0;
 BXE_FP_TX_LOCK(fp);
 BXE_FP_TX_UNLOCK(fp);
 }
@@ -4265,20 +4266,22 @@ bxe_nic_unload(struct bxe_softc *sc,
 
 if (IS_PF(sc) && sc->recovery_state != BXE_RECOVERY_DONE &&
 (sc->state == BXE_STATE_CLOSED || sc->state == BXE_STATE_ERROR)) {
-/*
- * We can get here if the driver has been unloaded
- * during parity error recovery and is either waiting for a
- * leader to complete or for other functions to unload and
- * then ifconfig down has been issued. In this case we want to
- * unload and let other functions to complete a recovery
- * process.
- */
-sc->recovery_state = BXE_RECOVERY_DONE;
-sc->is_leader = 0;
-bxe_release_leader_lock(sc);
-mb();
 
-BLOGD(sc, DBG_LOAD, "Releasing a leadership...\n");
+   if(CHIP_PORT_MODE(sc) == CHIP_4_PORT_MODE) {
+/*
+ * We can get here if the driver has been unloaded
+ * during parity error recovery and is either waiting for a
+ * leader to complete or for other functions to unload and
+ * then ifconfig down has been issued. In this case we want to
+ * unload and let other functions to complete a recovery
+ * process.
+ */
+sc->recovery_state = BXE_RECOVERY_DONE;
+sc->is_leader = 0;
+bxe_release_leader_lock(sc);
+mb();
+BLOGD(sc, DBG_LOAD, "Releasing a leadership...\n");
+   }
 BLOGE(sc, "Can't unload in closed or error state recover_state 0x%x"
 " state = 0x%x\n", sc->recovery_state, sc->state);
 return (-1);
@@ -7570,6 +7573,10 @@ bxe_parity_attn(struct bxe_softc *sc,
 if (print)
 BLOGI(sc, "\n");
 
+   if( *global == TRUE ) {
+BXE_SET_ERROR_BIT(sc, BXE_ERR_GLOBAL);
+}
+
 return (TRUE);
 }
 
@@ -7584,6 +7591,9 @@ bxe_chk_parity_attn(struct bxe_softc *sc,
 struct attn_route attn = { {0} };
 int port = SC_PORT(sc);
 
+if(sc->state != BXE_STATE_OPEN)
+return FALSE;
+
 attn.sig[0] = REG_RD(sc, MISC_REG_AEU_AFTER_INVERT_1_FUNC_0 + port*4);
 attn.sig[1] = REG_RD(sc, MISC_REG_AEU_AFTER_INVERT_2_FUNC_0 + port*4);
 attn.sig[2] = REG_RD(sc, MISC_REG_AEU_AFTER_INVERT_3_FUNC_0 + port*4);
@@ -7610,10 +7620,12 @@ bxe_attn_int_deasserted4(struct bxe_softc *sc,
  uint32_t attn)
 {
 uint32_t val;
+boolean_t err_flg = FALSE;
 
 if (attn & AEU_INPUTS_ATTN_BITS_PGLUE_HW_INTERRUPT) {
 val = REG_RD(sc, PGLUE_B_REG_PGLUE_B_INT_STS_CLR);
 BLOGE(sc, "PGLUE hw attention 0x%08x\n", val);
+err_flg = TRUE;
 if (val & PGLUE_B_PGLUE_B_INT_STS_REG_ADDRESS_ERROR)
 BLOGE(sc, "PGLUE_B_PGLUE_B_INT_STS_REG_ADDRESS_ERROR\n");
 if (val & 

svn commit: r339365 - head/share/man/man4

2018-10-15 Thread Mark Johnston
Author: markj
Date: Mon Oct 15 18:28:34 2018
New Revision: 339365
URL: https://svnweb.freebsd.org/changeset/base/339365

Log:
  Typo.
  
  Submitted by: Fred Schlechter 
  Approved by:  re (gjb)
  MFC after:3 days

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

Modified: head/share/man/man4/dtrace_ip.4
==
--- head/share/man/man4/dtrace_ip.4 Mon Oct 15 18:12:25 2018
(r339364)
+++ head/share/man/man4/dtrace_ip.4 Mon Oct 15 18:28:34 2018
(r339365)
@@ -235,7 +235,7 @@ This script will print some details of each IP packet 
 by the kernel:
 .Bd -literal -offset indent
 #pragma D option quiet
-#pramga D option switchrate=10Hz
+#pragma D option switchrate=10Hz
 
 dtrace:::BEGIN
 {
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r339364 - head/sys/amd64/vmm/amd

2018-10-15 Thread John Baldwin
Author: jhb
Date: Mon Oct 15 18:12:25 2018
New Revision: 339364
URL: https://svnweb.freebsd.org/changeset/base/339364

Log:
  Reload the LDT selector after an AMD-v #VMEXIT.
  
  cpu_switch() always reloads the LDT, so this can only affect the
  hypervisor process itself.  Fix this by explicitly reloading the host
  LDT selector after each #VMEXIT.  The stock bhyve process on FreeBSD
  never uses a custom LDT, so this change is cosmetic.
  
  Reviewed by:  kib
  Tested by:Mike Tancsa 
  Approved by:  re (gjb)
  MFC after:2 weeks

Modified:
  head/sys/amd64/vmm/amd/svm.c

Modified: head/sys/amd64/vmm/amd/svm.c
==
--- head/sys/amd64/vmm/amd/svm.cMon Oct 15 17:50:02 2018
(r339363)
+++ head/sys/amd64/vmm/amd/svm.cMon Oct 15 18:12:25 2018
(r339364)
@@ -1940,6 +1940,7 @@ svm_vmrun(void *arg, int vcpu, register_t rip, pmap_t 
struct vm *vm;
uint64_t vmcb_pa;
int handled;
+   uint16_t ldt_sel;
 
svm_sc = arg;
vm = svm_sc->vm;
@@ -2024,6 +2025,15 @@ svm_vmrun(void *arg, int vcpu, register_t rip, pmap_t 
break;
}
 
+   /*
+* #VMEXIT resumes the host with the guest LDTR, so
+* save the current LDT selector so it can be restored
+* after an exit.  The userspace hypervisor probably
+* doesn't use a LDT, but save and restore it to be
+* safe.
+*/
+   ldt_sel = sldt();
+
svm_inj_interrupts(svm_sc, vcpu, vlapic);
 
/* Activate the nested pmap on 'curcpu' */
@@ -2053,6 +2063,9 @@ svm_vmrun(void *arg, int vcpu, register_t rip, pmap_t 
 * to be restored explicitly.
 */
restore_host_tss();
+
+   /* Restore host LDTR. */
+   lldt(ldt_sel);
 
/* #VMEXIT disables interrupts so re-enable them here. */ 
enable_gintr();
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r339363 - head/lib/libc/net

2018-10-15 Thread Edward Tomasz Napierala
Author: trasz
Date: Mon Oct 15 17:50:02 2018
New Revision: 339363
URL: https://svnweb.freebsd.org/changeset/base/339363

Log:
  Don't call dlopen(3) for built-in NSS types - "cache", "compat",
  "dns", "files", "db", and "nis". It saves some path lookups during
  binary startup.
  
  Reviewed by:  markj
  Approved by:  re (gjb, kib)
  MFC after:2 weeks
  Sponsored by: DARPA, AFRL
  Differential Revision:https://reviews.freebsd.org/D17557

Modified:
  head/lib/libc/net/nsdispatch.3
  head/lib/libc/net/nsdispatch.c

Modified: head/lib/libc/net/nsdispatch.3
==
--- head/lib/libc/net/nsdispatch.3  Mon Oct 15 17:23:41 2018
(r339362)
+++ head/lib/libc/net/nsdispatch.3  Mon Oct 15 17:50:02 2018
(r339363)
@@ -32,7 +32,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd April 4, 2010
+.Dd October 15, 2018
 .Dt NSDISPATCH 3
 .Os
 .Sh NAME
@@ -112,10 +112,7 @@ which case they are selected using the
 and
 .Fa method_name
 arguments along with the configured source.
-(The methods supplied via
-.Fa dtab
-take priority over those implemented in NSS modules in the event
-of a conflict.)
+Modules must use source names different from the built-in ones.
 .Pp
 .Va defaults
 contains a list of default sources to try if

Modified: head/lib/libc/net/nsdispatch.c
==
--- head/lib/libc/net/nsdispatch.c  Mon Oct 15 17:23:41 2018
(r339362)
+++ head/lib/libc/net/nsdispatch.c  Mon Oct 15 17:50:02 2018
(r339363)
@@ -486,9 +486,19 @@ nss_load_module(const char *source, nss_module_registe
 */
mod.handle = nss_builtin_handle;
fn = reg_fn;
-   } else if (!is_dynamic())
+   } else if (!is_dynamic()) {
goto fin;
-   else {
+   } else if (strcmp(source, NSSRC_CACHE) == 0 ||
+   strcmp(source, NSSRC_COMPAT) == 0 ||
+   strcmp(source, NSSRC_DB) == 0 ||
+   strcmp(source, NSSRC_DNS) == 0 ||
+   strcmp(source, NSSRC_FILES) == 0 ||
+   strcmp(source, NSSRC_NIS) == 0) {
+   /*
+* Avoid calling dlopen(3) for built-in modules.
+*/
+   goto fin;
+   } else {
if (snprintf(buf, sizeof(buf), "nss_%s.so.%d", mod.name,
NSS_MODULE_INTERFACE_VERSION) >= (int)sizeof(buf))
goto fin;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r339362 - in head/sys: conf dev/ixl modules/iavf

2018-10-15 Thread Eric Joyner
Author: erj
Date: Mon Oct 15 17:23:41 2018
New Revision: 339362
URL: https://svnweb.freebsd.org/changeset/base/339362

Log:
  iavf(4): Finish rename/rebrand internally
  
  Rename functions and variables from ixlv to iavf to match the
  user-facing name change. There shouldn't be any functional changes
  with this change, but this may help with browsing the source code
  and reducing diffs in the future.
  
  Submitted by:   kbowling@
  Reviewed by:erj@, sbruno@
  Approved by:  re (gjb@)
  Differential Revision:  https://reviews.freebsd.org/D17544

Added:
  head/sys/dev/ixl/iavf.h
 - copied, changed from r339361, head/sys/dev/ixl/ixlv.h
  head/sys/dev/ixl/iavf_vc.c
 - copied, changed from r339361, head/sys/dev/ixl/ixlvc.c
  head/sys/dev/ixl/if_iavf.c
 - copied, changed from r339361, head/sys/dev/ixl/if_ixlv.c
Deleted:
  head/sys/dev/ixl/if_ixlv.c
  head/sys/dev/ixl/ixlv.h
  head/sys/dev/ixl/ixlvc.c
Modified:
  head/sys/conf/files.amd64
  head/sys/dev/ixl/ixl.h
  head/sys/dev/ixl/ixl_debug.h
  head/sys/dev/ixl/ixl_pf_iov.c
  head/sys/modules/iavf/Makefile

Modified: head/sys/conf/files.amd64
==
--- head/sys/conf/files.amd64   Mon Oct 15 17:16:47 2018(r339361)
+++ head/sys/conf/files.amd64   Mon Oct 15 17:23:41 2018(r339362)
@@ -271,9 +271,9 @@ dev/ixl/ixl_pf_iov.coptionalixl pci 
 pci_iov \
compile-with "${NORMAL_C} -I$S/dev/ixl"
 dev/ixl/ixl_pf_i2c.c   optionalixl pci \
compile-with "${NORMAL_C} -I$S/dev/ixl"
-dev/ixl/if_ixlv.c  optionaliavf pci \
+dev/ixl/if_iavf.c  optionaliavf pci \
compile-with "${NORMAL_C} -I$S/dev/ixl"
-dev/ixl/ixlvc.coptionaliavf pci \
+dev/ixl/iavf_vc.c  optionaliavf pci \
compile-with "${NORMAL_C} -I$S/dev/ixl"
 dev/ixl/ixl_txrx.c optionalixl pci | iavf pci \
compile-with "${NORMAL_C} -I$S/dev/ixl"

Copied and modified: head/sys/dev/ixl/iavf.h (from r339361, 
head/sys/dev/ixl/ixlv.h)
==
--- head/sys/dev/ixl/ixlv.h Mon Oct 15 17:16:47 2018(r339361, copy 
source)
+++ head/sys/dev/ixl/iavf.h Mon Oct 15 17:23:41 2018(r339362)
@@ -33,40 +33,40 @@
 /*$FreeBSD$*/
 
 
-#ifndef _IXLV_H_
-#define _IXLV_H_
+#ifndef _IAVF_H_
+#define _IAVF_H_
 
 #include "ixl.h"
 
-#define IXLV_AQ_MAX_ERR200
-#define IXLV_MAX_FILTERS   128
-#define IXLV_MAX_QUEUES16
-#define IXLV_AQ_TIMEOUT(1 * hz)
+#define IAVF_AQ_MAX_ERR200
+#define IAVF_MAX_FILTERS   128
+#define IAVF_MAX_QUEUES16
+#define IAVF_AQ_TIMEOUT(1 * hz)
 
-#define IXLV_FLAG_AQ_ENABLE_QUEUES(u32)(1 << 0)
-#define IXLV_FLAG_AQ_DISABLE_QUEUES   (u32)(1 << 1)
-#define IXLV_FLAG_AQ_ADD_MAC_FILTER   (u32)(1 << 2)
-#define IXLV_FLAG_AQ_ADD_VLAN_FILTER  (u32)(1 << 3)
-#define IXLV_FLAG_AQ_DEL_MAC_FILTER   (u32)(1 << 4)
-#define IXLV_FLAG_AQ_DEL_VLAN_FILTER  (u32)(1 << 5)
-#define IXLV_FLAG_AQ_CONFIGURE_QUEUES (u32)(1 << 6)
-#define IXLV_FLAG_AQ_MAP_VECTORS  (u32)(1 << 7)
-#define IXLV_FLAG_AQ_HANDLE_RESET (u32)(1 << 8)
-#define IXLV_FLAG_AQ_CONFIGURE_PROMISC(u32)(1 << 9)
-#define IXLV_FLAG_AQ_GET_STATS(u32)(1 << 10)
-#define IXLV_FLAG_AQ_CONFIG_RSS_KEY   (u32)(1 << 11)
-#define IXLV_FLAG_AQ_SET_RSS_HENA (u32)(1 << 12)
-#define IXLV_FLAG_AQ_GET_RSS_HENA_CAPS(u32)(1 << 13)
-#define IXLV_FLAG_AQ_CONFIG_RSS_LUT   (u32)(1 << 14)
+#define IAVF_FLAG_AQ_ENABLE_QUEUES(u32)(1 << 0)
+#define IAVF_FLAG_AQ_DISABLE_QUEUES   (u32)(1 << 1)
+#define IAVF_FLAG_AQ_ADD_MAC_FILTER   (u32)(1 << 2)
+#define IAVF_FLAG_AQ_ADD_VLAN_FILTER  (u32)(1 << 3)
+#define IAVF_FLAG_AQ_DEL_MAC_FILTER   (u32)(1 << 4)
+#define IAVF_FLAG_AQ_DEL_VLAN_FILTER  (u32)(1 << 5)
+#define IAVF_FLAG_AQ_CONFIGURE_QUEUES (u32)(1 << 6)
+#define IAVF_FLAG_AQ_MAP_VECTORS  (u32)(1 << 7)
+#define IAVF_FLAG_AQ_HANDLE_RESET (u32)(1 << 8)
+#define IAVF_FLAG_AQ_CONFIGURE_PROMISC(u32)(1 << 9)
+#define IAVF_FLAG_AQ_GET_STATS(u32)(1 << 10)
+#define IAVF_FLAG_AQ_CONFIG_RSS_KEY   (u32)(1 << 11)
+#define IAVF_FLAG_AQ_SET_RSS_HENA (u32)(1 << 12)
+#define IAVF_FLAG_AQ_GET_RSS_HENA_CAPS(u32)(1 << 13)
+#define IAVF_FLAG_AQ_CONFIG_RSS_LUT   (u32)(1 << 14)
 
 /* printf %b flag args */
-#define IXLV_FLAGS \
+#define IAVF_FLAGS \
 "\20\1ENABLE_QUEUES\2DISABLE_QUEUES\3ADD_MAC_FILTER" \
 "\4ADD_VLAN_FILTER\5DEL_MAC_FILTER\6DEL_VLAN_FILTER" \
 "\7CONFIGURE_QUEUES\10MAP_VECTORS\11HANDLE_RESET" \
 

svn commit: r339361 - head

2018-10-15 Thread Glen Barber
Author: gjb
Date: Mon Oct 15 17:16:47 2018
New Revision: 339361
URL: https://svnweb.freebsd.org/changeset/base/339361

Log:
  Remove stale libcasper(3) shared libraries following the
  OpenSSL 1.1.1 update.
  
  Reported by:  des
  Approved by:  re (kib)
  Sponsored by: The FreeBSD Foundation

Modified:
  head/ObsoleteFiles.inc

Modified: head/ObsoleteFiles.inc
==
--- head/ObsoleteFiles.inc  Mon Oct 15 16:43:07 2018(r339360)
+++ head/ObsoleteFiles.inc  Mon Oct 15 17:16:47 2018(r339361)
@@ -38,6 +38,19 @@
 #   xargs -n1 | sort | uniq -d;
 # done
 
+# 20181015: Stale libcasper(3) files following 20181009: OpenSSL 1.1.1
+OLD_LIBS+=lib/casper/libcap_sysctl.so.0
+OLD_LIBS+=lib/casper/libcap_grp.so.0
+OLD_LIBS+=lib/casper/libcap_pwd.so.0
+OLD_LIBS+=lib/casper/libcap_random.so.0
+OLD_LIBS+=lib/casper/libcap_dns.so.0
+OLD_LIBS+=lib/casper/libcap_syslog.so.0
+OLD_LIBS+=usr/lib32/libcap_sysctl.so.0
+OLD_LIBS+=usr/lib32/libcap_grp.so.0
+OLD_LIBS+=usr/lib32/libcap_pwd.so.0
+OLD_LIBS+=usr/lib32/libcap_random.so.0
+OLD_LIBS+=usr/lib32/libcap_dns.so.0
+OLD_LIBS+=usr/lib32/libcap_syslog.so.0
 # 20181009: OpenSSL 1.1.1
 OLD_FILES+=usr/include/openssl/des_old.h
 OLD_FILES+=usr/include/openssl/dso.h
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r339360 - head/sys/powerpc/powerpc

2018-10-15 Thread Leandro Lupori
Author: luporl
Date: Mon Oct 15 16:43:07 2018
New Revision: 339360
URL: https://svnweb.freebsd.org/changeset/base/339360

Log:
  Initialize SPRG0 before its first possible use
  
  At early boot, PCPU_GET(), that obtains a pointer from SPRG0, was being
  used with SPRG0 not yet initialized. If it pointed to an invalid
  address, the machine would hang.
  
  Approved by:  re(gjb), jhibbits(mentor)

Modified:
  head/sys/powerpc/powerpc/machdep.c

Modified: head/sys/powerpc/powerpc/machdep.c
==
--- head/sys/powerpc/powerpc/machdep.c  Mon Oct 15 10:50:04 2018
(r339359)
+++ head/sys/powerpc/powerpc/machdep.c  Mon Oct 15 16:43:07 2018
(r339360)
@@ -383,12 +383,12 @@ powerpc_init(vm_offset_t fdt, vm_offset_t toc, vm_offs
if (platform_smp_get_bsp() != 0)
bsp.cr_cpuid = 0;
pc = &__pcpu[bsp.cr_cpuid];
+   __asm __volatile("mtsprg 0, %0" :: "r"(pc));
pcpu_init(pc, bsp.cr_cpuid, sizeof(struct pcpu));
pc->pc_curthread = 
thread0.td_oncpu = bsp.cr_cpuid;
pc->pc_cpuid = bsp.cr_cpuid;
pc->pc_hwref = bsp.cr_hwref;
-   __asm __volatile("mtsprg 0, %0" :: "r"(pc));
 
/*
 * Init KDB
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r339350 - head/contrib/elftoolchain/elfcopy

2018-10-15 Thread Ed Maste
On Mon, 15 Oct 2018 at 07:13, Ed Maste  wrote:
>
> Hi Antoine, did you bisect to this rev or does it just look like the
> most probable candidate? Can you copy a pair of differing .o files
> (say, gcc/cc1plus-checksum.o) from the work dir to freefall?

Antoine provided a tarball of the work dir to me, and pointed out that
the *-checksum.o files are not interesting - they are warnings only
and are present prior to the identified change.

Comparing one of the other differing files, e.g.
stage{2,3}-gcc/expmed.o, demonstrates the problem. Gcc's build
machinery is reasonably obfuscated so I'm not sure of the exact set of
operations, but I can infer that the stage2/stage3 comparison is
running strip on the object files and then comparing the result. Gcc
is encountering this part of my strip/objcopy change:

> Stripping binaries with relocations
> referencing removed symbols was already broken, and after this change
> may still be broken in a different way.

Stripping symbols and relocations from an object file is not a
particularly useful operation, since the object then can't be linked
or otherwise used. But it seems Gcc's stage comparison relies on this.
I did try running "strip --strip-debug" on stage{2,3}-gcc/expmed.o (a
reasonable operation on object files) and that produced identical
output.

It may well be that a further change to ELF Tool Chain's strip is
warranted, but I suspect the most straightforward and reliable fix
here will be to just have gcc use GNU strip.
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r339350 - head/contrib/elftoolchain/elfcopy

2018-10-15 Thread Ed Maste
On Mon, 15 Oct 2018 at 05:43, Antoine Brodin  wrote:
>
> On Sat, Oct 13, 2018 at 11:26 PM Ed Maste  wrote:
> >
> > Author: emaste
> > Date: Sat Oct 13 21:26:07 2018
> > New Revision: 339350
> > URL: https://svnweb.freebsd.org/changeset/base/339350
> >
> > Log:
> >   elfcopy: delete filter_reloc, it is broken and unnecessary
> >
> Hi,
>
> This commit broke lang/gcc* :

Hi Antoine, did you bisect to this rev or does it just look like the
most probable candidate? Can you copy a pair of differing .o files
(say, gcc/cc1plus-checksum.o) from the work dir to freefall?
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r339358 - head/sys/net

2018-10-15 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Oct 15 10:29:29 2018
New Revision: 339358
URL: https://svnweb.freebsd.org/changeset/base/339358

Log:
  Fix deadlock when destroying VLANs.
  
  Synchronizing the epoch before freeing the multicast addresses while holding
  the VLAN_XLOCK() might lead to a deadlock. Use deferred freeing of the VLAN
  multicast addresses to resolve deadlock. Backtrace:
  
  Thread1:
  epoch_block_handler_preempt()
  ck_epoch_synchronize_wait()
  epoch_wait_preempt()
  vlan_setmulti()
  vlan_ioctl()
  in6m_release_task()
  gtaskqueue_run_locked()
  gtaskqueue_thread_loop()
  fork_exit()
  fork_trampoline()
  
  Thread2:
  sleepq_switch()
  sleepq_wait()
  _sx_xlock_hard()
  _sx_xlock()
  in6_leavegroup()
  in6_purgeaddr()
  if_purgeaddrs()
  if_detach_internal()
  if_detach()
  vlan_clone_destroy()
  if_clone_destroyif()
  if_clone_destroy()
  ifioctl()
  kern_ioctl()
  sys_ioctl()
  amd64_syscall()
  fast_syscall_common()
  syscall()
  
  Differential revision:https://reviews.freebsd.org/D17496
  Reviewed by:  slavash, mmacy
  Approved by:  re (kib)
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/net/if_vlan.c

Modified: head/sys/net/if_vlan.c
==
--- head/sys/net/if_vlan.c  Mon Oct 15 10:25:34 2018(r339357)
+++ head/sys/net/if_vlan.c  Mon Oct 15 10:29:29 2018(r339358)
@@ -153,6 +153,7 @@ struct ifvlantrunk {
 struct vlan_mc_entry {
struct sockaddr_dl  mc_addr;
CK_SLIST_ENTRY(vlan_mc_entry)   mc_entries;
+   struct epoch_contextmc_epoch_ctx;
 };
 
 struct ifvlan {
@@ -317,6 +318,13 @@ VNET_DEFINE_STATIC(struct if_clone *, vlan_cloner);
 #define HASH(n, m) n) >> 8) ^ ((n) >> 4) ^ (n)) & (m))
 
 static void
+vlan_mc_free(struct epoch_context *ctx)
+{
+   struct vlan_mc_entry *mc = __containerof(ctx, struct vlan_mc_entry, 
mc_epoch_ctx);
+   free(mc, M_VLAN);
+}
+
+static void
 vlan_inithash(struct ifvlantrunk *trunk)
 {
int i, n;
@@ -572,8 +580,7 @@ vlan_setmulti(struct ifnet *ifp)
while ((mc = CK_SLIST_FIRST(>vlan_mc_listhead)) != NULL) {
CK_SLIST_REMOVE_HEAD(>vlan_mc_listhead, mc_entries);
(void)if_delmulti(ifp_p, (struct sockaddr *)>mc_addr);
-   NET_EPOCH_WAIT();
-   free(mc, M_VLAN);
+   epoch_call(net_epoch_preempt, >mc_epoch_ctx, vlan_mc_free);
}
 
/* Now program new ones. */
@@ -1485,8 +1492,7 @@ vlan_unconfig_locked(struct ifnet *ifp, int departing)
error);
}
CK_SLIST_REMOVE_HEAD(>vlan_mc_listhead, 
mc_entries);
-   NET_EPOCH_WAIT();
-   free(mc, M_VLAN);
+   epoch_call(net_epoch_preempt, >mc_epoch_ctx, 
vlan_mc_free);
}
 
vlan_setflags(ifp, 0); /* clear special flags on parent */
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r339357 - head/sys/netpfil/ipfw

2018-10-15 Thread Andrey V. Elsukov
Author: ae
Date: Mon Oct 15 10:25:34 2018
New Revision: 339357
URL: https://svnweb.freebsd.org/changeset/base/339357

Log:
  Add extra parentheses to fix "versrcreach" opcode, (oif != NULL) should
  not be used as condition for ternary operator.
  
  Submitted by: Tatsuki Makino 
  Approved by:  re (kib)
  MFC after:1 week

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

Modified: head/sys/netpfil/ipfw/ip_fw2.c
==
--- head/sys/netpfil/ipfw/ip_fw2.c  Sun Oct 14 18:42:54 2018
(r339356)
+++ head/sys/netpfil/ipfw/ip_fw2.c  Mon Oct 15 10:25:34 2018
(r339357)
@@ -2355,13 +2355,13 @@ do {
\
 
case O_VERSRCREACH:
/* Outgoing packets automatically pass/match */
-   match = (hlen > 0 && ((oif != NULL) ||
+   match = (hlen > 0 && ((oif != NULL) || (
 #ifdef INET6
is_ipv6 ?
verify_path6(&(args->f_id.src_ip6),
NULL, args->f_id.fib) :
 #endif
-   verify_path(src_ip, NULL, args->f_id.fib)));
+   verify_path(src_ip, NULL, 
args->f_id.fib;
break;
 
case O_ANTISPOOF:
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r339350 - head/contrib/elftoolchain/elfcopy

2018-10-15 Thread Antoine Brodin
On Sat, Oct 13, 2018 at 11:26 PM Ed Maste  wrote:
>
> Author: emaste
> Date: Sat Oct 13 21:26:07 2018
> New Revision: 339350
> URL: https://svnweb.freebsd.org/changeset/base/339350
>
> Log:
>   elfcopy: delete filter_reloc, it is broken and unnecessary
>
>   elfcopy contained logic to filter individual relocations in STRIP_ALL
>   mode.  However, this is not valid; relocations emitted by the linker are
>   required, unless they apply to an entire section being removed (which is
>   handled by other logic in elfcopy).
>
>   Note that filter_reloc was also buggy: for RELA relocation sections it
>   operated on uninitialized rel.r_info resulting in invalid operation.
>
>   The logic most likely needs to be inverted: instead of removing
>   relocations because their associated symbols are being removed, we must
>   keep symbols referenced by relocations.  That said, in practice we do
>   not encounter this code path today: objects being stripped are either
>   dynamically linked binaries which retain .dynsym, or static binaries
>   with no relocations.
>
>   Just remove filter_reloc.  This fixes certain cases including statically
>   linked binaries containing ifuncs.  Stripping binaries with relocations
>   referencing removed symbols was already broken, and after this change
>   may still be broken in a different way.
>
>   PR:   232176
>   Reviewed by:  kaiw, kib, markj
>   Approved by:  re (rgrimes)
>   MFC after:1 month
>   Sponsored by: The FreeBSD Foundation
>   Differential Revision:https://reviews.freebsd.org/D17519
>
> Modified:
>   head/contrib/elftoolchain/elfcopy/sections.c

Hi,

This commit broke lang/gcc* :
http://gohan2.ysv.freebsd.org/data/head-amd64-default-baseline/p482125_s339356/logs/errors/gcc48-4.8.5_9.log
http://gohan2.ysv.freebsd.org/data/head-amd64-default-baseline/p482125_s339356/logs/errors/gcc49-4.9.4_8.log
http://gohan2.ysv.freebsd.org/data/head-amd64-default-baseline/p482125_s339356/logs/errors/gcc5-5.5.0_5.log
http://gohan2.ysv.freebsd.org/data/head-amd64-default-baseline/p482125_s339356/logs/errors/gcc7-7.3.0_5.log
http://gohan2.ysv.freebsd.org/data/head-amd64-default-baseline/p482125_s339356/logs/errors/gcc8-8.2.0_1.log
etc.

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