svn commit: r332422 - head/sys/net

2018-04-11 Thread Mateusz Guzik
Author: mjg
Date: Thu Apr 12 04:11:37 2018
New Revision: 332422
URL: https://svnweb.freebsd.org/changeset/base/332422

Log:
  iflib: fix up a mismerge in r332419
  
  Lead to crashes on boot while in ifconfig.
  
  Submitted by: Matthew Macy 

Modified:
  head/sys/net/iflib.c

Modified: head/sys/net/iflib.c
==
--- head/sys/net/iflib.cThu Apr 12 02:10:01 2018(r332421)
+++ head/sys/net/iflib.cThu Apr 12 04:11:37 2018(r332422)
@@ -2288,7 +2288,7 @@ iflib_stop(if_ctx_t ctx)
for (i = 0; i < scctx->isc_nrxqsets; i++, rxq++) {
/* make sure all transmitters have completed before proceeding 
XXX */
 
-   for (j = 0, di = txq->ift_ifdi; j < rxq->ifr_nfl; j++, di++)
+   for (j = 0, di = rxq->ifr_ifdi; j < rxq->ifr_nfl; j++, di++)
bzero((void *)di->idi_vaddr, di->idi_size);
/* also resets the free lists pidx/cidx */
for (j = 0, fl = rxq->ifr_fl; j < rxq->ifr_nfl; j++, fl++)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r332419 - head/sys/net

2018-04-11 Thread K. Macy
There was a panic inducing merge error, please apply if you encounter problems:

@ -2288,7 +2294,7 @@ iflib_stop(if_ctx_t ctx)
for (i = 0; i < scctx->isc_nrxqsets; i++, rxq++) {
/* make sure all transmitters have completed before
proceeding XXX */

-   for (j = 0, di = txq->ift_ifdi; j < rxq->ifr_nfl; j++, di++)
+   for (j = 0, di = rxq->ifr_ifdi; j < rxq->ifr_nfl; j++, di++)
bzero((void *)di->idi_vaddr, di->idi_size);
/* also resets the free lists pidx/cidx */
for (j = 0, fl = rxq->ifr_fl; j < rxq->ifr_nfl; j++, fl++)

On Wed, Apr 11, 2018 at 2:41 PM, Stephen Hurd  wrote:
> Author: shurd
> Date: Wed Apr 11 21:41:59 2018
> New Revision: 332419
> URL: https://svnweb.freebsd.org/changeset/base/332419
>
> Log:
>   Properly initialize ifc_nhwtxqs.
>
>   Also, since ifc_nhwrxqs is only used in one place, remove it from the 
> struct.
>   This was preventing iflib_dma_free() from being called via
>   iflib_device_detach().
>
>   Submitted by: Matthew Macy 
>   Reviewed by:  shurd
>   Sponsored by: Limelight Networks
>
> Modified:
>   head/sys/net/iflib.c
>
> Modified: head/sys/net/iflib.c
> ==
> --- head/sys/net/iflib.cWed Apr 11 20:04:06 2018(r332418)
> +++ head/sys/net/iflib.cWed Apr 11 21:41:59 2018(r332419)
> @@ -166,7 +166,6 @@ struct iflib_ctx {
> struct mtx ifc_mtx;
>
> uint16_t ifc_nhwtxqs;
> -   uint16_t ifc_nhwrxqs;
>
> iflib_txq_t ifc_txqs;
> iflib_rxq_t ifc_rxqs;
> @@ -2289,7 +2288,7 @@ iflib_stop(if_ctx_t ctx)
> for (i = 0; i < scctx->isc_nrxqsets; i++, rxq++) {
> /* make sure all transmitters have completed before 
> proceeding XXX */
>
> -   for (j = 0, di = txq->ift_ifdi; j < ctx->ifc_nhwrxqs; j++, 
> di++)
> +   for (j = 0, di = txq->ift_ifdi; j < rxq->ifr_nfl; j++, di++)
> bzero((void *)di->idi_vaddr, di->idi_size);
> /* also resets the free lists pidx/cidx */
> for (j = 0, fl = rxq->ifr_fl; j < rxq->ifr_nfl; j++, fl++)
> @@ -4198,6 +4197,7 @@ iflib_device_register(device_t dev, void *sc, if_share
>
> scctx = >ifc_softc_ctx;
> ifp = ctx->ifc_ifp;
> +   ctx->ifc_nhwtxqs = sctx->isc_ntxqs;
>
> /*
>  * XXX sanity check that ntxd & nrxd are a power of 2
> ___
> svn-src-h...@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-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r332421 - head/sys/dev/vt/hw/vga

2018-04-11 Thread Ed Maste
Author: emaste
Date: Thu Apr 12 02:10:01 2018
New Revision: 332421
URL: https://svnweb.freebsd.org/changeset/base/332421

Log:
  vt: add three more cp437 mappings for vga textmode
  
  In UTF-8 locales mandoc uses a number of characters outside of the Basic
  Latin group, e.g. from general punctuation or miscellaneous mathematical
  symbols, and these rendered as ? in text mode.
  
  This change adds (char, replacement, code point, description):
  
  – - U+2013 En Dash
  ⟨ < U+27E8 Mathematical Left Angle Bracket
  ⟩ > U+27E9 Mathematical Right Angle Bracket
  
  This change addresses some common cases; there are others that still
  need to be added after a more thorough review.
  
  PR:   227409
  MFC after:1 week
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/dev/vt/hw/vga/vt_vga.c

Modified: head/sys/dev/vt/hw/vga/vt_vga.c
==
--- head/sys/dev/vt/hw/vga/vt_vga.c Wed Apr 11 22:23:22 2018
(r332420)
+++ head/sys/dev/vt/hw/vga/vt_vga.c Thu Apr 12 02:10:01 2018
(r332421)
@@ -237,6 +237,7 @@ static const struct unicp437 cp437table[] = {
{ 0x03c0, 0xe3, 0x00 }, { 0x03c3, 0xe5, 0x00 },
{ 0x03c4, 0xe7, 0x00 }, { 0x03c6, 0xed, 0x00 },
{ 0x03d5, 0xed, 0x00 }, { 0x2010, 0x2d, 0x00 },
+   { 0x2013, 0x2d, 0x00 },
{ 0x2014, 0x2d, 0x00 }, { 0x2018, 0x60, 0x00 },
{ 0x2019, 0x27, 0x00 }, { 0x201c, 0x22, 0x00 },
{ 0x201d, 0x22, 0x00 }, { 0x2022, 0x07, 0x00 },
@@ -285,7 +286,8 @@ static const struct unicp437 cp437table[] = {
{ 0x2640, 0x0c, 0x00 }, { 0x2642, 0x0b, 0x00 },
{ 0x2660, 0x06, 0x00 }, { 0x2663, 0x05, 0x00 },
{ 0x2665, 0x03, 0x01 }, { 0x266a, 0x0d, 0x00 },
-   { 0x266c, 0x0e, 0x00 },
+   { 0x266c, 0x0e, 0x00 }, { 0x27e8, 0x3c, 0x00 },
+   { 0x27e9, 0x3e, 0x00 },
 };
 
 static uint8_t
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r332420 - in stable/11: stand/common sys/kern

2018-04-11 Thread John Baldwin
Author: jhb
Date: Wed Apr 11 22:23:22 2018
New Revision: 332420
URL: https://svnweb.freebsd.org/changeset/base/332420

Log:
  MFC 328101,328911: Require SHF_ALLOC for kernel object module sections.
  
  328101:
  Require the SHF_ALLOC flag for program sections from kernel object modules.
  
  ELF object files can contain program sections which are not supposed
  to be loaded into memory (e.g. .comment).  Normally the static linker
  uses these flags to decide which sections are allocated to loadable
  program segments in ELF binaries and shared objects (including kernels
  on all architectures and kernel modules on architectures other than
  amd64).
  
  Mapping ELF object files (such as amd64 kernel modules) into memory
  directly is a bit of a grey area.  ELF object files are intended to be
  used as inputs to the static linker.  As a result, there is not a
  standardized definition for what the memory layout of an ELF object
  should be (none of the section headers have valid virtual memory
  addresses for example).
  
  The kernel and loader were not checking the SHF_ALLOC flag but loading
  any program sections with certain types such as SHT_PROGBITS.  As a
  result, the kernel and loader would load into RAM some sections that
  weren't marked with SHF_ALLOC such as .comment that are not loaded
  into RAM for kernel modules on other architectures (which are
  implemented as ELF shared objects).  Aside from possibly requiring
  slightly more RAM to hold a kernel module this does not affect runtime
  correctness as the kernel relocates symbols based on the layout it
  uses.
  
  Debuggers such as gdb and lldb do not extract symbol tables from a
  running process or kernel.  Instead, they replicate the memory layout
  of ELF executables and shared objects and use that to construct their
  own symbol tables.  For executables and shared objects this works
  fine.  For ELF objects the current logic in kgdb (and probably lldb
  based on a simple reading) assumes that only sections with SHF_ALLOC
  are memory resident when constructing a memory layout.  If the
  debugger constructs a different memory layout than the kernel, then it
  will compute different addresses for symbols causing symbols in the
  debugger to appear to have the wrong values (though the kernel itself
  is working fine).  The current port of mdb does not check SHF_ALLOC as
  it replicates the kernel's logic in its existing kernel support.
  
  The bfd linker sorts the sections in ELF object files such that all of
  the allocated sections (sections with SHF_ALLOCATED) are placed first
  followed by unallocated sections.  As a result, when kgdb composed a
  memory layout using only the allocated sections, this layout happened
  to match the layout used by the kernel and loader.  The lld linker
  does not sort the sections in ELF object files and mixed allocated and
  unallocated sections.  This resulted in kgdb composing a different
  memory layout than the kernel and loader.
  
  We could either patch kgdb (and possibly in the future lldb) to use
  custom handling when generating memory layouts for kernel modules that
  are ELF objects, or we could change the kernel and loader to check
  SHF_ALLOCATED.  I chose the latter as I feel we shouldn't be loading
  things into RAM that the module won't use.  This should mostly be a
  NOP when linking with bfd but will allow the existing kgdb to work
  with amd64 kernel modules linked with lld.
  
  Note that we only require SHF_ALLOC for "program" sections for types
  like SHT_PROGBITS and SHT_NOBITS.  Other section types such as symbol
  tables, string tables, and relocations must also be loaded and are not
  marked with SHF_ALLOC.
  
  328911:
  Ignore relocation tables for non-memory-resident sections.
  
  As a followup to r328101, ignore relocation tables for ELF object
  sections that are not memory resident.  For modules loaded by the
  loader, ignore relocation tables whose associated section was not
  loaded by the loader (sh_addr is zero).  For modules loaded at runtime
  via kldload(2), ignore relocation tables whose associated section is
  not marked with SHF_ALLOC.

Modified:
  stable/11/stand/common/load_elf_obj.c
  stable/11/sys/kern/link_elf_obj.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/stand/common/load_elf_obj.c
==
--- stable/11/stand/common/load_elf_obj.c   Wed Apr 11 21:41:59 2018
(r332419)
+++ stable/11/stand/common/load_elf_obj.c   Wed Apr 11 22:23:22 2018
(r332420)
@@ -224,6 +224,8 @@ __elfN(obj_loadimage)(struct preloaded_file *fp, elf_f
 #if defined(__i386__) || defined(__amd64__)
case SHT_X86_64_UNWIND:
 #endif
+   if ((shdr[i].sh_flags & SHF_ALLOC) == 0)
+   break;
lastaddr = roundup(lastaddr, shdr[i].sh_addralign);

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

2018-04-11 Thread Gleb Smirnoff
On Fri, Apr 06, 2018 at 04:48:11PM +, Jonathan T. Looney wrote:
J> Author: jtl
J> Date: Fri Apr  6 16:48:11 2018
J> New Revision: 332114
J> URL: https://svnweb.freebsd.org/changeset/base/332114
J> 
J> Log:
J>   Check that in_pcbfree() is only called once for each PCB.  If that
J>   assumption is violated, "bad things" could follow.
J>   
J>   I believe such an assert would have detected some of the problems jch@
J>   was chasing in PR 203175 (see r307551).  We also use it in our internal
J>   TCP development efforts.  And, in case a bug does slip through to
J>   released code, this change silently ignores subsequent calls to
J>   in_pcbfree().
J>   
J>   Reviewed by:   rrs
J>   Sponsored by:  Netflix, Inc.
J>   Differential Revision: https://reviews.freebsd.org/D14990
J> 
J> Modified:
J>   head/sys/netinet/in_pcb.c
J> 
J> Modified: head/sys/netinet/in_pcb.c
J> 
==
J> --- head/sys/netinet/in_pcb.cFri Apr  6 16:48:07 2018
(r332113)
J> +++ head/sys/netinet/in_pcb.cFri Apr  6 16:48:11 2018
(r332114)
J> @@ -1288,6 +1288,13 @@ in_pcbfree(struct inpcb *inp)
J>  
J>  KASSERT(inp->inp_socket == NULL, ("%s: inp_socket != NULL", __func__));
J>  
J> +KASSERT((inp->inp_flags2 & INP_FREED) == 0,
J> +("%s: called twice for pcb %p", __func__, inp));
J> +if (inp->inp_flags2 & INP_FREED) {
J> +INP_WUNLOCK(inp);
J> +return;
J> +}
J> +

This code will create Coverity report. IMHO, only KASSERT should be left.

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


Re: svn commit: r332091 - stable/11/sys/vm

2018-04-11 Thread Slawa Olhovchenkov
On Wed, Apr 11, 2018 at 02:27:48PM -0700, John Baldwin wrote:

> On Wednesday, April 11, 2018 10:49:20 PM Konstantin Belousov wrote:
> > On Wed, Apr 11, 2018 at 08:52:08AM -0700, John Baldwin wrote:
> > > On Monday, April 09, 2018 07:29:09 PM Slawa Olhovchenkov wrote:
> > > > On Fri, Apr 06, 2018 at 09:25:08AM +, Konstantin Belousov wrote:
> > > > 
> > > > > Author: kib
> > > > > Date: Fri Apr  6 09:25:08 2018
> > > > > New Revision: 332091
> > > > > URL: https://svnweb.freebsd.org/changeset/base/332091
> > > > > 
> > > > > Log:
> > > > >   MFC r331760:
> > > > >   Make vm_map_max/min/pmap KBI stable.
> > > > > 
> > > > > Modified:
> > > > >   stable/11/sys/vm/vm_map.c
> > > > >   stable/11/sys/vm/vm_map.h
> > > > > Directory Properties:
> > > > >   stable/11/   (props changed)
> > > > 
> > > > -STABLE still crashed after load vboxnet build on 11.1-RELEASE
> > > > nvidia (build on 11.1-RELEASE) also don't work
> > > 
> > > Yes, this only helps with the future KBI, it doesn't restore the
> > > existing one.  However, r320889 which was committed earlier should
> > > have restored the KBI?
> > 
> > I am not sure.  It might have, but there might be more breakage
> > accumulated.  My current opinion is that both vbox and nvidia (as well as
> > in-tree and out of tree drm modules) must be marked as tied.  The modules
> > definitely depends on much more kernel interfaces than a typical HBA or
> > network controller driver, for which the stability claim is actually
> > intended to apply.
> 
> I do think virtualbox is probably too hard to make work, but I didn't think
> the nvidia driver was that bad.
> 
> I think that for kmods in ports we should consider moving to a different model
> than we currently do where the port installs the source for the kernel
> module to a standard location and we could have a way to rebuild all of the
> modules as needed.  This would permit us to provide PORTS_MODULES-type
> functionality via either ports or packages (and it is a bit more flexible as
> you wouldn't to deinstall/reinstall the package each time you just wanted to
> rebuild the kernel module).
> 
> I would suggest something like /usr/local/src/modules/ and a
> 'LOCAL_MODULES' kernel option that is a list of ' ' to replace
> PORTS_MODULES.  A package could still ship an initial module by default, but
> recompiling the module would either overwrite it, or if the module is built as
> part of the kernel (via LOCAL_MODULES) the new one would be installed with the
> kernel itself into /boot/kernel leaving the one from the package in
> /boot/modules.  For tied modules we could simply build it with a strict
> MODULE_DEPEND line on the kernel so that the pre-built module won't load on
> newer kernels and then encourage the user to use LOCAL_MODULES in pkg-message.
> Using LOCAL_MODULES would be better than PORTS_MODULES as it would DTRT if you
> move kernel to kernel.old during an upgrade, etc.

Hmm, what about packages? I am use nvidia driver as package.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r332419 - head/sys/net

2018-04-11 Thread Stephen Hurd
Author: shurd
Date: Wed Apr 11 21:41:59 2018
New Revision: 332419
URL: https://svnweb.freebsd.org/changeset/base/332419

Log:
  Properly initialize ifc_nhwtxqs.
  
  Also, since ifc_nhwrxqs is only used in one place, remove it from the struct.
  This was preventing iflib_dma_free() from being called via
  iflib_device_detach().
  
  Submitted by: Matthew Macy 
  Reviewed by:  shurd
  Sponsored by: Limelight Networks

Modified:
  head/sys/net/iflib.c

Modified: head/sys/net/iflib.c
==
--- head/sys/net/iflib.cWed Apr 11 20:04:06 2018(r332418)
+++ head/sys/net/iflib.cWed Apr 11 21:41:59 2018(r332419)
@@ -166,7 +166,6 @@ struct iflib_ctx {
struct mtx ifc_mtx;
 
uint16_t ifc_nhwtxqs;
-   uint16_t ifc_nhwrxqs;
 
iflib_txq_t ifc_txqs;
iflib_rxq_t ifc_rxqs;
@@ -2289,7 +2288,7 @@ iflib_stop(if_ctx_t ctx)
for (i = 0; i < scctx->isc_nrxqsets; i++, rxq++) {
/* make sure all transmitters have completed before proceeding 
XXX */
 
-   for (j = 0, di = txq->ift_ifdi; j < ctx->ifc_nhwrxqs; j++, di++)
+   for (j = 0, di = txq->ift_ifdi; j < rxq->ifr_nfl; j++, di++)
bzero((void *)di->idi_vaddr, di->idi_size);
/* also resets the free lists pidx/cidx */
for (j = 0, fl = rxq->ifr_fl; j < rxq->ifr_nfl; j++, fl++)
@@ -4198,6 +4197,7 @@ iflib_device_register(device_t dev, void *sc, if_share
 
scctx = >ifc_softc_ctx;
ifp = ctx->ifc_ifp;
+   ctx->ifc_nhwtxqs = sctx->isc_ntxqs;
 
/*
 * XXX sanity check that ntxd & nrxd are a power of 2
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r332091 - stable/11/sys/vm

2018-04-11 Thread John Baldwin
On Wednesday, April 11, 2018 10:49:20 PM Konstantin Belousov wrote:
> On Wed, Apr 11, 2018 at 08:52:08AM -0700, John Baldwin wrote:
> > On Monday, April 09, 2018 07:29:09 PM Slawa Olhovchenkov wrote:
> > > On Fri, Apr 06, 2018 at 09:25:08AM +, Konstantin Belousov wrote:
> > > 
> > > > Author: kib
> > > > Date: Fri Apr  6 09:25:08 2018
> > > > New Revision: 332091
> > > > URL: https://svnweb.freebsd.org/changeset/base/332091
> > > > 
> > > > Log:
> > > >   MFC r331760:
> > > >   Make vm_map_max/min/pmap KBI stable.
> > > > 
> > > > Modified:
> > > >   stable/11/sys/vm/vm_map.c
> > > >   stable/11/sys/vm/vm_map.h
> > > > Directory Properties:
> > > >   stable/11/   (props changed)
> > > 
> > > -STABLE still crashed after load vboxnet build on 11.1-RELEASE
> > > nvidia (build on 11.1-RELEASE) also don't work
> > 
> > Yes, this only helps with the future KBI, it doesn't restore the
> > existing one.  However, r320889 which was committed earlier should
> > have restored the KBI?
> 
> I am not sure.  It might have, but there might be more breakage
> accumulated.  My current opinion is that both vbox and nvidia (as well as
> in-tree and out of tree drm modules) must be marked as tied.  The modules
> definitely depends on much more kernel interfaces than a typical HBA or
> network controller driver, for which the stability claim is actually
> intended to apply.

I do think virtualbox is probably too hard to make work, but I didn't think
the nvidia driver was that bad.

I think that for kmods in ports we should consider moving to a different model
than we currently do where the port installs the source for the kernel
module to a standard location and we could have a way to rebuild all of the
modules as needed.  This would permit us to provide PORTS_MODULES-type
functionality via either ports or packages (and it is a bit more flexible as
you wouldn't to deinstall/reinstall the package each time you just wanted to
rebuild the kernel module).

I would suggest something like /usr/local/src/modules/ and a
'LOCAL_MODULES' kernel option that is a list of ' ' to replace
PORTS_MODULES.  A package could still ship an initial module by default, but
recompiling the module would either overwrite it, or if the module is built as
part of the kernel (via LOCAL_MODULES) the new one would be installed with the
kernel itself into /boot/kernel leaving the one from the package in
/boot/modules.  For tied modules we could simply build it with a strict
MODULE_DEPEND line on the kernel so that the pre-built module won't load on
newer kernels and then encourage the user to use LOCAL_MODULES in pkg-message.
Using LOCAL_MODULES would be better than PORTS_MODULES as it would DTRT if you
move kernel to kernel.old during an upgrade, etc.

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


Re: svn commit: r332091 - stable/11/sys/vm

2018-04-11 Thread Konstantin Belousov
On Wed, Apr 11, 2018 at 08:52:08AM -0700, John Baldwin wrote:
> On Monday, April 09, 2018 07:29:09 PM Slawa Olhovchenkov wrote:
> > On Fri, Apr 06, 2018 at 09:25:08AM +, Konstantin Belousov wrote:
> > 
> > > Author: kib
> > > Date: Fri Apr  6 09:25:08 2018
> > > New Revision: 332091
> > > URL: https://svnweb.freebsd.org/changeset/base/332091
> > > 
> > > Log:
> > >   MFC r331760:
> > >   Make vm_map_max/min/pmap KBI stable.
> > > 
> > > Modified:
> > >   stable/11/sys/vm/vm_map.c
> > >   stable/11/sys/vm/vm_map.h
> > > Directory Properties:
> > >   stable/11/   (props changed)
> > 
> > -STABLE still crashed after load vboxnet build on 11.1-RELEASE
> > nvidia (build on 11.1-RELEASE) also don't work
> 
> Yes, this only helps with the future KBI, it doesn't restore the
> existing one.  However, r320889 which was committed earlier should
> have restored the KBI?

I am not sure.  It might have, but there might be more breakage
accumulated.  My current opinion is that both vbox and nvidia (as well as
in-tree and out of tree drm modules) must be marked as tied.  The modules
definitely depends on much more kernel interfaces than a typical HBA or
network controller driver, for which the stability claim is actually
intended to apply.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r332416 - in head/stand/efi: include libefi loader

2018-04-11 Thread Warner Losh
Author: imp
Date: Wed Apr 11 19:46:24 2018
New Revision: 332416
URL: https://svnweb.freebsd.org/changeset/base/332416

Log:
  Refactor currdev setting
  
  Refactor the currdev setting to find the device we booted from. Limit
  searching when we don't already have a reasonable currdev from that to
  the same device only. Search a little harder for ZFS volumes as that's
  needed for loader.efi to live on an ESP.
  
  Sponsored by: Netflix
  Differential Review: https://reviews.freebsd.org/D13784

Modified:
  head/stand/efi/include/efilib.h
  head/stand/efi/include/efizfs.h
  head/stand/efi/libefi/efipart.c
  head/stand/efi/libefi/efizfs.c
  head/stand/efi/loader/main.c

Modified: head/stand/efi/include/efilib.h
==
--- head/stand/efi/include/efilib.h Wed Apr 11 19:28:54 2018
(r332415)
+++ head/stand/efi/include/efilib.h Wed Apr 11 19:46:24 2018
(r332416)
@@ -59,10 +59,13 @@ typedef struct pdinfo
uint32_tpd_unit;/* unit number */
uint32_tpd_open;/* reference counter */
void*pd_bcache; /* buffer cache data */
+   struct pdinfo   *pd_parent; /* Linked items (eg partitions) 
*/
+   struct devsw*pd_devsw;  /* Back pointer to devsw */
 } pdinfo_t;
 
 pdinfo_list_t *efiblk_get_pdinfo_list(struct devsw *dev);
 pdinfo_t *efiblk_get_pdinfo(struct devdesc *dev);
+pdinfo_t *efiblk_get_pdinfo_by_handle(EFI_HANDLE h);
 
 void *efi_get_table(EFI_GUID *tbl);
 

Modified: head/stand/efi/include/efizfs.h
==
--- head/stand/efi/include/efizfs.h Wed Apr 11 19:28:54 2018
(r332415)
+++ head/stand/efi/include/efizfs.h Wed Apr 11 19:46:24 2018
(r332416)
@@ -48,6 +48,7 @@ extern void efi_zfs_probe(void);
 extern zfsinfo_list_t *efizfs_get_zfsinfo_list(void);
 extern bool efi_zfs_is_preferred(EFI_HANDLE *h);
 extern EFI_HANDLE efizfs_get_handle_by_guid(uint64_t);
+extern bool efizfs_get_guid_by_handle(EFI_HANDLE, uint64_t *);
 
 #endif
 

Modified: head/stand/efi/libefi/efipart.c
==
--- head/stand/efi/libefi/efipart.c Wed Apr 11 19:28:54 2018
(r332415)
+++ head/stand/efi/libefi/efipart.c Wed Apr 11 19:46:24 2018
(r332416)
@@ -119,6 +119,7 @@ efiblk_get_pdinfo_list(struct devsw *dev)
return (NULL);
 }
 
+/* XXX this gets called way way too often, investigate */
 pdinfo_t *
 efiblk_get_pdinfo(struct devdesc *dev)
 {
@@ -136,6 +137,40 @@ efiblk_get_pdinfo(struct devdesc *dev)
return (pd);
 }
 
+static bool
+same_handle(pdinfo_t *pd, EFI_HANDLE h)
+{
+
+   return (pd->pd_handle == h || pd->pd_alias == h);
+}
+
+pdinfo_t *
+efiblk_get_pdinfo_by_handle(EFI_HANDLE h)
+{
+   pdinfo_t *dp, *pp;
+
+   /*
+* Check hard disks, then cd, then floppy
+*/
+   STAILQ_FOREACH(dp, , pd_link) {
+   if (same_handle(dp, h))
+   return (dp);
+   STAILQ_FOREACH(pp, >pd_part, pd_link) {
+   if (same_handle(pp, h))
+   return (pp);
+   }
+   }
+   STAILQ_FOREACH(dp, , pd_link) {
+   if (same_handle(dp, h))
+   return (dp);
+   }
+   STAILQ_FOREACH(dp, , pd_link) {
+   if (same_handle(dp, h))
+   return (dp);
+   }
+   return (NULL);
+}
+
 static int
 efiblk_pdinfo_count(pdinfo_list_t *pdi)
 {
@@ -294,6 +329,8 @@ efipart_fdinfo_add(EFI_HANDLE handle, uint32_t uid, EF
fd->pd_unit = uid;
fd->pd_handle = handle;
fd->pd_devpath = devpath;
+   fd->pd_parent = NULL;
+   fd->pd_devsw = _fddev;
STAILQ_INSERT_TAIL(, fd, pd_link);
return (0);
 }
@@ -364,6 +401,8 @@ efipart_cdinfo_add(EFI_HANDLE handle, EFI_HANDLE alias
cd->pd_unit = unit;
cd->pd_alias = alias;
cd->pd_devpath = devpath;
+   cd->pd_parent = NULL;
+   cd->pd_devsw = _cddev;
STAILQ_INSERT_TAIL(, cd, pd_link);
return (0);
 }
@@ -489,6 +528,8 @@ efipart_hdinfo_add(EFI_HANDLE disk_handle, EFI_HANDLE 
pd->pd_handle = part_handle;
pd->pd_unit = node->PartitionNumber;
pd->pd_devpath = part_devpath;
+   pd->pd_parent = hd;
+   pd->pd_devsw = _hddev;
STAILQ_INSERT_TAIL(>pd_part, pd, pd_link);
return (0);
}
@@ -505,6 +546,8 @@ efipart_hdinfo_add(EFI_HANDLE disk_handle, EFI_HANDLE 
hd->pd_handle = disk_handle;
hd->pd_unit = unit;
hd->pd_devpath = disk_devpath;
+   hd->pd_parent = NULL;
+   hd->pd_devsw = _hddev;
STAILQ_INSERT_TAIL(, hd, pd_link);
 

svn commit: r332415 - head/lib/libufs

2018-04-11 Thread Kirk McKusick
Author: mckusick
Date: Wed Apr 11 19:28:54 2018
New Revision: 332415
URL: https://svnweb.freebsd.org/changeset/base/332415

Log:
  Fix potentially overflowing expression "fs->fs_ipg * fs->fs_ncg"
  by casting fs->fs_ipg to (ino_t).
  
  CID: 1388258

Modified:
  head/lib/libufs/inode.c

Modified: head/lib/libufs/inode.c
==
--- head/lib/libufs/inode.c Wed Apr 11 18:39:47 2018(r332414)
+++ head/lib/libufs/inode.c Wed Apr 11 19:28:54 2018(r332415)
@@ -60,7 +60,7 @@ getino(struct uufsd *disk, void **dino, ino_t inode, i
ERROR(disk, NULL);
 
fs = >d_fs;
-   if (inode >= fs->fs_ipg * fs->fs_ncg) {
+   if (inode >= (ino_t)fs->fs_ipg * fs->fs_ncg) {
ERROR(disk, "inode number out of range");
return (-1);
}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r332414 - head/usr.bin/clang/clang

2018-04-11 Thread Dimitry Andric
Author: dim
Date: Wed Apr 11 18:39:47 2018
New Revision: 332414
URL: https://svnweb.freebsd.org/changeset/base/332414

Log:
  Regenerate clang man page after upstream change to document the possible
  values for the -std= option.
  
  Noticed by:   Steve Kargl
  Obtained from:https://reviews.llvm.org/rL329827
  MFC after:3 days

Modified:
  head/usr.bin/clang/clang/clang.1

Modified: head/usr.bin/clang/clang/clang.1
==
--- head/usr.bin/clang/clang/clang.1Wed Apr 11 18:02:13 2018
(r332413)
+++ head/usr.bin/clang/clang/clang.1Wed Apr 11 18:39:47 2018
(r332414)
@@ -1,7 +1,7 @@
 .\" $FreeBSD$
 .\" Man page generated from reStructuredText.
 .
-.TH "CLANG" "1" "Dec 24, 2017" "6" "Clang"
+.TH "CLANG" "1" "Apr 11, 2018" "6" "Clang"
 .SH NAME
 clang \- the Clang C, C++, and Objective-C compiler
 .
@@ -128,10 +128,265 @@ Treat subsequent input files as having type language.
 .UNINDENT
 .INDENT 0.0
 .TP
-.B \-std=
+.B \-std=
 Specify the language standard to compile for.
+.sp
+Supported values for the C language are:
+.INDENT 7.0
+.INDENT 3.5
+.nf
+\fBc89\fP
+\fBc90\fP
+\fBiso9899:1990\fP
+.fi
+.sp
+.INDENT 0.0
+.INDENT 3.5
+ISO C 1990
 .UNINDENT
+.UNINDENT
+.nf
+\fBiso9899:199409\fP
+.fi
+.sp
 .INDENT 0.0
+.INDENT 3.5
+ISO C 1990 with amendment 1
+.UNINDENT
+.UNINDENT
+.nf
+\fBgnu89\fP
+\fBgnu90\fP
+.fi
+.sp
+.INDENT 0.0
+.INDENT 3.5
+ISO C 1990 with GNU extensions
+.UNINDENT
+.UNINDENT
+.nf
+\fBc99\fP
+\fBiso9899:1999\fP
+.fi
+.sp
+.INDENT 0.0
+.INDENT 3.5
+ISO C 1999
+.UNINDENT
+.UNINDENT
+.nf
+\fBgnu99\fP
+.fi
+.sp
+.INDENT 0.0
+.INDENT 3.5
+ISO C 1999 with GNU extensions
+.UNINDENT
+.UNINDENT
+.nf
+\fBc11\fP
+\fBiso9899:2011\fP
+.fi
+.sp
+.INDENT 0.0
+.INDENT 3.5
+ISO C 2011
+.UNINDENT
+.UNINDENT
+.nf
+\fBgnu11\fP
+.fi
+.sp
+.INDENT 0.0
+.INDENT 3.5
+ISO C 2011 with GNU extensions
+.UNINDENT
+.UNINDENT
+.nf
+\fBc17\fP
+\fBiso9899:2017\fP
+.fi
+.sp
+.INDENT 0.0
+.INDENT 3.5
+ISO C 2017
+.UNINDENT
+.UNINDENT
+.nf
+\fBgnu17\fP
+.fi
+.sp
+.INDENT 0.0
+.INDENT 3.5
+ISO C 2017 with GNU extensions
+.UNINDENT
+.UNINDENT
+.UNINDENT
+.UNINDENT
+.sp
+The default C language standard is \fBgnu11\fP, except on PS4, where it is
+\fBgnu99\fP\&.
+.sp
+Supported values for the C++ language are:
+.INDENT 7.0
+.INDENT 3.5
+.nf
+\fBc++98\fP
+\fBc++03\fP
+.fi
+.sp
+.INDENT 0.0
+.INDENT 3.5
+ISO C++ 1998 with amendments
+.UNINDENT
+.UNINDENT
+.nf
+\fBgnu++98\fP
+\fBgnu++03\fP
+.fi
+.sp
+.INDENT 0.0
+.INDENT 3.5
+ISO C++ 1998 with amendments and GNU extensions
+.UNINDENT
+.UNINDENT
+.nf
+\fBc++11\fP
+.fi
+.sp
+.INDENT 0.0
+.INDENT 3.5
+ISO C++ 2011 with amendments
+.UNINDENT
+.UNINDENT
+.nf
+\fBgnu++11\fP
+.fi
+.sp
+.INDENT 0.0
+.INDENT 3.5
+ISO C++ 2011 with amendments and GNU extensions
+.UNINDENT
+.UNINDENT
+.nf
+\fBc++14\fP
+.fi
+.sp
+.INDENT 0.0
+.INDENT 3.5
+ISO C++ 2014 with amendments
+.UNINDENT
+.UNINDENT
+.nf
+\fBgnu++14\fP
+.fi
+.sp
+.INDENT 0.0
+.INDENT 3.5
+ISO C++ 2014 with amendments and GNU extensions
+.UNINDENT
+.UNINDENT
+.nf
+\fBc++17\fP
+.fi
+.sp
+.INDENT 0.0
+.INDENT 3.5
+ISO C++ 2017 with amendments
+.UNINDENT
+.UNINDENT
+.nf
+\fBgnu++17\fP
+.fi
+.sp
+.INDENT 0.0
+.INDENT 3.5
+ISO C++ 2017 with amendments and GNU extensions
+.UNINDENT
+.UNINDENT
+.nf
+\fBc++2a\fP
+.fi
+.sp
+.INDENT 0.0
+.INDENT 3.5
+Working draft for ISO C++ 2020
+.UNINDENT
+.UNINDENT
+.nf
+\fBgnu++2a\fP
+.fi
+.sp
+.INDENT 0.0
+.INDENT 3.5
+Working draft for ISO C++ 2020 with GNU extensions
+.UNINDENT
+.UNINDENT
+.UNINDENT
+.UNINDENT
+.sp
+The default C++ language standard is \fBgnu++14\fP\&.
+.sp
+Supported values for the OpenCL language are:
+.INDENT 7.0
+.INDENT 3.5
+.nf
+\fBcl1.0\fP
+.fi
+.sp
+.INDENT 0.0
+.INDENT 3.5
+OpenCL 1.0
+.UNINDENT
+.UNINDENT
+.nf
+\fBcl1.1\fP
+.fi
+.sp
+.INDENT 0.0
+.INDENT 3.5
+OpenCL 1.1
+.UNINDENT
+.UNINDENT
+.nf
+\fBcl1.2\fP
+.fi
+.sp
+.INDENT 0.0
+.INDENT 3.5
+OpenCL 1.2
+.UNINDENT
+.UNINDENT
+.nf
+\fBcl2.0\fP
+.fi
+.sp
+.INDENT 0.0
+.INDENT 3.5
+OpenCL 2.0
+.UNINDENT
+.UNINDENT
+.UNINDENT
+.UNINDENT
+.sp
+The default OpenCL language standard is \fBcl1.0\fP\&.
+.sp
+Supported values for the CUDA language are:
+.INDENT 7.0
+.INDENT 3.5
+.nf
+\fBcuda\fP
+.fi
+.sp
+.INDENT 0.0
+.INDENT 3.5
+NVIDIA CUDA(tm)
+.UNINDENT
+.UNINDENT
+.UNINDENT
+.UNINDENT
+.UNINDENT
+.INDENT 0.0
 .TP
 .B \-stdlib=
 Specify the C++ standard library to use; supported options are libstdc++ and
@@ -602,6 +857,6 @@ output of the compiler, along with information to repr
 .SH AUTHOR
 Maintained by the Clang / LLVM Team ()
 .SH COPYRIGHT
-2007-2017, The Clang Team
+2007-2018, The Clang Team
 .\" Generated by docutils manpage writer.
 .
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r332413 - in head/stand: forth i386/loader

2018-04-11 Thread Warner Losh
Author: imp
Date: Wed Apr 11 18:02:13 2018
New Revision: 332413
URL: https://svnweb.freebsd.org/changeset/base/332413

Log:
  Revert r332275, r332272, r332270
  
  There's problems with them. The order of efi stuff isn't quite right,
  and there's various problems. Revert until thos problems can be fixed.
  
  Reviewed by: kevans@

Modified:
  head/stand/forth/efi.4th
  head/stand/forth/loader.4th
  head/stand/forth/loader.rc
  head/stand/i386/loader/loader.rc

Modified: head/stand/forth/efi.4th
==
--- head/stand/forth/efi.4thWed Apr 11 17:28:24 2018(r332412)
+++ head/stand/forth/efi.4thWed Apr 11 18:02:13 2018(r332413)
@@ -26,5 +26,16 @@
 
 only forth definitions
 
-s" efi-autoresizecons" evaluate
+: efiboot? ( -- flag )
+   s" efi-version" getenv -1 <> dup if
+   swap drop ( c-addr flag -- flag )
+   then
+;
+
+: maybe-efi-resizecons
+   efiboot? if
+   s" efi-autoresizecons" evaluate
+   then
+;
+
 .( EFI boot environment) cr

Modified: head/stand/forth/loader.4th
==
--- head/stand/forth/loader.4th Wed Apr 11 17:28:24 2018(r332412)
+++ head/stand/forth/loader.4th Wed Apr 11 18:02:13 2018(r332413)
@@ -46,9 +46,6 @@ include /boot/support.4th
 include /boot/color.4th
 include /boot/delay.4th
 include /boot/check-password.4th
-s" efi-version" getenv? [if]
-   include /boot/efi.4th
-[then]
 
 only forth definitions
 

Modified: head/stand/forth/loader.rc
==
--- head/stand/forth/loader.rc  Wed Apr 11 17:28:24 2018(r332412)
+++ head/stand/forth/loader.rc  Wed Apr 11 18:02:13 2018(r332413)
@@ -6,11 +6,14 @@
 \
 \ Includes additional commands
 include /boot/loader.4th
+include /boot/efi.4th
 try-include /boot/loader.rc.local
 
 \ Reads and processes loader.conf variables
 \ NOTE: Change to `initialize' if you enable the below boot menu
 start
+
+maybe-efi-resizecons
 
 \ Tests for password -- executes autoboot first if a password was defined
 check-password

Modified: head/stand/i386/loader/loader.rc
==
--- head/stand/i386/loader/loader.rcWed Apr 11 17:28:24 2018
(r332412)
+++ head/stand/i386/loader/loader.rcWed Apr 11 18:02:13 2018
(r332413)
@@ -3,10 +3,13 @@
 \
 \ Includes additional commands
 include /boot/loader.4th
+include /boot/efi.4th
 try-include /boot/loader.rc.local
 
 \ Reads and processes loader.conf variables
 initialize
+
+maybe-efi-resizecons
 
 \ Tests for password -- executes autoboot first if a password was defined
 check-password
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r332091 - stable/11/sys/vm

2018-04-11 Thread Slawa Olhovchenkov
On Wed, Apr 11, 2018 at 08:52:08AM -0700, John Baldwin wrote:

> On Monday, April 09, 2018 07:29:09 PM Slawa Olhovchenkov wrote:
> > On Fri, Apr 06, 2018 at 09:25:08AM +, Konstantin Belousov wrote:
> > 
> > > Author: kib
> > > Date: Fri Apr  6 09:25:08 2018
> > > New Revision: 332091
> > > URL: https://svnweb.freebsd.org/changeset/base/332091
> > > 
> > > Log:
> > >   MFC r331760:
> > >   Make vm_map_max/min/pmap KBI stable.
> > > 
> > > Modified:
> > >   stable/11/sys/vm/vm_map.c
> > >   stable/11/sys/vm/vm_map.h
> > > Directory Properties:
> > >   stable/11/   (props changed)
> > 
> > -STABLE still crashed after load vboxnet build on 11.1-RELEASE
> > nvidia (build on 11.1-RELEASE) also don't work
> 
> Yes, this only helps with the future KBI, it doesn't restore the
> existing one.  However, r320889 which was committed earlier should
> have restored the KBI?

Sorry, miss you point.
I am update to last stable/11, build and install kernel and check old
modules.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r332270 - head/stand/forth

2018-04-11 Thread Kyle Evans
On Sun, Apr 8, 2018 at 6:39 AM, Toomas Soome  wrote:
> Author: tsoome
> Date: Sun Apr  8 11:39:27 2018
> New Revision: 332270
> URL: https://svnweb.freebsd.org/changeset/base/332270
>
> Log:
>   loader: include efi.4th only if we do have uefi
>
>   Also simplify efi.4th.
>
> Modified:
>   head/stand/forth/efi.4th
>   head/stand/forth/loader.4th
>   head/stand/forth/loader.rc
>
> Modified: head/stand/forth/efi.4th
> ==
> --- head/stand/forth/efi.4thSun Apr  8 11:37:00 2018(r332269)
> +++ head/stand/forth/efi.4thSun Apr  8 11:39:27 2018(r332270)
> @@ -26,16 +26,5 @@
>
>  only forth definitions
>
> -: efiboot? ( -- flag )
> -   s" efi-version" getenv -1 <> dup if
> -   swap drop ( c-addr flag -- flag )
> -   then
> -;
> -
> -: maybe-efi-resizecons
> -   efiboot? if
> -   s" efi-autoresizecons" evaluate
> -   then
> -;
> -
> +s" efi-autoresizecons" evaluate
>  .( EFI boot environment) cr
>

This was actually the wrong thing to do, here. efi-autoresizecons
should *not* be executed before loader.conf is invoked, which is why
this was done the way it was.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r332389 - head/sys/net

2018-04-11 Thread K. Macy
Yup. git<->phab patch update fail. Maybe some day we can move to git.
-M

On Wed, Apr 11, 2018 at 10:12 AM, Jonathan T. Looney  wrote:
> It appears this is causing panics (see the emails on freebsd-current@).
>
> From a brief glance, it appears that the new STATE_LOCK macros is used (and
> causes panics), but the STATE_LOCK_INIT macro is not used. Is it possible
> the code is missing an initialization call for the new mutex?
>
> Jonathan
>
> On Tue, Apr 10, 2018 at 3:48 PM, Stephen Hurd  wrote:
>
>> Author: shurd
>> Date: Tue Apr 10 19:48:24 2018
>> New Revision: 332389
>> URL: https://svnweb.freebsd.org/changeset/base/332389
>>
>> Log:
>>   Split out flag manipulation from general context manipulation in iflib
>>
>>   To avoid blocking on the context lock in the swi thread and risk
>> potential
>>   deadlocks, this change protects lighter weight updates that only need to
>>   be consistent with each other with their own lock.
>>
>>   Submitted by: Matthew Macy 
>>   Reviewed by:  shurd
>>   Sponsored by: Limelight Networks
>>   Differential Revision:https://reviews.freebsd.org/D14967
>>
>> Modified:
>>   head/sys/net/iflib.c
>>
>> Modified: head/sys/net/iflib.c
>> 
>> ==
>> --- head/sys/net/iflib.cTue Apr 10 19:42:50 2018(r332388)
>> +++ head/sys/net/iflib.cTue Apr 10 19:48:24 2018(r332389)
>> @@ -1,5 +1,5 @@
>>  /*-
>> - * Copyright (c) 2014-2017, Matthew Macy 
>> + * Copyright (c) 2014-2018, Matthew Macy 
>>   * All rights reserved.
>>   *
>>   * Redistribution and use in source and binary forms, with or without
>> @@ -163,7 +163,8 @@ struct iflib_ctx {
>> if_shared_ctx_t ifc_sctx;
>> struct if_softc_ctx ifc_softc_ctx;
>>
>> -   struct mtx ifc_mtx;
>> +   struct mtx ifc_ctx_mtx;
>> +   struct mtx ifc_state_mtx;
>>
>> uint16_t ifc_nhwtxqs;
>> uint16_t ifc_nhwrxqs;
>> @@ -318,8 +319,10 @@ typedef struct iflib_sw_tx_desc_array {
>>  #defineIFC_INIT_DONE   0x020
>>  #defineIFC_PREFETCH0x040
>>  #defineIFC_DO_RESET0x080
>> -#defineIFC_CHECK_HUNG  0x100
>> +#defineIFC_DO_WATCHDOG 0x100
>> +#defineIFC_CHECK_HUNG  0x200
>>
>> +
>>  #define CSUM_OFFLOAD   (CSUM_IP_TSO|CSUM_IP6_TSO|CSUM_IP| \
>>  CSUM_IP_UDP|CSUM_IP_TCP|CSUM_IP_SCTP| \
>>  CSUM_IP6_UDP|CSUM_IP6_TCP|CSUM_IP6_SCTP)
>> @@ -535,13 +538,19 @@ rxd_info_zero(if_rxd_info_t ri)
>>
>>  #define CTX_ACTIVE(ctx) ((if_getdrvflags((ctx)->ifc_ifp) &
>> IFF_DRV_RUNNING))
>>
>> -#define CTX_LOCK_INIT(_sc, _name)  mtx_init(&(_sc)->ifc_mtx, _name,
>> "iflib ctx lock", MTX_DEF)
>> +#define CTX_LOCK_INIT(_sc, _name)  mtx_init(&(_sc)->ifc_ctx_mtx, _name,
>> "iflib ctx lock", MTX_DEF)
>> +#define CTX_LOCK(ctx) mtx_lock(&(ctx)->ifc_ctx_mtx)
>> +#define CTX_UNLOCK(ctx) mtx_unlock(&(ctx)->ifc_ctx_mtx)
>> +#define CTX_LOCK_DESTROY(ctx) mtx_destroy(&(ctx)->ifc_ctx_mtx)
>>
>> -#define CTX_LOCK(ctx) mtx_lock(&(ctx)->ifc_mtx)
>> -#define CTX_UNLOCK(ctx) mtx_unlock(&(ctx)->ifc_mtx)
>> -#define CTX_LOCK_DESTROY(ctx) mtx_destroy(&(ctx)->ifc_mtx)
>>
>> +#define STATE_LOCK_INIT(_sc, _name)  mtx_init(&(_sc)->ifc_state_mtx,
>> _name, "iflib state lock", MTX_DEF)
>> +#define STATE_LOCK(ctx) mtx_lock(&(ctx)->ifc_state_mtx)
>> +#define STATE_UNLOCK(ctx) mtx_unlock(&(ctx)->ifc_state_mtx)
>> +#define STATE_LOCK_DESTROY(ctx) mtx_destroy(&(ctx)->ifc_state_mtx)
>>
>> +
>> +
>>  #define CALLOUT_LOCK(txq)  mtx_lock(>ift_mtx)
>>  #define CALLOUT_UNLOCK(txq)mtx_unlock(>ift_mtx)
>>
>> @@ -2144,18 +2153,14 @@ iflib_timer(void *arg)
>> if (if_getdrvflags(ctx->ifc_ifp) & IFF_DRV_RUNNING)
>> callout_reset_on(>ift_timer, hz/2, iflib_timer, txq,
>> txq->ift_timer.c_cpu);
>> return;
>> -hung:
>> -   CTX_LOCK(ctx);
>> -   if_setdrvflagbits(ctx->ifc_ifp, IFF_DRV_OACTIVE, IFF_DRV_RUNNING);
>> + hung:
>> device_printf(ctx->ifc_dev,  "TX(%d) desc avail = %d, pidx = %d\n",
>>   txq->ift_id, TXQ_AVAIL(txq),
>> txq->ift_pidx);
>> -
>> -   IFDI_WATCHDOG_RESET(ctx);
>> -   ctx->ifc_watchdog_events++;
>> -
>> -   ctx->ifc_flags |= IFC_DO_RESET;
>> +   STATE_LOCK(ctx);
>> +   if_setdrvflagbits(ctx->ifc_ifp, IFF_DRV_OACTIVE, IFF_DRV_RUNNING);
>> +   ctx->ifc_flags |= (IFC_DO_WATCHDOG|IFC_DO_RESET);
>> iflib_admin_intr_deferred(ctx);
>> -   CTX_UNLOCK(ctx);
>> +   STATE_UNLOCK(ctx);
>>  }
>>
>>  static void
>> @@ -2673,10 +2678,10 @@ iflib_rxeof(iflib_rxq_t rxq, qidx_t budget)
>> return true;
>> return (iflib_rxd_avail(ctx, rxq, *cidxp, 1));
>>  err:
>> -   CTX_LOCK(ctx);
>> +   STATE_LOCK(ctx);
>> ctx->ifc_flags |= IFC_DO_RESET;

svn commit: r332411 - head/sys/net

2018-04-11 Thread Sean Bruno
Author: sbruno
Date: Wed Apr 11 17:26:53 2018
New Revision: 332411
URL: https://svnweb.freebsd.org/changeset/base/332411

Log:
  Revert r332389 as it is causing panics for various users and we need
  to add some more test cases.

Modified:
  head/sys/net/iflib.c

Modified: head/sys/net/iflib.c
==
--- head/sys/net/iflib.cWed Apr 11 17:18:54 2018(r332410)
+++ head/sys/net/iflib.cWed Apr 11 17:26:53 2018(r332411)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2014-2018, Matthew Macy 
+ * Copyright (c) 2014-2017, Matthew Macy 
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -163,8 +163,7 @@ struct iflib_ctx {
if_shared_ctx_t ifc_sctx;
struct if_softc_ctx ifc_softc_ctx;
 
-   struct mtx ifc_ctx_mtx;
-   struct mtx ifc_state_mtx;
+   struct mtx ifc_mtx;
 
uint16_t ifc_nhwtxqs;
uint16_t ifc_nhwrxqs;
@@ -319,10 +318,8 @@ typedef struct iflib_sw_tx_desc_array {
 #defineIFC_INIT_DONE   0x020
 #defineIFC_PREFETCH0x040
 #defineIFC_DO_RESET0x080
-#defineIFC_DO_WATCHDOG 0x100
-#defineIFC_CHECK_HUNG  0x200
+#defineIFC_CHECK_HUNG  0x100
 
-
 #define CSUM_OFFLOAD   (CSUM_IP_TSO|CSUM_IP6_TSO|CSUM_IP| \
 CSUM_IP_UDP|CSUM_IP_TCP|CSUM_IP_SCTP| \
 CSUM_IP6_UDP|CSUM_IP6_TCP|CSUM_IP6_SCTP)
@@ -538,19 +535,13 @@ rxd_info_zero(if_rxd_info_t ri)
 
 #define CTX_ACTIVE(ctx) ((if_getdrvflags((ctx)->ifc_ifp) & IFF_DRV_RUNNING))
 
-#define CTX_LOCK_INIT(_sc, _name)  mtx_init(&(_sc)->ifc_ctx_mtx, _name, "iflib 
ctx lock", MTX_DEF)
-#define CTX_LOCK(ctx) mtx_lock(&(ctx)->ifc_ctx_mtx)
-#define CTX_UNLOCK(ctx) mtx_unlock(&(ctx)->ifc_ctx_mtx)
-#define CTX_LOCK_DESTROY(ctx) mtx_destroy(&(ctx)->ifc_ctx_mtx)
+#define CTX_LOCK_INIT(_sc, _name)  mtx_init(&(_sc)->ifc_mtx, _name, "iflib ctx 
lock", MTX_DEF)
 
+#define CTX_LOCK(ctx) mtx_lock(&(ctx)->ifc_mtx)
+#define CTX_UNLOCK(ctx) mtx_unlock(&(ctx)->ifc_mtx)
+#define CTX_LOCK_DESTROY(ctx) mtx_destroy(&(ctx)->ifc_mtx)
 
-#define STATE_LOCK_INIT(_sc, _name)  mtx_init(&(_sc)->ifc_state_mtx, _name, 
"iflib state lock", MTX_DEF)
-#define STATE_LOCK(ctx) mtx_lock(&(ctx)->ifc_state_mtx)
-#define STATE_UNLOCK(ctx) mtx_unlock(&(ctx)->ifc_state_mtx)
-#define STATE_LOCK_DESTROY(ctx) mtx_destroy(&(ctx)->ifc_state_mtx)
 
-
-
 #define CALLOUT_LOCK(txq)  mtx_lock(>ift_mtx)
 #define CALLOUT_UNLOCK(txq)mtx_unlock(>ift_mtx)
 
@@ -2153,14 +2144,18 @@ iflib_timer(void *arg)
if (if_getdrvflags(ctx->ifc_ifp) & IFF_DRV_RUNNING) 
callout_reset_on(>ift_timer, hz/2, iflib_timer, txq, 
txq->ift_timer.c_cpu);
return;
- hung:
+hung:
+   CTX_LOCK(ctx);
+   if_setdrvflagbits(ctx->ifc_ifp, IFF_DRV_OACTIVE, IFF_DRV_RUNNING);
device_printf(ctx->ifc_dev,  "TX(%d) desc avail = %d, pidx = %d\n",
  txq->ift_id, TXQ_AVAIL(txq), txq->ift_pidx);
-   STATE_LOCK(ctx);
-   if_setdrvflagbits(ctx->ifc_ifp, IFF_DRV_OACTIVE, IFF_DRV_RUNNING);
-   ctx->ifc_flags |= (IFC_DO_WATCHDOG|IFC_DO_RESET);
+
+   IFDI_WATCHDOG_RESET(ctx);
+   ctx->ifc_watchdog_events++;
+
+   ctx->ifc_flags |= IFC_DO_RESET;
iflib_admin_intr_deferred(ctx);
-   STATE_UNLOCK(ctx);
+   CTX_UNLOCK(ctx);
 }
 
 static void
@@ -2678,10 +2673,10 @@ iflib_rxeof(iflib_rxq_t rxq, qidx_t budget)
return true;
return (iflib_rxd_avail(ctx, rxq, *cidxp, 1));
 err:
-   STATE_LOCK(ctx);
+   CTX_LOCK(ctx);
ctx->ifc_flags |= IFC_DO_RESET;
iflib_admin_intr_deferred(ctx);
-   STATE_UNLOCK(ctx);
+   CTX_UNLOCK(ctx);
return (false);
 }
 
@@ -3711,35 +3706,27 @@ _task_fn_admin(void *context)
if_softc_ctx_t sctx = >ifc_softc_ctx;
iflib_txq_t txq;
int i;
-   bool oactive, running, do_reset, do_watchdog;
 
-   STATE_LOCK(ctx);
-   running = (if_getdrvflags(ctx->ifc_ifp) & IFF_DRV_RUNNING);
-   oactive = (if_getdrvflags(ctx->ifc_ifp) & IFF_DRV_OACTIVE);
-   do_reset = (ctx->ifc_flags & IFC_DO_RESET);
-   do_watchdog = (ctx->ifc_flags & IFC_DO_WATCHDOG);
-   ctx->ifc_flags &= ~(IFC_DO_RESET|IFC_DO_WATCHDOG);
-   STATE_UNLOCK(ctx);
+   if (!(if_getdrvflags(ctx->ifc_ifp) & IFF_DRV_RUNNING)) {
+   if (!(if_getdrvflags(ctx->ifc_ifp) & IFF_DRV_OACTIVE)) {
+   return;
+   }
+   }
 
-   if (!running & !oactive)
-   return;
-
CTX_LOCK(ctx);
for (txq = ctx->ifc_txqs, i = 0; i < sctx->isc_ntxqsets; i++, txq++) {
CALLOUT_LOCK(txq);
callout_stop(>ift_timer);
CALLOUT_UNLOCK(txq);
}
-   if (do_watchdog) {
-   

Re: svn commit: r332412 - in head: . lib/libifconfig sbin/etherswitchcfg sbin/ifconfig share/man/man4 sys/conf sys/dev/pdq sys/net sys/netinet sys/netinet6 sys/nfs

2018-04-11 Thread Alexander V . Chernikov
11.04.2018, 20:28, "Brooks Davis" <bro...@freebsd.org>:
> Author: brooks
> Date: Wed Apr 11 17:28:24 2018
> New Revision: 332412
> URL: https://svnweb.freebsd.org/changeset/base/332412
>
> Log:
>   Remove support for FDDI networks.
Awesome!
Thank you!
>
>   Defines in net/if_media.h remain in case code copied from ifconfig is in
>   use elsewere (supporting non-existant media type is harmless).
>
>   Reviewed by: kib, jhb
>   Sponsored by: DARPA, AFRL
>   Differential Revision: https://reviews.freebsd.org/D15017
>
> Deleted:
>   head/share/man/man4/fpa.4
>   head/sys/dev/pdq/if_fpa.c
>   head/sys/dev/pdq/pdq.c
>   head/sys/dev/pdq/pdq_freebsd.h
>   head/sys/dev/pdq/pdq_ifsubr.c
>   head/sys/dev/pdq/pdqreg.h
>   head/sys/dev/pdq/pdqvar.h
>   head/sys/net/fddi.h
>   head/sys/net/if_fddisubr.c
> Modified:
>   head/ObsoleteFiles.inc
>   head/UPDATING
>   head/lib/libifconfig/libifconfig_media.c
>   head/sbin/etherswitchcfg/ifmedia.c
>   head/sbin/ifconfig/ifmedia.c
>   head/share/man/man4/Makefile
>   head/sys/conf/NOTES
>   head/sys/conf/files
>   head/sys/net/if.c
>   head/sys/net/if_bridge.c
>   head/sys/net/if_media.c
>   head/sys/netinet/if_ether.c
>   head/sys/netinet/ip_carp.c
>   head/sys/netinet6/in6.c
>   head/sys/netinet6/in6_ifattach.c
>   head/sys/netinet6/nd6.c
>   head/sys/netinet6/nd6_nbr.c
>   head/sys/nfs/bootp_subr.c
>
> Modified: head/ObsoleteFiles.inc
> ==
> --- head/ObsoleteFiles.inc Wed Apr 11 17:26:53 2018 (r332411)
> +++ head/ObsoleteFiles.inc Wed Apr 11 17:28:24 2018 (r332412)
> @@ -38,6 +38,8 @@
>  # xargs -n1 | sort | uniq -d;
>  # done
>
> +# 20180409: remove FDDI support
> +OLD_FILES+=usr/include/net/fddi.h
>  # 20180319: remove /boot/overlays, replaced by /boot/dtb/overlays
>  OLD_DIRS+=boot/overlays
>  # 20180311: remove sys/sys/i386/include/pcaudioio.h
>
> Modified: head/UPDATING
> ==
> --- head/UPDATING Wed Apr 11 17:26:53 2018 (r332411)
> +++ head/UPDATING Wed Apr 11 17:28:24 2018 (r332412)
> @@ -51,6 +51,11 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 12.x IS SLOW:
>
>  ** SPECIAL WARNING: 
> **
>
> +20180411:
> + Support for FDDI networks has been removed. If you have device
> + fddi or device fpa in your kernel config file they must be
> + removed.
> +
>  20180406:
>  In addition to supporting RFC 3164 formatted messages, the
>  syslogd(8) service is now capable of parsing RFC 5424 formatted
>
> Modified: head/lib/libifconfig/libifconfig_media.c
> ==
> --- head/lib/libifconfig/libifconfig_media.c Wed Apr 11 17:26:53 2018 
> (r332411)
> +++ head/lib/libifconfig/libifconfig_media.c Wed Apr 11 17:28:24 2018 
> (r332412)
> @@ -86,15 +86,6 @@ static struct ifmedia_description ifm_subtype_tokenrin
>  static struct ifmedia_description 
> ifm_subtype_tokenring_option_descriptions[] =
>  IFM_SUBTYPE_TOKENRING_OPTION_DESCRIPTIONS;
>
> -static struct ifmedia_description ifm_subtype_fddi_descriptions[] =
> - IFM_SUBTYPE_FDDI_DESCRIPTIONS;
> -
> -static struct ifmedia_description ifm_subtype_fddi_aliases[] =
> - IFM_SUBTYPE_FDDI_ALIASES;
> -
> -static struct ifmedia_description ifm_subtype_fddi_option_descriptions[] =
> - IFM_SUBTYPE_FDDI_OPTION_DESCRIPTIONS;
> -
>  static struct ifmedia_description ifm_subtype_ieee80211_descriptions[] =
>  IFM_SUBTYPE_IEEE80211_DESCRIPTIONS;
>
> @@ -182,24 +173,6 @@ static struct ifmedia_type_to_subtype ifmedia_types_to
>  { _shared_option_descriptions[0], 0 },
>  { _shared_option_aliases[0], 1 },
>  { _subtype_tokenring_option_descriptions[0], 0 },
> - { NULL, 0 },
> - },
> - {
> - { NULL, 0 },
> - },
> - },
> - {
> - {
> - { _subtype_shared_descriptions[0], 0 },
> - { _subtype_shared_aliases[0], 1 },
> - { _subtype_fddi_descriptions[0], 0 },
> - { _subtype_fddi_aliases[0], 1 },
> - { NULL, 0 },
> - },
> - {
> - { _shared_option_descriptions[0], 0 },
> - { _shared_option_aliases[0], 1 },
> - { _subtype_fddi_option_descriptions[0], 0 },
>  { NULL, 0 },
>  },
>  {
>
> Modified: head/sbin/etherswitchcfg/ifmedia.c
> ==
> --- head/sbin/etherswitchcfg/ifmedia.c Wed Apr 11 17:26:53 2018 (r332411)
> +++ head/sbin/etherswitchcfg/ifmedia.c Wed Apr 11 17:28

svn commit: r332412 - in head: . lib/libifconfig sbin/etherswitchcfg sbin/ifconfig share/man/man4 sys/conf sys/dev/pdq sys/net sys/netinet sys/netinet6 sys/nfs

2018-04-11 Thread Brooks Davis
Author: brooks
Date: Wed Apr 11 17:28:24 2018
New Revision: 332412
URL: https://svnweb.freebsd.org/changeset/base/332412

Log:
  Remove support for FDDI networks.
  
  Defines in net/if_media.h remain in case code copied from ifconfig is in
  use elsewere (supporting non-existant media type is harmless).
  
  Reviewed by:  kib, jhb
  Sponsored by: DARPA, AFRL
  Differential Revision:https://reviews.freebsd.org/D15017

Deleted:
  head/share/man/man4/fpa.4
  head/sys/dev/pdq/if_fpa.c
  head/sys/dev/pdq/pdq.c
  head/sys/dev/pdq/pdq_freebsd.h
  head/sys/dev/pdq/pdq_ifsubr.c
  head/sys/dev/pdq/pdqreg.h
  head/sys/dev/pdq/pdqvar.h
  head/sys/net/fddi.h
  head/sys/net/if_fddisubr.c
Modified:
  head/ObsoleteFiles.inc
  head/UPDATING
  head/lib/libifconfig/libifconfig_media.c
  head/sbin/etherswitchcfg/ifmedia.c
  head/sbin/ifconfig/ifmedia.c
  head/share/man/man4/Makefile
  head/sys/conf/NOTES
  head/sys/conf/files
  head/sys/net/if.c
  head/sys/net/if_bridge.c
  head/sys/net/if_media.c
  head/sys/netinet/if_ether.c
  head/sys/netinet/ip_carp.c
  head/sys/netinet6/in6.c
  head/sys/netinet6/in6_ifattach.c
  head/sys/netinet6/nd6.c
  head/sys/netinet6/nd6_nbr.c
  head/sys/nfs/bootp_subr.c

Modified: head/ObsoleteFiles.inc
==
--- head/ObsoleteFiles.inc  Wed Apr 11 17:26:53 2018(r332411)
+++ head/ObsoleteFiles.inc  Wed Apr 11 17:28:24 2018(r332412)
@@ -38,6 +38,8 @@
 #   xargs -n1 | sort | uniq -d;
 # done
 
+# 20180409: remove FDDI support
+OLD_FILES+=usr/include/net/fddi.h
 # 20180319: remove /boot/overlays, replaced by /boot/dtb/overlays
 OLD_DIRS+=boot/overlays
 # 20180311: remove sys/sys/i386/include/pcaudioio.h

Modified: head/UPDATING
==
--- head/UPDATING   Wed Apr 11 17:26:53 2018(r332411)
+++ head/UPDATING   Wed Apr 11 17:28:24 2018(r332412)
@@ -51,6 +51,11 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 12.x IS SLOW:
 
 ** SPECIAL WARNING: **
 
+20180411:
+   Support for FDDI networks has been removed.  If you have device
+   fddi or device fpa in your kernel config file they must be
+   removed.
+   
 20180406:
In addition to supporting RFC 3164 formatted messages, the
syslogd(8) service is now capable of parsing RFC 5424 formatted

Modified: head/lib/libifconfig/libifconfig_media.c
==
--- head/lib/libifconfig/libifconfig_media.cWed Apr 11 17:26:53 2018
(r332411)
+++ head/lib/libifconfig/libifconfig_media.cWed Apr 11 17:28:24 2018
(r332412)
@@ -86,15 +86,6 @@ static struct ifmedia_description ifm_subtype_tokenrin
 static struct ifmedia_description ifm_subtype_tokenring_option_descriptions[] =
 IFM_SUBTYPE_TOKENRING_OPTION_DESCRIPTIONS;
 
-static struct ifmedia_description ifm_subtype_fddi_descriptions[] =
-IFM_SUBTYPE_FDDI_DESCRIPTIONS;
-
-static struct ifmedia_description ifm_subtype_fddi_aliases[] =
-IFM_SUBTYPE_FDDI_ALIASES;
-
-static struct ifmedia_description ifm_subtype_fddi_option_descriptions[] =
-IFM_SUBTYPE_FDDI_OPTION_DESCRIPTIONS;
-
 static struct ifmedia_description ifm_subtype_ieee80211_descriptions[] =
 IFM_SUBTYPE_IEEE80211_DESCRIPTIONS;
 
@@ -182,24 +173,6 @@ static struct ifmedia_type_to_subtype ifmedia_types_to
{ _shared_option_descriptions[0],0 },
{ _shared_option_aliases[0], 1 },
{ _subtype_tokenring_option_descriptions[0], 0 },
-   { NULL,  0 },
-   },
-   {
-   { NULL,  0 },
-   },
-   },
-   {
-   {
-   { _subtype_shared_descriptions[0],   0 },
-   { _subtype_shared_aliases[0],1 },
-   { _subtype_fddi_descriptions[0], 0 },
-   { _subtype_fddi_aliases[0],  1 },
-   { NULL,  0 },
-   },
-   {
-   { _shared_option_descriptions[0],0 },
-   { _shared_option_aliases[0], 1 },
-   { _subtype_fddi_option_descriptions[0],  0 },
{ NULL,  0 },
},
{

Modified: head/sbin/etherswitchcfg/ifmedia.c
==
--- head/sbin/etherswitchcfg/ifmedia.c  Wed Apr 11 17:26:53 2018
(r332411)
+++ head/sbin/etherswitchcfg/ifmedia.c  Wed Apr 11 17:28:24 2018

svn commit: r332410 - svnadmin/conf

2018-04-11 Thread George V. Neville-Neil
Author: gnn
Date: Wed Apr 11 17:18:54 2018
New Revision: 332410
URL: https://svnweb.freebsd.org/changeset/base/332410

Log:
  Temporarily suspend Bruce Simpson's commit bit.
  
  Approved by: core

Modified:
  svnadmin/conf/access

Modified: svnadmin/conf/access
==
--- svnadmin/conf/accessWed Apr 11 15:15:34 2018(r332409)
+++ svnadmin/conf/accessWed Apr 11 17:18:54 2018(r332410)
@@ -40,7 +40,6 @@ bapt
 bde
 bdrewery
 benno
-bms
 br
 brd
 brooks
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r332091 - stable/11/sys/vm

2018-04-11 Thread John Baldwin
On Monday, April 09, 2018 07:29:09 PM Slawa Olhovchenkov wrote:
> On Fri, Apr 06, 2018 at 09:25:08AM +, Konstantin Belousov wrote:
> 
> > Author: kib
> > Date: Fri Apr  6 09:25:08 2018
> > New Revision: 332091
> > URL: https://svnweb.freebsd.org/changeset/base/332091
> > 
> > Log:
> >   MFC r331760:
> >   Make vm_map_max/min/pmap KBI stable.
> > 
> > Modified:
> >   stable/11/sys/vm/vm_map.c
> >   stable/11/sys/vm/vm_map.h
> > Directory Properties:
> >   stable/11/   (props changed)
> 
> -STABLE still crashed after load vboxnet build on 11.1-RELEASE
> nvidia (build on 11.1-RELEASE) also don't work

Yes, this only helps with the future KBI, it doesn't restore the
existing one.  However, r320889 which was committed earlier should
have restored the KBI?

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


Re: svn commit: r332389 - head/sys/net

2018-04-11 Thread Jonathan T. Looney
It appears this is causing panics (see the emails on freebsd-current@).

>From a brief glance, it appears that the new STATE_LOCK macros is used (and
causes panics), but the STATE_LOCK_INIT macro is not used. Is it possible
the code is missing an initialization call for the new mutex?

Jonathan

On Tue, Apr 10, 2018 at 3:48 PM, Stephen Hurd  wrote:

> Author: shurd
> Date: Tue Apr 10 19:48:24 2018
> New Revision: 332389
> URL: https://svnweb.freebsd.org/changeset/base/332389
>
> Log:
>   Split out flag manipulation from general context manipulation in iflib
>
>   To avoid blocking on the context lock in the swi thread and risk
> potential
>   deadlocks, this change protects lighter weight updates that only need to
>   be consistent with each other with their own lock.
>
>   Submitted by: Matthew Macy 
>   Reviewed by:  shurd
>   Sponsored by: Limelight Networks
>   Differential Revision:https://reviews.freebsd.org/D14967
>
> Modified:
>   head/sys/net/iflib.c
>
> Modified: head/sys/net/iflib.c
> 
> ==
> --- head/sys/net/iflib.cTue Apr 10 19:42:50 2018(r332388)
> +++ head/sys/net/iflib.cTue Apr 10 19:48:24 2018(r332389)
> @@ -1,5 +1,5 @@
>  /*-
> - * Copyright (c) 2014-2017, Matthew Macy 
> + * Copyright (c) 2014-2018, Matthew Macy 
>   * All rights reserved.
>   *
>   * Redistribution and use in source and binary forms, with or without
> @@ -163,7 +163,8 @@ struct iflib_ctx {
> if_shared_ctx_t ifc_sctx;
> struct if_softc_ctx ifc_softc_ctx;
>
> -   struct mtx ifc_mtx;
> +   struct mtx ifc_ctx_mtx;
> +   struct mtx ifc_state_mtx;
>
> uint16_t ifc_nhwtxqs;
> uint16_t ifc_nhwrxqs;
> @@ -318,8 +319,10 @@ typedef struct iflib_sw_tx_desc_array {
>  #defineIFC_INIT_DONE   0x020
>  #defineIFC_PREFETCH0x040
>  #defineIFC_DO_RESET0x080
> -#defineIFC_CHECK_HUNG  0x100
> +#defineIFC_DO_WATCHDOG 0x100
> +#defineIFC_CHECK_HUNG  0x200
>
> +
>  #define CSUM_OFFLOAD   (CSUM_IP_TSO|CSUM_IP6_TSO|CSUM_IP| \
>  CSUM_IP_UDP|CSUM_IP_TCP|CSUM_IP_SCTP| \
>  CSUM_IP6_UDP|CSUM_IP6_TCP|CSUM_IP6_SCTP)
> @@ -535,13 +538,19 @@ rxd_info_zero(if_rxd_info_t ri)
>
>  #define CTX_ACTIVE(ctx) ((if_getdrvflags((ctx)->ifc_ifp) &
> IFF_DRV_RUNNING))
>
> -#define CTX_LOCK_INIT(_sc, _name)  mtx_init(&(_sc)->ifc_mtx, _name,
> "iflib ctx lock", MTX_DEF)
> +#define CTX_LOCK_INIT(_sc, _name)  mtx_init(&(_sc)->ifc_ctx_mtx, _name,
> "iflib ctx lock", MTX_DEF)
> +#define CTX_LOCK(ctx) mtx_lock(&(ctx)->ifc_ctx_mtx)
> +#define CTX_UNLOCK(ctx) mtx_unlock(&(ctx)->ifc_ctx_mtx)
> +#define CTX_LOCK_DESTROY(ctx) mtx_destroy(&(ctx)->ifc_ctx_mtx)
>
> -#define CTX_LOCK(ctx) mtx_lock(&(ctx)->ifc_mtx)
> -#define CTX_UNLOCK(ctx) mtx_unlock(&(ctx)->ifc_mtx)
> -#define CTX_LOCK_DESTROY(ctx) mtx_destroy(&(ctx)->ifc_mtx)
>
> +#define STATE_LOCK_INIT(_sc, _name)  mtx_init(&(_sc)->ifc_state_mtx,
> _name, "iflib state lock", MTX_DEF)
> +#define STATE_LOCK(ctx) mtx_lock(&(ctx)->ifc_state_mtx)
> +#define STATE_UNLOCK(ctx) mtx_unlock(&(ctx)->ifc_state_mtx)
> +#define STATE_LOCK_DESTROY(ctx) mtx_destroy(&(ctx)->ifc_state_mtx)
>
> +
> +
>  #define CALLOUT_LOCK(txq)  mtx_lock(>ift_mtx)
>  #define CALLOUT_UNLOCK(txq)mtx_unlock(>ift_mtx)
>
> @@ -2144,18 +2153,14 @@ iflib_timer(void *arg)
> if (if_getdrvflags(ctx->ifc_ifp) & IFF_DRV_RUNNING)
> callout_reset_on(>ift_timer, hz/2, iflib_timer, txq,
> txq->ift_timer.c_cpu);
> return;
> -hung:
> -   CTX_LOCK(ctx);
> -   if_setdrvflagbits(ctx->ifc_ifp, IFF_DRV_OACTIVE, IFF_DRV_RUNNING);
> + hung:
> device_printf(ctx->ifc_dev,  "TX(%d) desc avail = %d, pidx = %d\n",
>   txq->ift_id, TXQ_AVAIL(txq),
> txq->ift_pidx);
> -
> -   IFDI_WATCHDOG_RESET(ctx);
> -   ctx->ifc_watchdog_events++;
> -
> -   ctx->ifc_flags |= IFC_DO_RESET;
> +   STATE_LOCK(ctx);
> +   if_setdrvflagbits(ctx->ifc_ifp, IFF_DRV_OACTIVE, IFF_DRV_RUNNING);
> +   ctx->ifc_flags |= (IFC_DO_WATCHDOG|IFC_DO_RESET);
> iflib_admin_intr_deferred(ctx);
> -   CTX_UNLOCK(ctx);
> +   STATE_UNLOCK(ctx);
>  }
>
>  static void
> @@ -2673,10 +2678,10 @@ iflib_rxeof(iflib_rxq_t rxq, qidx_t budget)
> return true;
> return (iflib_rxd_avail(ctx, rxq, *cidxp, 1));
>  err:
> -   CTX_LOCK(ctx);
> +   STATE_LOCK(ctx);
> ctx->ifc_flags |= IFC_DO_RESET;
> iflib_admin_intr_deferred(ctx);
> -   CTX_UNLOCK(ctx);
> +   STATE_UNLOCK(ctx);
> return (false);
>  }
>
> @@ -3706,27 +3711,35 @@ _task_fn_admin(void *context)
> if_softc_ctx_t sctx = >ifc_softc_ctx;
> iflib_txq_t txq;
> int i;
> +   

svn commit: r332409 - in head/sys/dev: bnxt e1000 ixgbe

2018-04-11 Thread Mark Johnston
Author: markj
Date: Wed Apr 11 15:15:34 2018
New Revision: 332409
URL: https://svnweb.freebsd.org/changeset/base/332409

Log:
  Use C99 initializers for iflib function tables.
  
  Reviewed by:  sbruno
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D15041

Modified:
  head/sys/dev/bnxt/bnxt_txrx.c
  head/sys/dev/e1000/em_txrx.c
  head/sys/dev/e1000/igb_txrx.c
  head/sys/dev/ixgbe/ix_txrx.c

Modified: head/sys/dev/bnxt/bnxt_txrx.c
==
--- head/sys/dev/bnxt/bnxt_txrx.c   Wed Apr 11 15:04:31 2018
(r332408)
+++ head/sys/dev/bnxt/bnxt_txrx.c   Wed Apr 11 15:15:34 2018
(r332409)
@@ -66,14 +66,14 @@ static int bnxt_isc_rxd_pkt_get(void *sc, if_rxd_info_
 static int bnxt_intr(void *sc);
 
 struct if_txrx bnxt_txrx  = {
-   bnxt_isc_txd_encap,
-   bnxt_isc_txd_flush,
-   bnxt_isc_txd_credits_update,
-   bnxt_isc_rxd_available,
-   bnxt_isc_rxd_pkt_get,
-   bnxt_isc_rxd_refill,
-   bnxt_isc_rxd_flush,
-   bnxt_intr
+   .ift_txd_encap = bnxt_isc_txd_encap,
+   .ift_txd_flush = bnxt_isc_txd_flush,
+   .ift_txd_credits_update = bnxt_isc_txd_credits_update,
+   .ift_rxd_available = bnxt_isc_rxd_available,
+   .ift_rxd_pkt_get = bnxt_isc_rxd_pkt_get,
+   .ift_rxd_refill = bnxt_isc_rxd_refill,
+   .ift_rxd_flush = bnxt_isc_rxd_flush,
+   .ift_legacy_intr = bnxt_intr
 };
 
 /*

Modified: head/sys/dev/e1000/em_txrx.c
==
--- head/sys/dev/e1000/em_txrx.cWed Apr 11 15:04:31 2018
(r332408)
+++ head/sys/dev/e1000/em_txrx.cWed Apr 11 15:15:34 2018
(r332409)
@@ -68,25 +68,25 @@ static int em_determine_rsstype(u32 pkt_info);
 extern int em_intr(void *arg);
 
 struct if_txrx em_txrx = {
-   em_isc_txd_encap,
-   em_isc_txd_flush,
-   em_isc_txd_credits_update,
-   em_isc_rxd_available,
-   em_isc_rxd_pkt_get,
-   em_isc_rxd_refill,
-   em_isc_rxd_flush,
-   em_intr
+   .ift_txd_encap = em_isc_txd_encap,
+   .ift_txd_flush = em_isc_txd_flush,
+   .ift_txd_credits_update = em_isc_txd_credits_update,
+   .ift_rxd_available = em_isc_rxd_available,
+   .ift_rxd_pkt_get = em_isc_rxd_pkt_get,
+   .ift_rxd_refill = em_isc_rxd_refill,
+   .ift_rxd_flush = em_isc_rxd_flush,
+   .ift_legacy_intr = em_intr
 };
 
 struct if_txrx lem_txrx = {
-   em_isc_txd_encap,
-   em_isc_txd_flush,
-   em_isc_txd_credits_update,
-   lem_isc_rxd_available,
-   lem_isc_rxd_pkt_get,
-   lem_isc_rxd_refill,
-   em_isc_rxd_flush,
-   em_intr
+   .ift_txd_encap = em_isc_txd_encap,
+   .ift_txd_flush = em_isc_txd_flush,
+   .ift_txd_credits_update = em_isc_txd_credits_update,
+   .ift_rxd_available = lem_isc_rxd_available,
+   .ift_rxd_pkt_get = lem_isc_rxd_pkt_get,
+   .ift_rxd_refill = lem_isc_rxd_refill,
+   .ift_rxd_flush = em_isc_rxd_flush,
+   .ift_legacy_intr = em_intr
 };
 
 extern if_shared_ctx_t em_sctx;

Modified: head/sys/dev/e1000/igb_txrx.c
==
--- head/sys/dev/e1000/igb_txrx.c   Wed Apr 11 15:04:31 2018
(r332408)
+++ head/sys/dev/e1000/igb_txrx.c   Wed Apr 11 15:15:34 2018
(r332409)
@@ -62,14 +62,14 @@ extern void igb_if_enable_intr(if_ctx_t ctx);
 extern int em_intr(void *arg);
 
 struct if_txrx igb_txrx = {
-   igb_isc_txd_encap,
-   igb_isc_txd_flush,
-   igb_isc_txd_credits_update,
-   igb_isc_rxd_available,
-   igb_isc_rxd_pkt_get,
-   igb_isc_rxd_refill,
-   igb_isc_rxd_flush,
-   em_intr
+   .ift_txd_encap = igb_isc_txd_encap,
+   .ift_txd_flush = igb_isc_txd_flush,
+   .ift_txd_credits_update = igb_isc_txd_credits_update,
+   .ift_rxd_available = igb_isc_rxd_available,
+   .ift_rxd_pkt_get = igb_isc_rxd_pkt_get,
+   .ift_rxd_refill = igb_isc_rxd_refill,
+   .ift_rxd_flush = igb_isc_rxd_flush,
+   .ift_legacy_intr = em_intr
 };
 
 extern if_shared_ctx_t em_sctx;

Modified: head/sys/dev/ixgbe/ix_txrx.c
==
--- head/sys/dev/ixgbe/ix_txrx.cWed Apr 11 15:04:31 2018
(r332408)
+++ head/sys/dev/ixgbe/ix_txrx.cWed Apr 11 15:15:34 2018
(r332409)
@@ -62,14 +62,14 @@ extern void ixgbe_if_enable_intr(if_ctx_t ctx);
 static int ixgbe_determine_rsstype(u16 pkt_info);
 
 struct if_txrx ixgbe_txrx  = {
-   ixgbe_isc_txd_encap,
-   ixgbe_isc_txd_flush,
-   ixgbe_isc_txd_credits_update,
-   ixgbe_isc_rxd_available,
-   ixgbe_isc_rxd_pkt_get,
-   ixgbe_isc_rxd_refill,
-   ixgbe_isc_rxd_flush,
-   NULL
+   .ift_txd_encap = ixgbe_isc_txd_encap,
+   .ift_txd_flush = ixgbe_isc_txd_flush,
+   .ift_txd_credits_update = 

Re: svn commit: r332386 - head/share/misc

2018-04-11 Thread Kenneth D. Merry
On Tue, Apr 10, 2018 at 14:27:26 -0500, Kyle Evans wrote:
> On Tue, Apr 10, 2018 at 2:22 PM, Rodney W. Grimes
>  wrote:
> > [ Charset UTF-8 unsupported, converting... ]
> >> Author: ram
> >> Date: Tue Apr 10 18:39:20 2018
> >> New Revision: 332386
> >> URL: https://svnweb.freebsd.org/changeset/base/332386
> >>
> >> Log:
> >>   Updated mentors information.
> >>
> >>   Approved by: ken, mav
> >>
> >> Modified:
> >>   head/share/misc/committers-src.dot
> >>
> >> Modified: head/share/misc/committers-src.dot
> >> ==
> >> --- head/share/misc/committers-src.dotTue Apr 10 18:05:02 2018 
> >>(r332385)
> >> +++ head/share/misc/committers-src.dotTue Apr 10 18:39:20 2018 
> >>(r332386)
> >> @@ -76,6 +76,7 @@ nate [label="Nate Willams\nn...@freebsd.org\n1993/06/1
> >>  njl [label="Nate Lawson\n...@freebsd.org\n2002/08/07\n2008/02/16"]
> >>  non [label="Noriaki Mitsnaga\n...@freebsd.org\n2000/06/19\n2007/03/06"]
> >>  onoe [label="Atsushi Onoe\no...@freebsd.org\n2000/07/21\n2008/11/10"]
> >> +ram [label="Ram Kishore Vegesna\n...@freebsd.org\n2018/04/04\n???/??/??"]
> >  ^
> > That should be removed, you only have a start date.
> > Oh and Welcome ram to the project!
> >
> 
> The entry is also smack dab in the middle of the alumni section,
> rather than the later 'active' section. =)

Oops.  My fault for not paying attention. :(

Pointy hat to:  ken

Ram, could you fix this and send me the diffs for approval before you
commit it?

Thanks,

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


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

2018-04-11 Thread Mark Johnston
On Wed, Apr 11, 2018 at 12:51:55AM -0400, Allan Jude wrote:
> On 2018-04-10 09:56, Mark Johnston wrote:
> > Author: markj
> > Date: Tue Apr 10 13:56:06 2018
> > New Revision: 332365
> > URL: https://svnweb.freebsd.org/changeset/base/332365
> > 
> > Log:
> >   Set zfs_arc_free_target to v_free_target.
> >   
> >   Page daemon output is now regulated by a PID controller with a setpoint
> >   of v_free_target. Moreover, the page daemon now wakes up regularly
> >   rather than waiting for a wakeup from another thread. This means that
> >   the free page count is unlikely to drop below the old
> >   zfs_arc_free_target value, and as a result the ARC was not readily
> >   freeing pages under memory pressure. Address the immediate problem by
> >   updating zfs_arc_free_target to match the page daemon's new behaviour.
> >   
> >   Reported and tested by:   truckman
> >   Discussed with:   jeff
> >   X-MFC with:   r329882
> >   Differential Revision:https://reviews.freebsd.org/D14994
> > 
> 
> On a somewhat unrelated note, can we rename this sysctl and change to be
> counted in bytes? When users are tuning ZFS, every other ZFS value is in
> bytes, not pages.
> 
> Maybe keep the currently variable as it is, in pages, and adjust it by
> dividing the user set value by the page size.
> 
> The current name is great, but I wouldn't want anyone to end up setting
> it to 4096x the value they actually want if we just changed it out from
> under them.

Sure, any suggestions for what the new sysctl should be named?
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r332395 - head/sys/kern

2018-04-11 Thread Bruce Evans

On Tue, 10 Apr 2018, Ian Lepore wrote:


URL: https://svnweb.freebsd.org/changeset/base/332395

Log:
 Use explicit_bzero() when cleaning values out of the kernel environment.

 Sometimes the values contain geli passphrases being communicated from
 loader(8) to the kernel, and some day the compiler may decide to start
 eliding calls to memset() for a pointer which is not dereferenced again
 before being passed to free().


Using memset() in the kernel is also a style bug.  I used to police this
in files that I used, and there were still only 37 instances of it in
kern/*.c before this commit.  There were 209 instances of using the BSD
API bzero().

It is interesting that using memset() also asks for security holes.

bzero() already has the correct semantics for avoiding security holes,
so explicit_bzero() instead of just bzero() in the kernel is another
style bug.  There were only 6 instances of this style bug in kern/*.c
(all in kern_shutdown.c).

Most places where there is an obvious security bug just use bzero().  The
most common bug was for copying out structs.  Padding in the structs must
be zeroed, and bzero() is a good way to do this.  In this case, the
compiler can't see where the copy is used, so even bzero() is safe.

bzero() should not cause security bugs anywhere, since it is not a
standard C function so C compilers cannot know what it does.  However,
it is a standard POSIX function so C compilers with POSIX extensions
could know what it does.  POSIX has a deficient specification of it in
at least the 2001 version.  It says that "The bzero() function shall
place n zero-valued bytes in the area pointed to by s" and under
APPLICATION USAGE it says "[bad advice on preferring memset() deleted.
Now I quote its bad advice on portability:] for maximum portability,
it is recommended to replace the function call to bzero [by]
#define bzero(b,len) (memset((b), '\0', (len)), (void) 0).  The C
standard says much the same for memset(), but it is clearer that the
"as if" rule applies to memset(), so compilers don't have to actually
fill in the array as specified they can prove that no conforming program
can tell the difference.  Before POSIX standardized bzero() in 2001,
compilers couldn't do the same opimization for bzero(), so the de-facto
standard for it was to actually fill in the array and this is what should
have been standardized.  Similarly for memset() when it was standardized
in the late 1980's.  Not many people would have noticed and/or cared about
the security problem then.  It should have been better known in 2001.

In the kernel, the compiler cannot know what even memset() does, since the
kernel is built by freestanding compilers.  However, bzero() was recently
optimized to use __builtin_memset().  This is an invalid optimization,
since it gives the security hole.  bzero(9) is actually documented, but
its documentation has the same deficiencies as POSIX's and FreeBSD's
bzero(3) -- it is unobvious if the "as if" rule applies to these functions.
(The "as if" rule probably applies to all APIs, but it is too difficult
to determine and allow for operations not don;t exactly what their man
page says they do.)

Strangely, memset() in the kernel is not optimized using
__builtin_memset(), although this optimization might be valid.  (No
one knows what memset() in the kernel does since it doesn't have even
a fuzzy memset(9).).  memset(9) is still correctly deprecated by not
optimizing it like bzero(9).  It is significantly pessimized only for
a nonzero full byte -- then it uses a simple loop, with the loop bogusly
optimized by inlining it.  For a zero fill byte, it uses bzero() which
often uses __builtin_memset().  clang and even gcc-4.2.1 have a builtin
bzero, but this is not used.  Its semantics are as unclear as bzero()'s.

The simple loop for memset() in the nonzero fill-byte case is an older
mistake.  IIRC, it was originally only done for the inline memset() in
libkern.h.  However, due to bugs in builtins and possibly with -O0,
memset() is need as an extern function too.  So the loop occurs in
the inline version where it is mostly a negative optimization for space,
and in the extern version where it is good enough.  Inlining the loop
only clearly optimizes for security holes -- it allows the compiler to
see what the function does, so the compiler can make it do nothing.

However, in the freestanding case, it is still an invalid optimization
to not zero things before they are freed.  The compiler cannot know
what free(9) does unless free() is inlined, and free() is too large to
even be inlined.  So explicit_bzero() is needed here even less than in
most places.

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


svn commit: r332405 - head/bin/setfacl

2018-04-11 Thread Ed Maste
Author: emaste
Date: Wed Apr 11 13:33:12 2018
New Revision: 332405
URL: https://svnweb.freebsd.org/changeset/base/332405

Log:
  setfacl: minor man page edit to appease igor(1)

Modified:
  head/bin/setfacl/setfacl.1

Modified: head/bin/setfacl/setfacl.1
==
--- head/bin/setfacl/setfacl.1  Wed Apr 11 11:43:12 2018(r332404)
+++ head/bin/setfacl/setfacl.1  Wed Apr 11 13:33:12 2018(r332405)
@@ -80,7 +80,8 @@ entries of the current ACL.
 The operations apply to the default ACL entries instead of
 access ACL entries.
 Currently only directories may have
-default ACL's.  This option is not applicable to NFSv4 ACLs.
+default ACL's.
+This option is not applicable to NFSv4 ACLs.
 .It Fl h
 If the target of the operation is a symbolic link, perform the operation
 on the symbolic link itself, rather than following the link.
@@ -96,8 +97,9 @@ It
 is not considered an error if the specified files do not have
 any default ACL entries.
 An error will be reported if any of
-the specified files cannot have a default entry (i.e.\&
-non-directories).  This option is not applicable to NFSv4 ACLs.
+the specified files cannot have a default entry (i.e.,
+non-directories).
+This option is not applicable to NFSv4 ACLs.
 .It Fl L
 If the
 .Fl R
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r332404 - head/sys/netpfil/pf

2018-04-11 Thread Kristof Provost
Author: kp
Date: Wed Apr 11 11:43:12 2018
New Revision: 332404
URL: https://svnweb.freebsd.org/changeset/base/332404

Log:
  pf: limit ioctl to a reasonable and tuneable number of elements
  
  pf ioctls frequently take a variable number of elements as argument. This can
  potentially allow users to request very large allocations.  These will fail,
  but even a failing M_NOWAIT might tie up resources and result in concurrent
  M_WAITOK allocations entering vm_wait and inducing reclamation of caches.
  
  Limit these ioctls to what should be a reasonable value, but allow users to
  tune it should they need to.
  
  Differential Revision:https://reviews.freebsd.org/D15018

Modified:
  head/sys/netpfil/pf/pf.c
  head/sys/netpfil/pf/pf_ioctl.c

Modified: head/sys/netpfil/pf/pf.c
==
--- head/sys/netpfil/pf/pf.cWed Apr 11 11:17:57 2018(r332403)
+++ head/sys/netpfil/pf/pf.cWed Apr 11 11:43:12 2018(r332404)
@@ -369,11 +369,14 @@ u_longpf_hashmask;
 u_long pf_srchashmask;
 static u_long  pf_hashsize;
 static u_long  pf_srchashsize;
+u_long pf_ioctl_maxcount = 65535;
 
 SYSCTL_ULONG(_net_pf, OID_AUTO, states_hashsize, CTLFLAG_RDTUN,
 _hashsize, 0, "Size of pf(4) states hashtable");
 SYSCTL_ULONG(_net_pf, OID_AUTO, source_nodes_hashsize, CTLFLAG_RDTUN,
 _srchashsize, 0, "Size of pf(4) source nodes hashtable");
+SYSCTL_ULONG(_net_pf, OID_AUTO, request_maxcount, CTLFLAG_RDTUN,
+_ioctl_maxcount, 0, "Maximum number of tables, addresses, ... in a 
single ioctl() call");
 
 VNET_DEFINE(void *, pf_swi_cookie);
 

Modified: head/sys/netpfil/pf/pf_ioctl.c
==
--- head/sys/netpfil/pf/pf_ioctl.c  Wed Apr 11 11:17:57 2018
(r332403)
+++ head/sys/netpfil/pf/pf_ioctl.c  Wed Apr 11 11:43:12 2018
(r332404)
@@ -89,8 +89,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #endif
 
-#define PF_TABLES_MAX_REQUEST   65535 /* Maximum tables per request. */
-
 static struct pf_pool  *pf_get_pool(char *, u_int32_t, u_int8_t, u_int32_t,
u_int8_t, u_int8_t, u_int8_t);
 
@@ -218,6 +216,8 @@ pfsync_defer_t  *pfsync_defer_ptr = 
NULL;
 /* pflog */
 pflog_packet_t *pflog_packet_ptr = NULL;
 
+extern u_long  pf_ioctl_maxcount;
+
 static void
 pfattach_vnet(void)
 {
@@ -2533,7 +2533,8 @@ DIOCCHANGEADDR_error:
break;
}
 
-   if (io->pfrio_size < 0 || io->pfrio_size > 
PF_TABLES_MAX_REQUEST) {
+   if (io->pfrio_size < 0 || io->pfrio_size > pf_ioctl_maxcount ||
+   WOULD_OVERFLOW(io->pfrio_size, sizeof(struct pfr_table))) {
error = ENOMEM;
break;
}
@@ -2564,7 +2565,8 @@ DIOCCHANGEADDR_error:
break;
}
 
-   if (io->pfrio_size < 0 || io->pfrio_size > 
PF_TABLES_MAX_REQUEST) {
+   if (io->pfrio_size < 0 || io->pfrio_size > pf_ioctl_maxcount ||
+   WOULD_OVERFLOW(io->pfrio_size, sizeof(struct pfr_table))) {
error = ENOMEM;
break;
}
@@ -2741,6 +2743,7 @@ DIOCCHANGEADDR_error:
break;
}
if (io->pfrio_size < 0 ||
+   io->pfrio_size > pf_ioctl_maxcount ||
WOULD_OVERFLOW(io->pfrio_size, sizeof(struct pfr_addr))) {
error = EINVAL;
break;
@@ -2778,6 +2781,7 @@ DIOCCHANGEADDR_error:
break;
}
if (io->pfrio_size < 0 ||
+   io->pfrio_size > pf_ioctl_maxcount ||
WOULD_OVERFLOW(io->pfrio_size, sizeof(struct pfr_addr))) {
error = EINVAL;
break;
@@ -2819,7 +2823,8 @@ DIOCCHANGEADDR_error:
break;
}
count = max(io->pfrio_size, io->pfrio_size2);
-   if (WOULD_OVERFLOW(count, sizeof(struct pfr_addr))) {
+   if (count > pf_ioctl_maxcount ||
+   WOULD_OVERFLOW(count, sizeof(struct pfr_addr))) {
error = EINVAL;
break;
}
@@ -2857,6 +2862,7 @@ DIOCCHANGEADDR_error:
break;
}
if (io->pfrio_size < 0 ||
+   io->pfrio_size > pf_ioctl_maxcount ||
WOULD_OVERFLOW(io->pfrio_size, sizeof(struct pfr_addr))) {
error = EINVAL;
break;
@@ -2888,6 +2894,7 @@ DIOCCHANGEADDR_error:
break;
}
if (io->pfrio_size < 0 ||
+   io->pfrio_size > pf_ioctl_maxcount ||

svn commit: r332403 - head/sbin/ipfw

2018-04-11 Thread Oleg Bulyzhin
Author: oleg
Date: Wed Apr 11 11:17:57 2018
New Revision: 332403
URL: https://svnweb.freebsd.org/changeset/base/332403

Log:
  Fix typo.
  
  MFC after:1 week

Modified:
  head/sbin/ipfw/ipfw.8

Modified: head/sbin/ipfw/ipfw.8
==
--- head/sbin/ipfw/ipfw.8   Wed Apr 11 11:12:20 2018(r332402)
+++ head/sbin/ipfw/ipfw.8   Wed Apr 11 11:17:57 2018(r332403)
@@ -2233,7 +2233,7 @@ of the firewall and quickly (and atomically) switch be
 By default, tables from set 0 are referenced when adding rule with
 table opcodes regardless of rule set.
 This behavior can be changed by setting
-.Va net.inet.ip.fw.tables_set
+.Va net.inet.ip.fw.tables_sets
 variable to 1.
 Rule's set will then be used for table references.
 .Pp
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2018-04-11 Thread Oleg Bulyzhin
Author: oleg
Date: Wed Apr 11 11:12:20 2018
New Revision: 332402
URL: https://svnweb.freebsd.org/changeset/base/332402

Log:
  Fix ipfw table creation when net.inet.ip.fw.tables_sets = 0 and non zero set
  specified on table creation. This fixes following:
  
  # sysctl net.inet.ip.fw.tables_sets
  net.inet.ip.fw.tables_sets: 0
  # ipfw table all info
  # ipfw set 1 table 1 create type addr
  # ipfw set 1 table 1 create type addr
  # ipfw add 10 set 1 count ip from table\(1\) to any
  00010 count ip from table(1) to any
  # ipfw add 10 set 1 count ip from table\(1\) to any
  00010 count ip from table(1) to any
  # ipfw table all info
  --- table(1), set(1) ---
   kindex: 4, type: addr
   references: 1, valtype: legacy
   algorithm: addr:radix
   items: 0, size: 296
  --- table(1), set(1) ---
   kindex: 3, type: addr
   references: 1, valtype: legacy
   algorithm: addr:radix
   items: 0, size: 296
  --- table(1), set(1) ---
   kindex: 2, type: addr
   references: 0, valtype: legacy
   algorithm: addr:radix
   items: 0, size: 296
  --- table(1), set(1) ---
   kindex: 1, type: addr
   references: 0, valtype: legacy
   algorithm: addr:radix
   items: 0, size: 296
  #
  
  MFC after:1 week

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

Modified: head/sys/netpfil/ipfw/ip_fw_table.c
==
--- head/sys/netpfil/ipfw/ip_fw_table.c Wed Apr 11 10:36:20 2018
(r332401)
+++ head/sys/netpfil/ipfw/ip_fw_table.c Wed Apr 11 11:12:20 2018
(r332402)
@@ -3171,7 +3171,7 @@ alloc_table_config(struct ip_fw_chain *ch, struct tid_
if (ntlv == NULL)
return (NULL);
name = ntlv->name;
-   set = ntlv->set;
+   set = (V_fw_tables_sets == 0) ? 0 : ntlv->set;
} else {
/* Compat part: convert number to string representation */
snprintf(bname, sizeof(bname), "%d", ti->uidx);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r332401 - in stable/11/sys: conf modules/ipfw netinet netpfil/ipfw

2018-04-11 Thread Andrey V. Elsukov
Author: ae
Date: Wed Apr 11 10:36:20 2018
New Revision: 332401
URL: https://svnweb.freebsd.org/changeset/base/332401

Log:
  MFC r328988,r328989:
Rework ipfw dynamic states implementation to be lockless on fast path.
  
o added struct ipfw_dyn_info that keeps all needed for ipfw_chk and
  for dynamic states implementation information;
o added DYN_LOOKUP_NEEDED() macro that can be used to determine the
  need of new lookup of dynamic states;
o ipfw_dyn_rule now becomes obsolete. Currently it used to pass
  information from kernel to userland only.
o IPv4 and IPv6 states now described by different structures
  dyn_ipv4_state and dyn_ipv6_state;
o IPv6 scope zones support is added;
o ipfw(4) now depends from Concurrency Kit;
o states are linked with "entry" field using CK_SLIST. This allows
  lockless lookup and protected by mutex modifications.
o the "expired" SLIST field is used for states expiring.
o struct dyn_data is used to keep generic information for both IPv4
  and IPv6;
o struct dyn_parent is used to keep O_LIMIT_PARENT information;
o IPv4 and IPv6 states are stored in different hash tables;
o O_LIMIT_PARENT states now are kept separately from O_LIMIT and
  O_KEEP_STATE states;
o per-cpu dyn_hp pointers are used to implement hazard pointers and they
  prevent freeing states that are locklessly used by lookup threads;
o mutexes to protect modification of lists in hash tables now kept in
  separate arrays. 65535 limit to maximum number of hash buckets now
  removed.
o Separate lookup and install functions added for IPv4 and IPv6 states
  and for parent states.
o By default now is used Jenkinks hash function.
  
Obtained from:  Yandex LLC
Sponsored by:   Yandex LLC
Differential Revision:  https://reviews.freebsd.org/D12685

Modified:
  stable/11/sys/conf/files
  stable/11/sys/modules/ipfw/Makefile
  stable/11/sys/netinet/ip_fw.h
  stable/11/sys/netpfil/ipfw/ip_fw2.c
  stable/11/sys/netpfil/ipfw/ip_fw_dynamic.c
  stable/11/sys/netpfil/ipfw/ip_fw_private.h
  stable/11/sys/netpfil/ipfw/ip_fw_sockopt.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/conf/files
==
--- stable/11/sys/conf/filesWed Apr 11 10:24:47 2018(r332400)
+++ stable/11/sys/conf/filesWed Apr 11 10:36:20 2018(r332401)
@@ -4201,7 +4201,8 @@ netpfil/ipfw/ip_dn_io.c   optional inet dummynet
 netpfil/ipfw/ip_dn_glue.c  optional inet dummynet
 netpfil/ipfw/ip_fw2.c  optional inet ipfirewall
 netpfil/ipfw/ip_fw_bpf.c   optional inet ipfirewall
-netpfil/ipfw/ip_fw_dynamic.c   optional inet ipfirewall
+netpfil/ipfw/ip_fw_dynamic.c   optional inet ipfirewall \
+   compile-with "${NORMAL_C} -I$S/contrib/ck/include"
 netpfil/ipfw/ip_fw_eaction.c   optional inet ipfirewall
 netpfil/ipfw/ip_fw_log.c   optional inet ipfirewall
 netpfil/ipfw/ip_fw_pfil.c  optional inet ipfirewall

Modified: stable/11/sys/modules/ipfw/Makefile
==
--- stable/11/sys/modules/ipfw/Makefile Wed Apr 11 10:24:47 2018
(r332400)
+++ stable/11/sys/modules/ipfw/Makefile Wed Apr 11 10:36:20 2018
(r332401)
@@ -9,7 +9,7 @@ SRCS+=  ip_fw_sockopt.c ip_fw_table.c ip_fw_table_algo.
 SRCS+= ip_fw_table_value.c
 SRCS+= opt_inet.h opt_inet6.h opt_ipdivert.h opt_ipfw.h
 
-CFLAGS+= -DIPFIREWALL
+CFLAGS+= -DIPFIREWALL -I${SRCTOP}/sys/contrib/ck/include
 #
 #If you want it verbose
 #CFLAGS+= -DIPFIREWALL_VERBOSE

Modified: stable/11/sys/netinet/ip_fw.h
==
--- stable/11/sys/netinet/ip_fw.h   Wed Apr 11 10:24:47 2018
(r332400)
+++ stable/11/sys/netinet/ip_fw.h   Wed Apr 11 10:36:20 2018
(r332401)
@@ -669,7 +669,7 @@ struct ipfw_flow_id {
uint32_tsrc_ip;
uint16_tdst_port;
uint16_tsrc_port;
-   uint8_t fib;
+   uint8_t fib;/* XXX: must be uint16_t */
uint8_t proto;
uint8_t _flags; /* protocol-specific flags */
uint8_t addr_type; /* 4=ip4, 6=ip6, 1=ether ? */
@@ -680,6 +680,7 @@ struct ipfw_flow_id {
 };
 #endif
 
+#defineIS_IP4_FLOW_ID(id)  ((id)->addr_type == 4)
 #define IS_IP6_FLOW_ID(id) ((id)->addr_type == 6)
 
 /*

Modified: stable/11/sys/netpfil/ipfw/ip_fw2.c
==
--- stable/11/sys/netpfil/ipfw/ip_fw2.c Wed Apr 11 10:24:47 2018
(r332400)
+++ stable/11/sys/netpfil/ipfw/ip_fw2.c Wed Apr 11 10:36:20 2018
(r332401)
@@ -1385,8 +1385,7 @@ ipfw_chk(struct ip_fw_args *args)
 *  MATCH_NONE when checked and not matched (q = NULL),
 *  MATCH_FORWARD or MATCH_REVERSE 

svn commit: r332400 - stable/11/sbin/ipfw

2018-04-11 Thread Andrey V. Elsukov
Author: ae
Date: Wed Apr 11 10:24:47 2018
New Revision: 332400
URL: https://svnweb.freebsd.org/changeset/base/332400

Log:
  MFC r331668:
Rework ipfw rules parsing and printing code.
  
Introduce show_state structure to keep information about printed opcodes.
Split show_static_rule() function into several smaller functions. Make
parsing and printing opcodes into several passes. Each printed opcode
is marked in show_state structure and will be skipped in next passes.
Now show_static_rule() function is simple, it just prints each part
of rule separately: action, modifiers, proto, src and dst addresses,
options. The main goal of this change is avoiding occurrence of wrong
result of `ifpw show` command, that can not be parsed by ipfw(8).
Also now it is possible to make some simple static optimizations
by reordering of opcodes in the rule.
  
PR: 222705

Modified:
  stable/11/sbin/ipfw/ipfw2.c
  stable/11/sbin/ipfw/ipfw2.h
  stable/11/sbin/ipfw/main.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sbin/ipfw/ipfw2.c
==
--- stable/11/sbin/ipfw/ipfw2.c Wed Apr 11 07:15:30 2018(r332399)
+++ stable/11/sbin/ipfw/ipfw2.c Wed Apr 11 10:24:47 2018(r332400)
@@ -1176,7 +1176,7 @@ print_flags(struct buf_pr *bp, char const *name, ipfw_
  * Print the ip address contained in a command.
  */
 static void
-print_ip(struct buf_pr *bp, struct format_opts *fo, ipfw_insn_ip *cmd,
+print_ip(struct buf_pr *bp, const struct format_opts *fo, ipfw_insn_ip *cmd,
 char const *s)
 {
struct hostent *he = NULL;
@@ -1277,7 +1277,7 @@ print_ip(struct buf_pr *bp, struct format_opts *fo, ip
  * prints a MAC address/mask pair
  */
 static void
-print_mac(struct buf_pr *bp, uint8_t *addr, uint8_t *mask)
+format_mac(struct buf_pr *bp, uint8_t *addr, uint8_t *mask)
 {
int l = contigmask(mask, 48);
 
@@ -1296,6 +1296,15 @@ print_mac(struct buf_pr *bp, uint8_t *addr, uint8_t *m
 }
 
 static void
+print_mac(struct buf_pr *bp, ipfw_insn_mac *mac)
+{
+
+   bprintf(bp, " MAC");
+   format_mac(bp, mac->addr, mac->mask);
+   format_mac(bp, mac->addr + 6, mac->mask + 6);
+}
+
+static void
 fill_icmptypes(ipfw_insn_u32 *cmd, char *av)
 {
uint8_t type;
@@ -1358,817 +1367,843 @@ print_dscp(struct buf_pr *bp, ipfw_insn_u32 *cmd)
}
 }
 
-/*
- * show_ipfw() prints the body of an ipfw rule.
- * Because the standard rule has at least proto src_ip dst_ip, we use
- * a helper function to produce these entries if not provided explicitly.
- * The first argument is the list of fields we have, the second is
- * the list of fields we want to be printed.
- *
- * Special cases if we have provided a MAC header:
- *   + if the rule does not contain IP addresses/ports, do not print them;
- *   + if the rule does not contain an IP proto, print "all" instead of "ip";
- *
- * Once we have 'have_options', IP header fields are printed as options.
- */
+#defineinsntod(cmd, type)  ((ipfw_insn_ ## type *)(cmd))
+struct show_state {
+   struct ip_fw_rule   *rule;
+   const ipfw_insn *eaction;
+   uint8_t *printed;
+   int flags;
 #defineHAVE_PROTO  0x0001
 #defineHAVE_SRCIP  0x0002
 #defineHAVE_DSTIP  0x0004
-#defineHAVE_PROTO4 0x0008
-#defineHAVE_PROTO6 0x0010
-#defineHAVE_IP 0x0100
-#defineHAVE_OPTIONS0x8000
+   int proto;
+   int or_block;
+};
 
-static void
-show_prerequisites(struct buf_pr *bp, int *flags, int want, int cmd)
+static int
+init_show_state(struct show_state *state, struct ip_fw_rule *rule)
 {
-   (void)cmd;  /* UNUSED */
-   if (co.comment_only)
-   return;
-   if ( (*flags & HAVE_IP) == HAVE_IP)
-   *flags |= HAVE_OPTIONS;
 
-   if ( !(*flags & HAVE_OPTIONS)) {
-   if ( !(*flags & HAVE_PROTO) && (want & HAVE_PROTO)) {
-   if ( (*flags & HAVE_PROTO4))
-   bprintf(bp, " ip4");
-   else if ( (*flags & HAVE_PROTO6))
-   bprintf(bp, " ip6");
-   else
-   bprintf(bp, " ip");
-   }
-   if ( !(*flags & HAVE_SRCIP) && (want & HAVE_SRCIP))
-   bprintf(bp, " from any");
-   if ( !(*flags & HAVE_DSTIP) && (want & HAVE_DSTIP))
-   bprintf(bp, " to any");
-   }
-   *flags |= want;
+   state->printed = calloc(rule->cmd_len, sizeof(uint8_t));
+   if (state->printed == NULL)
+   return (ENOMEM);
+   state->rule = rule;
+   state->eaction = NULL;
+   state->flags = 0;
+   state->proto = 0;
+   state->or_block = 0;
+   return (0);
 }
 
 

svn commit: r332399 - head/tests/sys/acl

2018-04-11 Thread Eitan Adler
Author: eadler
Date: Wed Apr 11 07:15:30 2018
New Revision: 332399
URL: https://svnweb.freebsd.org/changeset/base/332399

Log:
  [tests] change tests/sys/acl/run to run on perl 5.26
  
  Previously unescaped regex just resulted in a warning. Now it results in
  a failed test.

Modified:
  head/tests/sys/acl/run

Modified: head/tests/sys/acl/run
==
--- head/tests/sys/acl/run  Wed Apr 11 01:43:29 2018(r332398)
+++ head/tests/sys/acl/run  Wed Apr 11 07:15:30 2018(r332399)
@@ -70,7 +70,7 @@ for (;;) {
   if (defined $line) {
 # Substitute %VAR and %{VAR} with environment variables.
 $line =~ s[%(\w+)][$ENV{$1}]eg;
-$line =~ s[%{(\w+)}][$ENV{$1}]eg;
+$line =~ s[%\{(\w+)\}][$ENV{$1}]eg;
   }
   if (defined $line) {
 if ($line =~ s/^\s*< ?//) {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"