svn commit: r357168 - in stable/12/contrib/llvm-project: clang/lib/Basic/Targets clang/lib/Driver/ToolChains/Arch llvm/include/llvm/ADT llvm/lib/Support llvm/lib/Target/PowerPC

2020-01-26 Thread Dimitry Andric
Author: dim
Date: Mon Jan 27 07:03:57 2020
New Revision: 357168
URL: https://svnweb.freebsd.org/changeset/base/357168

Log:
  MFC r356929:
  
  Merge commit bc4bc5aa0 from llvm git (by Justin Hibbits):
  
Add 8548 CPU definition and attributes
  
8548 CPU is GCC's name for the e500v2, so accept this in clang.  The
e500v2 doesn't support lwsync, so define __NO_LWSYNC__ for this as
well, as GCC does.
  
Differential Revision:  https://reviews.llvm.org/D67787
  
  Merge commit ff0311c4b from llvm git (by Justin Hibbits):
  
[PowerPC]: Add powerpcspe target triple subarch component
  
Summary:
This allows the use of '-target powerpcspe-unknown-linux-gnu' or
'powerpcspe-unknown-freebsd' to be used, instead of '-target
powerpc-unknown-linux-gnu -mspe'.
  
Reviewed By: dim
Differential Revision: https://reviews.llvm.org/D72014
  
  Merge commit ba91dffaf from llvm git (by Fangrui Song):
  
[Driver][PowerPC] Move powerpcspe logic from cc1 to Driver
  
Follow-up of D72014. It is more appropriate to use a target feature
instead of a SubTypeArch to express the difference.
  
Reviewed By: #powerpc, jhibbits
  
Differential Revision: https://reviews.llvm.org/D72433
  
  commit 36eedfcb3 from llvm git (by Justin Hibbits):
  
[PowerPC] Fix powerpcspe subtarget enablement in llvm backend
  
Summary:
  
As currently written, -target powerpcspe will enable SPE regardless
of disabling the feature later on in the command line.  Instead,
change this to just set a default CPU to 'e500' instead of a generic
CPU.
  
As part of this, add FeatureSPE to the e500 definition.
  
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D72673
  
  These are needed to unbreak the build for powerpcspe.
  
  Requested by: jhibbits

Modified:
  stable/12/contrib/llvm-project/clang/lib/Basic/Targets/PPC.cpp
  stable/12/contrib/llvm-project/clang/lib/Basic/Targets/PPC.h
  stable/12/contrib/llvm-project/clang/lib/Driver/ToolChains/Arch/PPC.cpp
  stable/12/contrib/llvm-project/llvm/include/llvm/ADT/Triple.h
  stable/12/contrib/llvm-project/llvm/lib/Support/Triple.cpp
  stable/12/contrib/llvm-project/llvm/lib/Target/PowerPC/PPC.td
  stable/12/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCSubtarget.cpp
Directory Properties:
  stable/12/   (props changed)
  stable/12/contrib/llvm-project/clang/   (props changed)
  stable/12/contrib/llvm-project/llvm/   (props changed)

Modified: stable/12/contrib/llvm-project/clang/lib/Basic/Targets/PPC.cpp
==
--- stable/12/contrib/llvm-project/clang/lib/Basic/Targets/PPC.cpp  Mon Jan 
27 07:02:52 2020(r357167)
+++ stable/12/contrib/llvm-project/clang/lib/Basic/Targets/PPC.cpp  Mon Jan 
27 07:03:57 2020(r357168)
@@ -157,6 +157,8 @@ void PPCTargetInfo::getTargetDefines(const LangOptions
 Builder.defineMacro("_ARCH_A2Q");
 Builder.defineMacro("_ARCH_QP");
   }
