Re: svn commit: r359681 - in head: . share/mk

2020-04-06 Thread Antoine Brodin
On Tue, Apr 7, 2020 at 1:38 AM Brooks Davis  wrote:
>
> Author: brooks
> Date: Mon Apr  6 23:38:46 2020
> New Revision: 359681
> URL: https://svnweb.freebsd.org/changeset/base/359681
>
> Log:
>   Fix compilation with upstream clang builtin headers.
>
>   By using -nobuiltininc and adding the clang builtin headers resource dir
>   to the end of the compiler header search path, we can still find headers
>   such as immintrin.h but find the FreeBSD version of stddef.h/stdarg.h/..
>   first.
>
>   This is a workaround until we are able to settle on and complete a plan
>   to harmonize guard macros with LLVM.  We've mostly worked out this on
>   FreeBSD systems by removing select headers from the installed set of
>   devel/llvm*, but that isn't a good solution for cross build.
>
>   Submitted by: arichardson
>   Obtained from:CheriBSD
>   Sponsored by: DARPA, AFRL
>   Differential Revision:https://reviews.freebsd.org/D17002
>
> Modified:
>   head/Makefile.inc1
>   head/share/mk/bsd.compiler.mk
>   head/share/mk/bsd.sys.mk
>

This breaks ports:

make[1]: "/usr/share/mk/bsd.sys.mk" line 219: Malformed conditional
(${MK_CLANG_BOOTSTRAP} == "no" && ${COMPILER_RESOURCE_DIR} !=
"unknown" &&  !defined(BOOTSTRAPPING))

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


Re: svn commit: r359681 - in head: . share/mk