+  if (ArchDefs & ArchDefineE500)
+Builder.defineMacro("__NO_LWSYNC__");
 
   if (getTriple().getVendor() == llvm::Triple::BGQ) {
 Builder.defineMacro("__bg__");
@@ -312,6 +314,11 @@ bool PPCTargetInfo::initFeatureMap(
 .Case("pwr8", true)
 .Default(false);
 
+  Features["spe"] = llvm::StringSwitch(CPU)
+.Case("8548", true)
+.Case("e500", true)
+.Default(false);
+
   if (!ppcUserFeaturesCheck(Diags, FeaturesVec))
 return false;
 
@@ -449,16 +456,16 @@ ArrayRef PPCTargetInfo::getGC
 }
 
 static constexpr llvm::StringLiteral ValidCPUNames[] = {
-{"generic"}, {"440"}, {"450"}, {"601"},{"602"},
-{"603"}, {"603e"},{"603ev"},   {"604"},{"604e"},
-{"620"}, {"630"}, {"g3"},  {"7400"},   {"g4"},
-{"7450"},{"g4+"}, {"750"}, {"970"},{"g5"},
-{"a2"},  {"a2q"}, {"e500mc"},  {"e5500"},  {"power3"},
-{"pwr3"},{"power4"},  {"pwr4"},{"power5"}, {"pwr5"},
-{"power5x"}, {"pwr5x"},   {"power6"},  {"pwr6"},   {"power6x"},
-{"pwr6x"},   {"power7"},  {"pwr7"},{"power8"}, {"pwr8"},
-{"power9"},  {"pwr9"},{"powerpc"}, {"ppc"},{"powerpc64"},
-{"ppc64"},   {"powerpc64le"}, {"ppc64le"},
+{"generic"},   {"440"},   {"450"}, {"601"}, {"602"},
+{"603"},   {"603e"},  {"603ev"},   {"604"}, {"604e"},
+{"620"},   {"630"},   {"g3"},  {"7400"},{"g4"},
+{"7450"},  {"g4+"},   {"750"}, {"8548"},{"970"},
+{"g5"},{"a2"},{"a2q"}, {"e500"},{"e500mc"},
+{"e5500"}, {"power3"},{"pwr3"},{"power4"},  {"pwr4"},
+{"power5"},{"pwr5"},  {"power5x"}, {"pwr5x"},   {"power6"},
+{"pwr6"},  {"power6x"},   {"pwr6x"},   

svn commit: r357167 - in stable/12/contrib/llvm-project/llvm/lib: MC Object Target/Mips

2020-01-26 Thread Dimitry Andric
Author: dim
Date: Mon Jan 27 07:02:52 2020
New Revision: 357167
URL: https://svnweb.freebsd.org/changeset/base/357167

Log:
  MFC r356789 (by arichardson):
  
  Merge commit 894f742acb from llvm git (by me):
  
[MIPS][ELF] Use PC-relative relocations in .eh_frame when possible
  
When compiling position-independent executables, we now use
DW_EH_PE_pcrel | DW_EH_PE_sdata4. However, the MIPS ABI does not define a
64-bit PC-relative ELF relocation so we cannot use sdata8 for the large
code model case. When using the large code model, we fall back to the
previous behaviour of generating absolute relocations.
  
With this change clang-generated .o files can be linked by LLD without
having to pass -Wl,-z,notext (which creates text relocations).
This is simpler than the approach used by ld.bfd, which rewrites the
.eh_frame section to convert absolute relocations into relative references.
  
I saw in D13104 that apparently ld.bfd did not accept pc-relative 
relocations
for MIPS ouput at some point. However, I also checked that recent ld.bfd
can process the clang-generated .o files so this no longer seems true.
  
Reviewed By: atanasyan
Differential Revision: https://reviews.llvm.org/D72228
  
  Merge commit 8e8ccf47 from llvm git (by me)
  
[MIPS] Don't emit R_(MICRO)MIPS_JALR relocations against data symbols
  
The R_(MICRO)MIPS_JALR optimization only works when used against functions.
Using the relocation against a data symbol (e.g. function pointer) will
cause some linkers that don't ignore the hint in this case (e.g. LLD prior
to commit 5bab291) to generate a relative branch to the data symbol
which crashes at run time. Before this patch, LLVM was erroneously emitting
these relocations against local-dynamic TLS function pointers and global
function pointers with internal visibility.
  
Reviewers: atanasyan, jrtc27, vstefanovic
Reviewed By: atanasyan
Differential Revision: https://reviews.llvm.org/D72571
  
  These two changes should allow using lld for MIPS64 (and maybe also MIPS32)
  by default.
  The second commit is not strictly necessary for clang+lld since LLD9 will
  not perform the R_MIPS_JALR optimization (it was only added for 10) but it
  is probably required in order to use recent ld.bfd.
  
  Reviewed By:  dim, emaste
  Differential Revision: https://reviews.freebsd.org/D23203

Modified:
  stable/12/contrib/llvm-project/llvm/lib/MC/MCObjectFileInfo.cpp
  stable/12/contrib/llvm-project/llvm/lib/Object/RelocationResolver.cpp
  stable/12/contrib/llvm-project/llvm/lib/Target/Mips/MipsISelLowering.cpp
Directory Properties:
  stable/12/   (props changed)
  stable/12/contrib/llvm-project/llvm/   (props changed)

Modified: stable/12/contrib/llvm-project/llvm/lib/MC/MCObjectFileInfo.cpp
==
--- stable/12/contrib/llvm-project/llvm/lib/MC/MCObjectFileInfo.cpp Mon Jan 
27 06:05:43 2020(r357166)
+++ stable/12/contrib/llvm-project/llvm/lib/MC/MCObjectFileInfo.cpp Mon Jan 
27 07:02:52 2020(r357167)
@@ -303,9 +303,14 @@ void MCObjectFileInfo::initELFMCObjectFileInfo(const T
   case Triple::mipsel:
   case Triple::mips64:
   case Triple::mips64el:
-FDECFIEncoding = Ctx->getAsmInfo()->getCodePointerSize() == 4
- ? dwarf::DW_EH_PE_sdata4
- : dwarf::DW_EH_PE_sdata8;
+// We cannot use DW_EH_PE_sdata8 for the large PositionIndependent case
+// since there is no R_MIPS_PC64 relocation (only a 32-bit version).
+if (PositionIndependent && !Large)
+  FDECFIEncoding = dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_sdata4;
+else
+  FDECFIEncoding = Ctx->getAsmInfo()->getCodePointerSize() == 4
+   ? dwarf::DW_EH_PE_sdata4
+   : dwarf::DW_EH_PE_sdata8;
 break;
   case Triple::ppc64:
   case Triple::ppc64le:

Modified: stable/12/contrib/llvm-project/llvm/lib/Object/RelocationResolver.cpp
==
--- stable/12/contrib/llvm-project/llvm/lib/Object/RelocationResolver.cpp   
Mon Jan 27 06:05:43 2020(r357166)
+++ stable/12/contrib/llvm-project/llvm/lib/Object/RelocationResolver.cpp   
Mon Jan 27 07:02:52 2020(r357167)
@@ -103,6 +103,7 @@ static bool supportsMips64(uint64_t Type) {
   case ELF::R_MIPS_32:
   case ELF::R_MIPS_64:
   case ELF::R_MIPS_TLS_DTPREL64:
+  case ELF::R_MIPS_PC32:
 return true;
   default:
 return false;
@@ -117,6 +118,8 @@ static uint64_t resolveMips64(RelocationRef R, uint64_
 return S + getELFAddend(R);
   case ELF::R_MIPS_TLS_DTPREL64:
 return S + getELFAddend(R) - 0x8000;
+  case ELF::R_MIPS_PC32:
+return S + getELFAddend(R) - R.getOffset();
   default:
 llvm_unreachable("Invalid relocation type");
   }

Modified: 

svn commit: r357166 - svnadmin/conf

2020-01-26 Thread Cy Schubert
Author: cy
Date: Mon Jan 27 06:05:43 2020
New Revision: 357166
URL: https://svnweb.freebsd.org/changeset/base/357166

Log:
  sqlite3 3.33.0 import into the vendor branch is now complete.

Modified:
  svnadmin/conf/sizelimit.conf

Modified: svnadmin/conf/sizelimit.conf
==
--- svnadmin/conf/sizelimit.confMon Jan 27 06:04:32 2020
(r357165)
+++ svnadmin/conf/sizelimit.confMon Jan 27 06:05:43 2020
(r357166)
@@ -16,7 +16,6 @@
 # First field is username, second field is the raised limit required.
 achim
 bapt
-cy
 davidcs
 dim2048
 imp
___
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: r357165 - head/sys/x86/cpufreq

2020-01-26 Thread Conrad Meyer
Author: cem
Date: Mon Jan 27 06:04:32 2020
New Revision: 357165
URL: https://svnweb.freebsd.org/changeset/base/357165

Log:
  hwpstate(4): Log a debug line when throttled
  
  If we're going to throttle user requested P-states, we should at least produce
  a debug log line indicating the surprising behavior.
  
  PR:   inspired by 234733

Modified:
  head/sys/x86/cpufreq/hwpstate_amd.c

Modified: head/sys/x86/cpufreq/hwpstate_amd.c
==
--- head/sys/x86/cpufreq/hwpstate_amd.c Mon Jan 27 06:03:36 2020
(r357164)
+++ head/sys/x86/cpufreq/hwpstate_amd.c Mon Jan 27 06:04:32 2020
(r357165)
@@ -173,8 +173,12 @@ hwpstate_goto_pstate(device_t dev, int id)
/* get the current pstate limit */
msr = rdmsr(MSR_AMD_10H_11H_LIMIT);
limit = AMD_10H_11H_GET_PSTATE_LIMIT(msr);
-   if (limit > id)
+   if (limit > id) {
+   HWPSTATE_DEBUG(dev,
+   "Restricting requested P%d to P%d due to HW limit\n", id,
+   limit);
id = limit;
+   }
 
cpu = curcpu;
HWPSTATE_DEBUG(dev, "setting P%d-state on cpu%d\n", id, cpu);
___
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: r357164 - vendor/sqlite3/sqlite-3310000

2020-01-26 Thread Cy Schubert
Author: cy
Date: Mon Jan 27 06:03:36 2020
New Revision: 357164
URL: https://svnweb.freebsd.org/changeset/base/357164

Log:
  Tag import of sqlite3-3.31.0 (331).

Added:
  vendor/sqlite3/sqlite-331/
 - copied from r357163, vendor/sqlite3/dist/
___
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: r357163 - in vendor/sqlite3/dist: . tea tea/generic tea/win

2020-01-26 Thread Cy Schubert
Author: cy
Date: Mon Jan 27 05:57:23 2020
New Revision: 357163
URL: https://svnweb.freebsd.org/changeset/base/357163

Log:
  Import sqlite3-3.31.0 (331)

Modified:
  vendor/sqlite3/dist/Makefile.msc
  vendor/sqlite3/dist/configure
  vendor/sqlite3/dist/configure.ac
  vendor/sqlite3/dist/shell.c
  vendor/sqlite3/dist/sqlite3.c
  vendor/sqlite3/dist/sqlite3.h
  vendor/sqlite3/dist/sqlite3ext.h
  vendor/sqlite3/dist/tea/configure
  vendor/sqlite3/dist/tea/configure.ac
  vendor/sqlite3/dist/tea/generic/tclsqlite3.c
  vendor/sqlite3/dist/tea/win/makefile.vc

Modified: vendor/sqlite3/dist/Makefile.msc
==
--- vendor/sqlite3/dist/Makefile.mscMon Jan 27 05:56:47 2020
(r357162)
+++ vendor/sqlite3/dist/Makefile.mscMon Jan 27 05:57:23 2020
(r357163)
@@ -210,6 +210,12 @@ OPTIMIZATIONS = 2
 SESSION = 0
 !ENDIF
 
+# Set this to non-0 to enable support for the rbu extension.
+#
+!IFNDEF RBU
+RBU = 0
+!ENDIF
+
 # Set the source code file to be used by executables and libraries when
 # they need the amalgamation.
 #
@@ -282,7 +288,6 @@ OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENAB
 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_STMTVTAB=1
 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_DBPAGE_VTAB=1
 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_DBSTAT_VTAB=1
-OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_INTROSPECTION_PRAGMAS=1
 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_DESERIALIZE=1
 !ENDIF
 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_COLUMN_METADATA=1
@@ -296,6 +301,13 @@ OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENAB
 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_PREUPDATE_HOOK=1
 !ENDIF
 
+# Should the rbu extension be enabled?  If so, add compilation options
+# to enable it.
+#
+!IF $(RBU)!=0
+OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_RBU=1
+!ENDIF
+
 # These are the "extended" SQLite compilation options used when compiling for
 # the Windows 10 platform.
 #
@@ -978,7 +990,7 @@ Replace.exe:
 sqlite3.def:   Replace.exe $(LIBOBJ)
echo EXPORTS > sqlite3.def
dumpbin /all $(LIBOBJ) \
-   | .\Replace.exe 
"^\s+/EXPORT:_?(sqlite3(?:session|changeset|changegroup|rebaser)?_[^@,]*)(?:@\d+|,DATA)?$$"
 $$1 true \
+   | .\Replace.exe 
"^\s+/EXPORT:_?(sqlite3(?:session|changeset|changegroup|rebaser|rbu)?_[^@,]*)(?:@\d+|,DATA)?$$"
 $$1 true \
| sort >> sqlite3.def
 
 $(SQLITE3EXE): shell.c $(SHELL_CORE_DEP) $(LIBRESOBJS) $(SHELL_CORE_SRC) 
$(SQLITE3H)

Modified: vendor/sqlite3/dist/configure
==
--- vendor/sqlite3/dist/configure   Mon Jan 27 05:56:47 2020
(r357162)
+++ vendor/sqlite3/dist/configure   Mon Jan 27 05:57:23 2020
(r357163)
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for sqlite 3.30.1.
+# Generated by GNU Autoconf 2.69 for sqlite 3.31.0.
 #
 # Report bugs to .
 #
@@ -590,8 +590,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='sqlite'
 PACKAGE_TARNAME='sqlite'
-PACKAGE_VERSION='3.30.1'
-PACKAGE_STRING='sqlite 3.30.1'
+PACKAGE_VERSION='3.31.0'
+PACKAGE_STRING='sqlite 3.31.0'
 PACKAGE_BUGREPORT='http://www.sqlite.org'
 PACKAGE_URL=''
 
@@ -1341,7 +1341,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures sqlite 3.30.1 to adapt to many kinds of systems.
+\`configure' configures sqlite 3.31.0 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1412,7 +1412,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
- short | recursive ) echo "Configuration of sqlite 3.30.1:";;
+ short | recursive ) echo "Configuration of sqlite 3.31.0:";;
esac
   cat <<\_ACEOF
 
@@ -1537,7 +1537,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-sqlite configure 3.30.1
+sqlite configure 3.31.0
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -1952,7 +1952,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by sqlite $as_me 3.30.1, which was
+It was created by sqlite $as_me 3.31.0, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -2818,7 +2818,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE='sqlite'
- VERSION='3.30.1'
+ VERSION='3.31.0'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -13653,7 +13653,7 @@ else
 fi
 
 if test x"$enable_rtree" = "xyes"; then
-  BUILD_CFLAGS="$BUILD_CFLAGS -DSQLITE_ENABLE_RTREE"

svn commit: r357162 - svnadmin/conf

2020-01-26 Thread Cy Schubert
Author: cy
Date: Mon Jan 27 05:56:47 2020
New Revision: 357162
URL: https://svnweb.freebsd.org/changeset/base/357162

Log:
  Sizelimit for sqlite3-3.31.0 (331).

Modified:
  svnadmin/conf/sizelimit.conf

Modified: svnadmin/conf/sizelimit.conf
==
--- svnadmin/conf/sizelimit.confMon Jan 27 00:14:51 2020
(r357161)
+++ svnadmin/conf/sizelimit.confMon Jan 27 05:56:47 2020
(r357162)
@@ -16,6 +16,7 @@
 # First field is username, second field is the raised limit required.
 achim
 bapt
+cy
 davidcs
 dim2048
 imp
___
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: r357161 - head/sys/dev/msk

2020-01-26 Thread Alexander Kabaev
Author: kan
Date: Mon Jan 27 00:14:51 2020
New Revision: 357161
URL: https://svnweb.freebsd.org/changeset/base/357161

Log:
  Enter net epoch in msk_tick.
  
  One more instance of if_input being called outside of
  interrupt, by means of msk_handle_events.
  
  Differential Revision:  https://reviews.freebsd.org/D23379

Modified:
  head/sys/dev/msk/if_msk.c

Modified: head/sys/dev/msk/if_msk.c
==
--- head/sys/dev/msk/if_msk.c   Sun Jan 26 21:55:17 2020(r357160)
+++ head/sys/dev/msk/if_msk.c   Mon Jan 27 00:14:51 2020(r357161)
@@ -3374,6 +3374,7 @@ msk_txeof(struct msk_if_softc *sc_if, int idx)
 static void
 msk_tick(void *xsc_if)
 {
+   struct epoch_tracker et;
struct msk_if_softc *sc_if;
struct mii_data *mii;
 
@@ -3386,7 +3387,9 @@ msk_tick(void *xsc_if)
mii_tick(mii);
if ((sc_if->msk_flags & MSK_FLAG_LINK) == 0)
msk_miibus_statchg(sc_if->msk_if_dev);
+   NET_EPOCH_ENTER(et);
msk_handle_events(sc_if->msk_softc);
+   NET_EPOCH_EXIT(et);
msk_watchdog(sc_if);
callout_reset(_if->msk_tick_ch, hz, msk_tick, sc_if);
 }
___
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: r357159 - head/sys/dev/netmap

2020-01-26 Thread Vincenzo Maffione
Author: vmaffione
Date: Sun Jan 26 21:34:46 2020
New Revision: 357159
URL: https://svnweb.freebsd.org/changeset/base/357159

Log:
  netmap_mem_unmap: fix NULL pointer dereference
  
  MFC after:3 days

Modified:
  head/sys/dev/netmap/netmap_mem2.c

Modified: head/sys/dev/netmap/netmap_mem2.c
==
--- head/sys/dev/netmap/netmap_mem2.c   Sun Jan 26 20:57:29 2020
(r357158)
+++ head/sys/dev/netmap/netmap_mem2.c   Sun Jan 26 21:34:46 2020
(r357159)
@@ -1523,11 +1523,12 @@ static int
 netmap_mem_unmap(struct netmap_obj_pool *p, struct netmap_adapter *na)
 {
int i, lim = p->objtotal;
-   struct netmap_lut *lut = >na_lut;
+   struct netmap_lut *lut;
 
if (na == NULL || na->pdev == NULL)
return 0;
 
+   lut = >na_lut;
 #if defined(__FreeBSD__)
/* On FreeBSD mapping and unmapping is performed by the txsync
 * and rxsync routine, packet by packet. */
___
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: r357051 - head/sys/dev/bge

2020-01-26 Thread Jeff Roberson

On Sun, 26 Jan 2020, John Baldwin wrote:


On 1/23/20 7:32 PM, Gleb Smirnoff wrote:

On Thu, Jan 23, 2020 at 05:09:14PM -1000, Jeff Roberson wrote:
J> While we don't have a policy strictly requiring reviews it is the norm to
J> have substantial changes socialized and reviewed.  I appreciate the work
J> that you are doing but it likely should've been discussed somewhere
J> more publicly.  I apologized if I missed it but I don't see reference to
J> anything.

That was https://reviews.freebsd.org/D23242


A review alone isn't sufficient for large, sweeping changes in my mind.
For major changes, a thread on arch@ or net@ or the like is probably more
appropriate.  You can include a link to a review or git branch, etc. in
that e-mail, but phabricator aren't as well suited to higher-level
design-review type discussion, more for implementation-review.

J> Architecturally I am more concerned with the coarseness of net_epoch and
J> the duration of hold becoming a resource utilization problem in high
J> turn-over workloads.  Like short connection tcp.  Has anyone done
J> substantial testing here?  epoch as it is today will hold every free
J> callback for a minimum of several clock ticks and a maximum of 2x the
J> duration of the longest epoch section time.  With preemption, etc. this
J> could be 100s of ms of PCBs held.

We also are concerned about that theoretically. Haven't yet seen effect
in practice, but our sessions are mostly longer living. First we have the
tunable to limit batching. Second, there are some ideas on how to improve
the garbage collector performance if it becomes an issue.


There are other workloads than Netflix. ;)  Verisign has incredibly short-lived
connections with very high turnover.  I think though that they have already
abandoned the in-tree network stack for a userland stack built on netmap.  
Still,
I think that there are probably other FreeBSD users that are probably somewhere
in the middle that shouldn't be ignored.

Packet batching would not be impossible by simply using m_nextpkt chains in
mbufs passed up to ether_input and having ether_input pass them in a loop to
the next higher loop (as a first step).  That would reduce unlock/lock 
operations
in drivers (for those still using locks on receive) as well as permitting
ether_input to process batches under a single epoch invocation.


This is actually the approach that I took for nokia.  You could prefetch 
m->m_nextpkt at the top of the loop iteration.  It was very effective 
there.


Seeing how many drivers and unexpected entry points had to have the 
NET_EPOCH added I would want to review again once it's stable and see if 
there is a way to simplify through API changes.  It seems like more than 
expected slipped through the cracks and I worry about long-term 
maintenance.


Thanks,
Jeff



--
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"


svn commit: r357149 - head/sys/fs/nfsserver

2020-01-26 Thread Rick Macklem
Author: rmacklem
Date: Sun Jan 26 17:59:05 2020
New Revision: 357149
URL: https://svnweb.freebsd.org/changeset/base/357149

Log:
  Fix a crash in the NFSv4 server.
  
  The PR reported a crash that occurred when a file was removed while
  client(s) were actively doing lock operations on it.
  Since nfsvno_getvp() will return NULL when the file does not exist,
  the bug was obvious and easy to fix via this patch. It is a little
  surprising that this wasn't found sooner, but I guess the above
  case rarely occurs.
  
  Tested by:iron.ud...@gmail.com
  PR:   242768
  Reported by:  iron.ud...@gmail.com
  MFC after:2 weeks

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

Modified: head/sys/fs/nfsserver/nfs_nfsdstate.c
==
--- head/sys/fs/nfsserver/nfs_nfsdstate.c   Sun Jan 26 17:22:05 2020
(r357148)
+++ head/sys/fs/nfsserver/nfs_nfsdstate.c   Sun Jan 26 17:59:05 2020
(r357149)
@@ -1554,7 +1554,8 @@ nfsrv_freeallnfslocks(struct nfsstate *stp, vnode_t vp
tvp = NULL;
else if (vp == NULL && cansleep != 0) {
tvp = nfsvno_getvp(>lf_fh);
-   NFSVOPUNLOCK(tvp);
+   if (tvp != NULL)
+   NFSVOPUNLOCK(tvp);
} else
tvp = vp;
gottvp = 1;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2020-01-26 Thread John Baldwin
On 1/26/20 6:23 AM, John Baldwin wrote:
> Author: jhb
> Date: Sun Jan 26 14:23:27 2020
> New Revision: 357147
> URL: https://svnweb.freebsd.org/changeset/base/357147
> 
> Log:
>   Revert accidental change from r357146.

Oops, this was a different warning fix which I've opened a separate review for
(this one was found by gcc 9 instead of clang 10).

-- 
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"


svn commit: r357147 - head/sys/kern

2020-01-26 Thread John Baldwin
Author: jhb
Date: Sun Jan 26 14:23:27 2020
New Revision: 357147
URL: https://svnweb.freebsd.org/changeset/base/357147

Log:
  Revert accidental change from r357146.

Modified:
  head/sys/kern/subr_stats.c

Modified: head/sys/kern/subr_stats.c
==
--- head/sys/kern/subr_stats.c  Sun Jan 26 14:20:57 2020(r357146)
+++ head/sys/kern/subr_stats.c  Sun Jan 26 14:23:27 2020(r357147)
@@ -1583,7 +1583,9 @@ stats_v1_blob_iter(struct statsblobv1 *sb, stats_v1_bl
int i, j, firstvoi;
 
ctx.usrctx = usrctx;
-   ctx.flags = SB_IT_FIRST_CB;
+   ctx.flags |= SB_IT_FIRST_CB;
+   ctx.flags &= ~(SB_IT_FIRST_VOI | SB_IT_LAST_VOI | SB_IT_FIRST_VOISTAT |
+   SB_IT_LAST_VOISTAT);
firstvoi = 1;
 
for (i = 0; i < NVOIS(sb); i++) {
___
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: r357146 - in head/sys: dev/mrsas dev/sound/pci kern

2020-01-26 Thread John Baldwin
Author: jhb
Date: Sun Jan 26 14:20:57 2020
New Revision: 357146
URL: https://svnweb.freebsd.org/changeset/base/357146

Log:
  Fix some misleading indentation warnings reported by recent clang.
  
  These should not be any functional change.  While the change in
  emul10kx-pcm.c looks like a real bug fix (as opposed to inconsistent
  whitespace), the extra statements were not harmful.
  
  Reviewed by:  kib
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D23363

Modified:
  head/sys/dev/mrsas/mrsas_cam.c
  head/sys/dev/sound/pci/emu10k1.c
  head/sys/dev/sound/pci/emu10kx-pcm.c
  head/sys/kern/subr_stats.c

Modified: head/sys/dev/mrsas/mrsas_cam.c
==
--- head/sys/dev/mrsas/mrsas_cam.c  Sun Jan 26 14:19:08 2020
(r357145)
+++ head/sys/dev/mrsas/mrsas_cam.c  Sun Jan 26 14:20:57 2020
(r357146)
@@ -1908,13 +1908,14 @@ mrsas_track_scsiio(struct mrsas_softc *sc, target_id_t
for (i = 0 ; i < sc->max_fw_cmds; i++) {
mpt_cmd = sc->mpt_cmd_list[i];
 
-   /*
-* Check if the target_id and bus_id is same as the timeout IO
-*/
-   if (mpt_cmd->ccb_ptr) {
-   /* bus_id = 1 denotes a VD */
-   if (bus_id == 1)
-   tgt_id = (mpt_cmd->ccb_ptr->ccb_h.target_id - 
(MRSAS_MAX_PD - 1));
+   /*
+* Check if the target_id and bus_id is same as the timeout IO
+*/
+   if (mpt_cmd->ccb_ptr) {
+   /* bus_id = 1 denotes a VD */
+   if (bus_id == 1)
+   tgt_id =
+   (mpt_cmd->ccb_ptr->ccb_h.target_id - 
(MRSAS_MAX_PD - 1));
 
if (mpt_cmd->ccb_ptr->cpi.bus_id == bus_id &&
mpt_cmd->ccb_ptr->ccb_h.target_id == tgt_id) {

Modified: head/sys/dev/sound/pci/emu10k1.c
==
--- head/sys/dev/sound/pci/emu10k1.cSun Jan 26 14:19:08 2020
(r357145)
+++ head/sys/dev/sound/pci/emu10k1.cSun Jan 26 14:20:57 2020
(r357146)
@@ -1257,11 +1257,12 @@ emu_intr(void *data)
 #endif
}
 
-   if (stat & EMU_IPR_MIDIRECVBUFE)
-   if (sc->mpu_intr) {
-   (sc->mpu_intr)(sc->mpu);
-   ack |= EMU_IPR_MIDIRECVBUFE | EMU_IPR_MIDITRANSBUFE;
-   }
+   if (stat & EMU_IPR_MIDIRECVBUFE) {
+   if (sc->mpu_intr) {
+   (sc->mpu_intr)(sc->mpu);
+   ack |= EMU_IPR_MIDIRECVBUFE | 
EMU_IPR_MIDITRANSBUFE;
+   }
+   }
if (stat & ~ack)
device_printf(sc->dev, "dodgy irq: %x (harmless)\n",
stat & ~ack);

Modified: head/sys/dev/sound/pci/emu10kx-pcm.c
==
--- head/sys/dev/sound/pci/emu10kx-pcm.cSun Jan 26 14:19:08 2020
(r357145)
+++ head/sys/dev/sound/pci/emu10kx-pcm.cSun Jan 26 14:20:57 2020
(r357146)
@@ -263,11 +263,12 @@ emu_dspmixer_uninit(struct snd_mixer *m)
 
/* drop submixer for AC97 codec */
sc = mix_getdevinfo(m);
-   if (sc->sm != NULL)
+   if (sc->sm != NULL) {
err = mixer_delete(sc->sm);
if (err)
return (err);
sc->sm = NULL;
+   }
return (0);
 }
 

Modified: head/sys/kern/subr_stats.c
==
--- head/sys/kern/subr_stats.c  Sun Jan 26 14:19:08 2020(r357145)
+++ head/sys/kern/subr_stats.c  Sun Jan 26 14:20:57 2020(r357146)
@@ -1583,9 +1583,7 @@ stats_v1_blob_iter(struct statsblobv1 *sb, stats_v1_bl
int i, j, firstvoi;
 
ctx.usrctx = usrctx;
-   ctx.flags |= SB_IT_FIRST_CB;
-   ctx.flags &= ~(SB_IT_FIRST_VOI | SB_IT_LAST_VOI | SB_IT_FIRST_VOISTAT |
-   SB_IT_LAST_VOISTAT);
+   ctx.flags = SB_IT_FIRST_CB;
firstvoi = 1;
 
for (i = 0; i < NVOIS(sb); i++) {
___
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: r357145 - head/sys/conf

2020-01-26 Thread John Baldwin
Author: jhb
Date: Sun Jan 26 14:19:08 2020
New Revision: 357145
URL: https://svnweb.freebsd.org/changeset/base/357145

Log:
  Compile hack.c with normal CFLAGS + -shared -nostdlib.
  
  Originally, hack.c was compiled into a shard object with just -shared
  -nostdlib.  This assumed that ${CC} did not require any additional
  flags for ABIs, cross-building, etc.
  
  When kern.post.mk was created in r89509 by reducing duplication in
  kernel Makefile. files, the -shared flag was moved into a
  HACK_EXTRA_FLAGS variable so that sparc64 could override it with
  -Wl,-shared.  The sparc64 hack was removed in r111650, but
  HACK_EXTRA_FLAGS was left in place.  Over time, we have started
  support toolchains that require flags to support alternate ABIs on
  MIPS and PowerPC and started (ab)using HACK_EXTRA_FLAGS to set only
  those flags.
  
  I need to fix risc-v to pass -mno-relax to the hack.c build for lld in
  llvm 10, and the patches to support cross-build from non-FreeBSD hosts
  need to include -target for clang in CFLAGS for hack.c.  Rather than
  adding more hacks into HACK_EXTRA_FLAGS, just use the full set of
  CFLAGS with hack.c.
  
  Reviewed by:  kib, arichardson
  MFC after:1 month
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D23362

Modified:
  head/sys/conf/Makefile.mips
  head/sys/conf/Makefile.powerpc
  head/sys/conf/kern.post.mk

Modified: head/sys/conf/Makefile.mips
==
--- head/sys/conf/Makefile.mips Sun Jan 26 11:54:21 2020(r357144)
+++ head/sys/conf/Makefile.mips Sun Jan 26 14:19:08 2020(r357145)
@@ -50,12 +50,9 @@ ARCH_FLAGS+=-mabi=${MIPS_ABI}
 EXTRA_FLAGS=-fno-pic -mno-abicalls -G0 -DKERNLOADADDR=${KERNLOADADDR}
 EXTRA_FLAGS+=-${MIPS_ENDIAN}
 
-HACK_EXTRA_FLAGS=-shared
-
 # We add the -fno-pic flag to kernels because otherwise performance
 # is extremely poor, as well as -mno-abicalls to force no ABI usage.
 CFLAGS+=${EXTRA_FLAGS} $(ARCH_FLAGS)
-HACK_EXTRA_FLAGS+=${EXTRA_FLAGS} $(ARCH_FLAGS)
 TRAMP_ARCH_FLAGS?=$(ARCH_FLAGS)
 TRAMP_EXTRA_FLAGS=${EXTRA_FLAGS} ${TRAMP_ARCH_FLAGS}
 # Kernel code is always compiled with soft-float on MIPS

Modified: head/sys/conf/Makefile.powerpc
==
--- head/sys/conf/Makefile.powerpc  Sun Jan 26 11:54:21 2020
(r357144)
+++ head/sys/conf/Makefile.powerpc  Sun Jan 26 14:19:08 2020
(r357145)
@@ -39,7 +39,6 @@ INCLUDES+= -I$S/contrib/libfdt
 # Force __SPE__, since the builtin will be removed later with -mno-spe
 CFLAGS.gcc+= -mabi=spe -D__SPE__
 CFLAGS.clang+= -mspe -D__SPE__ -m32
-HACK_EXTRA_FLAGS= -shared -m32 -mspe -D__SPE__
 .endif
 CFLAGS+= -msoft-float
 CFLAGS.gcc+= -Wa,-many

Modified: head/sys/conf/kern.post.mk
==
--- head/sys/conf/kern.post.mk  Sun Jan 26 11:54:21 2020(r357144)
+++ head/sys/conf/kern.post.mk  Sun Jan 26 14:19:08 2020(r357145)
@@ -226,10 +226,9 @@ kernel-clean:
 # This is a hack.  BFD "optimizes" away dynamic mode if there are no
 # dynamic references.  We could probably do a '-Bforcedynamic' mode like
 # in the a.out ld.  For now, this works.
-HACK_EXTRA_FLAGS?= -shared
 hack.pico: Makefile
:> hack.c
-   ${CC} ${HACK_EXTRA_FLAGS} -nostdlib hack.c -o hack.pico
+   ${CC} -shared ${CFLAGS} -nostdlib hack.c -o hack.pico
rm -f hack.c
 
 offset.inc: $S/kern/genoffset.sh genoffset.o
___
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: r357144 - head/sys/netinet

2020-01-26 Thread Alexander V. Chernikov
Author: melifaro
Date: Sun Jan 26 11:54:21 2020
New Revision: 357144
URL: https://svnweb.freebsd.org/changeset/base/357144

Log:
  Fix NOINET6 build after r357038.
  
  Reported by:  AN 

Modified:
  head/sys/netinet/ip_divert.c

Modified: head/sys/netinet/ip_divert.c
==
--- head/sys/netinet/ip_divert.cSun Jan 26 11:13:34 2020
(r357143)
+++ head/sys/netinet/ip_divert.cSun Jan 26 11:54:21 2020
(r357144)
@@ -371,9 +371,11 @@ div_output(struct socket *so, struct mbuf *m, struct s
case IPVERSION:
family = AF_INET;
break;
+#ifdef INET6
case IPV6_VERSION >> 4:
family = AF_INET6;
break;
+#endif
default:
m_freem(m);
return (EAFNOSUPPORT);
___
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: r357143 - head/bin/pwait

2020-01-26 Thread Pawel Jakub Dawidek
Author: pjd
Date: Sun Jan 26 11:13:34 2020
New Revision: 357143
URL: https://svnweb.freebsd.org/changeset/base/357143

Log:
  Style changes, mostly usage of braces around single line statements -
  it is safer and allowed for some time now by style(9).
  
  Sponsored by: Fudo Security

Modified:
  head/bin/pwait/pwait.c

Modified: head/bin/pwait/pwait.c
==
--- head/bin/pwait/pwait.c  Sun Jan 26 11:03:45 2020(r357142)
+++ head/bin/pwait/pwait.c  Sun Jan 26 11:13:34 2020(r357143)
@@ -63,12 +63,11 @@ int
 main(int argc, char *argv[])
 {
struct itimerval itv;
-   int kq;
struct kevent *e;
int oflag, tflag, verbose;
-   int opt, nleft, n, i, status;
+   int i, kq, n, nleft, opt, status;
long pid;
-   char *s, *end;
+   char *end, *s;
double timeout;
 
oflag = 0;
@@ -76,7 +75,7 @@ main(int argc, char *argv[])
verbose = 0;
memset(, 0, sizeof(itv));
 
-   while ((opt = getopt(argc, argv, "t:ov")) != -1) {
+   while ((opt = getopt(argc, argv, "ot:v")) != -1) {
switch (opt) {
case 'o':
oflag = 1;
@@ -85,9 +84,9 @@ main(int argc, char *argv[])
tflag = 1;
errno = 0;
timeout = strtod(optarg, );
-   if (end == optarg || errno == ERANGE ||
-   timeout < 0)
+   if (end == optarg || errno == ERANGE || timeout < 0) {
errx(EX_DATAERR, "timeout value");
+   }
switch(*end) {
case 0:
case 's':
@@ -101,8 +100,9 @@ main(int argc, char *argv[])
default:
errx(EX_DATAERR, "timeout unit");
}
-   if (timeout > 1L)
+   if (timeout > 1L) {
errx(EX_DATAERR, "timeout value");
+   }
itv.it_value.tv_sec = (time_t)timeout;
timeout -= (time_t)timeout;
itv.it_value.tv_usec =
@@ -120,21 +120,26 @@ main(int argc, char *argv[])
argc -= optind;
argv += optind;
 
-   if (argc == 0)
+   if (argc == 0) {
usage();
+   }
 
kq = kqueue();
-   if (kq == -1)
+   if (kq == -1) {
err(EX_OSERR, "kqueue");
+   }
 
e = malloc((argc + tflag) * sizeof(struct kevent));
-   if (e == NULL)
+   if (e == NULL) {
err(EX_OSERR, "malloc");
+   }
nleft = 0;
for (n = 0; n < argc; n++) {
s = argv[n];
-   if (!strncmp(s, "/proc/", 6)) /* Undocumented Solaris compat */
+   /* Undocumented Solaris compat */
+   if (!strncmp(s, "/proc/", 6)) {
s += 6;
+   }
errno = 0;
pid = strtol(s, , 10);
if (pid < 0 || *end != '\0' || errno != 0) {
@@ -142,8 +147,9 @@ main(int argc, char *argv[])
continue;
}
for (i = 0; i < nleft; i++) {
-   if (e[i].ident == (uintptr_t)pid)
+   if (e[i].ident == (uintptr_t)pid) {
break;
+   }
}
if (i < nleft) {
/* Duplicate. */
@@ -152,8 +158,9 @@ main(int argc, char *argv[])
EV_SET(e + nleft, pid, EVFILT_PROC, EV_ADD, NOTE_EXIT, 0, NULL);
if (kevent(kq, e + nleft, 1, NULL, 0, NULL) == -1) {
warn("%ld", pid);
-   if (oflag)
+   if (oflag) {
exit(EX_OK);
+   }
} else {
nleft++;
}
@@ -165,39 +172,45 @@ main(int argc, char *argv[])
 * can be returned rather than 142.
 */
EV_SET(e + nleft, SIGALRM, EVFILT_SIGNAL, EV_ADD, 0, 0, NULL);
-   if (kevent(kq, e + nleft, 1, NULL, 0, NULL) == -1)
+   if (kevent(kq, e + nleft, 1, NULL, 0, NULL) == -1) {
err(EX_OSERR, "kevent");
+   }
/* Ignore SIGALRM to not interrupt kevent(2). */
signal(SIGALRM, SIG_IGN);
-   if (setitimer(ITIMER_REAL, , NULL) == -1)
+   if (setitimer(ITIMER_REAL, , NULL) == -1) {
err(EX_OSERR, "setitimer");
+   }
}
while (nleft > 0) {
n = kevent(kq, NULL, 0, e, nleft + tflag, NULL);
-   if (n == -1)
+   if (n == -1) {
   

svn commit: r357142 - head/bin/pwait/tests

2020-01-26 Thread Pawel Jakub Dawidek
Author: pjd
Date: Sun Jan 26 11:03:45 2020
New Revision: 357142
URL: https://svnweb.freebsd.org/changeset/base/357142

Log:
  Implement tests for the newly added -o flag.
  
  Sponsored by: Fudo Security

Modified:
  head/bin/pwait/tests/pwait_test.sh

Modified: head/bin/pwait/tests/pwait_test.sh
==
--- head/bin/pwait/tests/pwait_test.sh  Sun Jan 26 11:02:51 2020
(r357141)
+++ head/bin/pwait/tests/pwait_test.sh  Sun Jan 26 11:03:45 2020
(r357142)
@@ -232,6 +232,85 @@ timeout_many_cleanup()
wait $p1 $p5 $p10 >/dev/null 2>&1
 }
 
+atf_test_case or_flag
+or_flag_head()
+{
+   atf_set "descr" "Test OR flag"
+}
+
+or_flag_body()
+{
+   sleep 2 &
+   p2=$!
+
+   sleep 4 &
+   p4=$!
+
+   sleep 6 &
+   p6=$!
+
+   atf_check \
+   -o inline:"$p2: exited with status 0.\n" \
+   -e empty \
+   -s exit:0 \
+   timeout --preserve-status 15 pwait -o -v $p2 $p4 $p6
+
+   atf_check \
+   -o empty \
+   -e inline:"pwait: $p2: No such process\n" \
+   -s exit:0 \
+   timeout --preserve-status 15 pwait -o $p2 $p4 $p6
+
+   atf_check \
+   -o empty \
+   -e empty \
+   -s exit:0 \
+   timeout --preserve-status 15 pwait -o $p4 $p6
+
+   atf_check \
+   -o empty \
+   -e inline:"pwait: $p4: No such process\n" \
+   -s exit:0 \
+   timeout --preserve-status 15 pwait -o $p4 $p6
+
+   atf_check \
+   -o inline:"$p6: exited with status 0.\n" \
+   -e empty \
+   -s exit:0 \
+   timeout --preserve-status 15 pwait -o -v $p6
+
+   atf_check \
+   -o empty \
+   -e inline:"pwait: $p6: No such process\n" \
+   -s exit:0 \
+   timeout --preserve-status 15 pwait -o $p6
+
+   atf_check \
+   -o empty \
+   -e inline:"kill: $p2: No such process\n" \
+   -s exit:1 \
+   kill -0 $p2
+
+   atf_check \
+   -o empty \
+   -e inline:"kill: $p4: No such process\n" \
+   -s exit:1 \
+   kill -0 $p4
+
+   atf_check \
+   -o empty \
+   -e inline:"kill: $p6: No such process\n" \
+   -s exit:1 \
+   kill -0 $p6
+
+}
+
+or_flag_cleanup()
+{
+   kill $p2 $p4 $p6 >/dev/null 2>&1
+   wait $p2 $p4 $p6 >/dev/null 2>&1
+}
+
 atf_init_test_cases()
 {
atf_add_test_case basic
@@ -239,4 +318,5 @@ atf_init_test_cases()
atf_add_test_case timeout_trigger_timeout
atf_add_test_case timeout_no_timeout
atf_add_test_case timeout_many
+   atf_add_test_case or_flag
 }
___
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: r357141 - head/bin/pwait

2020-01-26 Thread Pawel Jakub Dawidek
Author: pjd
Date: Sun Jan 26 11:02:51 2020
New Revision: 357141
URL: https://svnweb.freebsd.org/changeset/base/357141

Log:
  Implement -o flag which tells pwait(1) to exit if any of the given processes
  has terminated.
  
  Sponsored by: Fudo Security

Modified:
  head/bin/pwait/pwait.1
  head/bin/pwait/pwait.c

Modified: head/bin/pwait/pwait.1
==
--- head/bin/pwait/pwait.1  Sun Jan 26 10:54:16 2020(r357140)
+++ head/bin/pwait/pwait.1  Sun Jan 26 11:02:51 2020(r357141)
@@ -32,7 +32,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd March 7, 2017
+.Dd January 26, 2020
 .Dt PWAIT 1
 .Os
 .Sh NAME
@@ -41,7 +41,7 @@
 .Sh SYNOPSIS
 .Nm
 .Op Fl t Ar duration
-.Op Fl v
+.Op Fl ov
 .Ar pid
 \&...
 .Sh DESCRIPTION
@@ -51,6 +51,8 @@ utility will wait until each of the given processes ha
 .Pp
 The following option is available:
 .Bl -tag -width indent
+.It Fl o
+Exit when any of the given processes has terminated.
 .It Fl t Ar duration
 If any process is still running after
 .Ar duration ,

Modified: head/bin/pwait/pwait.c
==
--- head/bin/pwait/pwait.c  Sun Jan 26 10:54:16 2020(r357140)
+++ head/bin/pwait/pwait.c  Sun Jan 26 11:02:51 2020(r357141)
@@ -53,7 +53,7 @@ static void
 usage(void)
 {
 
-   errx(EX_USAGE, "usage: pwait [-t timeout] [-v] pid ...");
+   errx(EX_USAGE, "usage: pwait [-t timeout] [-ov] pid ...");
 }
 
 /*
@@ -65,16 +65,22 @@ main(int argc, char *argv[])
struct itimerval itv;
int kq;
struct kevent *e;
-   int tflag, verbose;
+   int oflag, tflag, verbose;
int opt, nleft, n, i, status;
long pid;
char *s, *end;
double timeout;
 
-   tflag = verbose = 0;
+   oflag = 0;
+   tflag = 0;
+   verbose = 0;
memset(, 0, sizeof(itv));
-   while ((opt = getopt(argc, argv, "t:v")) != -1) {
+
+   while ((opt = getopt(argc, argv, "t:ov")) != -1) {
switch (opt) {
+   case 'o':
+   oflag = 1;
+   break;
case 't':
tflag = 1;
errno = 0;
@@ -144,10 +150,13 @@ main(int argc, char *argv[])
continue;
}
EV_SET(e + nleft, pid, EVFILT_PROC, EV_ADD, NOTE_EXIT, 0, NULL);
-   if (kevent(kq, e + nleft, 1, NULL, 0, NULL) == -1)
+   if (kevent(kq, e + nleft, 1, NULL, 0, NULL) == -1) {
warn("%ld", pid);
-   else
+   if (oflag)
+   exit(EX_OK);
+   } else {
nleft++;
+   }
}
 
if (nleft > 0 && tflag) {
@@ -187,6 +196,8 @@ main(int argc, char *argv[])
printf("%ld: terminated.\n",
(long)e[i].ident);
}
+   if (oflag)
+   exit(EX_OK);
--nleft;
}
}
___
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: r357140 - head/bin/pwait

2020-01-26 Thread Pawel Jakub Dawidek
Author: pjd
Date: Sun Jan 26 10:54:16 2020
New Revision: 357140
URL: https://svnweb.freebsd.org/changeset/base/357140

Log:
  Don't setup a timeout if we are exiting.
  
  Sponsored by: Fudo Security

Modified:
  head/bin/pwait/pwait.c

Modified: head/bin/pwait/pwait.c
==
--- head/bin/pwait/pwait.c  Sun Jan 26 10:51:57 2020(r357139)
+++ head/bin/pwait/pwait.c  Sun Jan 26 10:54:16 2020(r357140)
@@ -150,7 +150,7 @@ main(int argc, char *argv[])
nleft++;
}
 
-   if (tflag) {
+   if (nleft > 0 && tflag) {
/*
 * Explicitly detect SIGALRM so that an exit status of 124
 * can be returned rather than 142.
___
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: r357139 - head/bin/pwait

2020-01-26 Thread Pawel Jakub Dawidek
Author: pjd
Date: Sun Jan 26 10:51:57 2020
New Revision: 357139
URL: https://svnweb.freebsd.org/changeset/base/357139

Log:
  Check for duplicated PID without using additional variable.
  
  Sponsored by: Fudo Security

Modified:
  head/bin/pwait/pwait.c

Modified: head/bin/pwait/pwait.c
==
--- head/bin/pwait/pwait.c  Sun Jan 26 10:49:24 2020(r357138)
+++ head/bin/pwait/pwait.c  Sun Jan 26 10:51:57 2020(r357139)
@@ -66,7 +66,7 @@ main(int argc, char *argv[])
int kq;
struct kevent *e;
int tflag, verbose;
-   int opt, nleft, n, i, duplicate, status;
+   int opt, nleft, n, i, status;
long pid;
char *s, *end;
double timeout;
@@ -135,18 +135,19 @@ main(int argc, char *argv[])
warnx("%s: bad process id", s);
continue;
}
-   duplicate = 0;
-   for (i = 0; i < nleft; i++)
+   for (i = 0; i < nleft; i++) {
if (e[i].ident == (uintptr_t)pid)
-   duplicate = 1;
-   if (!duplicate) {
-   EV_SET(e + nleft, pid, EVFILT_PROC, EV_ADD, NOTE_EXIT,
-   0, NULL);
-   if (kevent(kq, e + nleft, 1, NULL, 0, NULL) == -1)
-   warn("%ld", pid);
-   else
-   nleft++;
+   break;
}
+   if (i < nleft) {
+   /* Duplicate. */
+   continue;
+   }
+   EV_SET(e + nleft, pid, EVFILT_PROC, EV_ADD, NOTE_EXIT, 0, NULL);
+   if (kevent(kq, e + nleft, 1, NULL, 0, NULL) == -1)
+   warn("%ld", pid);
+   else
+   nleft++;
}
 
if (tflag) {
___
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: r357138 - head/bin/pwait

2020-01-26 Thread Pawel Jakub Dawidek
Author: pjd
Date: Sun Jan 26 10:49:24 2020
New Revision: 357138
URL: https://svnweb.freebsd.org/changeset/base/357138

Log:
  - Be consistent with using sysexits(3) codes.
  - Turn fprintf()+exit() into errx().
  
  Sponsored by: Fudo Security

Modified:
  head/bin/pwait/pwait.c

Modified: head/bin/pwait/pwait.c
==
--- head/bin/pwait/pwait.c  Sun Jan 26 07:24:49 2020(r357137)
+++ head/bin/pwait/pwait.c  Sun Jan 26 10:49:24 2020(r357138)
@@ -53,8 +53,7 @@ static void
 usage(void)
 {
 
-   fprintf(stderr, "usage: pwait [-t timeout] [-v] pid ...\n");
-   exit(EX_USAGE);
+   errx(EX_USAGE, "usage: pwait [-t timeout] [-v] pid ...");
 }
 
 /*
@@ -120,11 +119,11 @@ main(int argc, char *argv[])
 
kq = kqueue();
if (kq == -1)
-   err(1, "kqueue");
+   err(EX_OSERR, "kqueue");
 
e = malloc((argc + tflag) * sizeof(struct kevent));
if (e == NULL)
-   err(1, "malloc");
+   err(EX_OSERR, "malloc");
nleft = 0;
for (n = 0; n < argc; n++) {
s = argv[n];
@@ -166,12 +165,12 @@ main(int argc, char *argv[])
while (nleft > 0) {
n = kevent(kq, NULL, 0, e, nleft + tflag, NULL);
if (n == -1)
-   err(1, "kevent");
+   err(EX_OSERR, "kevent");
for (i = 0; i < n; i++) {
if (e[i].filter == EVFILT_SIGNAL) {
if (verbose)
printf("timeout\n");
-   return (124);
+   exit(124);
}
if (verbose) {
status = e[i].data;
___
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: r357051 - head/sys/dev/bge

2020-01-26 Thread John Baldwin
On 1/23/20 7:32 PM, Gleb Smirnoff wrote:
> On Thu, Jan 23, 2020 at 05:09:14PM -1000, Jeff Roberson wrote:
> J> While we don't have a policy strictly requiring reviews it is the norm to 
> J> have substantial changes socialized and reviewed.  I appreciate the work 
> J> that you are doing but it likely should've been discussed somewhere 
> J> more publicly.  I apologized if I missed it but I don't see reference to 
> J> anything.
> 
> That was https://reviews.freebsd.org/D23242

A review alone isn't sufficient for large, sweeping changes in my mind.
For major changes, a thread on arch@ or net@ or the like is probably more
appropriate.  You can include a link to a review or git branch, etc. in
that e-mail, but phabricator aren't as well suited to higher-level
design-review type discussion, more for implementation-review.
> J> Architecturally I am more concerned with the coarseness of net_epoch and 
> J> the duration of hold becoming a resource utilization problem in high 
> J> turn-over workloads.  Like short connection tcp.  Has anyone done 
> J> substantial testing here?  epoch as it is today will hold every free 
> J> callback for a minimum of several clock ticks and a maximum of 2x the 
> J> duration of the longest epoch section time.  With preemption, etc. this 
> J> could be 100s of ms of PCBs held.
> 
> We also are concerned about that theoretically. Haven't yet seen effect
> in practice, but our sessions are mostly longer living. First we have the
> tunable to limit batching. Second, there are some ideas on how to improve
> the garbage collector performance if it becomes an issue.

There are other workloads than Netflix. ;)  Verisign has incredibly short-lived
connections with very high turnover.  I think though that they have already
abandoned the in-tree network stack for a userland stack built on netmap.  
Still,
I think that there are probably other FreeBSD users that are probably somewhere
in the middle that shouldn't be ignored.

Packet batching would not be impossible by simply using m_nextpkt chains in
mbufs passed up to ether_input and having ether_input pass them in a loop to
the next higher loop (as a first step).  That would reduce unlock/lock 
operations
in drivers (for those still using locks on receive) as well as permitting
ether_input to process batches under a single epoch invocation.

-- 
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: r357051 - head/sys/dev/bge

2020-01-26 Thread John Baldwin
On 1/23/20 9:15 PM, Gleb Smirnoff wrote:
> On Thu, Jan 23, 2020 at 06:18:15PM -1000, Jeff Roberson wrote:
> J> > That was https://reviews.freebsd.org/D23242
> J> 
> J> Ok thank you.  Can you tag commits so people can see the discussion?  Was 
> J> it in one I missed?  When I'm committing a long patch series I include the 
> J> link in all of them.
> 
> I probably now on will also include in every patch in a serie. I just
> dislike that first one (usually a preparation change) closes the review.

You can also add additional commits to a review via 'Edit related revisions'
in the web ui if you forget to tag a commit.

-- 
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: r357113 - head/tests/sys/net/routing

2020-01-26 Thread Alexander V . Chernikov
25.01.2020, 10:51, "Kristof Provost" :
> Author: kp
> Date: Sat Jan 25 10:51:51 2020
> New Revision: 357113
> URL: https://svnweb.freebsd.org/changeset/base/357113
>
> Log:
>   tests: Routing tests overwrote net tests
>
>   The routing subdirectory installed into the same directory as the test 
> tests,
>   which caused them to overwrite the net Kyuafile. As a result these tests 
> were
>   not executed.
Missed that one, thank you!
>
>   X-MFC-With: r356146
>
> Modified:
>   head/tests/sys/net/routing/Makefile
>
> Modified: head/tests/sys/net/routing/Makefile
> ==
> --- head/tests/sys/net/routing/Makefile Sat Jan 25 09:22:28 2020 (r357112)
> +++ head/tests/sys/net/routing/Makefile Sat Jan 25 10:51:51 2020 (r357113)
> @@ -2,7 +2,7 @@
>
>  PACKAGE= tests
>
> -TESTSDIR= ${TESTSBASE}/sys/net
> +TESTSDIR= ${TESTSBASE}/sys/net/routing
>
>  ATF_TESTS_C += test_rtsock_l3
>  ATF_TESTS_C += test_rtsock_lladdr
___
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"