2020-04-06 Thread Maxim Sobolev
This broke Jenkins builds. :(

https://ci.freebsd.org/job/FreeBSD-head-armv7-build/8689/


-Max

On Mon, Apr 6, 2020 at 6:49 PM Bryan Drewery  wrote:

> On 4/6/2020 4:38 PM, Brooks Davis wrote:
> > Author: brooks
> > Date: Mon Apr  6 23:38:46 2020
> > New Revision: 359681
> > URL: https://svnweb.freebsd.org/changeset/base/359681
> >
> > Log:
> >   Fix compilation with upstream clang builtin headers.
> >
> >   By using -nobuiltininc and adding the clang builtin headers resource
> dir
> >   to the end of the compiler header search path, we can still find
> headers
> >   such as immintrin.h but find the FreeBSD version of
> stddef.h/stdarg.h/..
> >   first.
> >
> >   This is a workaround until we are able to settle on and complete a plan
> >   to harmonize guard macros with LLVM.  We've mostly worked out this on
> >   FreeBSD systems by removing select headers from the installed set of
> >   devel/llvm*, but that isn't a good solution for cross build.
> >
> >   Submitted by:   arichardson
> >   Obtained from:  CheriBSD
> >   Sponsored by:   DARPA, AFRL
> >   Differential Revision:  https://reviews.freebsd.org/D17002
> >
> > Modified:
> >   head/Makefile.inc1
> >   head/share/mk/bsd.compiler.mk
> >   head/share/mk/bsd.sys.mk
> >
> > Modified: head/Makefile.inc1
> >
> ==
> > --- head/Makefile.inc1Mon Apr  6 23:28:24 2020(r359680)
> > +++ head/Makefile.inc1Mon Apr  6 23:38:46 2020(r359681)
> > @@ -337,6 +337,7 @@ _TOOLCHAIN_METADATA_VARS= COMPILER_VERSION \
> >   COMPILER_TYPE \
> >   COMPILER_FEATURES \
> >   COMPILER_FREEBSD_VERSION \
> > + COMPILER_RESOURCE_DIR \
> >   LINKER_VERSION \
> >   LINKER_FEATURES \
> >   LINKER_TYPE \
> >
> > Modified: head/share/mk/bsd.compiler.mk
> >
> ==
> > --- head/share/mk/bsd.compiler.mk Mon Apr  6 23:28:24 2020
> (r359680)
> > +++ head/share/mk/bsd.compiler.mk Mon Apr  6 23:38:46 2020
> (r359681)
> > @@ -143,7 +143,7 @@ _cc_vars+=XCC X_
> >  # The value is only used/exported for the same environment that impacts
> >  # CC and COMPILER_* settings here.
> >  _exported_vars=  ${X_}COMPILER_TYPE ${X_}COMPILER_VERSION \
> > - ${X_}COMPILER_FREEBSD_VERSION
> > + ${X_}COMPILER_FREEBSD_VERSION ${X_}COMPILER_RESOURCE_DIR
> >  ${X_}_cc_hash=   ${${cc}}${MACHINE}${PATH}
> >  ${X_}_cc_hash:=  ${${X_}_cc_hash:hash}
> >  # Only import if none of the vars are set somehow else.
> > @@ -201,6 +201,10 @@ ${X_}COMPILER_FREEBSD_VERSION=   unknown
> >  .endif
> >  .endif
> >
> > +.if !defined(${X_}COMPILER_RESOURCE_DIR)
> > +${X_}COMPILER_RESOURCE_DIR!= ${${cc}:N${CCACHE_BIN}}
> -print-resource-dir 2>/dev/null || echo unknown
> > +.endif
> > +
> >  ${X_}COMPILER_FEATURES=
> >  .if (${${X_}COMPILER_TYPE} == "clang" && ${${X_}COMPILER_VERSION} >=
> 30300) || \
> >   (${${X_}COMPILER_TYPE} == "gcc" && ${${X_}COMPILER_VERSION} >=
> 40800)
> > @@ -224,6 +228,7 @@ X_COMPILER_TYPE=  ${COMPILER_TYPE}
> >  X_COMPILER_VERSION=  ${COMPILER_VERSION}
> >  X_COMPILER_FREEBSD_VERSION=  ${COMPILER_FREEBSD_VERSION}
> >  X_COMPILER_FEATURES= ${COMPILER_FEATURES}
> > +X_COMPILER_RESOURCE_DIR= ${COMPILER_RESOURCE_DIR}
> >  .endif   # ${cc} == "CC" || (${cc} == "XCC" && ${XCC} != ${CC})
> >
> >  # Export the values so sub-makes don't have to look them up again,
> using the
> >
> > Modified: head/share/mk/bsd.sys.mk
> >
> ==
> > --- head/share/mk/bsd.sys.mk  Mon Apr  6 23:28:24 2020(r359680)
> > +++ head/share/mk/bsd.sys.mk  Mon Apr  6 23:38:46 2020(r359681)
> > @@ -206,6 +206,21 @@ CWARNFLAGS+= -Wno-unknown-pragmas
> >  # This warning is utter nonsense
> >  CFLAGS+= -Wno-format-zero-length
> >
> > +.if ${COMPILER_TYPE} == "clang"
> > +# The headers provided by clang are incompatible with the FreeBSD
> headers.
> > +# If the version of clang is not one that has been patched to omit the
> > +# incompatible headers, we need to compile with -nobuiltininc and add
> the
> > +# resource dir to the end of the search paths. This ensures that
> headers such as
> > +# immintrin.h are still found but stddef.h, etc. are picked up from
> FreeBSD.
> > +#
> > +# XXX: This is a hack to support complete external installs of clang
> while
> > +# we work to synchronize our decleration guards with those in the clang
> tree.
> > +.if ${MK_CLANG_BOOTSTRAP} == "no" && ${COMPILER_RESOURCE_DIR} !=
> "unknown" && \
> > +!defined(BOOTSTRAPPING)
>
> I just realized MK_CLANG_BOOTSTRAP is not going to be defined here
> outside of the tree. Adding :Uno will fix it. Keep in mind this current
> change 

svn commit: r359686 - head/sys/cam/ctl

2020-04-06 Thread Alexander Motin
Author: mav
Date: Tue Apr  7 03:19:00 2020
New Revision: 359686
URL: https://svnweb.freebsd.org/changeset/base/359686

Log:
  Fix panic on kern.cam.ctl.ha_role change after r333446.
  
  MFC after:1 week
  Sponsored by: iXsystems, Inc.

Modified:
  head/sys/cam/ctl/ctl_backend_block.c
  head/sys/cam/ctl/ctl_backend_ramdisk.c

Modified: head/sys/cam/ctl/ctl_backend_block.c
==
--- head/sys/cam/ctl/ctl_backend_block.cTue Apr  7 02:46:22 2020
(r359685)
+++ head/sys/cam/ctl/ctl_backend_block.cTue Apr  7 03:19:00 2020
(r359686)
@@ -2574,8 +2574,10 @@ ctl_be_block_modify(struct ctl_be_block_softc *softc, 
if (params->lun_size_bytes != 0)
be_lun->params.lun_size_bytes = params->lun_size_bytes;
 
-   nvlist_destroy(cbe_lun->options);
-   cbe_lun->options = nvlist_clone(req->args_nvl);
+   if (req->args_nvl != NULL) {
+   nvlist_destroy(cbe_lun->options);
+   cbe_lun->options = nvlist_clone(req->args_nvl);
+   }
 
wasprim = (cbe_lun->flags & CTL_LUN_FLAG_PRIMARY);
value = dnvlist_get_string(cbe_lun->options, "ha_role", NULL);

Modified: head/sys/cam/ctl/ctl_backend_ramdisk.c
==
--- head/sys/cam/ctl/ctl_backend_ramdisk.c  Tue Apr  7 02:46:22 2020
(r359685)
+++ head/sys/cam/ctl/ctl_backend_ramdisk.c  Tue Apr  7 03:19:00 2020
(r359686)
@@ -1252,8 +1252,10 @@ ctl_backend_ramdisk_modify(struct ctl_be_ramdisk_softc
if (params->lun_size_bytes != 0)
be_lun->params.lun_size_bytes = params->lun_size_bytes;
 
-   nvlist_destroy(cbe_lun->options);
-   cbe_lun->options = nvlist_clone(req->args_nvl);
+   if (req->args_nvl != NULL) {
+   nvlist_destroy(cbe_lun->options);
+   cbe_lun->options = nvlist_clone(req->args_nvl);
+   }
 
wasprim = (cbe_lun->flags & CTL_LUN_FLAG_PRIMARY);
value = dnvlist_get_string(cbe_lun->options, "ha_role", NULL);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r359685 - in head: . etc lib/libc/gen share/mk share/termcap usr.bin/login usr.bin/vgrind usr.sbin/services_mkdb

2020-04-06 Thread Maxim Sobolev
Author: sobomax
Date: Tue Apr  7 02:46:22 2020
New Revision: 359685
URL: https://svnweb.freebsd.org/changeset/base/359685

Log:
  Normalize deployment tools usage and definitions by putting into one place
  instead of sprinkling them out over many disjoint files. This is a follow-up
  to achieve the same goal in an incomplete rev.348521.
  
  Approved by:  imp
  MFC after:1 month
  Differential Revision:https://reviews.freebsd.org/D20520

Added:
  head/share/mk/src.tools.mk   (contents, props changed)
Modified:
  head/Makefile.inc1
  head/etc/Makefile
  head/lib/libc/gen/Makefile.inc
  head/share/mk/sys.mk
  head/share/termcap/Makefile
  head/usr.bin/login/Makefile
  head/usr.bin/vgrind/Makefile
  head/usr.sbin/services_mkdb/Makefile

Modified: head/Makefile.inc1
==
--- head/Makefile.inc1  Tue Apr  7 02:45:24 2020(r359684)
+++ head/Makefile.inc1  Tue Apr  7 02:46:22 2020(r359685)
@@ -57,6 +57,8 @@ _MKSHOWCONFIG=t
 SRCDIR?=   ${.CURDIR}
 LOCALBASE?=/usr/local
 
+.include "share/mk/src.tools.mk"
+
 # Cross toolchain changes must be in effect before bsd.compiler.mk
 # so that gets the right CC, and pass CROSS_TOOLCHAIN to submakes.
 .if defined(CROSS_TOOLCHAIN)
@@ -874,8 +876,8 @@ MTREEFLAGS+=-W
 INSTALLFLAGS+= -h sha256
 .endif
 .if defined(DB_FROM_SRC) || defined(NO_ROOT)
-IMAKE_INSTALL= INSTALL="install ${INSTALLFLAGS}"
-IMAKE_MTREE=   MTREE_CMD="mtree ${MTREEFLAGS}"
+IMAKE_INSTALL= INSTALL="${INSTALL_CMD} ${INSTALLFLAGS}"
+IMAKE_MTREE=   MTREE_CMD="${MTREE_CMD} ${MTREEFLAGS}"
 .endif
 
 DESTDIR_MTREEFLAGS=-deU
@@ -887,12 +889,12 @@ WORLDTMP_MTREEFLAGS=  -deUW
 # that are created by mtree to be owned by root/wheel.
 DESTDIR_MTREEFLAGS+=   -W
 .endif
-MTREE?=mtree
+DISTR_MTREE=   ${MTREE_CMD}
 .if ${BUILD_WITH_STRICT_TMPPATH} != 0
-MTREE= ${WORLDTMP}/legacy/usr/sbin/mtree
+DISTR_MTREE=   ${WORLDTMP}/legacy/usr/sbin/mtree
 .endif
-WORLDTMP_MTREE=${MTREE} ${WORLDTMP_MTREEFLAGS}
-DESTDIR_MTREE= ${MTREE} ${DESTDIR_MTREEFLAGS}
+WORLDTMP_MTREE=${DISTR_MTREE} ${WORLDTMP_MTREEFLAGS}
+DESTDIR_MTREE= ${DISTR_MTREE} ${DESTDIR_MTREEFLAGS}
 
 # kernel stage
 KMAKEENV=  ${WMAKEENV:NSYSROOT=*}
@@ -1363,14 +1365,14 @@ distributeworld installworld stageworld: _installcheck
 .endif
 .endif
 .if defined(NO_ROOT)
-   ${IMAKEENV} ${MTREE} -C -f ${.CURDIR}/etc/mtree/BSD.root.dist | \
+   ${IMAKEENV} ${DISTR_MTREE} -C -f ${.CURDIR}/etc/mtree/BSD.root.dist | \
sed -e 's#^\./#./${dist}/#' >> ${METALOG}
-   ${IMAKEENV} ${MTREE} -C -f ${.CURDIR}/etc/mtree/BSD.usr.dist | \
+   ${IMAKEENV} ${DISTR_MTREE} -C -f ${.CURDIR}/etc/mtree/BSD.usr.dist | \
sed -e 's#^\./#./${dist}/usr/#' >> ${METALOG}
-   ${IMAKEENV} ${MTREE} -C -f ${.CURDIR}/etc/mtree/BSD.include.dist | \
+   ${IMAKEENV} ${DISTR_MTREE} -C -f ${.CURDIR}/etc/mtree/BSD.include.dist 
| \
sed -e 's#^\./#./${dist}/usr/include/#' >> ${METALOG}
 .if defined(_LIBCOMPAT)
-   ${IMAKEENV} ${MTREE} -C -f 
${.CURDIR}/etc/mtree/BSD.lib${libcompat}.dist | \
+   ${IMAKEENV} ${DISTR_MTREE} -C -f 
${.CURDIR}/etc/mtree/BSD.lib${libcompat}.dist | \
sed -e 's#^\./#./${dist}/usr/#' >> ${METALOG}
 .endif
 .endif

Modified: head/etc/Makefile
==
--- head/etc/Makefile   Tue Apr  7 02:45:24 2020(r359684)
+++ head/etc/Makefile   Tue Apr  7 02:46:22 2020(r359685)
@@ -2,11 +2,11 @@
 # $FreeBSD$
 
 .include 
+.include 
 
 FILESGROUPS=   FILES
 NLS_ALIASES=   POSIX C \
en_US.US_ASCII C
-PWD_MKDB_CMD?= pwd_mkdb
 
 # No need as it is empty and just causes rebuilds since this file does so much.
 UPDATE_DEPENDFILE= no
@@ -98,8 +98,6 @@ distribution:
${DESTDIR}/boot/device.hints
 .endif
 .endif
-
-MTREE_CMD?=mtree
 
 MTREES=mtree/BSD.root.dist /   \
mtree/BSD.var.dist  /var\

Modified: head/lib/libc/gen/Makefile.inc
==
--- head/lib/libc/gen/Makefile.inc  Tue Apr  7 02:45:24 2020
(r359684)
+++ head/lib/libc/gen/Makefile.inc  Tue Apr  7 02:46:22 2020
(r359685)
@@ -550,11 +550,13 @@ MLINKS+=vis.3 nvis.3 \
 
 MLINKS+=wordexp.3 wordfree.3
 
+.include 
+
 afterinstallconfig:
 .if ${MK_TCSH} == "no"
sed -i "" -e 's;/bin/csh;/bin/sh;' ${DESTDIR}/etc/master.passwd
 .endif
-   pwd_mkdb -i -p -d ${DESTDIR}/etc ${DESTDIR}/etc/master.passwd
+   ${PWD_MKDB_CMD} -i -p -d ${DESTDIR}/etc ${DESTDIR}/etc/master.passwd
 .if defined(NO_ROOT) && defined(METALOG)
( \
echo "./etc/pwd.db type=file mode=0644 uname=root gname=wheel"; 
\

Added: head/share/mk/src.tools.mk
==
--- 

Re: svn commit: r359681 - in head: . share/mk

2020-04-06 Thread Bryan Drewery
On 4/6/2020 4:38 PM, Brooks Davis wrote:
> Author: brooks
> Date: Mon Apr  6 23:38:46 2020
> New Revision: 359681
> URL: https://svnweb.freebsd.org/changeset/base/359681
> 
> Log:
>   Fix compilation with upstream clang builtin headers.
>   
>   By using -nobuiltininc and adding the clang builtin headers resource dir
>   to the end of the compiler header search path, we can still find headers
>   such as immintrin.h but find the FreeBSD version of stddef.h/stdarg.h/..
>   first.
>   
>   This is a workaround until we are able to settle on and complete a plan
>   to harmonize guard macros with LLVM.  We've mostly worked out this on
>   FreeBSD systems by removing select headers from the installed set of
>   devel/llvm*, but that isn't a good solution for cross build.
>   
>   Submitted by:   arichardson
>   Obtained from:  CheriBSD
>   Sponsored by:   DARPA, AFRL
>   Differential Revision:  https://reviews.freebsd.org/D17002
> 
> Modified:
>   head/Makefile.inc1
>   head/share/mk/bsd.compiler.mk
>   head/share/mk/bsd.sys.mk
> 
> Modified: head/Makefile.inc1
> ==
> --- head/Makefile.inc1Mon Apr  6 23:28:24 2020(r359680)
> +++ head/Makefile.inc1Mon Apr  6 23:38:46 2020(r359681)
> @@ -337,6 +337,7 @@ _TOOLCHAIN_METADATA_VARS= COMPILER_VERSION \
>   COMPILER_TYPE \
>   COMPILER_FEATURES \
>   COMPILER_FREEBSD_VERSION \
> + COMPILER_RESOURCE_DIR \
>   LINKER_VERSION \
>   LINKER_FEATURES \
>   LINKER_TYPE \
> 
> Modified: head/share/mk/bsd.compiler.mk
> ==
> --- head/share/mk/bsd.compiler.mk Mon Apr  6 23:28:24 2020
> (r359680)
> +++ head/share/mk/bsd.compiler.mk Mon Apr  6 23:38:46 2020
> (r359681)
> @@ -143,7 +143,7 @@ _cc_vars+=XCC X_
>  # The value is only used/exported for the same environment that impacts
>  # CC and COMPILER_* settings here.
>  _exported_vars=  ${X_}COMPILER_TYPE ${X_}COMPILER_VERSION \
> - ${X_}COMPILER_FREEBSD_VERSION
> + ${X_}COMPILER_FREEBSD_VERSION ${X_}COMPILER_RESOURCE_DIR
>  ${X_}_cc_hash=   ${${cc}}${MACHINE}${PATH}
>  ${X_}_cc_hash:=  ${${X_}_cc_hash:hash}
>  # Only import if none of the vars are set somehow else.
> @@ -201,6 +201,10 @@ ${X_}COMPILER_FREEBSD_VERSION=   unknown
>  .endif
>  .endif
>  
> +.if !defined(${X_}COMPILER_RESOURCE_DIR)
> +${X_}COMPILER_RESOURCE_DIR!= ${${cc}:N${CCACHE_BIN}} -print-resource-dir 
> 2>/dev/null || echo unknown
> +.endif
> +
>  ${X_}COMPILER_FEATURES=
>  .if (${${X_}COMPILER_TYPE} == "clang" && ${${X_}COMPILER_VERSION} >= 30300) 
> || \
>   (${${X_}COMPILER_TYPE} == "gcc" && ${${X_}COMPILER_VERSION} >= 40800)
> @@ -224,6 +228,7 @@ X_COMPILER_TYPE=  ${COMPILER_TYPE}
>  X_COMPILER_VERSION=  ${COMPILER_VERSION}
>  X_COMPILER_FREEBSD_VERSION=  ${COMPILER_FREEBSD_VERSION}
>  X_COMPILER_FEATURES= ${COMPILER_FEATURES}
> +X_COMPILER_RESOURCE_DIR= ${COMPILER_RESOURCE_DIR}
>  .endif   # ${cc} == "CC" || (${cc} == "XCC" && ${XCC} != ${CC})
>  
>  # Export the values so sub-makes don't have to look them up again, using the
> 
> Modified: head/share/mk/bsd.sys.mk
> ==
> --- head/share/mk/bsd.sys.mk  Mon Apr  6 23:28:24 2020(r359680)
> +++ head/share/mk/bsd.sys.mk  Mon Apr  6 23:38:46 2020(r359681)
> @@ -206,6 +206,21 @@ CWARNFLAGS+= -Wno-unknown-pragmas
>  # This warning is utter nonsense
>  CFLAGS+= -Wno-format-zero-length
>  
> +.if ${COMPILER_TYPE} == "clang"
> +# The headers provided by clang are incompatible with the FreeBSD headers.
> +# If the version of clang is not one that has been patched to omit the
> +# incompatible headers, we need to compile with -nobuiltininc and add the
> +# resource dir to the end of the search paths. This ensures that headers 
> such as
> +# immintrin.h are still found but stddef.h, etc. are picked up from FreeBSD.
> +#
> +# XXX: This is a hack to support complete external installs of clang while
> +# we work to synchronize our decleration guards with those in the clang tree.
> +.if ${MK_CLANG_BOOTSTRAP} == "no" && ${COMPILER_RESOURCE_DIR} != "unknown" 
> && \
> +!defined(BOOTSTRAPPING)

I just realized MK_CLANG_BOOTSTRAP is not going to be defined here
outside of the tree. Adding :Uno will fix it. Keep in mind this current
change and the next will affect ports. It looks like by default clang
will always get these flags added on.

> +CFLAGS+=-nobuiltininc -idirafter ${COMPILER_RESOURCE_DIR}/include
> +.endif
> +.endif
> +
>  CLANG_OPT_SMALL= -mstack-alignment=8 -mllvm -inline-threshold=3\
>-mllvm -simplifycfg-dup-ret
>  .if 

svn commit: r359682 - head/sys/riscv/riscv

2020-04-06 Thread Jessica Clarke
Author: jrtc27
Date: Mon Apr  6 23:54:50 2020
New Revision: 359682
URL: https://svnweb.freebsd.org/changeset/base/359682

Log:
  riscv: Add semicolon missing from r359672
  
  Somehow this got lost between build-testing and submitting to Phabricator.

Modified:
  head/sys/riscv/riscv/pmap.c

Modified: head/sys/riscv/riscv/pmap.c
==
--- head/sys/riscv/riscv/pmap.c Mon Apr  6 23:38:46 2020(r359681)
+++ head/sys/riscv/riscv/pmap.c Mon Apr  6 23:54:50 2020(r359682)
@@ -4354,7 +4354,7 @@ pmap_sync_icache(pmap_t pmap, vm_offset_t va, vm_size_
sched_pin();
mask = all_harts;
CPU_CLR(PCPU_GET(hart), );
-   fence_i()
+   fence_i();
if (!CPU_EMPTY() && smp_started) {
fence();
sbi_remote_fence_i(mask.__bits);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r359681 - in head: . share/mk

2020-04-06 Thread Brooks Davis
Author: brooks
Date: Mon Apr  6 23:38:46 2020
New Revision: 359681
URL: https://svnweb.freebsd.org/changeset/base/359681

Log:
  Fix compilation with upstream clang builtin headers.
  
  By using -nobuiltininc and adding the clang builtin headers resource dir
  to the end of the compiler header search path, we can still find headers
  such as immintrin.h but find the FreeBSD version of stddef.h/stdarg.h/..
  first.
  
  This is a workaround until we are able to settle on and complete a plan
  to harmonize guard macros with LLVM.  We've mostly worked out this on
  FreeBSD systems by removing select headers from the installed set of
  devel/llvm*, but that isn't a good solution for cross build.
  
  Submitted by: arichardson
  Obtained from:CheriBSD
  Sponsored by: DARPA, AFRL
  Differential Revision:https://reviews.freebsd.org/D17002

Modified:
  head/Makefile.inc1
  head/share/mk/bsd.compiler.mk
  head/share/mk/bsd.sys.mk

Modified: head/Makefile.inc1
==
--- head/Makefile.inc1  Mon Apr  6 23:28:24 2020(r359680)
+++ head/Makefile.inc1  Mon Apr  6 23:38:46 2020(r359681)
@@ -337,6 +337,7 @@ _TOOLCHAIN_METADATA_VARS=   COMPILER_VERSION \
COMPILER_TYPE \
COMPILER_FEATURES \
COMPILER_FREEBSD_VERSION \
+   COMPILER_RESOURCE_DIR \
LINKER_VERSION \
LINKER_FEATURES \
LINKER_TYPE \

Modified: head/share/mk/bsd.compiler.mk
==
--- head/share/mk/bsd.compiler.mk   Mon Apr  6 23:28:24 2020
(r359680)
+++ head/share/mk/bsd.compiler.mk   Mon Apr  6 23:38:46 2020
(r359681)
@@ -143,7 +143,7 @@ _cc_vars+=XCC X_
 # The value is only used/exported for the same environment that impacts
 # CC and COMPILER_* settings here.
 _exported_vars=${X_}COMPILER_TYPE ${X_}COMPILER_VERSION \
-   ${X_}COMPILER_FREEBSD_VERSION
+   ${X_}COMPILER_FREEBSD_VERSION ${X_}COMPILER_RESOURCE_DIR
 ${X_}_cc_hash= ${${cc}}${MACHINE}${PATH}
 ${X_}_cc_hash:=${${X_}_cc_hash:hash}
 # Only import if none of the vars are set somehow else.
@@ -201,6 +201,10 @@ ${X_}COMPILER_FREEBSD_VERSION= unknown
 .endif
 .endif
 
+.if !defined(${X_}COMPILER_RESOURCE_DIR)
+${X_}COMPILER_RESOURCE_DIR!=   ${${cc}:N${CCACHE_BIN}} -print-resource-dir 
2>/dev/null || echo unknown
+.endif
+
 ${X_}COMPILER_FEATURES=
 .if (${${X_}COMPILER_TYPE} == "clang" && ${${X_}COMPILER_VERSION} >= 30300) || 
\
(${${X_}COMPILER_TYPE} == "gcc" && ${${X_}COMPILER_VERSION} >= 40800)
@@ -224,6 +228,7 @@ X_COMPILER_TYPE=${COMPILER_TYPE}
 X_COMPILER_VERSION=${COMPILER_VERSION}
 X_COMPILER_FREEBSD_VERSION=${COMPILER_FREEBSD_VERSION}
 X_COMPILER_FEATURES=   ${COMPILER_FEATURES}
+X_COMPILER_RESOURCE_DIR=   ${COMPILER_RESOURCE_DIR}
 .endif # ${cc} == "CC" || (${cc} == "XCC" && ${XCC} != ${CC})
 
 # Export the values so sub-makes don't have to look them up again, using the

Modified: head/share/mk/bsd.sys.mk
==
--- head/share/mk/bsd.sys.mkMon Apr  6 23:28:24 2020(r359680)
+++ head/share/mk/bsd.sys.mkMon Apr  6 23:38:46 2020(r359681)
@@ -206,6 +206,21 @@ CWARNFLAGS+=   -Wno-unknown-pragmas
 # This warning is utter nonsense
 CFLAGS+=   -Wno-format-zero-length
 
+.if ${COMPILER_TYPE} == "clang"
+# The headers provided by clang are incompatible with the FreeBSD headers.
+# If the version of clang is not one that has been patched to omit the
+# incompatible headers, we need to compile with -nobuiltininc and add the
+# resource dir to the end of the search paths. This ensures that headers such 
as
+# immintrin.h are still found but stddef.h, etc. are picked up from FreeBSD.
+#
+# XXX: This is a hack to support complete external installs of clang while
+# we work to synchronize our decleration guards with those in the clang tree.
+.if ${MK_CLANG_BOOTSTRAP} == "no" && ${COMPILER_RESOURCE_DIR} != "unknown" && \
+!defined(BOOTSTRAPPING)
+CFLAGS+=-nobuiltininc -idirafter ${COMPILER_RESOURCE_DIR}/include
+.endif
+.endif
+
 CLANG_OPT_SMALL= -mstack-alignment=8 -mllvm -inline-threshold=3\
 -mllvm -simplifycfg-dup-ret
 .if ${COMPILER_VERSION} >= 30500 && ${COMPILER_VERSION} < 30700
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r359680 - in head/usr.bin: gprof mail tip/tip

2020-04-06 Thread Kyle Evans
Author: kevans
Date: Mon Apr  6 23:28:24 2020
New Revision: 359680
URL: https://svnweb.freebsd.org/changeset/base/359680

Log:
  mail/gprof/tip: tap with the ugly stick
  
  The ugly stick here is this bit in the respective headers:
  
  #ifndef EXTERN
  #define EXTERN extern
  #endif
  
  with a follow-up #define EXTERN in a single .c file to push all of their
  definitions into one spot. A pass should be made over these three later to
  push these definitions into the correct files instead, but this will suffice
  for now and at a more leisurely pace.
  
  MFC after:3 days

Modified:
  head/usr.bin/gprof/gprof.c
  head/usr.bin/gprof/gprof.h
  head/usr.bin/mail/glob.h
  head/usr.bin/mail/main.c
  head/usr.bin/mail/strings.c
  head/usr.bin/tip/tip/tip.c
  head/usr.bin/tip/tip/tip.h

Modified: head/usr.bin/gprof/gprof.c
==
--- head/usr.bin/gprof/gprof.c  Mon Apr  6 23:21:39 2020(r359679)
+++ head/usr.bin/gprof/gprof.c  Mon Apr  6 23:28:24 2020(r359680)
@@ -49,6 +49,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#defineEXTERN
 #include "gprof.h"
 
 static int valcmp(const void *, const void *);

Modified: head/usr.bin/gprof/gprof.h
==
--- head/usr.bin/gprof/gprof.h  Mon Apr  6 23:21:39 2020(r359679)
+++ head/usr.bin/gprof/gprof.h  Mon Apr  6 23:28:24 2020(r359680)
@@ -75,18 +75,22 @@ typedef int bool;
  */
 #defineHISTORICAL_SCALE_2  2
 
+#ifndef EXTERN
+#defineEXTERN  extern
+#endif
+
 /*
  * ticks per second
  */
-long   hz;
+EXTERN longhz;
 
-size_t histcounter_size;
-inthistcounter_type;
+EXTERN size_t  histcounter_size;
+EXTERN int histcounter_type;
 
-char   *a_outname;
+EXTERN char*a_outname;
 #defineA_OUTNAME   "a.out"
 
-char   *gmonname;
+EXTERN char*gmonname;
 #defineGMONSUM "gmon.sum"
 
 /*
@@ -146,9 +150,9 @@ struct nl {
 };
 typedef struct nl  nltype;
 
-nltype *nl;/* the whole namelist */
-nltype *npe;   /* the virtual end of the namelist */
-intnname;  /* the number of function names */
+EXTERN nltype  *nl;/* the whole namelist */
+EXTERN nltype  *npe;   /* the virtual end of the namelist */
+EXTERN int nname;  /* the number of function names */
 
 #defineHASCYCLEXIT 0x08/* node has arc exiting from cycle */
 #defineCYCLEHEAD   0x10/* node marked as head of a cycle */
@@ -167,9 +171,9 @@ struct cl {
 };
 typedef struct cl cltype;
 
-arctype*archead;   /* the head of arcs in current cycle 
list */
-cltype *cyclehead; /* the head of the list */
-intcyclecnt;   /* the number of cycles found */
+EXTERN arctype *archead;   /* the head of arcs in current cycle list */
+EXTERN cltype  *cyclehead; /* the head of the list */
+EXTERN int cyclecnt;   /* the number of cycles found */
 #defineCYCLEMAX100 /* maximum cycles before cutting one of 
them */
 
 /*
@@ -183,8 +187,8 @@ int cyclecnt;   /* the number of cycles found */
  * namelist entries for cycle headers.
  * the number of discovered cycles.
  */
-nltype *cyclenl;   /* cycle header namelist */
-intncycle; /* number of cycles discovered */
+EXTERN nltype  *cyclenl;   /* cycle header namelist */
+EXTERN int ncycle; /* number of cycles discovered */
 
 /*
  * The header on the gmon.out file.
@@ -200,43 +204,46 @@ struct ophdr {
 intncnt;
 };
 
-intdebug;
+EXTERN int debug;
 
 /*
  * Each discretized pc sample has
  * a count of the number of samples in its range
  */
-double *samples;
+EXTERN double  *samples;
 
-unsigned long  s_lowpc;/* lowpc from the profile file */
-unsigned long  s_highpc;   /* highpc from the profile file */
-unsigned long  lowpc, highpc;  /* range profiled, in historical units  */
-unsigned sampbytes;/* number of bytes of samples */
-intnsamples;   /* number of samples */
-double actime; /* accumulated time thus far for putprofline */
-double totime; /* total time for all routines */
-double printtime;  /* total of time being printed */
-double scale;  /* scale factor converting samples to pc
+EXTERN unsigned long   s_lowpc;/* lowpc from the profile file */
+EXTERN unsigned long   s_highpc;   /* highpc from the profile file */
+/* range profiled, in historical units  */
+EXTERN unsigned long   lowpc, highpc;
+EXTERN unsigned sampbytes; /* number of bytes of samples */
+EXTERN int nsamples;   /* number of samples */

svn commit: r359679 - in head/sys/fs: nfs nfsserver

2020-04-06 Thread Rick Macklem
Author: rmacklem
Date: Mon Apr  6 23:21:39 2020
New Revision: 359679
URL: https://svnweb.freebsd.org/changeset/base/359679

Log:
  Fix noisy NFSv4 server printf.
  
  Peter reported that his dmesg was getting cluttered with
  nfsrv_cache_session: no session
  messages when he rebooted his NFS server and they did not seem useful.
  He was correct, in that these messages are "normal" and expected when
  NFSv4.1 or NFSv4.2 are mounted and the server is rebooted.
  This patch silences the printf() during the grace period after a reboot.
  It also adds the client IP address to the printf(), so that the message
  is more useful if/when it occurs. If this happens outside of the
  server's grace period, it does indicate something is not working correctly.
  Instead of adding yet another nd_XXX argument, the arguments for
  nfsrv_cache_session() were simplified to take a "struct nfsrv_descript *".
  
  Reported by:  p...@lysator.liu.se
  MFC after:2 weeks

Modified:
  head/sys/fs/nfs/nfs_var.h
  head/sys/fs/nfsserver/nfs_nfsdkrpc.c
  head/sys/fs/nfsserver/nfs_nfsdstate.c

Modified: head/sys/fs/nfs/nfs_var.h
==
--- head/sys/fs/nfs/nfs_var.h   Mon Apr  6 23:20:20 2020(r359678)
+++ head/sys/fs/nfs/nfs_var.h   Mon Apr  6 23:21:39 2020(r359679)
@@ -143,7 +143,7 @@ void nfsrv_throwawayallstate(NFSPROC_T *);
 int nfsrv_checksequence(struct nfsrv_descript *, uint32_t, uint32_t *,
 uint32_t *, int, uint32_t *, NFSPROC_T *);
 int nfsrv_checkreclaimcomplete(struct nfsrv_descript *, int);
-void nfsrv_cache_session(uint8_t *, uint32_t, int, struct mbuf **);
+void nfsrv_cache_session(struct nfsrv_descript *, struct mbuf **);
 void nfsrv_freeallbackchannel_xprts(void);
 int nfsrv_layoutcommit(struct nfsrv_descript *, vnode_t, int, int, uint64_t,
 uint64_t, uint64_t, int, struct timespec *, int, nfsv4stateid_t *,

Modified: head/sys/fs/nfsserver/nfs_nfsdkrpc.c
==
--- head/sys/fs/nfsserver/nfs_nfsdkrpc.cMon Apr  6 23:20:20 2020
(r359678)
+++ head/sys/fs/nfsserver/nfs_nfsdkrpc.cMon Apr  6 23:21:39 2020
(r359679)
@@ -393,8 +393,7 @@ nfs_proc(struct nfsrv_descript *nd, u_int32_t xid, SVC
} else
m = NULL;
if ((nd->nd_flag & ND_HASSEQUENCE) != 0)
-   nfsrv_cache_session(nd->nd_sessionid,
-   nd->nd_slotid, nd->nd_repstat, );
+   nfsrv_cache_session(nd, );
if (nd->nd_repstat == NFSERR_REPLYFROMCACHE)
nd->nd_repstat = 0;
cacherep = RC_REPLY;

Modified: head/sys/fs/nfsserver/nfs_nfsdstate.c
==
--- head/sys/fs/nfsserver/nfs_nfsdstate.c   Mon Apr  6 23:20:20 2020
(r359678)
+++ head/sys/fs/nfsserver/nfs_nfsdstate.c   Mon Apr  6 23:21:39 2020
(r359679)
@@ -6294,22 +6294,56 @@ nfsrv_checkreclaimcomplete(struct nfsrv_descript *nd, 
  * Cache the reply in a session slot.
  */
 void
-nfsrv_cache_session(uint8_t *sessionid, uint32_t slotid, int repstat,
-   struct mbuf **m)
+nfsrv_cache_session(struct nfsrv_descript *nd, struct mbuf **m)
 {
struct nfsdsession *sep;
struct nfssessionhash *shp;
+   char *buf, *cp;
+#ifdef INET
+   struct sockaddr_in *sin;
+#endif
+#ifdef INET6
+   struct sockaddr_in6 *sin6;
+#endif
 
-   shp = NFSSESSIONHASH(sessionid);
+   shp = NFSSESSIONHASH(nd->nd_sessionid);
NFSLOCKSESSION(shp);
-   sep = nfsrv_findsession(sessionid);
+   sep = nfsrv_findsession(nd->nd_sessionid);
if (sep == NULL) {
NFSUNLOCKSESSION(shp);
-   printf("nfsrv_cache_session: no session\n");
+   if ((nfsrv_stablefirst.nsf_flags & NFSNSF_GRACEOVER) != 0) {
+   buf = malloc(INET6_ADDRSTRLEN, M_TEMP, M_WAITOK);
+   switch (nd->nd_nam->sa_family) {
+#ifdef INET
+   case AF_INET:
+   sin = (struct sockaddr_in *)nd->nd_nam;
+   cp = inet_ntop(sin->sin_family,
+   >sin_addr.s_addr, buf,
+   INET6_ADDRSTRLEN);
+   break;
+#endif
+#ifdef INET6
+   case AF_INET6:
+   sin6 = (struct sockaddr_in6 *)nd->nd_nam;
+   cp = inet_ntop(sin6->sin6_family,
+   >sin6_addr, buf, INET6_ADDRSTRLEN);
+   break;
+#endif
+   default:
+   cp = NULL;
+   }
+   if (cp != NULL)
+   

svn commit: r359678 - head/usr.bin/indent

2020-04-06 Thread Kyle Evans
Author: kevans
Date: Mon Apr  6 23:20:20 2020
New Revision: 359678
URL: https://svnweb.freebsd.org/changeset/base/359678

Log:
  indent: fix the -fno-common build
  
  Spread the globals far and wide, hopefully to the files that make the most
  sense.
  
  -fno-common will become the default in GCC10/LLVM11.
  
  MFC after:3 days

Modified:
  head/usr.bin/indent/indent.c
  head/usr.bin/indent/indent_globs.h
  head/usr.bin/indent/io.c
  head/usr.bin/indent/parse.c

Modified: head/usr.bin/indent/indent.c
==
--- head/usr.bin/indent/indent.cMon Apr  6 23:16:05 2020
(r359677)
+++ head/usr.bin/indent/indent.cMon Apr  6 23:20:20 2020
(r359678)
@@ -59,6 +59,30 @@ __FBSDID("$FreeBSD$");
 #include "indent_codes.h"
 #include "indent.h"
 
+/* Globals */
+FILE   *input, *output;
+char   *labbuf, *s_lab, *e_lab, *l_lab;
+char   *codebuf, *s_code, *e_code, *l_code;
+char   *combuf, *s_com, *e_com, *l_com;
+char   *tokenbuf, *s_token, *e_token, *l_token;
+char   *in_buffer, *in_buffer_limit;
+char   *buf_ptr, *buf_end;
+
+charsc_buf[sc_size];
+
+char   *save_com, *sc_end;
+char   *bp_save;
+char   *be_save;
+
+struct options opt;
+int line_no;
+
+struct parser_stateps;
+int ifdef_level;
+struct parser_statestate_stack[5];
+struct parser_statematch_state[5];
+
+
 static void bakcopy(void);
 static void indent_declaration(int, int);
 

Modified: head/usr.bin/indent/indent_globs.h
==
--- head/usr.bin/indent/indent_globs.h  Mon Apr  6 23:16:05 2020
(r359677)
+++ head/usr.bin/indent/indent_globs.h  Mon Apr  6 23:20:20 2020
(r359678)
@@ -49,8 +49,8 @@
 #define true  1
 
 
-FILE   *input; /* the fid for the input file */
-FILE   *output;/* the output file */
+extern FILE   *input;  /* the fid for the input file */
+extern FILE   *output; /* the output file */
 
 #define CHECK_SIZE_CODE(desired_size) \
if (e_code + (desired_size) >= l_code) { \
@@ -104,41 +104,43 @@ FILE   *output;   /* the output file */
s_token = tokenbuf + 1; \
}
 
-char   *labbuf;/* buffer for label */
-char   *s_lab; /* start ... */
-char   *e_lab; /* .. and end of stored label */
-char   *l_lab; /* limit of label buffer */
+extern char   *labbuf; /* buffer for label */
+extern char   *s_lab;  /* start ... */
+extern char   *e_lab;  /* .. and end of stored label */
+extern char   *l_lab;  /* limit of label buffer */
 
-char   *codebuf;   /* buffer for code section */
-char   *s_code;/* start ... */
-char   *e_code;/* .. and end of stored code */
-char   *l_code;/* limit of code section */
+extern char   *codebuf;/* buffer for code section */
+extern char   *s_code; /* start ... */
+extern char   *e_code; /* .. and end of stored code */
+extern char   *l_code; /* limit of code section */
 
-char   *combuf;/* buffer for comments */
-char   *s_com; /* start ... */
-char   *e_com; /* ... and end of stored comments */
-char   *l_com; /* limit of comment buffer */
+extern char   *combuf; /* buffer for comments */
+extern char   *s_com;  /* start ... */
+extern char   *e_com;  /* ... and end of stored comments */
+extern char   *l_com;  /* limit of comment buffer */
 
 #define token s_token
-char   *tokenbuf;  /* the last token scanned */
-char  *s_token;
-char   *e_token;
-char  *l_token;
+extern char   *tokenbuf;   /* the last token scanned */
+extern char  *s_token;
+extern char   *e_token;
+extern char  *l_token;
 
-char   *in_buffer; /* input buffer */
-char  *in_buffer_limit;/* the end of the input buffer */
-char   *buf_ptr;   /* ptr to next character to be taken from
-* in_buffer */
-char   *buf_end;   /* ptr to first after last char in in_buffer */
+extern char   *in_buffer;  /* input buffer */
+extern char  *in_buffer_limit; /* the end of the input buffer */
+extern char   *buf_ptr;/* ptr to next character to be taken
+* from in_buffer */
+extern char   *buf_end;/* ptr to first after last char in
+   * in_buffer */
 
-charsc_buf[sc_size];   /* input text is saved here when looking for
-* the brace after an if, while, etc */
-char   *save_com;  /* start of the 

svn commit: r359677 - in head: libexec/ypxfr usr.sbin/rpc.yppasswdd usr.sbin/rpc.ypupdated usr.sbin/rpc.ypxfrd usr.sbin/ypldap usr.sbin/ypserv

2020-04-06 Thread Kyle Evans
Author: kevans
Date: Mon Apr  6 23:16:05 2020
New Revision: 359677
URL: https://svnweb.freebsd.org/changeset/base/359677

Log:
  yp*: fix -fno-common build
  
  This is mostly two problems spread out far and wide:
  - ypldap_process should be declared properly
  - debug is defined differently in many programs
  
  For the latter, just extern it and define it everywhere that actually needs
  it. This mostly works out nicely for ^/libexec/ypxfr, which can remove the
  assignment at the beginning of main in favor of defining it properly.
  
  -fno-common will become the default in GCC10/LLVM11.
  
  MFC after:3 days

Modified:
  head/libexec/ypxfr/ypxfr_main.c
  head/usr.sbin/rpc.yppasswdd/yppasswdd_main.c
  head/usr.sbin/rpc.ypupdated/ypupdated_main.c
  head/usr.sbin/rpc.ypxfrd/ypxfrd_main.c
  head/usr.sbin/ypldap/ypldap.c
  head/usr.sbin/ypldap/ypldap.h
  head/usr.sbin/ypserv/yp_access.c
  head/usr.sbin/ypserv/yp_error.c
  head/usr.sbin/ypserv/yp_main.c

Modified: head/libexec/ypxfr/ypxfr_main.c
==
--- head/libexec/ypxfr/ypxfr_main.c Mon Apr  6 23:11:43 2020
(r359676)
+++ head/libexec/ypxfr/ypxfr_main.c Mon Apr  6 23:16:05 2020
(r359677)
@@ -53,6 +53,8 @@ __FBSDID("$FreeBSD$");
 #include 
 #include "ypxfr_extern.h"
 
+int debug = 1;
+
 char *progname = "ypxfr";
 char *yp_dir = _PATH_YP;
 int _rpcpmstart = 0;
@@ -175,8 +177,6 @@ main(int argc, char *argv[])
int remoteport;
int interdom = 0;
int secure = 0;
-
-   debug = 1;
 
if (!isatty(fileno(stderr))) {
openlog("ypxfr", LOG_PID, LOG_DAEMON);

Modified: head/usr.sbin/rpc.yppasswdd/yppasswdd_main.c
==
--- head/usr.sbin/rpc.yppasswdd/yppasswdd_main.cMon Apr  6 23:11:43 
2020(r359676)
+++ head/usr.sbin/rpc.yppasswdd/yppasswdd_main.cMon Apr  6 23:16:05 
2020(r359677)
@@ -83,6 +83,7 @@ static int _rpcfdtype;
 #define_IDLE 0
 #define_SERVED 1
 #define_SERVING 2
+int debug;
 
 static char _localhost[] = "localhost";
 static char _passwd_byname[] = "passwd.byname";
@@ -172,8 +173,6 @@ main(int argc, char *argv[])
char *mastername;
char myname[MAXHOSTNAMELEN + 2];
int maxrec = RPC_MAXDATASIZE;
-
-   extern int debug;
 
debug = 1;
 

Modified: head/usr.sbin/rpc.ypupdated/ypupdated_main.c
==
--- head/usr.sbin/rpc.ypupdated/ypupdated_main.cMon Apr  6 23:11:43 
2020(r359676)
+++ head/usr.sbin/rpc.ypupdated/ypupdated_main.cMon Apr  6 23:16:05 
2020(r359677)
@@ -76,6 +76,8 @@ static int _rpcfdtype;
 
 extern int _rpcsvcstate;/* Set when a request is serviced */
 
+int debug;
+
 char *progname = "rpc.ypupdated";
 char *yp_dir = "/var/yp/";
 

Modified: head/usr.sbin/rpc.ypxfrd/ypxfrd_main.c
==
--- head/usr.sbin/rpc.ypxfrd/ypxfrd_main.c  Mon Apr  6 23:11:43 2020
(r359676)
+++ head/usr.sbin/rpc.ypxfrd/ypxfrd_main.c  Mon Apr  6 23:16:05 2020
(r359677)
@@ -78,6 +78,8 @@ static int _rpcfdtype;
 
 extern int _rpcsvcstate;/* Set when a request is serviced */
 
+int debug;
+
 char *progname = "rpc.ypxfrd";
 char *yp_dir = "/var/yp/";
 

Modified: head/usr.sbin/ypldap/ypldap.c
==
--- head/usr.sbin/ypldap/ypldap.c   Mon Apr  6 23:11:43 2020
(r359676)
+++ head/usr.sbin/ypldap/ypldap.c   Mon Apr  6 23:16:05 2020
(r359677)
@@ -40,6 +40,8 @@
 
 #include "ypldap.h"
 
+enum ypldap_process_type   ypldap_process;
+
 __dead2 voidusage(void);
 int check_child(pid_t, const char *);
 voidmain_sig_handler(int, short, void *);

Modified: head/usr.sbin/ypldap/ypldap.h
==
--- head/usr.sbin/ypldap/ypldap.h   Mon Apr  6 23:11:43 2020
(r359676)
+++ head/usr.sbin/ypldap/ypldap.h   Mon Apr  6 23:16:05 2020
(r359677)
@@ -47,10 +47,11 @@ struct ypldap_addr {
 };
 TAILQ_HEAD(ypldap_addr_list, ypldap_addr);
 
-enum {
+enum ypldap_process_type {
PROC_MAIN,
PROC_CLIENT
-} ypldap_process;
+};
+extern enum ypldap_process_typeypldap_process;
 
 struct userent {
RB_ENTRY(userent)ue_name_node;

Modified: head/usr.sbin/ypserv/yp_access.c
==
--- head/usr.sbin/ypserv/yp_access.cMon Apr  6 23:11:43 2020
(r359676)
+++ head/usr.sbin/ypserv/yp_access.cMon Apr  6 23:16:05 2020
(r359677)
@@ -57,8 +57,6 @@ __FBSDID("$FreeBSD$");
 #include "tcpd.h"
 #endif
 
-extern int debug;
-
 static const char 

svn commit: r359676 - in head/contrib/ntp: include ntpd

2020-04-06 Thread Kyle Evans
Author: kevans
Date: Mon Apr  6 23:11:43 2020
New Revision: 359676
URL: https://svnweb.freebsd.org/changeset/base/359676

Log:
  ntpd: fix build with -fno-common
  
  Only a small nit here: psl should be declared extern and defined exactly
  once.
  
  -fno-common will become the default in GCC10/LLVM11.
  
  MFC after:3 days

Modified:
  head/contrib/ntp/include/ntp_config.h
  head/contrib/ntp/ntpd/ntp_config.c

Modified: head/contrib/ntp/include/ntp_config.h
==
--- head/contrib/ntp/include/ntp_config.h   Mon Apr  6 23:08:07 2020
(r359675)
+++ head/contrib/ntp/include/ntp_config.h   Mon Apr  6 23:11:43 2020
(r359676)
@@ -280,7 +280,7 @@ typedef struct settrap_parms_tag {
  * Poll Skew List
  */
 
-psl_item psl[17-3+1];  /* values for polls 3-17 */
+extern psl_item psl[17-3+1];   /* values for polls 3-17 */
/* To simplify the runtime code we */
/* don't want to have to special-case */
/* dealing with a default */

Modified: head/contrib/ntp/ntpd/ntp_config.c
==
--- head/contrib/ntp/ntpd/ntp_config.c  Mon Apr  6 23:08:07 2020
(r359675)
+++ head/contrib/ntp/ntpd/ntp_config.c  Mon Apr  6 23:11:43 2020
(r359676)
@@ -202,6 +202,8 @@ int cryptosw;   /* crypto command called */
 
 extern char *stats_drift_file; /* name of the driftfile */
 
+psl_item psl[17-3+1];
+
 #ifdef BC_LIST_FRAMEWORK_NOT_YET_USED
 /*
  * backwards compatibility flags
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r359674 - head/lib/libcasper/services/cap_sysctl

2020-04-06 Thread Conrad Meyer
Author: cem
Date: Mon Apr  6 23:07:56 2020
New Revision: 359674
URL: https://svnweb.freebsd.org/changeset/base/359674

Log:
  libcasper: Constify cap_sysctl_limit_mib() mib parameter
  
  No functional change. Minor API change that is nicer for consumers. ABI is
  identical; the routine never needed to modify the pointed to value.
  
  Reviewed by:  emaste, markj
  Differential Revision:https://reviews.freebsd.org/D24319

Modified:
  head/lib/libcasper/services/cap_sysctl/cap_sysctl.3
  head/lib/libcasper/services/cap_sysctl/cap_sysctl.c
  head/lib/libcasper/services/cap_sysctl/cap_sysctl.h

Modified: head/lib/libcasper/services/cap_sysctl/cap_sysctl.3
==
--- head/lib/libcasper/services/cap_sysctl/cap_sysctl.3 Mon Apr  6 22:48:43 
2020(r359673)
+++ head/lib/libcasper/services/cap_sysctl/cap_sysctl.3 Mon Apr  6 23:07:56 
2020(r359674)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd May 13, 2019
+.Dd April 6, 2020
 .Dt CAP_SYSCTL 3
 .Os
 .Sh NAME
@@ -46,7 +46,7 @@
 .Ft void *
 .Fn cap_sysctl_limit_name "void *limit" "const char *name" "int flags"
 .Ft void *
-.Fn cap_sysctl_limit_mib "void *limit" "int *mibp" "u_int miblen" "int flags"
+.Fn cap_sysctl_limit_mib "void *limit" "const int *mibp" "u_int miblen" "int 
flags"
 .Ft int
 .Fn cap_sysctl_limit "void *limit"
 .Sh DESCRIPTION

Modified: head/lib/libcasper/services/cap_sysctl/cap_sysctl.c
==
--- head/lib/libcasper/services/cap_sysctl/cap_sysctl.c Mon Apr  6 22:48:43 
2020(r359673)
+++ head/lib/libcasper/services/cap_sysctl/cap_sysctl.c Mon Apr  6 23:07:56 
2020(r359674)
@@ -109,7 +109,7 @@ cap_sysctl_limit_name(cap_sysctl_limit_t *limit, const
 }
 
 cap_sysctl_limit_t *
-cap_sysctl_limit_mib(cap_sysctl_limit_t *limit, int *mibp, u_int miblen,
+cap_sysctl_limit_mib(cap_sysctl_limit_t *limit, const int *mibp, u_int miblen,
 int flags)
 {
nvlist_t *lnv;

Modified: head/lib/libcasper/services/cap_sysctl/cap_sysctl.h
==
--- head/lib/libcasper/services/cap_sysctl/cap_sysctl.h Mon Apr  6 22:48:43 
2020(r359673)
+++ head/lib/libcasper/services/cap_sysctl/cap_sysctl.h Mon Apr  6 23:07:56 
2020(r359674)
@@ -55,8 +55,8 @@ typedef struct cap_sysctl_limit cap_sysctl_limit_t;
 cap_sysctl_limit_t *cap_sysctl_limit_init(cap_channel_t *);
 cap_sysctl_limit_t *cap_sysctl_limit_name(cap_sysctl_limit_t *limit,
 const char *name, int flags);
-cap_sysctl_limit_t *cap_sysctl_limit_mib(cap_sysctl_limit_t *limit, int *mibp,
-u_int miblen, int flags);
+cap_sysctl_limit_t *cap_sysctl_limit_mib(cap_sysctl_limit_t *limit,
+const int *mibp, u_int miblen, int flags);
 int cap_sysctl_limit(cap_sysctl_limit_t *limit);
 #else /* !WITH_CASPER */
 #definecap_sysctl(chan, name, namelen, oldp, oldlenp, newp, newlen)
\
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r359675 - head/tests/sys/kqueue/libkqueue

2020-04-06 Thread Kyle Evans
Author: kevans
Date: Mon Apr  6 23:08:07 2020
New Revision: 359675
URL: https://svnweb.freebsd.org/changeset/base/359675

Log:
  kqueue tests: fix -fno-common build
  
  vnode_fd and kqfd are both shared among multiple CU; define them exactly
  once.
  
  In the case of vnode_fd, it was simply the declaration that needed
  correction.
  
  -fno-common will become the default in GCC10/LLVM11.
  
  MFC after:3 days

Modified:
  head/tests/sys/kqueue/libkqueue/common.h
  head/tests/sys/kqueue/libkqueue/proc.c
  head/tests/sys/kqueue/libkqueue/read.c
  head/tests/sys/kqueue/libkqueue/signal.c
  head/tests/sys/kqueue/libkqueue/timer.c
  head/tests/sys/kqueue/libkqueue/user.c
  head/tests/sys/kqueue/libkqueue/vnode.c

Modified: head/tests/sys/kqueue/libkqueue/common.h
==
--- head/tests/sys/kqueue/libkqueue/common.hMon Apr  6 23:07:56 2020
(r359674)
+++ head/tests/sys/kqueue/libkqueue/common.hMon Apr  6 23:08:07 2020
(r359675)
@@ -41,7 +41,8 @@
 #include 
 
 extern char *cur_test_id;
-int vnode_fd;
+extern int vnode_fd;
+extern int kqfd;
 
 extern char * kevent_to_str(struct kevent *);
 struct kevent * kevent_get(int);

Modified: head/tests/sys/kqueue/libkqueue/proc.c
==
--- head/tests/sys/kqueue/libkqueue/proc.c  Mon Apr  6 23:07:56 2020
(r359674)
+++ head/tests/sys/kqueue/libkqueue/proc.c  Mon Apr  6 23:08:07 2020
(r359675)
@@ -25,7 +25,6 @@
 
 static int sigusr1_caught = 0;
 
-int kqfd;
 
 static void
 sig_handler(int signum)

Modified: head/tests/sys/kqueue/libkqueue/read.c
==
--- head/tests/sys/kqueue/libkqueue/read.c  Mon Apr  6 23:07:56 2020
(r359674)
+++ head/tests/sys/kqueue/libkqueue/read.c  Mon Apr  6 23:08:07 2020
(r359675)
@@ -18,7 +18,6 @@
 
 #include "common.h"
 
-int kqfd;
 int sockfd[2];
 
 static void

Modified: head/tests/sys/kqueue/libkqueue/signal.c
==
--- head/tests/sys/kqueue/libkqueue/signal.cMon Apr  6 23:07:56 2020
(r359674)
+++ head/tests/sys/kqueue/libkqueue/signal.cMon Apr  6 23:08:07 2020
(r359675)
@@ -18,7 +18,6 @@
 
 #include "common.h"
 
-int kqfd;
 
 void
 test_kevent_signal_add(void)

Modified: head/tests/sys/kqueue/libkqueue/timer.c
==
--- head/tests/sys/kqueue/libkqueue/timer.c Mon Apr  6 23:07:56 2020
(r359674)
+++ head/tests/sys/kqueue/libkqueue/timer.c Mon Apr  6 23:08:07 2020
(r359675)
@@ -26,7 +26,6 @@
 #defineMS_TO_US(t)  ((t) * THOUSAND)   /* Convert milliseconds to 
microseconds. */
 #defineUS_TO_NS(t)  ((t) * THOUSAND)   /* Convert microseconds to 
nanoseconds. */
 
-int kqfd;
 
 /* Get the current time with microsecond precision. Used for
  * sub-second timing to make some timer tests run faster.

Modified: head/tests/sys/kqueue/libkqueue/user.c
==
--- head/tests/sys/kqueue/libkqueue/user.c  Mon Apr  6 23:07:56 2020
(r359674)
+++ head/tests/sys/kqueue/libkqueue/user.c  Mon Apr  6 23:08:07 2020
(r359675)
@@ -18,7 +18,6 @@
 
 #include "common.h"
 
-int kqfd;
 
 static void
 add_and_delete(void)

Modified: head/tests/sys/kqueue/libkqueue/vnode.c
==
--- head/tests/sys/kqueue/libkqueue/vnode.c Mon Apr  6 23:07:56 2020
(r359674)
+++ head/tests/sys/kqueue/libkqueue/vnode.c Mon Apr  6 23:08:07 2020
(r359675)
@@ -18,7 +18,6 @@
 
 #include "common.h"
 
-int kqfd;
 int vnode_fd;
 
 void
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r359673 - in head/sys/riscv: include riscv

2020-04-06 Thread Mitchell Horne
Author: mhorne
Date: Mon Apr  6 22:48:43 2020
New Revision: 359673
URL: https://svnweb.freebsd.org/changeset/base/359673

Log:
  RISC-V: copy the DTB to early KVA
  
  The location of the device-tree blob is passed to the kernel by the
  previous booting stage (i.e. BBL or OpenSBI). Currently, we leave it
  untouched and mark the 1MB of memory holding it as unavailable.
  
  Instead, do what is done by other fake_preload_metadata() routines and
  copy to the DTB to KVA space. This is more in line with what loader(8)
  will provide us in the future, and it allows us to reclaim the hole in
  physical memory.
  
  Reviewed by:  markj, kp (earlier version)
  Differential Revision:https://reviews.freebsd.org/D24152

Added:
  head/sys/riscv/include/metadata.h   (contents, props changed)
Modified:
  head/sys/riscv/include/machdep.h
  head/sys/riscv/include/vmparam.h
  head/sys/riscv/riscv/genassym.c
  head/sys/riscv/riscv/locore.S
  head/sys/riscv/riscv/machdep.c
  head/sys/riscv/riscv/pmap.c

Modified: head/sys/riscv/include/machdep.h
==
--- head/sys/riscv/include/machdep.hMon Apr  6 22:31:30 2020
(r359672)
+++ head/sys/riscv/include/machdep.hMon Apr  6 22:48:43 2020
(r359673)
@@ -42,7 +42,6 @@ struct riscv_bootparams {
vm_offset_t kern_phys;  /* Kernel base (physical) addr */
vm_offset_t kern_stack;
vm_offset_t dtbp_virt;  /* Device tree blob virtual addr */
-   vm_offset_t dtbp_phys;  /* Device tree blob physical addr */
 };
 
 extern vm_paddr_t physmap[];

Added: head/sys/riscv/include/metadata.h
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/riscv/include/metadata.h   Mon Apr  6 22:48:43 2020
(r359673)
@@ -0,0 +1,35 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
+ * Copyright (c) 2020 Mitchell Horne 
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _MACHINE_METADATA_H_
+#define_MACHINE_METADATA_H_
+
+#defineMODINFOMD_DTBP  0x1001
+
+#endif /* !_MACHINE_METADATA_H_ */

Modified: head/sys/riscv/include/vmparam.h
==
--- head/sys/riscv/include/vmparam.hMon Apr  6 22:31:30 2020
(r359672)
+++ head/sys/riscv/include/vmparam.hMon Apr  6 22:48:43 2020
(r359673)
@@ -192,6 +192,8 @@
 
 #defineKERNENTRY   (0)
 
+#defineVM_EARLY_DTB_ADDRESS(VM_MAX_KERNEL_ADDRESS - (2 * L2_SIZE))
+
 /*
  * How many physical pages per kmem arena virtual page.
  */

Modified: head/sys/riscv/riscv/genassym.c
==
--- head/sys/riscv/riscv/genassym.c Mon Apr  6 22:31:30 2020
(r359672)
+++ head/sys/riscv/riscv/genassym.c Mon Apr  6 22:48:43 2020
(r359673)
@@ -56,10 +56,12 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
 ASSYM(KERNBASE, KERNBASE);
 ASSYM(VM_MAXUSER_ADDRESS, VM_MAXUSER_ADDRESS);
 ASSYM(VM_MAX_KERNEL_ADDRESS, VM_MAX_KERNEL_ADDRESS);
+ASSYM(VM_EARLY_DTB_ADDRESS, VM_EARLY_DTB_ADDRESS);
 ASSYM(TDF_ASTPENDING, TDF_ASTPENDING);
 ASSYM(TDF_NEEDRESCHED, TDF_NEEDRESCHED);
 
@@ -104,4 +106,3 @@ ASSYM(RISCV_BOOTPARAMS_KERN_PHYS, offsetof(struct risc
 ASSYM(RISCV_BOOTPARAMS_KERN_STACK, offsetof(struct riscv_bootparams,
 kern_stack));
 ASSYM(RISCV_BOOTPARAMS_DTBP_VIRT, offsetof(struct riscv_bootparams, 
dtbp_virt));
-ASSYM(RISCV_BOOTPARAMS_DTBP_PHYS, offsetof(struct riscv_bootparams, 
dtbp_phys));

Modified: 

svn commit: r359672 - head/sys/riscv/riscv

2020-04-06 Thread Jessica Clarke
Author: jrtc27
Date: Mon Apr  6 22:31:30 2020
New Revision: 359672
URL: https://svnweb.freebsd.org/changeset/base/359672

Log:
  riscv: Make sure local hart's icache is synced in pmap_sync_icache
  
  The only way to flush the local hart's icache is with a FENCE.I (or an
  equivalent SBI call); a normal FENCE is insufficient and, for the
  single-hart case, unnecessary.
  
  Reviewed by:  jhb (mentor), markj
  Approved by:  jhb (mentor), markj
  Differential Revision:https://reviews.freebsd.org/D24317

Modified:
  head/sys/riscv/riscv/pmap.c

Modified: head/sys/riscv/riscv/pmap.c
==
--- head/sys/riscv/riscv/pmap.c Mon Apr  6 22:29:15 2020(r359671)
+++ head/sys/riscv/riscv/pmap.c Mon Apr  6 22:31:30 2020(r359672)
@@ -4335,13 +4335,20 @@ pmap_sync_icache(pmap_t pmap, vm_offset_t va, vm_size_
 * RISC-V harts, the writing hart has to execute a data FENCE
 * before requesting that all remote RISC-V harts execute a
 * FENCE.I."
+*
+* However, this is slightly misleading; we still need to
+* perform a FENCE.I for the local hart, as FENCE does nothing
+* for its icache. FENCE.I alone is also sufficient for the
+* local hart.
 */
sched_pin();
mask = all_harts;
CPU_CLR(PCPU_GET(hart), );
-   fence();
-   if (!CPU_EMPTY() && smp_started)
+   fence_i()
+   if (!CPU_EMPTY() && smp_started) {
+   fence();
sbi_remote_fence_i(mask.__bits);
+   }
sched_unpin();
 }
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r359671 - head/sys/riscv/riscv

2020-04-06 Thread Jessica Clarke
Author: jrtc27
Date: Mon Apr  6 22:29:15 2020
New Revision: 359671
URL: https://svnweb.freebsd.org/changeset/base/359671

Log:
  riscv: Fix pmap_fault_fixup for L3 pages
  
  Summary:
  The parentheses being in the wrong place means that, for L3 pages,
  oldpte has all bits except PTE_V cleared, and so all the subsequent
  checks against oldpte will fail, causing us to bail out and not retry
  the faulting instruction after an SFENCE.VMA. This causes a WITNESS +
  INVARIANTS kernel to fault on the "Chisel P3" (BOOM-based) DARPA SSITH
  GFE SoC in pmap_init when writing to pv_table and, being a nofault
  entry, subsequently panic with:
  
panic: vm_fault_lookup: fault on nofault entry, addr: 0xffc004e0
  
  Reviewed by:  markj
  Approved by:  markj
  Differential Revision:https://reviews.freebsd.org/D24315

Modified:
  head/sys/riscv/riscv/pmap.c

Modified: head/sys/riscv/riscv/pmap.c
==
--- head/sys/riscv/riscv/pmap.c Mon Apr  6 22:14:50 2020(r359670)
+++ head/sys/riscv/riscv/pmap.c Mon Apr  6 22:29:15 2020(r359671)
@@ -2416,7 +2416,7 @@ pmap_fault_fixup(pmap_t pmap, vm_offset_t va, vm_prot_
goto done;
if ((l2e & PTE_RWX) == 0) {
pte = pmap_l2_to_l3(l2, va);
-   if (pte == NULL || ((oldpte = pmap_load(pte) & PTE_V)) == 0)
+   if (pte == NULL || ((oldpte = pmap_load(pte)) & PTE_V) == 0)
goto done;
} else {
pte = l2;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r359668 - head/sys/ufs/ffs

2020-04-06 Thread Kirk McKusick
Author: mckusick
Date: Mon Apr  6 20:23:47 2020
New Revision: 359668
URL: https://svnweb.freebsd.org/changeset/base/359668

Log:
  Revert -r359612 as it can cause other panics.
  An updated version will be made when the issue has been resolved.
  
  Reported by: Peter Holm

Modified:
  head/sys/ufs/ffs/ffs_inode.c

Modified: head/sys/ufs/ffs/ffs_inode.c
==
--- head/sys/ufs/ffs/ffs_inode.cMon Apr  6 19:45:26 2020
(r359667)
+++ head/sys/ufs/ffs/ffs_inode.cMon Apr  6 20:23:47 2020
(r359668)
@@ -426,6 +426,11 @@ ffs_truncate(vp, length, flags, cred)
ip->i_size = length;
DIP_SET(ip, i_size, length);
} else {
+   lbn = lblkno(fs, length);
+   flags |= BA_CLRBUF;
+   error = UFS_BALLOC(vp, length - 1, 1, cred, flags, );
+   if (error)
+   return (error);
/*
 * When we are doing soft updates and the UFS_BALLOC
 * above fills in a direct block hole with a full sized
@@ -434,14 +439,9 @@ ffs_truncate(vp, length, flags, cred)
 * so that we do not get a soft updates inconsistency
 * when we create the fragment below.
 */
-   lbn = lblkno(fs, length);
if (DOINGSOFTDEP(vp) && lbn < UFS_NDADDR &&
fragroundup(fs, blkoff(fs, length)) < fs->fs_bsize &&
(error = ffs_syncvnode(vp, MNT_WAIT, 0)) != 0)
-   return (error);
-   flags |= BA_CLRBUF;
-   error = UFS_BALLOC(vp, length - 1, 1, cred, flags, );
-   if (error)
return (error);
ip->i_size = length;
DIP_SET(ip, i_size, length);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r359667 - in head/sys: dev/hwpmc sys

2020-04-06 Thread Marcin Wojtas
Author: mw
Date: Mon Apr  6 19:45:26 2020
New Revision: 359667
URL: https://svnweb.freebsd.org/changeset/base/359667

Log:
  Add hwpmc support for Intel Atom Goldmont microarchitecture
  
  Recognize new micro-architecture in hwpmc_intel driver. Based on Intel
  document 325462-071US. Tested with tools/test/hwpmc/pmctest.py
  on Atom E3930 SoC.
  
  Submitted by: Dawid Gorecki 
  Reviewed by: kib
  Obtained from: Semihalf
  Sponsored by: Stormshield
  Differential Revision: https://reviews.freebsd.org/D24310

Modified:
  head/sys/dev/hwpmc/hwpmc_intel.c
  head/sys/sys/pmc.h

Modified: head/sys/dev/hwpmc/hwpmc_intel.c
==
--- head/sys/dev/hwpmc/hwpmc_intel.cMon Apr  6 18:52:40 2020
(r359666)
+++ head/sys/dev/hwpmc/hwpmc_intel.cMon Apr  6 19:45:26 2020
(r359667)
@@ -203,6 +203,10 @@ pmc_intel_initialize(void)
cputype = PMC_CPU_INTEL_ATOM_SILVERMONT;
nclasses = 3;
break;
+   case 0x5C:  /* Per Intel document 325462-071US 10/2019. */
+   cputype = PMC_CPU_INTEL_ATOM_GOLDMONT;
+   nclasses = 3;
+   break;
}
break;
}
@@ -230,6 +234,7 @@ pmc_intel_initialize(void)
 */
case PMC_CPU_INTEL_ATOM:
case PMC_CPU_INTEL_ATOM_SILVERMONT:
+   case PMC_CPU_INTEL_ATOM_GOLDMONT:
case PMC_CPU_INTEL_BROADWELL:
case PMC_CPU_INTEL_BROADWELL_XEON:
case PMC_CPU_INTEL_SKYLAKE_XEON:
@@ -293,6 +298,7 @@ pmc_intel_finalize(struct pmc_mdep *md)
switch (md->pmd_cputype) {
case PMC_CPU_INTEL_ATOM:
case PMC_CPU_INTEL_ATOM_SILVERMONT:
+   case PMC_CPU_INTEL_ATOM_GOLDMONT:
case PMC_CPU_INTEL_BROADWELL:
case PMC_CPU_INTEL_BROADWELL_XEON:
case PMC_CPU_INTEL_SKYLAKE_XEON:

Modified: head/sys/sys/pmc.h
==
--- head/sys/sys/pmc.h  Mon Apr  6 18:52:40 2020(r359666)
+++ head/sys/sys/pmc.h  Mon Apr  6 19:45:26 2020(r359667)
@@ -110,6 +110,7 @@ extern char pmc_cpuid[PMC_CPUID_LEN];
__PMC_CPU(INTEL_BROADWELL_XEON, 0x97,   "Intel Broadwell Xeon") \
__PMC_CPU(INTEL_SKYLAKE, 0x98,   "Intel Skylake")   \
__PMC_CPU(INTEL_SKYLAKE_XEON, 0x99,   "Intel Skylake Xeon") \
+   __PMC_CPU(INTEL_ATOM_GOLDMONT, 0x9A,   "Intel Atom Goldmont")   \
__PMC_CPU(INTEL_XSCALE, 0x100,  "Intel XScale") \
__PMC_CPU(MIPS_24K, 0x200,  "MIPS 24K") \
__PMC_CPU(MIPS_OCTEON,  0x201,  "Cavium Octeon")\
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r359662 - head/sys/cam/scsi

2020-04-06 Thread Alexander Motin
Author: mav
Date: Mon Apr  6 18:42:01 2020
New Revision: 359662
URL: https://svnweb.freebsd.org/changeset/base/359662

Log:
  Relax too strict SES element descriptors check in r355430.
  
  SES specifications allows the string to be NULL-terminated, while previous
  code was considering it as invalid due to incorrectly ordered conditions.
  
  MFC after: 1 week
  Sponsored by: iXsystem, Inc.

Modified:
  head/sys/cam/scsi/scsi_enc_ses.c

Modified: head/sys/cam/scsi/scsi_enc_ses.c
==
--- head/sys/cam/scsi/scsi_enc_ses.cMon Apr  6 17:28:17 2020
(r359661)
+++ head/sys/cam/scsi/scsi_enc_ses.cMon Apr  6 18:42:01 2020
(r359662)
@@ -2004,11 +2004,11 @@ ses_sanitize_elm_desc(const char *desc, uint16_t *len)
int i;
 
for (i = 0; i < *len; i++) {
-   if (desc[i] < 0x20 || desc[i] > 0x7e) {
+   if (desc[i] == 0) {
+   break;
+   } else if (desc[i] < 0x20 || desc[i] > 0x7e) {
*len = strlen(invalid);
return (invalid);
-   } else if (desc[i] == 0) {
-   break;
}
}
return (desc);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r359657 - head/sys/netinet

2020-04-06 Thread Michael Tuexen
Author: tuexen
Date: Mon Apr  6 13:58:13 2020
New Revision: 359657
URL: https://svnweb.freebsd.org/changeset/base/359657

Log:
  Do more argument validation under INVARIANTS when starting/stopping
  an SCTP timer.
  
  MFC after:1 week

Modified:
  head/sys/netinet/sctputil.c

Modified: head/sys/netinet/sctputil.c
==
--- head/sys/netinet/sctputil.c Mon Apr  6 09:59:21 2020(r359656)
+++ head/sys/netinet/sctputil.c Mon Apr  6 13:58:13 2020(r359657)
@@ -1730,9 +1730,14 @@ sctp_timeout_handler(void *t)
 #endif
 
/* sanity checks... */
-   KASSERT(tmr->self == tmr, ("tmr->self corrupted"));
-   KASSERT(SCTP_IS_TIMER_TYPE_VALID(tmr->type), ("Invalid timer type %d", 
tmr->type));
+   KASSERT(tmr->self == tmr,
+   ("sctp_timeout_handler: tmr->self corrupted"));
+   KASSERT(SCTP_IS_TIMER_TYPE_VALID(tmr->type),
+   ("sctp_timeout_handler: invalid timer type %d", tmr->type));
type = tmr->type;
+   KASSERT(stcb == NULL || stcb->sctp_ep == inp,
+   ("sctp_timeout_handler of type %d: inp = %p, stcb->sctp_ep %p",
+   type, stcb, stcb->sctp_ep));
if (inp) {
SCTP_INP_INCR_REF(inp);
}
@@ -2147,6 +2152,9 @@ sctp_timer_start(int t_type, struct sctp_inpcb *inp, s
uint32_t to_ticks;
uint32_t rndval, jitter;
 
+   KASSERT(stcb == NULL || stcb->sctp_ep == inp,
+   ("sctp_timer_start of type %d: inp = %p, stcb->sctp_ep %p",
+   t_type, stcb, stcb->sctp_ep));
tmr = NULL;
to_ticks = 0;
if (stcb != NULL) {
@@ -2581,6 +2589,9 @@ sctp_timer_stop(int t_type, struct sctp_inpcb *inp, st
 {
struct sctp_timer *tmr;
 
+   KASSERT(stcb == NULL || stcb->sctp_ep == inp,
+   ("sctp_timer_stop of type %d: inp = %p, stcb->sctp_ep %p",
+   t_type, stcb, stcb->sctp_ep));
if (stcb != NULL) {
SCTP_TCB_LOCK_ASSERT(stcb);
} else if (inp != NULL) {
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2020-04-06 Thread Christian Brueffer
Author: brueffer
Date: Mon Apr  6 09:59:21 2020
New Revision: 359656
URL: https://svnweb.freebsd.org/changeset/base/359656

Log:
  Add Gordon Bergling to the authors section; remove trailing whitespace.
  
  Suggested by: rgrimes
  Approved by:  Gordon Bergling
  X-MFC-with:   r359633

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

Modified: head/share/man/man4/smbios.4
==
--- head/share/man/man4/smbios.4Mon Apr  6 09:50:20 2020
(r359655)
+++ head/share/man/man4/smbios.4Mon Apr  6 09:59:21 2020
(r359656)
@@ -1,4 +1,4 @@
-.\" Copyright (c) 2020 Gordon Bergling 
+.\" Copyright (c) 2020 Gordon Bergling
 .\"
 .\" Redistribution and use in source and binary forms, with or without
 .\" modification, are permitted provided that the following conditions
@@ -23,11 +23,11 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd April 4, 2020
+.Dd April 6, 2020
 .Dt SMBIOS 4
 .Os
 .Sh NAME
-.Nm smbios 
+.Nm smbios
 .Nd "System Management BIOS"
 .Sh SYNOPSIS
 To compile this driver into the kernel,
@@ -61,3 +61,5 @@ The
 .Nm
 device driver was written by
 .An Matthew N. Dodd Aq Mt win...@jurai.net .
+This manual page was written by
+.An Gordon Bergling Aq Mt gbergl...@gmail.com .
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r359655 - head/sys/dev/mlx5/mlx5_en

2020-04-06 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Apr  6 09:50:20 2020
New Revision: 359655
URL: https://svnweb.freebsd.org/changeset/base/359655

Log:
  Don't drop packets having too many TCP option headers in mlx5en(4).
  
  When using SACK it can happen there are multiple option headers.
  Don't drop these packets, but instead limit the amount of inlining
  to the maximum supported.
  
  MFC after:1 week
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c

Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c
==
--- head/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c  Mon Apr  6 09:45:49 2020
(r359654)
+++ head/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c  Mon Apr  6 09:50:20 2020
(r359655)
@@ -613,18 +613,18 @@ top:
 
if (likely(args.ihs == 0)) {
/* nothing to inline */
-   } else if (unlikely(args.ihs > sq->max_inline)) {
-   /* inline header size is too big */
-   err = EINVAL;
-   goto tx_drop;
} else if ((mb->m_flags & M_VLANTAG) != 0) {
struct ether_vlan_header *eh = (struct ether_vlan_header *)
wqe->eth.inline_hdr_start;
 
/* Range checks */
-   if (unlikely(args.ihs > (MLX5E_MAX_TX_INLINE - 
ETHER_VLAN_ENCAP_LEN)))
-   args.ihs = (MLX5E_MAX_TX_INLINE - ETHER_VLAN_ENCAP_LEN);
-   else if (unlikely(args.ihs < ETHER_HDR_LEN)) {
+   if (unlikely(args.ihs > (sq->max_inline - 
ETHER_VLAN_ENCAP_LEN))) {
+   if (mb->m_pkthdr.csum_flags & CSUM_TSO) {
+   err = EINVAL;
+   goto tx_drop;
+   }
+   args.ihs = (sq->max_inline - ETHER_VLAN_ENCAP_LEN);
+   } else if (unlikely(args.ihs < ETHER_HDR_LEN)) {
err = EINVAL;
goto tx_drop;
}
@@ -641,6 +641,14 @@ top:
args.ihs += ETHER_VLAN_ENCAP_LEN;
wqe->eth.inline_hdr_sz = cpu_to_be16(args.ihs);
} else {
+   /* check if inline header size is too big */
+   if (unlikely(args.ihs > sq->max_inline)) {
+   if (unlikely(mb->m_pkthdr.csum_flags & CSUM_TSO)) {
+   err = EINVAL;
+   goto tx_drop;
+   }
+   args.ihs = sq->max_inline;
+   }
m_copydata(mb, 0, args.ihs, wqe->eth.inline_hdr_start);
m_adj(mb, args.ihs);
wqe->eth.inline_hdr_sz = cpu_to_be16(args.ihs);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r359654 - head/sys/dev/mlx5/mlx5_en

2020-04-06 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Apr  6 09:45:49 2020
New Revision: 359654
URL: https://svnweb.freebsd.org/changeset/base/359654

Log:
  Ensure a minimum inline size of 16 bytes in mlx5en(4).
  
  This includes 14 bytes of ethernet header and 2 bytes of VLAN header.
  
  This allows for making assumptions about the inline size limit
  in the fast transmit path later on.
  
  Use a signed integer variable to catch underflow.
  
  MFC after:1 week
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c

Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
==
--- head/sys/dev/mlx5/mlx5_en/mlx5_en_main.cMon Apr  6 09:41:22 2020
(r359653)
+++ head/sys/dev/mlx5/mlx5_en/mlx5_en_main.cMon Apr  6 09:45:49 2020
(r359654)
@@ -3523,15 +3523,19 @@ mlx5e_check_required_hca_cap(struct mlx5_core_dev *mde
 static u16
 mlx5e_get_max_inline_cap(struct mlx5_core_dev *mdev)
 {
-   uint32_t bf_buf_size = (1U << MLX5_CAP_GEN(mdev, log_bf_reg_size)) / 2U;
+   const int min_size = ETHER_VLAN_ENCAP_LEN + ETHER_HDR_LEN;
+   const int max_size = MLX5E_MAX_TX_INLINE;
+   const int bf_buf_size =
+   ((1U << MLX5_CAP_GEN(mdev, log_bf_reg_size)) / 2U) -
+   (sizeof(struct mlx5e_tx_wqe) - 2);
 
-   bf_buf_size -= sizeof(struct mlx5e_tx_wqe) - 2;
-
-   /* verify against driver hardware limit */
-   if (bf_buf_size > MLX5E_MAX_TX_INLINE)
-   bf_buf_size = MLX5E_MAX_TX_INLINE;
-
-   return (bf_buf_size);
+   /* verify against driver limits */
+   if (bf_buf_size > max_size)
+   return (max_size);
+   else if (bf_buf_size < min_size)
+   return (min_size);
+   else
+   return (bf_buf_size);
 }
 
 static int
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r359653 - head/sys/dev/mlx5/mlx5_en

2020-04-06 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Apr  6 09:41:22 2020
New Revision: 359653
URL: https://svnweb.freebsd.org/changeset/base/359653

Log:
  Count number of times transmit ring is out of buffers in mlx5en(4).
  
  Differential Revision:https://reviews.freebsd.org/D24273
  MFC after:1 week
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/dev/mlx5/mlx5_en/en.h
  head/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c

Modified: head/sys/dev/mlx5/mlx5_en/en.h
==
--- head/sys/dev/mlx5/mlx5_en/en.h  Mon Apr  6 07:16:31 2020
(r359652)
+++ head/sys/dev/mlx5/mlx5_en/en.h  Mon Apr  6 09:41:22 2020
(r359653)
@@ -627,6 +627,7 @@ struct mlx5e_rq_stats {
   m(+1, u64, csum_offload_none, "csum_offload_none", "Transmitted packets")
\
   m(+1, u64, defragged, "defragged", "Transmitted packets")\
   m(+1, u64, dropped, "dropped", "Transmitted packets")
\
+  m(+1, u64, enobuf, "enobuf", "Transmitted packets")  \
   m(+1, u64, nop, "nop", "Transmitted packets")
 
 #defineMLX5E_SQ_STATS_NUM (0 MLX5E_SQ_STATS(MLX5E_STATS_COUNT))

Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c
==
--- head/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c  Mon Apr  6 07:16:31 2020
(r359652)
+++ head/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c  Mon Apr  6 09:41:22 2020
(r359653)
@@ -401,6 +401,7 @@ mlx5e_sq_dump_xmit(struct mlx5e_sq *sq, struct mlx5e_x
 
/* return ENOBUFS if the queue is full */
if (unlikely(!mlx5e_sq_has_room_for(sq, xsegs))) {
+   sq->stats.enobuf++;
bus_dmamap_unload(sq->dma_tag, sq->mbuf[pi].dma_map);
m_freem(mb);
*mbp = NULL;/* safety clear */
@@ -493,8 +494,10 @@ mlx5e_sq_xmit(struct mlx5e_sq *sq, struct mbuf **mbp)
 top:
 #endif
/* Return ENOBUFS if the queue is full */
-   if (unlikely(!mlx5e_sq_has_room_for(sq, 2 * MLX5_SEND_WQE_MAX_WQEBBS)))
+   if (unlikely(!mlx5e_sq_has_room_for(sq, 2 * MLX5_SEND_WQE_MAX_WQEBBS))) 
{
+   sq->stats.enobuf++;
return (ENOBUFS);
+   }
 
/* Align SQ edge with NOPs to avoid WQE wrap around */
pi = ((~sq->pc) & sq->wq.sz_m1);
@@ -502,8 +505,10 @@ top:
/* Send one multi NOP message instead of many */
mlx5e_send_nop(sq, (pi + 1) * MLX5_SEND_WQEBB_NUM_DS);
pi = ((~sq->pc) & sq->wq.sz_m1);
-   if (pi < (MLX5_SEND_WQE_MAX_WQEBBS - 1))
+   if (pi < (MLX5_SEND_WQE_MAX_WQEBBS - 1)) {
+   sq->stats.enobuf++;
return (ENOMEM);
+   }
}
 
 #ifdef KERN_TLS
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r359633 - head/share/man/man4

2020-04-06 Thread Gordon Bergling
Hi Chris,

yes, why not. :) 

Should I create a new differential for it, or could you do it on the fly?

Best regards,

Gordon

> Am 06.04.2020 um 11:23 schrieb Christian Brueffer :
> 
> On 2020-04-05 01:48, Rodney W. Grimes wrote:
>> 
>>> On Sat, 2020-04-04 at 17:10 -0700, Rodney W. Grimes wrote:
> Author: brueffer
> Date: Sat Apr  4 21:38:00 2020
> New Revision: 359633
> URL: https://svnweb.freebsd.org/changeset/base/359633
> 
> Log:
>   Add a manpage for smbios(4).
> 
>   Submitted by:   Gordon Bergling
 
 There should be an AUTHORS section entry for him writting the man
 page.
>>> 
>>> Is that not optional?  I've never added one to any manpage I've ever
>>> written, and don't especially want it to be added.
>> 
>> Yes, of cource it is optional, but perhaps he was not aware that
>> option even existed as he probably copied the man page from some
>> other work which may of not had that attribution.
>> 
> 
> Gordon,
> 
> please see above, would you like to be added to the AUTHORS section?
> 
> Cheers,
> 
> Chris

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


Re: svn commit: r359633 - head/share/man/man4

2020-04-06 Thread Christian Brueffer
On 2020-04-05 01:48, Rodney W. Grimes wrote:
> 
>> On Sat, 2020-04-04 at 17:10 -0700, Rodney W. Grimes wrote:
 Author: brueffer
 Date: Sat Apr  4 21:38:00 2020
 New Revision: 359633
 URL: https://svnweb.freebsd.org/changeset/base/359633

 Log:
Add a manpage for smbios(4).

Submitted by:   Gordon Bergling
>>>
>>> There should be an AUTHORS section entry for him writting the man
>>> page.
>>
>> Is that not optional?  I've never added one to any manpage I've ever
>> written, and don't especially want it to be added.
> 
> Yes, of cource it is optional, but perhaps he was not aware that
> option even existed as he probably copied the man page from some
> other work which may of not had that attribution.
> 

Gordon,

please see above, would you like to be added to the AUTHORS section?

Cheers,

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