Re: svn commit: r324941 - in head: lib/libc/sys sys/kern

2017-10-25 Thread Conrad Meyer
Hi Alan,

Coverity reports a mismatch between the loop quoted in the context
below and the dynamic array size nent.  (The mismatch predates your
change, due to the invariant nent <= aio_listio_max and aiol_zone
sized in terms of aio_listio_max.)

CID is 1382114.

On Mon, Oct 23, 2017 at 4:12 PM, Alan Somers  wrote:
> Author: asomers
> Date: Mon Oct 23 23:12:01 2017
> New Revision: 324941
> URL: https://svnweb.freebsd.org/changeset/base/324941
>
> Log:
>   Remove artificial restriction on lio_listio's operation count
> ...
> Modified: head/sys/kern/vfs_aio.c
> ==
> --- head/sys/kern/vfs_aio.c Mon Oct 23 23:05:29 2017(r324940)
> +++ head/sys/kern/vfs_aio.c Mon Oct 23 23:12:01 2017(r324941)
>...
> @@ -2812,7 +2809,7 @@ freebsd32_aio_suspend(struct thread *td, struct freebs
> } else
> tsp = NULL;
>
> -   ujoblist = uma_zalloc(aiol_zone, M_WAITOK);
> +   ujoblist = malloc(uap->nent * sizeof(ujoblist[0]), M_AIOS, M_WAITOK);
> ujoblist32 = (uint32_t *)ujoblist;
> error = copyin(uap->aiocbp, ujoblist32, uap->nent *
> sizeof(ujoblist32[0]));
> if (error == 0) {
> for (i = uap->nent; i > 0; i--)

Probably, this should be: for (i = uap->nent - 1; i > 0; i--)

> ujoblist[i] = PTRIN(ujoblist32[i]);
>
> error = kern_aio_suspend(td, uap->nent, ujoblist, tsp);
> }
> -   uma_zfree(aiol_zone, ujoblist);
> +   free(ujoblist, M_AIOS);
> return (error);
>  }

I think this loop was wrong when it was introduced in r185878, but
have not investigated that thoroughly.

Best,
Conrad
___
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: r325004 - head/share/man/man4

2017-10-25 Thread Warner Losh
Author: imp
Date: Wed Oct 25 23:24:30 2017
New Revision: 325004
URL: https://svnweb.freebsd.org/changeset/base/325004

Log:
  Fix typo and bump .Dd date.
  
  Noticed by: Richard Tector
  Sponsored by: Netflix

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

Modified: head/share/man/man4/ipmi.4
==
--- head/share/man/man4/ipmi.4  Wed Oct 25 22:25:32 2017(r325003)
+++ head/share/man/man4/ipmi.4  Wed Oct 25 23:24:30 2017(r325004)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd July 10, 2007
+.Dd October 25, 2017
 .Dt IPMI 4
 .Os
 .Sh NAME
@@ -98,7 +98,7 @@ driver implements the power cycling option to
 to implement power cycling of the system.
 The motherboard's BMC must support the chassis device and the optional
 power cycle subcomand of the chassis control command as described in section 
28.3
-if the IPMI standard.
+of the IPMI standard.
 The length of time the system is off will be at least one second, but
 may be longer if the power cycle interval has been set (see section 28.9).
 .Sh IOCTLS
___
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: r325001 - head

2017-10-25 Thread Bryan Drewery
Author: bdrewery
Date: Wed Oct 25 21:46:36 2017
New Revision: 325001
URL: https://svnweb.freebsd.org/changeset/base/325001

Log:
  Fix native-xtools build to use a proper sysroot.
  
  This takes longer but should reliably produce working binaries.
  The old version linked against system libraries and headers
  which would be a problem if building a native-xtools against
  a newer source than the host system.  With a proper sysroot made
  first this is not a problem.
  
  This also allows:
  - NXBDIRS to be built in parallel
  - NXBDIRS to be installed to NXBDESTDIR in parallel
  - SYSTEM_COMPILER logic to work again.  Note that because this change
is adding a sysroot phase the compiler may be built up to twice now.
The first is the "cross-compiler" even though it is for the native
architecture, but it is still built to ensure the latest compiler
is used to generate the binaries, unless SYSTEM_COMPILER allows
/usr/bin/cc to be used.  Then the target compiler is built
which is actually a cross-compiler since it runs on native host
but generates TARGET.TARGET_ARCH binaries.
  
  Note this also changes the path used for the OBJDIR.  It used to use
  /usr/obj/target.target_arch/nxb/ for objects and
  /usr/obj/target.target_arch/nxb-bin for installed files, but now uses
  /usr/obj/nxb/target.target_arch/ for objects and
  /usr/obj/nxb/target.target_arch//nxb-bin for installed files.
- NXBDESTDIR can be specified for where to install or queried with
  `make -f Makefile.inc1 TARGET=... TARGET_ARCH=... -V NXBDESTDIR`
  
  This could potentially be improved to reuse an existing sysroot.  The
  problem is with building the SUBDIR_OVERRIDE list it needs to use a
  different OBJDIR since it is building all statically.  We don't want to
  pollute the existing 'buildworld' OBJDIR and cause confusion on the next
  build.  Using a separate OBJDIR for the 'everything' phase mostly works
  except for some things like linking in INTERNALLIBS that exist in the
  other OBJDIR.
  
  MFC after:1 month
  Sponsored by: Dell EMC Isilon

Modified:
  head/Makefile.inc1

Modified: head/Makefile.inc1
==
--- head/Makefile.inc1  Wed Oct 25 21:46:33 2017(r325000)
+++ head/Makefile.inc1  Wed Oct 25 21:46:36 2017(r325001)
@@ -637,6 +637,8 @@ XCXXFLAGS+= -isystem ${WORLDTMP}/usr/include/c++/v1 -s
 .endif
 .elif ${WANT_COMPILER_TYPE} == clang || \
 (defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} == clang)
+MACHINE_ABI?=  unknown
+MACHINE_TRIPLE?=${MACHINE_ARCH:C/amd64/x86_64/}-${MACHINE_ABI}-freebsd12.0
 TARGET_ABI?=   unknown
 TARGET_TRIPLE?=${TARGET_ARCH:C/amd64/x86_64/}-${TARGET_ABI}-freebsd12.0
 XCFLAGS+=  -target ${TARGET_TRIPLE}
@@ -2111,47 +2113,20 @@ cross-tools: .MAKE .PHONY
${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX} install
 .endfor
 
-NXBDESTDIR=${OBJTREE}/nxb-bin
-NXBENV=MAKEOBJDIRPREFIX=${OBJTREE}/nxb \
-   TOOLS_PREFIX= \
-   INSTALL="sh ${.CURDIR}/tools/install.sh" \
-   PATH=${PATH}:${OBJTREE}/gperf_for_gcc/usr/bin
-NXBMAKE=   ${NXBENV} ${MAKE} \
-   LLVM_TBLGEN=${NXBDESTDIR}/usr/bin/llvm-tblgen \
-   CLANG_TBLGEN=${NXBDESTDIR}/usr/bin/clang-tblgen \
-   MACHINE=${TARGET} MACHINE_ARCH=${TARGET_ARCH} \
-   MK_GDB=no MK_TESTS=no \
-   SSP_CFLAGS= \
-   MK_HTML=no NO_LINT=yes MK_MAN=no MK_MAN_UTILS=yes \
-   -DNO_PIC MK_PROFILE=no -DNO_SHARED \
-   -DNO_CPU_CFLAGS MK_WARNS=no MK_CTF=no \
-   MK_CLANG_EXTRAS=no MK_CLANG_FULL=no \
-   MK_LLDB=no MK_DEBUG_FILES=no
-
+#
 # native-xtools is the current target for qemu-user cross builds of ports
 # via poudriere and the imgact_binmisc kernel module.
-# For non-clang enabled targets that are still using the in tree gcc
-# we must build a gperf binary for one instance of its Makefiles.  On
-# clang-enabled systems, the gperf binary is obsolete.
-native-xtools: .PHONY
-.if ${MK_GCC_BOOTSTRAP} != "no"
-   mkdir -p ${OBJTREE}/gperf_for_gcc/usr/bin
-   ${_+_}@${ECHODIR} "===> ${_gperf} (obj,all,install)"; \
-   cd ${.CURDIR}/${_gperf}; \
-   if [ -z "${NO_OBJ}" ]; then ${NXBMAKE} DIRPRFX=${_gperf}/ obj; fi; \
-   ${NXBMAKE} DIRPRFX=${_gperf}/ all; \
-   ${NXBMAKE} DIRPRFX=${_gperf}/ DESTDIR=${OBJTREE}/gperf_for_gcc install
-.endif
-   mkdir -p ${NXBDESTDIR}/bin ${NXBDESTDIR}/sbin ${NXBDESTDIR}/usr
-   mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
-   -p ${NXBDESTDIR}/usr >/dev/null
-   mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
-   -p ${NXBDESTDIR}/usr/include >/dev/null
-.if ${MK_DEBUG_FILES} != "no"
-   mtree -deU -f ${.CURDIR}/etc/mtree/BSD.debug.dist \
-   -p ${NXBDESTDIR}/usr/lib >/dev/null
-.endif
-.for _tool in \
+# This target merely builds a 

svn commit: r324999 - head

2017-10-25 Thread Bryan Drewery
Author: bdrewery
Date: Wed Oct 25 21:46:30 2017
New Revision: 324999
URL: https://svnweb.freebsd.org/changeset/base/324999

Log:
  META_MODE: Follow-up r319593: Don't use host headers in a fresh new build.
  
  Sponsored by: Dell EMC Isilon

Modified:
  head/Makefile.inc1

Modified: head/Makefile.inc1
==
--- head/Makefile.inc1  Wed Oct 25 21:45:55 2017(r324998)
+++ head/Makefile.inc1  Wed Oct 25 21:46:30 2017(r324999)
@@ -671,7 +671,7 @@ META_MODE_BAD_ABI_VERS+=1200031
 OBJDIR_HOST_OSRELDATE!=\
 awk '/^\#define[[:space:]]*__FreeBSD_version/ { print $$3 }' \
 ${OBJTREE}${.CURDIR}/host-osreldate.h
-.else
+.elif exists(${WORLDTMP}/usr/include/osreldate.h)
 OBJDIR_HOST_OSRELDATE= 0
 .endif
 .export OBJDIR_HOST_OSRELDATE
@@ -680,6 +680,7 @@ OBJDIR_HOST_OSRELDATE=  0
 # Note that this logic is the opposite of normal BOOTSTRAP handling.  We want
 # to compare the WORLDTMP's OSRELDATE to the host's OSRELDATE.  If the WORLDTMP
 # is older than the ABI-breakage OSRELDATE of the HOST then we rebuild.
+.if defined(OBJDIR_HOST_OSRELDATE)
 .for _ver in ${META_MODE_BAD_ABI_VERS}
 .if ${OSRELDATE} >= ${_ver} && ${OBJDIR_HOST_OSRELDATE} < ${_ver}
 _meta_mode_need_rebuild=   ${_ver}
@@ -689,8 +690,9 @@ _meta_mode_need_rebuild=${_ver}
 .info META_MODE: Rebuilding host tools due to ABI breakage in 
__FreeBSD_version ${_meta_mode_need_rebuild}.
 NO_META_IGNORE_HOST_HEADERS=   1
 .export NO_META_IGNORE_HOST_HEADERS
-.endif
-.endif
+.endif # defined(_meta_mode_need_rebuild)
+.endif # defined(OBJDIR_HOST_OSRELDATE)
+.endif # ${MK_META_MODE} == "yes" && defined(NO_CLEAN) ...
 # This is only used for META_MODE+filemon to track what the oldest
 # __FreeBSD_version is in WORLDTMP.  This purposely does NOT have
 # a make dependency on /usr/include/osreldate.h as the file should
___
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: r325000 - head/tools/tools/nanobsd

2017-10-25 Thread Bryan Drewery
Author: bdrewery
Date: Wed Oct 25 21:46:33 2017
New Revision: 325000
URL: https://svnweb.freebsd.org/changeset/base/325000

Log:
  native-xtools: Override proper NXBDESTDIR.
  
  The new native-xtools uses 'make toolchain' so overriding DESTDIR
  as a make argument may interfere with WORLDTMP handling.
  The target also does a 'mkdir -p ${NXBDESTDIR}/usr', so we should
  be modifying that rather than DESTDIR.
  
  Note this causes the native-xtools binaries to be installed in
  NANO_WORLDDIR/usr NANO_WORLDDIR/bin rather than NANO_WORLDDIR/nxb-bin/usr
  and NANO_WORLDDIR/nxb-bin/bin.  This was the case before this change
  as well.
  
  MFC after:2 weeks
  Reviewed by:  imp
  Differential Revision:https://reviews.freebsd.org/D12782

Modified:
  head/tools/tools/nanobsd/defaults.sh

Modified: head/tools/tools/nanobsd/defaults.sh
==
--- head/tools/tools/nanobsd/defaults.shWed Oct 25 21:46:30 2017
(r324999)
+++ head/tools/tools/nanobsd/defaults.shWed Oct 25 21:46:33 2017
(r325000)
@@ -438,7 +438,7 @@ native_xtools ( ) (
nano_make_install_env
set -o xtrace
cd "${NANO_SRC}"
-   ${NANO_MAKE} native-xtools DESTDIR="${NANO_WORLDDIR}"
+   ${NANO_MAKE} native-xtools NXBDESTDIR="${NANO_WORLDDIR}"
 
) > ${NANO_LOG}/_.native_xtools 2>&1
 )
___
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: r325002 - head

2017-10-25 Thread Bryan Drewery
Author: bdrewery
Date: Wed Oct 25 21:46:39 2017
New Revision: 325002
URL: https://svnweb.freebsd.org/changeset/base/325002

Log:
  Cleanup pieces missed in r315057 which made mandoc mandatory
  
  Sponsored by: Dell EMC Isilon

Modified:
  head/Makefile.inc1

Modified: head/Makefile.inc1
==
--- head/Makefile.inc1  Wed Oct 25 21:46:36 2017(r325001)
+++ head/Makefile.inc1  Wed Oct 25 21:46:39 2017(r325002)
@@ -1849,7 +1849,6 @@ _vtfontcvt=   usr.bin/vtfontcvt
 .endif
 
 .if ${BOOTSTRAPPING} < 133
-_libopenbsd=   lib/libopenbsd
 _m4=   usr.bin/m4
 _lex=  usr.bin/lex
 
@@ -1935,9 +1934,6 @@ _kerberos5_bootstrap_tools= \
 .ORDER: ${_kerberos5_bootstrap_tools:C/^/${_bt}-/g}
 .endif
 
-# r283777 makewhatis(1) replaced with mandoc version which builds a database.
-_libopenbsd?=  lib/libopenbsd
-_makewhatis=   usr.bin/mandoc
 ${_bt}-usr.bin/mandoc: ${_bt}-lib/libopenbsd
 
 bootstrap-tools: .PHONY
@@ -1954,8 +1950,8 @@ bootstrap-tools: .PHONY
 ${_cat} \
 ${_kbdcontrol} \
 usr.bin/lorder \
-${_libopenbsd} \
-${_makewhatis} \
+lib/libopenbsd \
+usr.bin/mandoc \
 usr.bin/rpcgen \
 ${_yacc} \
 ${_m4} \
___
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: r324998 - head/lib/clang

2017-10-25 Thread Bryan Drewery
Author: bdrewery
Date: Wed Oct 25 21:45:55 2017
New Revision: 324998
URL: https://svnweb.freebsd.org/changeset/base/324998

Log:
  Prefix {TARGET,BUILD}_TRIPLE with LLVM_ to avoid Makefile.inc1 collision.
  
  The Makefile.inc1 TARGET_TRIPLE is for specifying which -target is used
  during the build of world.
  
  MFC after:2 weeks
  Reviewed by:  dim, imp
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D12792

Modified:
  head/lib/clang/llvm.build.mk

Modified: head/lib/clang/llvm.build.mk
==
--- head/lib/clang/llvm.build.mkWed Oct 25 19:27:12 2017
(r324997)
+++ head/lib/clang/llvm.build.mkWed Oct 25 21:45:55 2017
(r324998)
@@ -33,11 +33,11 @@ TARGET_ABI=
 VENDOR=unknown
 OS_VERSION=freebsd12.0
 
-TARGET_TRIPLE?=
${TARGET_ARCH:C/amd64/x86_64/:C/arm64/aarch64/}-${VENDOR}-${OS_VERSION}${TARGET_ABI}
-BUILD_TRIPLE?= 
${BUILD_ARCH:C/amd64/x86_64/:C/arm64/aarch64/}-${VENDOR}-${OS_VERSION}
+LLVM_TARGET_TRIPLE?=   
${TARGET_ARCH:C/amd64/x86_64/:C/arm64/aarch64/}-${VENDOR}-${OS_VERSION}${TARGET_ABI}
+LLVM_BUILD_TRIPLE?=
${BUILD_ARCH:C/amd64/x86_64/:C/arm64/aarch64/}-${VENDOR}-${OS_VERSION}
 
-CFLAGS+=   -DLLVM_DEFAULT_TARGET_TRIPLE=\"${TARGET_TRIPLE}\"
-CFLAGS+=   -DLLVM_HOST_TRIPLE=\"${BUILD_TRIPLE}\"
+CFLAGS+=   -DLLVM_DEFAULT_TARGET_TRIPLE=\"${LLVM_TARGET_TRIPLE}\"
+CFLAGS+=   -DLLVM_HOST_TRIPLE=\"${LLVM_BUILD_TRIPLE}\"
 CFLAGS+=   -DDEFAULT_SYSROOT=\"${TOOLS_PREFIX}\"
 
 CFLAGS+=   -ffunction-sections
___
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: r322951 - head

2017-10-25 Thread Bryan Drewery
On 8/27/17 9:15 AM, Ngie Cooper wrote:
> Author: ngie
> Date: Sun Aug 27 16:15:37 2017
> New Revision: 322951
> URL: https://svnweb.freebsd.org/changeset/base/322951
> 
> Log:
>   Respect MK_TCSH with build-tools and native-xtools
>   
>   This helps reduce the WORLDTMP footprint slightly.
>   
>   Based on a patch I submitted 5 years ago to GNATS.
>   
>   PR: 174051
>   MFC after:  2 weeks
>   Relnotes:   yes (anyone who cross-builds with MK_TCSH=yes will run into
>build failures if the host doesn't have tcsh(1))

I don't understand what you're saying here. If I build with MK_TCSH=yes
and the host does not have tcsh, a failure occurs AFTER or BEFORE this
change?
Neither case makes sense to me.
What is the failure?

The change here is to build-tools which just calls 'make build-tools' in
bin/csh which just builds 'gethost'.
> # make build-tools
> grep 'ERR_' /root/git/freebsd/contrib/tcsh/sh.err.c | grep '^#define' >> 
> sh.err.h
> cc -E -O2 -pipe -I. -I/root/git/freebsd/bin/csh 
> -I/root/git/freebsd/contrib/tcsh -D_PATH_TCSHELL='"/bin/csh"' -g -std=gnu99 
> -fstack-protector-strong -Wsystem-headers -Werror -Wno-pointer-sign 
> -Wno-empty-body -Wno-string-plus-int -Wno-unused-const-variable 
> -Wno-tautological-compare -Wno-unused-value -Wno-parentheses-equality 
> -Wno-unused-function -Wno-enum-conversion -Wno-unused-local-typedef 
> -Wno-address-of-packed-member -Wno-switch -Wno-switch-enum 
> -Wno-knr-promoted-parameter -Wno-parentheses -fcolor-diagnostics 
> -Qunused-arguments /root/git/freebsd/contrib/tcsh/tc.const.c 
> /root/git/freebsd/contrib/tcsh/sh.char.h /root/git/freebsd/bin/csh/config.h 
> /root/git/freebsd/contrib/tcsh/config_f.h 
> /root/git/freebsd/contrib/tcsh/sh.types.h sh.err.h -D_h_tc_const |  grep 
> 'Char STR' |  sed -e 's/Char \([a-zA-Z0-9_]*\)\(.*\)/extern Char \1[];/' |  
> sort >> tc.const.h
> Building /usr/obj/root/git/freebsd/bin/csh/gethost


If the host does not have tcsh and MK_TCSH is set to yes and fails, then
we're missing building tcsh as a build tool (in bootstrap-tools).  I
don't know where it is used though.
This is the only place I see using csh in the build:
> tools/test/malloc/Makefile: @csh -x -c "time ./malloc  50  2000 
> 8192"
> tools/test/malloc/Makefile: @csh -x -c "time ./malloc5000  2000 
> 8192"
> tools/test/malloc/Makefile: @csh -x -c "time ./malloc  50 14000 
> 8192"
> tools/test/malloc/Makefile: @csh -x -c "time ./malloc2000 2 
> 2048"


>   Reminded by:Fabian Keil 

This patch is overall fine but it saves 25KB in OBJDIR and ~1 second in
build time.  Based on the reminder and the Relnotes, it seems like
whatever was intended to be fixed may not have been.

> 
> Modified:
>   head/Makefile.inc1
> 
> Modified: head/Makefile.inc1
> ==
> --- head/Makefile.inc1Sun Aug 27 13:02:51 2017(r322950)
> +++ head/Makefile.inc1Sun Aug 27 16:15:37 2017(r322951)
> @@ -1984,8 +1984,12 @@ _gcc_tools= gnu/usr.bin/cc/cc_tools
>  _rescue=rescue/rescue
>  .endif
>  
> +.if ${MK_TCSH} != "no"
> +_tcsh=bin/csh
> +.endif
> +
>  .for _tool in \
> -bin/csh \
> +${_tcsh} \
>  bin/sh \
>  ${LOCAL_TOOL_DIRS} \
>  lib/ncurses/ncurses \
> @@ -2143,7 +2147,7 @@ native-xtools: .PHONY
>  bin/cat \
>  bin/chmod \
>  bin/cp \
> -bin/csh \
> +${_tcsh} \
>  bin/echo \
>  bin/expr \
>  bin/hostname \
> 


-- 
Regards,
Bryan Drewery



signature.asc
Description: OpenPGP digital signature


svn commit: r324996 - head/sys/netinet6

2017-10-25 Thread Kristof Provost
Author: kp
Date: Wed Oct 25 19:21:48 2017
New Revision: 324996
URL: https://svnweb.freebsd.org/changeset/base/324996

Log:
  Evaluate packet size after the firewall had its chance in the ip6 fast path
  
  Defer the packet size check until after the firewall has had a look at it. 
This
  means that the firewall now has the opportunity to (re-)fragment an oversized
  packet.
  This mirrors what the slow path does.
  
  Reviewed by:  ae
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D12779

Modified:
  head/sys/netinet6/ip6_fastfwd.c

Modified: head/sys/netinet6/ip6_fastfwd.c
==
--- head/sys/netinet6/ip6_fastfwd.c Wed Oct 25 18:55:04 2017
(r324995)
+++ head/sys/netinet6/ip6_fastfwd.c Wed Oct 25 19:21:48 2017
(r324996)
@@ -194,7 +194,17 @@ passin:
in6_ifstat_inc(rcvif, ifs6_in_noroute);
goto dropin;
}
+
/*
+* Outgoing packet firewall processing.
+*/
+   if (!PFIL_HOOKED(_inet6_pfil_hook))
+   goto passout;
+   if (pfil_run_hooks(_inet6_pfil_hook, , nh.nh_ifp, PFIL_OUT,
+   NULL) != 0 || m == NULL)
+   goto dropout;
+
+   /*
 * We used slow path processing for packets with scoped addresses.
 * So, scope checks aren't needed here.
 */
@@ -205,14 +215,6 @@ passin:
goto dropout;
}
 
-   /*
-* Outgoing packet firewall processing.
-*/
-   if (!PFIL_HOOKED(_inet6_pfil_hook))
-   goto passout;
-   if (pfil_run_hooks(_inet6_pfil_hook, , nh.nh_ifp, PFIL_OUT,
-   NULL) != 0 || m == NULL)
-   goto dropout;
/*
 * If packet filter sets the M_FASTFWD_OURS flag, this means
 * that new destination or next hop is our local address.
___
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: r324995 - in head/sys: arm64/include boot/efi/loader boot/efi/loader/arch/amd64

2017-10-25 Thread Emmanuel Vadot
Author: manu
Date: Wed Oct 25 18:55:04 2017
New Revision: 324995
URL: https://svnweb.freebsd.org/changeset/base/324995

Log:
  loader.efi: Make framebuffer commands available for arm64
  
  Move framebuffer.{c,h} to sys/boot/efi/loader and add the efifb
  related metadata and pass it to the kernel
  
  Reviewed by:  imp, andrew
  Differential Revision:https://reviews.freebsd.org/D12757

Added:
  head/sys/boot/efi/loader/framebuffer.c
 - copied unchanged from r324994, 
head/sys/boot/efi/loader/arch/amd64/framebuffer.c
  head/sys/boot/efi/loader/framebuffer.h
 - copied unchanged from r324994, 
head/sys/boot/efi/loader/arch/amd64/framebuffer.h
Deleted:
  head/sys/boot/efi/loader/arch/amd64/framebuffer.c
  head/sys/boot/efi/loader/arch/amd64/framebuffer.h
Modified:
  head/sys/arm64/include/metadata.h
  head/sys/boot/efi/loader/Makefile
  head/sys/boot/efi/loader/arch/amd64/Makefile.inc
  head/sys/boot/efi/loader/bootinfo.c

Modified: head/sys/arm64/include/metadata.h
==
--- head/sys/arm64/include/metadata.h   Wed Oct 25 17:49:17 2017
(r324994)
+++ head/sys/arm64/include/metadata.h   Wed Oct 25 18:55:04 2017
(r324995)
@@ -31,11 +31,24 @@
 
 #defineMODINFOMD_EFI_MAP   0x1001
 #defineMODINFOMD_DTBP  0x1002
+#defineMODINFOMD_EFI_FB0x1003
 
 struct efi_map_header {
size_t  memory_size;
size_t  descriptor_size;
uint32_tdescriptor_version;
+};
+
+struct efi_fb {
+   uint64_tfb_addr;
+   uint64_tfb_size;
+   uint32_tfb_height;
+   uint32_tfb_width;
+   uint32_tfb_stride;
+   uint32_tfb_mask_red;
+   uint32_tfb_mask_green;
+   uint32_tfb_mask_blue;
+   uint32_tfb_mask_reserved;
 };
 
 #endif /* !_MACHINE_METADATA_H_ */

Modified: head/sys/boot/efi/loader/Makefile
==
--- head/sys/boot/efi/loader/Makefile   Wed Oct 25 17:49:17 2017
(r324994)
+++ head/sys/boot/efi/loader/Makefile   Wed Oct 25 18:55:04 2017
(r324995)
@@ -22,6 +22,7 @@ SRCS= autoload.c \
conf.c \
copy.c \
efi_main.c \
+   framebuffer.c \
main.c \
self_reloc.c \
smbios.c \

Modified: head/sys/boot/efi/loader/arch/amd64/Makefile.inc
==
--- head/sys/boot/efi/loader/arch/amd64/Makefile.incWed Oct 25 17:49:17 
2017(r324994)
+++ head/sys/boot/efi/loader/arch/amd64/Makefile.incWed Oct 25 18:55:04 
2017(r324995)
@@ -2,7 +2,6 @@
 
 SRCS+= amd64_tramp.S \
start.S \
-   framebuffer.c \
elf64_freebsd.c \
trap.c \
exc.S

Modified: head/sys/boot/efi/loader/bootinfo.c
==
--- head/sys/boot/efi/loader/bootinfo.c Wed Oct 25 17:49:17 2017
(r324994)
+++ head/sys/boot/efi/loader/bootinfo.c Wed Oct 25 18:55:04 2017
(r324995)
@@ -48,9 +48,10 @@ __FBSDID("$FreeBSD$");
 
 #if defined(__amd64__)
 #include 
-#include "framebuffer.h"
 #endif
 
+#include "framebuffer.h"
+
 #if defined(LOADER_FDT_SUPPORT)
 #include 
 #endif
@@ -247,12 +248,12 @@ bi_load_efi_data(struct preloaded_file *kfp)
UINT32 mmver;
struct efi_map_header *efihdr;
 
-#if defined(__amd64__)
+#if defined(__amd64__) || defined(__aarch64__)
struct efi_fb efifb;
 
if (efi_find_framebuffer() == 0) {
printf("EFI framebuffer information:\n");
-   printf("addr, size 0x%lx, 0x%lx\n", efifb.fb_addr,
+   printf("addr, size 0x%jx, 0x%jx\n", efifb.fb_addr,
efifb.fb_size);
printf("dimensions %d x %d\n", efifb.fb_width,
efifb.fb_height);

Copied: head/sys/boot/efi/loader/framebuffer.c (from r324994, 
head/sys/boot/efi/loader/arch/amd64/framebuffer.c)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/boot/efi/loader/framebuffer.c  Wed Oct 25 18:55:04 2017
(r324995, copy of r324994, head/sys/boot/efi/loader/arch/amd64/framebuffer.c)
@@ -0,0 +1,568 @@
+/*-
+ * Copyright (c) 2013 The FreeBSD Foundation
+ * All rights reserved.
+ *
+ * This software was developed by Benno Rice under sponsorship from
+ * the FreeBSD Foundation.
+ * 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 

svn commit: r324994 - in head/sys: dev/liquidio dev/liquidio/base modules

2017-10-25 Thread Sean Bruno
Author: sbruno
Date: Wed Oct 25 17:49:17 2017
New Revision: 324994
URL: https://svnweb.freebsd.org/changeset/base/324994

Log:
  Enable i386 build of the Cavium LiquidIO driver (lio) module.
  
  Submitted by: pkannega...@cavium.com (Prasad V Kanneganti)
  MFC after:1 week
  Sponsored by: Cavium Networks
  Differential Revision:https://reviews.freebsd.org/D12415

Modified:
  head/sys/dev/liquidio/base/cn23xx_pf_device.c
  head/sys/dev/liquidio/base/lio_device.c
  head/sys/dev/liquidio/base/lio_device.h
  head/sys/dev/liquidio/base/lio_droq.c
  head/sys/dev/liquidio/base/lio_mem_ops.c
  head/sys/dev/liquidio/base/lio_request_manager.c
  head/sys/dev/liquidio/lio_main.c
  head/sys/dev/liquidio/lio_main.h
  head/sys/dev/liquidio/lio_rxtx.c
  head/sys/dev/liquidio/lio_sysctl.c
  head/sys/modules/Makefile

Modified: head/sys/dev/liquidio/base/cn23xx_pf_device.c
==
--- head/sys/dev/liquidio/base/cn23xx_pf_device.c   Wed Oct 25 17:23:33 
2017(r324993)
+++ head/sys/dev/liquidio/base/cn23xx_pf_device.c   Wed Oct 25 17:49:17 
2017(r324994)
@@ -162,11 +162,11 @@ lio_cn23xx_pf_setup_global_mac_regs(struct octeon_devi
lio_write_csr64(oct, LIO_CN23XX_SLI_PKT_MAC_RINFO64(mac_no, pf_num),
reg_val);
 
-   lio_dev_dbg(oct, "SLI_PKT_MAC(%d)_PF(%d)_RINFO : 0x%016lx\n", mac_no,
+   lio_dev_dbg(oct, "SLI_PKT_MAC(%d)_PF(%d)_RINFO : 0x%016llx\n", mac_no,
pf_num,
-   lio_read_csr64(oct,
+   LIO_CAST64(lio_read_csr64(oct,
   LIO_CN23XX_SLI_PKT_MAC_RINFO64(mac_no,
- pf_num)));
+ pf_num;
 }
 
 static int

Modified: head/sys/dev/liquidio/base/lio_device.c
==
--- head/sys/dev/liquidio/base/lio_device.c Wed Oct 25 17:23:33 2017
(r324993)
+++ head/sys/dev/liquidio/base/lio_device.c Wed Oct 25 17:49:17 2017
(r324994)
@@ -817,8 +817,8 @@ lio_core_drv_init(struct lio_recv_info *recv_info, voi
cs = _setup[oct->octeon_id];
 
if (recv_pkt->buffer_size[0] != (sizeof(*cs) + LIO_DROQ_INFO_SIZE)) {
-   lio_dev_dbg(oct, "Core setup bytes expected %lu found %d\n",
-   (uint32_t)sizeof(*cs) + LIO_DROQ_INFO_SIZE,
+   lio_dev_dbg(oct, "Core setup bytes expected %llu found %d\n",
+   LIO_CAST64(sizeof(*cs) + LIO_DROQ_INFO_SIZE),
recv_pkt->buffer_size[0]);
}
 

Modified: head/sys/dev/liquidio/base/lio_device.h
==
--- head/sys/dev/liquidio/base/lio_device.h Wed Oct 25 17:23:33 2017
(r324993)
+++ head/sys/dev/liquidio/base/lio_device.h Wed Oct 25 17:49:17 2017
(r324994)
@@ -873,16 +873,26 @@ static inline uint64_t
 lio_read_csr64(struct octeon_device *oct, uint32_t reg)
 {
 
+#ifdef __i386__
+   return (lio_read_csr32(oct, reg) |
+   ((uint64_t)lio_read_csr32(oct, reg + 4) << 32));
+#else
return (bus_space_read_8(oct->mem_bus_space[0].tag,
 oct->mem_bus_space[0].handle, reg));
+#endif
 }
 
 static inline void
 lio_write_csr64(struct octeon_device *oct, uint32_t reg, uint64_t val)
 {
 
+#ifdef __i386__
+   lio_write_csr32(oct, reg, (uint32_t)val);
+   lio_write_csr32(oct, reg + 4, val >> 32);
+#else
bus_space_write_8(oct->mem_bus_space[0].tag,
  oct->mem_bus_space[0].handle, reg, val);
+#endif
 }
 
 #endif /* _LIO_DEVICE_H_ */

Modified: head/sys/dev/liquidio/base/lio_droq.c
==
--- head/sys/dev/liquidio/base/lio_droq.c   Wed Oct 25 17:23:33 2017
(r324993)
+++ head/sys/dev/liquidio/base/lio_droq.c   Wed Oct 25 17:49:17 2017
(r324994)
@@ -294,8 +294,8 @@ lio_init_droq(struct octeon_device *oct, uint32_t q_no
return (1);
}
 
-   lio_dev_dbg(oct, "droq[%d]: desc_ring: virt: 0x%p, dma: %lx\n", q_no,
-   droq->desc_ring, droq->desc_ring_dma);
+   lio_dev_dbg(oct, "droq[%d]: desc_ring: virt: 0x%p, dma: %llx\n", q_no,
+   droq->desc_ring, LIO_CAST64(droq->desc_ring_dma));
lio_dev_dbg(oct, "droq[%d]: num_desc: %d\n", q_no, droq->max_count);
 
size = droq->max_count * LIO_DROQ_RECVBUF_SIZE;

Modified: head/sys/dev/liquidio/base/lio_mem_ops.c
==
--- head/sys/dev/liquidio/base/lio_mem_ops.cWed Oct 25 17:23:33 2017
(r324993)
+++ head/sys/dev/liquidio/base/lio_mem_ops.cWed Oct 25 17:49:17 2017
(r324994)
@@ -65,20 

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

2017-10-25 Thread John Baldwin
Author: jhb
Date: Wed Oct 25 17:23:33 2017
New Revision: 324993
URL: https://svnweb.freebsd.org/changeset/base/324993

Log:
  Add a test for sending a signal while stepping a thread via PT_STEP.
  
  MFC after:1 week

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

Modified: head/tests/sys/kern/ptrace_test.c
==
--- head/tests/sys/kern/ptrace_test.c   Wed Oct 25 17:20:18 2017
(r324992)
+++ head/tests/sys/kern/ptrace_test.c   Wed Oct 25 17:23:33 2017
(r324993)
@@ -3377,6 +3377,92 @@ ATF_TC_BODY(ptrace__PT_ATTACH_with_SBDRY_thread, tc)
ATF_REQUIRE(close(fd) == 0);
 }
 
+static void
+sigusr1_step_handler(int sig)
+{
+
+   CHILD_REQUIRE(sig == SIGUSR1);
+   raise(SIGABRT);
+}
+
+/*
+ * Verify that PT_STEP with a signal invokes the signal before
+ * stepping the next instruction (and that the next instruction is
+ * stepped correctly).
+ */
+ATF_TC_WITHOUT_HEAD(ptrace__PT_STEP_with_signal);
+ATF_TC_BODY(ptrace__PT_STEP_with_signal, tc)
+{
+   struct ptrace_lwpinfo pl;
+   pid_t fpid, wpid;
+   int status;
+
+   ATF_REQUIRE((fpid = fork()) != -1);
+   if (fpid == 0) {
+   trace_me();
+   signal(SIGUSR1, sigusr1_step_handler);
+   raise(SIGABRT);
+   exit(1);
+   }
+
+   /* The first wait() should report the stop from SIGSTOP. */
+   wpid = waitpid(fpid, , 0);
+   ATF_REQUIRE(wpid == fpid);
+   ATF_REQUIRE(WIFSTOPPED(status));
+   ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP);
+
+   ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0);
+
+   /* The next stop should report the SIGABRT in the child body. */
+   wpid = waitpid(fpid, , 0);
+   ATF_REQUIRE(wpid == fpid);
+   ATF_REQUIRE(WIFSTOPPED(status));
+   ATF_REQUIRE(WSTOPSIG(status) == SIGABRT);
+
+   ATF_REQUIRE(ptrace(PT_LWPINFO, wpid, (caddr_t), sizeof(pl)) != -1);
+   ATF_REQUIRE(pl.pl_flags & PL_FLAG_SI);
+   ATF_REQUIRE(pl.pl_siginfo.si_signo == SIGABRT);
+
+   /* Step the child process inserting SIGUSR1. */
+   ATF_REQUIRE(ptrace(PT_STEP, fpid, (caddr_t)1, SIGUSR1) == 0);
+
+   /* The next stop should report the SIGABRT in the signal handler. */
+   wpid = waitpid(fpid, , 0);
+   ATF_REQUIRE(wpid == fpid);
+   ATF_REQUIRE(WIFSTOPPED(status));
+   ATF_REQUIRE(WSTOPSIG(status) == SIGABRT);
+
+   ATF_REQUIRE(ptrace(PT_LWPINFO, wpid, (caddr_t), sizeof(pl)) != -1);
+   ATF_REQUIRE(pl.pl_flags & PL_FLAG_SI);
+   ATF_REQUIRE(pl.pl_siginfo.si_signo == SIGABRT);
+
+   /* Continue the child process discarding the signal. */
+   ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0);
+
+   /* The next stop should report a trace trap from PT_STEP. */
+   wpid = waitpid(fpid, , 0);
+   ATF_REQUIRE(wpid == fpid);
+   ATF_REQUIRE(WIFSTOPPED(status));
+   ATF_REQUIRE(WSTOPSIG(status) == SIGTRAP);
+
+   ATF_REQUIRE(ptrace(PT_LWPINFO, wpid, (caddr_t), sizeof(pl)) != -1);
+   ATF_REQUIRE(pl.pl_flags & PL_FLAG_SI);
+   ATF_REQUIRE(pl.pl_siginfo.si_signo == SIGTRAP);
+   ATF_REQUIRE(pl.pl_siginfo.si_code == TRAP_TRACE);
+
+   /* Continue the child to let it exit. */
+   ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0);
+
+   /* The last event should be for the child process's exit. */
+   wpid = waitpid(fpid, , 0);
+   ATF_REQUIRE(WIFEXITED(status));
+   ATF_REQUIRE(WEXITSTATUS(status) == 1);
+
+   wpid = wait();
+   ATF_REQUIRE(wpid == -1);
+   ATF_REQUIRE(errno == ECHILD);
+}
+
 ATF_TP_ADD_TCS(tp)
 {
 
@@ -3428,6 +3514,7 @@ ATF_TP_ADD_TCS(tp)
ATF_TP_ADD_TC(tp, ptrace__parent_terminate_with_pending_sigstop2);
ATF_TP_ADD_TC(tp, ptrace__event_mask_sigkill_discard);
ATF_TP_ADD_TC(tp, ptrace__PT_ATTACH_with_SBDRY_thread);
+   ATF_TP_ADD_TC(tp, ptrace__PT_STEP_with_signal);
 
return (atf_no_error());
 }
___
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: r324971 - head/sys/netinet

2017-10-25 Thread Rodney W. Grimes
> On Wed, Oct 25, 2017 at 07:57:14AM -0700, Rodney W. Grimes wrote:
> > > New Revision: 324971
> > > URL: https://svnweb.freebsd.org/changeset/base/324971
> > > 
> > > Log:
> > >   Fix a bug reported by Felix Weinrank using the libfuzzer on the
> > >   userland stack.
> > 
> > Please try to say what the bug was, why it was a bug, and
> > how it was fixed in any bug commit message.
> > 
> > External vague references are of little value when reading
> > through a files svn history.
> 
> Honestly, I don't understand at all why this topic comes up again and
> again.  It's beaten to death, aren't people supposed to read svn-* mail?
> 
> :-(

I think one thing that causes some of this is that many work in
private repositories with no one else seeing there commits and
they develope a bad habit of writting very brief commit messages
and then these get carried into public repositories.

> ./danfe
-- 
Rod Grimes rgri...@freebsd.org
___
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: r324992 - head/sys/ufs/ffs

2017-10-25 Thread Mark Johnston
Author: markj
Date: Wed Oct 25 17:20:18 2017
New Revision: 324992
URL: https://svnweb.freebsd.org/changeset/base/324992

Log:
  Make drain_output() use bufobj_wwait().
  
  No functional change intended.
  
  Reviewed by:  kib
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D12790

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

Modified: head/sys/ufs/ffs/ffs_softdep.c
==
--- head/sys/ufs/ffs/ffs_softdep.c  Wed Oct 25 16:01:19 2017
(r324991)
+++ head/sys/ufs/ffs/ffs_softdep.c  Wed Oct 25 17:20:18 2017
(r324992)
@@ -14289,25 +14289,14 @@ softdep_get_depcounts(struct mount *mp,
 
 /*
  * Wait for pending output on a vnode to complete.
- * Must be called with vnode lock and interlock locked.
- *
- * XXX: Should just be a call to bufobj_wwait().
  */
 static void
 drain_output(vp)
struct vnode *vp;
 {
-   struct bufobj *bo;
 
-   bo = >v_bufobj;
ASSERT_VOP_LOCKED(vp, "drain_output");
-   ASSERT_BO_WLOCKED(bo);
-
-   while (bo->bo_numoutput) {
-   bo->bo_flag |= BO_WWAIT;
-   msleep((caddr_t)>bo_numoutput,
-   BO_LOCKPTR(bo), PRIBIO + 1, "drainvp", 0);
-   }
+   (void)bufobj_wwait(>v_bufobj, 0, 0);
 }
 
 /*
___
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: r324971 - head/sys/netinet

2017-10-25 Thread Michael Tuexen
> On 25. Oct 2017, at 16:57, Rodney W. Grimes  
> wrote:
> 
> [ Charset UTF-8 unsupported, converting... ]
>> Author: tuexen
>> Date: Wed Oct 25 09:12:22 2017
>> New Revision: 324971
>> URL: https://svnweb.freebsd.org/changeset/base/324971
>> 
>> Log:
>>  Fix a bug reported by Felix Weinrank using the libfuzzer on the
>>  userland stack.
> 
> Please try to say what the bug was, why it was a bug, and
> how it was fixed in any bug commit message.
Yepp, you are right. The bug was that when taking the length
of what is used in a buffer, the offset was not taken into account.
The fix is to do that...

Best regards
Michael
> 
> External vague references are of little value when reading
> through a files svn history.
> 
> Thanks,
>> 
>>  MFC after:  3 days
>> 
>> Modified:
>>  head/sys/netinet/sctp_auth.c
>> 
>> Modified: head/sys/netinet/sctp_auth.c
>> ==
>> --- head/sys/netinet/sctp_auth.c Wed Oct 25 05:55:13 2017
>> (r324970)
>> +++ head/sys/netinet/sctp_auth.c Wed Oct 25 09:12:22 2017
>> (r324971)
>> @@ -1606,9 +1606,9 @@ sctp_zero_m(struct mbuf *m, uint32_t m_offset, uint32_
>>  /* now use the rest of the mbuf chain */
>>  while ((m_tmp != NULL) && (size > 0)) {
>>  data = mtod(m_tmp, uint8_t *)+m_offset;
>> -if (size > (uint32_t)SCTP_BUF_LEN(m_tmp)) {
>> -memset(data, 0, SCTP_BUF_LEN(m_tmp));
>> -size -= SCTP_BUF_LEN(m_tmp);
>> +if (size > (uint32_t)(SCTP_BUF_LEN(m_tmp) - m_offset)) {
>> +memset(data, 0, SCTP_BUF_LEN(m_tmp) - m_offset);
>> +size -= SCTP_BUF_LEN(m_tmp) - m_offset;
>>  } else {
>>  memset(data, 0, size);
>>  size = 0;
>> 
>> 
> 
> -- 
> Rod Grimes rgri...@freebsd.org
> 

___
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: r324971 - head/sys/netinet

2017-10-25 Thread Alexey Dokuchaev
On Wed, Oct 25, 2017 at 07:57:14AM -0700, Rodney W. Grimes wrote:
> > New Revision: 324971
> > URL: https://svnweb.freebsd.org/changeset/base/324971
> > 
> > Log:
> >   Fix a bug reported by Felix Weinrank using the libfuzzer on the
> >   userland stack.
> 
> Please try to say what the bug was, why it was a bug, and
> how it was fixed in any bug commit message.
> 
> External vague references are of little value when reading
> through a files svn history.

Honestly, I don't understand at all why this topic comes up again and
again.  It's beaten to death, aren't people supposed to read svn-* mail?

:-(

./danfe
___
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: r324991 - head/cddl/contrib/opensolaris/lib/libzfs/common

2017-10-25 Thread Alan Somers
Author: asomers
Date: Wed Oct 25 16:01:19 2017
New Revision: 324991
URL: https://svnweb.freebsd.org/changeset/base/324991

Log:
  Fix zpool_read_all_labels when vfs.aio.enable_unsafe=0
  
  Previously, zpool_read_all_labels was trying to do 256KB reads, which are
  greater than the default MAXPHYS and therefore must go through the slow,
  unsafe AIO path.  Shrink these reads to 112KB so they can use the safe, fast
  AIO path instead.
  
  MFC after:1 week
  X-MFC-With:   324568
  Sponsored by: Spectra Logic Corp

Modified:
  head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c

Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c
==
--- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c Wed Oct 
25 15:30:53 2017(r324990)
+++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c Wed Oct 
25 16:01:19 2017(r324991)
@@ -930,7 +930,7 @@ zpool_read_all_labels(int fd, nvlist_t **config)
struct aiocb aiocbs[VDEV_LABELS];
struct aiocb *aiocbps[VDEV_LABELS];
int l;
-   vdev_label_t *labels;
+   vdev_phys_t *labels;
uint64_t state, txg, size;
int nlabels = 0;
 
@@ -940,15 +940,15 @@ zpool_read_all_labels(int fd, nvlist_t **config)
return (0);
size = P2ALIGN_TYPED(statbuf.st_size, sizeof (vdev_label_t), uint64_t);
 
-   if ((labels = calloc(VDEV_LABELS, sizeof (vdev_label_t))) == NULL)
+   if ((labels = calloc(VDEV_LABELS, sizeof (vdev_phys_t))) == NULL)
return (0);
 
memset(aiocbs, 0, sizeof(aiocbs));
for (l = 0; l < VDEV_LABELS; l++) {
aiocbs[l].aio_fildes = fd;
-   aiocbs[l].aio_offset = label_offset(size, l);
+   aiocbs[l].aio_offset = label_offset(size, l) + VDEV_SKIP_SIZE;
aiocbs[l].aio_buf = [l];
-   aiocbs[l].aio_nbytes = sizeof(vdev_label_t);
+   aiocbs[l].aio_nbytes = sizeof(vdev_phys_t);
aiocbs[l].aio_lio_opcode = LIO_READ;
aiocbps[l] = [l];
}
@@ -962,17 +962,18 @@ zpool_read_all_labels(int fd, nvlist_t **config)
(void)aio_return([l]);
}
}
+   free(labels);
return (0);
}
 
for (l = 0; l < VDEV_LABELS; l++) {
nvlist_t *temp = NULL;
 
-   if (aio_return([l]) != sizeof(vdev_label_t))
+   if (aio_return([l]) != sizeof(vdev_phys_t))
continue;
 
-   if (nvlist_unpack(labels[l].vl_vdev_phys.vp_nvlist,
-   sizeof (labels[l].vl_vdev_phys.vp_nvlist), , 0) != 0)
+   if (nvlist_unpack(labels[l].vp_nvlist,
+   sizeof (labels[l].vp_nvlist), , 0) != 0)
continue;
 
if (nvlist_lookup_uint64(temp, ZPOOL_CONFIG_POOL_STATE,
___
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: r324983 - in head: lib/libc/sys sys/sys

2017-10-25 Thread Steven Hartland
Personally I would expect the fallback to be reboot as without the 
ability to power back on remotely e.g. IPMI this could render the 
machine inaccessible, which is not ideal, thoughts?


On 25/10/2017 16:30, Warner Losh wrote:

Author: imp
Date: Wed Oct 25 15:30:20 2017
New Revision: 324983
URL: https://svnweb.freebsd.org/changeset/base/324983

Log:
   Define RB_POWERCYCLE
   
   RB_POWERCYCLE instructs the platform to power off and then power back

   on a short time later, if that's possible. Otherwise, degrade to the
   RB_POWEROFF behavior.
   
   Sponsored by: Netflix


Modified:
   head/lib/libc/sys/reboot.2
   head/sys/sys/reboot.h

Modified: head/lib/libc/sys/reboot.2
==
--- head/lib/libc/sys/reboot.2  Wed Oct 25 15:28:05 2017(r324982)
+++ head/lib/libc/sys/reboot.2  Wed Oct 25 15:30:20 2017(r324983)
@@ -28,7 +28,7 @@
  .\" @(#)reboot.2 8.1 (Berkeley) 6/4/93
  .\" $FreeBSD$
  .\"
-.Dd September 18, 2015
+.Dd October 24, 2017
  .Dt REBOOT 2
  .Os
  .Sh NAME
@@ -84,6 +84,14 @@ for more information.
  .It Dv RB_HALT
  The processor is simply halted; no reboot takes place.
  This option should be used with caution.
+.It Dv RB_POWERCYCLE
+After halting, the shutdown code will do what it can to turn
+off the power and then turn the power back on.
+This requires hardware support, usually an auxiliary microprocessor
+that can sequence the power supply.
+At present only the
+.Xr ipmi 4
+driver implements this feature.
  .It Dv RB_POWEROFF
  After halting, the shutdown code will do what it can to turn
  off the power.

Modified: head/sys/sys/reboot.h
==
--- head/sys/sys/reboot.h   Wed Oct 25 15:28:05 2017(r324982)
+++ head/sys/sys/reboot.h   Wed Oct 25 15:30:20 2017(r324983)
@@ -60,6 +60,7 @@
  #define   RB_RESERVED20x8 /* reserved for internal use of boot 
blocks */
  #define   RB_PAUSE0x10 /* pause after each output line during 
probe */
  #define   RB_REROOT   0x20 /* unmount the rootfs and mount it 
again */
+#defineRB_POWERCYCLE   0x40 /* Power cycle if possible */
  #define   RB_MULTIPLE 0x2000  /* use multiple consoles */
  
  #define	RB_BOOTINFO	0x8000	/* have `struct bootinfo *' arg */




___
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: r324984 - head/lib/libsysdecode

2017-10-25 Thread Warner Losh
Author: imp
Date: Wed Oct 25 15:30:25 2017
New Revision: 324984
URL: https://svnweb.freebsd.org/changeset/base/324984

Log:
  RB_POWERCYCLE needs to be handled like RB_POWEROFF for decoding.
  
  Sponsored by: Netflix

Modified:
  head/lib/libsysdecode/flags.c

Modified: head/lib/libsysdecode/flags.c
==
--- head/lib/libsysdecode/flags.c   Wed Oct 25 15:30:20 2017
(r324983)
+++ head/lib/libsysdecode/flags.c   Wed Oct 25 15:30:25 2017
(r324984)
@@ -647,9 +647,9 @@ sysdecode_reboot_howto(FILE *fp, int howto, int *rem)
/*
 * RB_AUTOBOOT is special in that its value is zero, but it is
 * also an implied argument if a different operation is not
-* requested via RB_HALT, RB_POWEROFF, or RB_REROOT.
+* requested via RB_HALT, RB_POWERCYCLE, RB_POWEROFF, or RB_REROOT.
 */
-   if (howto != 0 && (howto & (RB_HALT | RB_POWEROFF | RB_REROOT)) == 0) {
+   if (howto != 0 && (howto & (RB_HALT | RB_POWEROFF | RB_REROOT | 
RB_POWERCYCLE)) == 0) {
fputs("RB_AUTOBOOT|", fp);
printed = true;
} else
___
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: r324987 - head/sbin/init

2017-10-25 Thread Warner Losh
Author: imp
Date: Wed Oct 25 15:30:40 2017
New Revision: 324987
URL: https://svnweb.freebsd.org/changeset/base/324987

Log:
  Implement power cycle in init.
  
  If SIGWINCH is received, then halt with power cycle.
  
  Sponsored by: Netflix

Modified:
  head/sbin/init/init.8
  head/sbin/init/init.c

Modified: head/sbin/init/init.8
==
--- head/sbin/init/init.8   Wed Oct 25 15:30:35 2017(r324986)
+++ head/sbin/init/init.8   Wed Oct 25 15:30:40 2017(r324987)
@@ -286,6 +286,7 @@ as follows:
 .It Sy "Run-level  Signal  Action"
 .It Cm 0 Ta Dv SIGUSR1 Ta "Halt"
 .It Cm 0 Ta Dv SIGUSR2 Ta "Halt and turn the power off"
+.It Cm 0 Ta Dv SIGWINCH Ta "Halt and turn the power off and then back on"
 .It Cm 1 Ta Dv SIGTERM Ta "Go to single-user mode"
 .It Cm 6 Ta Dv SIGINT Ta "Reboot the machine"
 .It Cm c Ta Dv SIGTSTP Ta "Block further logins"

Modified: head/sbin/init/init.c
==
--- head/sbin/init/init.c   Wed Oct 25 15:30:35 2017(r324986)
+++ head/sbin/init/init.c   Wed Oct 25 15:30:40 2017(r324987)
@@ -305,12 +305,12 @@ invalid:
handle(disaster, SIGABRT, SIGFPE, SIGILL, SIGSEGV, SIGBUS, SIGXCPU,
SIGXFSZ, 0);
handle(transition_handler, SIGHUP, SIGINT, SIGEMT, SIGTERM, SIGTSTP,
-   SIGUSR1, SIGUSR2, 0);
+   SIGUSR1, SIGUSR2, SIGWINCH, 0);
handle(alrm_handler, SIGALRM, 0);
sigfillset();
delset(, SIGABRT, SIGFPE, SIGILL, SIGSEGV, SIGBUS, SIGSYS,
SIGXCPU, SIGXFSZ, SIGHUP, SIGINT, SIGEMT, SIGTERM, SIGTSTP,
-   SIGALRM, SIGUSR1, SIGUSR2, 0);
+   SIGALRM, SIGUSR1, SIGUSR2, SIGWINCH, 0);
sigprocmask(SIG_SETMASK, , (sigset_t *) 0);
sigemptyset(_mask);
sa.sa_flags = 0;
@@ -1557,8 +1557,9 @@ transition_handler(int sig)
current_state == clean_ttys || current_state == catatonia)
requested_transition = clean_ttys;
break;
+   case SIGWINCH:
case SIGUSR2:
-   howto = RB_POWEROFF;
+   howto = sig == SIGUSR2 ? RB_POWEROFF : RB_POWERCYCLE;
case SIGUSR1:
howto |= RB_HALT;
case SIGINT:
___
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: r324985 - head/sbin/shutdown

2017-10-25 Thread Warner Losh
Author: imp
Date: Wed Oct 25 15:30:30 2017
New Revision: 324985
URL: https://svnweb.freebsd.org/changeset/base/324985

Log:
  Add power cycle support (-c) to shutdown.
  
  Sponsored by: Netflix

Modified:
  head/sbin/shutdown/shutdown.8
  head/sbin/shutdown/shutdown.c

Modified: head/sbin/shutdown/shutdown.8
==
--- head/sbin/shutdown/shutdown.8   Wed Oct 25 15:30:25 2017
(r324984)
+++ head/sbin/shutdown/shutdown.8   Wed Oct 25 15:30:30 2017
(r324985)
@@ -28,7 +28,7 @@
 .\" @(#)shutdown.8 8.2 (Berkeley) 4/27/95
 .\" $FreeBSD$
 .\"
-.Dd September 21, 2016
+.Dd October 23, 2017
 .Dt SHUTDOWN 8
 .Os
 .Sh NAME
@@ -39,7 +39,7 @@
 .Nm
 .Op Fl
 .Oo
-.Fl h | Fl p |
+.Fl c | Fl h | Fl p |
 .Fl r | Fl k
 .Oc
 .Oo
@@ -59,12 +59,22 @@ would otherwise not bother with such niceties.
 .Pp
 The following options are available:
 .Bl -tag -width indent
+.It Fl c
+The system is power cycled (power turned off and then back on)
+at the specified time.
+If the hardware doesn't support power cycle, the system will be
+halted.
+At the present time, only systems with BMC supported by the
+.Xr ipmi 4
+driver that implement this functionality support this flag.
+The amount of time the system is off is dependent on the device
+that implements this feature.
 .It Fl h
 The system is halted at the specified
 .Ar time .
 .It Fl p
 The system is halted and the power is turned off
-(hardware support required)
+(hardware support required, otherwise the system is halted)
 at the specified
 .Ar time .
 .It Fl r
@@ -79,6 +89,7 @@ does not actually halt the system, but leaves the
 system multi-user with logins disabled (for all but super-user).
 .It Fl o
 If one of the
+.Fl c ,
 .Fl h ,
 .Fl p
 or

Modified: head/sbin/shutdown/shutdown.c
==
--- head/sbin/shutdown/shutdown.c   Wed Oct 25 15:30:25 2017
(r324984)
+++ head/sbin/shutdown/shutdown.c   Wed Oct 25 15:30:30 2017
(r324985)
@@ -89,7 +89,7 @@ static struct interval {
 #undef S
 
 static time_t offset, shuttime;
-static int dohalt, dopower, doreboot, killflg, mbuflen, oflag;
+static int docycle, dohalt, dopower, doreboot, killflg, mbuflen, oflag;
 static char mbuf[BUFSIZ];
 static const char *nosync, *whom;
 
@@ -141,11 +141,14 @@ main(int argc, char **argv)
goto poweroff;
}
 
-   while ((ch = getopt(argc, argv, "-hknopr")) != -1)
+   while ((ch = getopt(argc, argv, "-chknopr")) != -1)
switch (ch) {
case '-':
readstdin = 1;
break;
+   case 'c':
+   docycle = 1;
+   break;
case 'h':
dohalt = 1;
break;
@@ -174,11 +177,11 @@ main(int argc, char **argv)
if (argc < 1)
usage((char *)NULL);
 
-   if (killflg + doreboot + dohalt + dopower > 1)
-   usage("incompatible switches -h, -k, -p and -r");
+   if (killflg + doreboot + dohalt + dopower + docycle > 1)
+   usage("incompatible switches -c, -h, -k, -p and -r");
 
-   if (oflag && !(dohalt || dopower || doreboot))
-   usage("-o requires -h, -p or -r");
+   if (oflag && !(dohalt || dopower || doreboot || docycle))
+   usage("-o requires -c, -h, -p or -r");
 
if (nosync != NULL && !oflag)
usage("-n requires -o");
@@ -356,8 +359,8 @@ die_you_gravy_sucking_pig_dog(void)
char *empty_environ[] = { NULL };
 
syslog(LOG_NOTICE, "%s by %s: %s",
-   doreboot ? "reboot" : dohalt ? "halt" : dopower ? "power-down" : 
-   "shutdown", whom, mbuf);
+   doreboot ? "reboot" : dohalt ? "halt" : dopower ? "power-down" :
+   docycle ? "power-cycle" : "shutdown", whom, mbuf);
 
(void)printf("\r\nSystem shutdown time has arrived\007\007\r\n");
if (killflg) {
@@ -367,6 +370,8 @@ die_you_gravy_sucking_pig_dog(void)
 #ifdef DEBUG
if (doreboot)
(void)printf("reboot");
+   else if (docycle)
+   (void)printf("power-cycle");
else if (dohalt)
(void)printf("halt");
else if (dopower)
@@ -379,6 +384,7 @@ die_you_gravy_sucking_pig_dog(void)
(void)kill(1, doreboot ? SIGINT :   /* reboot */
  dohalt ? SIGUSR1 :/* halt */
  dopower ? SIGUSR2 :   /* power-down */
+ docycle ? SIGWINCH :  /* power-cycle */
  SIGTERM); /* single-user */
} else {
if (doreboot) {
@@ -397,6 +403,13 @@ die_you_gravy_sucking_pig_dog(void)
}
else if (dopower) {
execle(_PATH_HALT, "halt", "-l", "-p", 

svn commit: r324990 - in head: share/man/man4 sys/dev/ipmi sys/sys

2017-10-25 Thread Warner Losh
Author: imp
Date: Wed Oct 25 15:30:53 2017
New Revision: 324990
URL: https://svnweb.freebsd.org/changeset/base/324990

Log:
  Implement IPMI support for RB_POWRECYCLE
  
  Some BMCs support power cycling the chassis via the chassis control
  command 2 subcommand 2 (ipmitool called it 'chassis power cycle').  If
  the BMC supports the chassis device, register a shutdown_final handler
  that sends the power cycle command if request and waits up to 10s for
  it to take effect. To minimize stack strain, we preallocate a ipmi
  request in the softc. At the moment, we're verbose about what we're
  doing.
  
  Sponsored by: Netflix

Modified:
  head/share/man/man4/ipmi.4
  head/sys/dev/ipmi/ipmi.c
  head/sys/dev/ipmi/ipmivars.h
  head/sys/sys/ipmi.h

Modified: head/share/man/man4/ipmi.4
==
--- head/share/man/man4/ipmi.4  Wed Oct 25 15:30:48 2017(r324989)
+++ head/share/man/man4/ipmi.4  Wed Oct 25 15:30:53 2017(r324990)
@@ -90,6 +90,17 @@ is heavily adopted from the standard and
 .Tn Linux
 driver; however, not all features described in the
 standard are supported.
+.Pp
+The
+.Nm
+driver implements the power cycling option to
+.Xr shutdown 8
+to implement power cycling of the system.
+The motherboard's BMC must support the chassis device and the optional
+power cycle subcomand of the chassis control command as described in section 
28.3
+if the IPMI standard.
+The length of time the system is off will be at least one second, but
+may be longer if the power cycle interval has been set (see section 28.9).
 .Sh IOCTLS
 Sending and receiving messages through the
 .Nm
@@ -179,6 +190,8 @@ An address supplied was invalid.
 .Sh SEE ALSO
 .Xr ioctl 2 ,
 .Xr watchdog 4 ,
+.Xr reboot 8 ,
+.Xr shutdown 8 ,
 .Xr watchdog 8 ,
 .Xr watchdogd 8 ,
 .Xr watchdog 9

Modified: head/sys/dev/ipmi/ipmi.c
==
--- head/sys/dev/ipmi/ipmi.cWed Oct 25 15:30:48 2017(r324989)
+++ head/sys/dev/ipmi/ipmi.cWed Oct 25 15:30:53 2017(r324990)
@@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -690,6 +691,45 @@ ipmi_wd_event(void *arg, unsigned int cmd, int *error)
 }
 
 static void
+ipmi_power_cycle(void *arg, int howto)
+{
+   struct ipmi_softc *sc = arg;
+   struct ipmi_request *req;
+
+   /*
+* Ignore everything except power cycling requests
+*/
+   if ((howto & RB_POWERCYCLE) == 0)
+   return;
+
+   device_printf(sc->ipmi_dev, "Power cycling using IPMI\n");
+
+   /*
+* Send a CHASSIS_CONTROL command to the CHASSIS device, subcommand 2
+* as described in IPMI v2.0 spec section 28.3.
+*/
+   IPMI_ALLOC_DRIVER_REQUEST(req, IPMI_ADDR(IPMI_CHASSIS_REQUEST, 0),
+   IPMI_CHASSIS_CONTROL, 1, 0);
+   req->ir_request[0] = IPMI_CC_POWER_CYCLE;
+
+   ipmi_submit_driver_request(sc, req, MAX_TIMEOUT);
+
+   if (req->ir_error != 0 || req->ir_compcode != 0) {
+   device_printf(sc->ipmi_dev, "Power cycling via IPMI failed code 
%#x %#x\n",
+   req->ir_error, req->ir_compcode);
+   return;
+   }
+
+   /*
+* BMCs are notoriously slow, give it up to 10s to effect the power
+* down leg of the power cycle. If that fails, fallback to the next
+* hanlder in the shutdown_final chain and/or the platform failsafe.
+*/
+   DELAY(10 * 1000 * 1000);
+   device_printf(sc->ipmi_dev, "Power cycling via IPMI timed out\n");
+}
+
+static void
 ipmi_startup(void *arg)
 {
struct ipmi_softc *sc = arg;
@@ -737,11 +777,13 @@ ipmi_startup(void *arg)
}
 
device_printf(dev, "IPMI device rev. %d, firmware rev. %d.%d%d, "
-   "version %d.%d\n",
-req->ir_reply[1] & 0x0f,
-req->ir_reply[2] & 0x7f, req->ir_reply[3] >> 4, req->ir_reply[3] & 
0x0f,
-req->ir_reply[4] & 0x0f, req->ir_reply[4] >> 4);
+   "version %d.%d, device support mask %#x\n",
+   req->ir_reply[1] & 0x0f,
+   req->ir_reply[2] & 0x7f, req->ir_reply[3] >> 4, req->ir_reply[3] & 
0x0f,
+   req->ir_reply[4] & 0x0f, req->ir_reply[4] >> 4, req->ir_reply[5]);
 
+   sc->ipmi_dev_support = req->ir_reply[5];
+
IPMI_INIT_DRIVER_REQUEST(req, IPMI_ADDR(IPMI_APP_REQUEST, 0),
IPMI_CLEAR_FLAGS, 1, 0);
 
@@ -792,6 +834,17 @@ ipmi_startup(void *arg)
return;
}
sc->ipmi_cdev->si_drv1 = sc;
+
+   /*
+* Power cycle the system off using IPMI. We use last - 1 since we don't
+* handle all the other kinds of reboots. We'll let others handle them.
+* We only try to do this if the BMC supports the Chassis device.
+*/
+   if (sc->ipmi_dev_support & IPMI_ADS_CHASSIS) {
+   device_printf(dev, "Establishing power 

svn commit: r324989 - head/sys/cam/ata

2017-10-25 Thread Warner Losh
Author: imp
Date: Wed Oct 25 15:30:48 2017
New Revision: 324989
URL: https://svnweb.freebsd.org/changeset/base/324989

Log:
  Handle RB_POWERCYCLE in ada driver
  
  Allow the disks to be spun down when doing a POWERCYCLE as well as
  POWEROFF.
  
  Sponsored by: Netflix

Modified:
  head/sys/cam/ata/ata_da.c

Modified: head/sys/cam/ata/ata_da.c
==
--- head/sys/cam/ata/ata_da.c   Wed Oct 25 15:30:44 2017(r324988)
+++ head/sys/cam/ata/ata_da.c   Wed Oct 25 15:30:48 2017(r324989)
@@ -3513,7 +3513,7 @@ adashutdown(void *arg, int howto)
 
adaflush();
if (ada_spindown_shutdown != 0 &&
-   (howto & (RB_HALT | RB_POWEROFF)) != 0)
+   (howto & (RB_HALT | RB_POWEROFF | RB_POWERCYCLE)) != 0)
adaspindown(ATA_STANDBY_IMMEDIATE, 0);
 }
 
___
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: r324982 - in head/sys/boot/arm: at91 at91/boot0 at91/boot0iic at91/boot0spi at91/boot2 at91/bootiic at91/bootspi at91/libat91 ixp425 ixp425/boot2

2017-10-25 Thread Warner Losh
Author: imp
Date: Wed Oct 25 15:28:05 2017
New Revision: 324982
URL: https://svnweb.freebsd.org/changeset/base/324982

Log:
  Remove sys/boot/arm/at91 and ixp425
  
  Remove at91 bootloader. It only worked on AT91RM9200, and only
  specific boards that were all EOLd 10 years ago.
  
  Remove ixp425. It doesn't build anymore and is for boards that were
  EOLd 8 years ago.
  
  Sponsored by: Netflix

Deleted:
  head/sys/boot/arm/at91/Makefile
  head/sys/boot/arm/at91/Makefile.inc
  head/sys/boot/arm/at91/boot0/Makefile
  head/sys/boot/arm/at91/boot0/README
  head/sys/boot/arm/at91/boot0/linker.cfg
  head/sys/boot/arm/at91/boot0/main.c
  head/sys/boot/arm/at91/boot0iic/Makefile
  head/sys/boot/arm/at91/boot0iic/main.c
  head/sys/boot/arm/at91/boot0spi/Makefile
  head/sys/boot/arm/at91/boot0spi/main.c
  head/sys/boot/arm/at91/boot2/Makefile
  head/sys/boot/arm/at91/boot2/board.h
  head/sys/boot/arm/at91/boot2/boot2.c
  head/sys/boot/arm/at91/boot2/bwct_board.c
  head/sys/boot/arm/at91/boot2/centipad_board.c
  head/sys/boot/arm/at91/boot2/kb920x_board.c
  head/sys/boot/arm/at91/bootiic/Makefile
  head/sys/boot/arm/at91/bootiic/README
  head/sys/boot/arm/at91/bootiic/env_vars.c
  head/sys/boot/arm/at91/bootiic/env_vars.h
  head/sys/boot/arm/at91/bootiic/loader_prompt.c
  head/sys/boot/arm/at91/bootiic/loader_prompt.h
  head/sys/boot/arm/at91/bootiic/main.c
  head/sys/boot/arm/at91/bootspi/Makefile
  head/sys/boot/arm/at91/bootspi/README
  head/sys/boot/arm/at91/bootspi/ee.c
  head/sys/boot/arm/at91/bootspi/ee.h
  head/sys/boot/arm/at91/bootspi/env_vars.c
  head/sys/boot/arm/at91/bootspi/env_vars.h
  head/sys/boot/arm/at91/bootspi/loader_prompt.c
  head/sys/boot/arm/at91/bootspi/loader_prompt.h
  head/sys/boot/arm/at91/bootspi/main.c
  head/sys/boot/arm/at91/libat91/Makefile
  head/sys/boot/arm/at91/libat91/arm_init.S
  head/sys/boot/arm/at91/libat91/at91rm9200.h
  head/sys/boot/arm/at91/libat91/at91rm9200_lowlevel.c
  head/sys/boot/arm/at91/libat91/at91rm9200_lowlevel.h
  head/sys/boot/arm/at91/libat91/delay.c
  head/sys/boot/arm/at91/libat91/eeprom.c
  head/sys/boot/arm/at91/libat91/emac.c
  head/sys/boot/arm/at91/libat91/emac.h
  head/sys/boot/arm/at91/libat91/emac_init.c
  head/sys/boot/arm/at91/libat91/getc.c
  head/sys/boot/arm/at91/libat91/lib.h
  head/sys/boot/arm/at91/libat91/lib_AT91RM9200.h
  head/sys/boot/arm/at91/libat91/mci_device.h
  head/sys/boot/arm/at91/libat91/memcmp.c
  head/sys/boot/arm/at91/libat91/memcpy.c
  head/sys/boot/arm/at91/libat91/memset.c
  head/sys/boot/arm/at91/libat91/p_string.c
  head/sys/boot/arm/at91/libat91/printf.c
  head/sys/boot/arm/at91/libat91/putchar.c
  head/sys/boot/arm/at91/libat91/reset.c
  head/sys/boot/arm/at91/libat91/sd-card.c
  head/sys/boot/arm/at91/libat91/sd-card.h
  head/sys/boot/arm/at91/libat91/spi_flash.c
  head/sys/boot/arm/at91/libat91/spi_flash.h
  head/sys/boot/arm/at91/libat91/strcmp.c
  head/sys/boot/arm/at91/libat91/strcpy.c
  head/sys/boot/arm/at91/libat91/strcvt.c
  head/sys/boot/arm/at91/libat91/strlen.c
  head/sys/boot/arm/at91/libat91/tag_list.c
  head/sys/boot/arm/at91/libat91/tag_list.h
  head/sys/boot/arm/at91/libat91/xmodem.c
  head/sys/boot/arm/at91/linker.cfg
  head/sys/boot/arm/ixp425/Makefile.inc
  head/sys/boot/arm/ixp425/boot2/Makefile
  head/sys/boot/arm/ixp425/boot2/arm_init.S
  head/sys/boot/arm/ixp425/boot2/boot2.c
  head/sys/boot/arm/ixp425/boot2/cf_ata.h
  head/sys/boot/arm/ixp425/boot2/ixp425_board.c
  head/sys/boot/arm/ixp425/boot2/lib.h
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r324981 - in head/sys/boot: . arm/uboot efi i386 mips/beri mips/beri/boot2 mips/uboot powerpc/boot1.chrp powerpc/kboot powerpc/ofw powerpc/ps3 powerpc/uboot sparc64

2017-10-25 Thread Warner Losh
Author: imp
Date: Wed Oct 25 15:27:58 2017
New Revision: 324981
URL: https://svnweb.freebsd.org/changeset/base/324981

Log:
  Move BINDIR definition to defs.mk, and override where it isn't /boot
  (those files already do that so weren't changed).
  
  Sponsored by: Netflix

Modified:
  head/sys/boot/arm/uboot/Makefile
  head/sys/boot/defs.mk
  head/sys/boot/efi/Makefile.inc
  head/sys/boot/i386/Makefile.inc
  head/sys/boot/mips/beri/Makefile.inc
  head/sys/boot/mips/beri/boot2/Makefile
  head/sys/boot/mips/uboot/Makefile
  head/sys/boot/powerpc/boot1.chrp/Makefile
  head/sys/boot/powerpc/kboot/Makefile
  head/sys/boot/powerpc/ofw/Makefile
  head/sys/boot/powerpc/ps3/Makefile
  head/sys/boot/powerpc/uboot/Makefile
  head/sys/boot/sparc64/Makefile.inc

Modified: head/sys/boot/arm/uboot/Makefile
==
--- head/sys/boot/arm/uboot/MakefileWed Oct 25 15:27:53 2017
(r324980)
+++ head/sys/boot/arm/uboot/MakefileWed Oct 25 15:27:58 2017
(r324981)
@@ -5,7 +5,6 @@
 FILES= ubldr ubldr.bin
 
 NEWVERSWHAT=   "U-Boot loader" ${MACHINE_ARCH}
-BINDIR?=   /boot
 INSTALLFLAGS=  -b
 WARNS?=1
 # Address at which ubldr will be loaded.

Modified: head/sys/boot/defs.mk
==
--- head/sys/boot/defs.mk   Wed Oct 25 15:27:53 2017(r324980)
+++ head/sys/boot/defs.mk   Wed Oct 25 15:27:58 2017(r324981)
@@ -15,6 +15,9 @@ UBOOTSRC= ${BOOTSRC}/uboot
 
 BOOTOBJ=   ${OBJTOP}/sys/boot
 
+# BINDIR is where we install
+BINDIR?=   /boot
+
 # NB: The makefiles depend on these being empty when we don't build forth.
 .if ${MK_FORTH} != "no"
 LIBFICL=   ${BOOTOBJ}/ficl/libficl.a

Modified: head/sys/boot/efi/Makefile.inc
==
--- head/sys/boot/efi/Makefile.inc  Wed Oct 25 15:27:53 2017
(r324980)
+++ head/sys/boot/efi/Makefile.inc  Wed Oct 25 15:27:58 2017
(r324981)
@@ -1,7 +1,5 @@
 # $FreeBSD$
 
-BINDIR?=   /boot
-
 .if ${MACHINE_CPUARCH} == "i386"
 CFLAGS+=-march=i386
 CFLAGS+=   -mno-aes

Modified: head/sys/boot/i386/Makefile.inc
==
--- head/sys/boot/i386/Makefile.inc Wed Oct 25 15:27:53 2017
(r324980)
+++ head/sys/boot/i386/Makefile.inc Wed Oct 25 15:27:58 2017
(r324981)
@@ -2,8 +2,6 @@
 #
 # $FreeBSD$
 
-BINDIR?=   /boot
-
 LOADER_ADDRESS?=0x20
 CFLAGS+=   -march=i386 -ffreestanding
 CFLAGS.gcc+=   -mpreferred-stack-boundary=2

Modified: head/sys/boot/mips/beri/Makefile.inc
==
--- head/sys/boot/mips/beri/Makefile.incWed Oct 25 15:27:53 2017
(r324980)
+++ head/sys/boot/mips/beri/Makefile.incWed Oct 25 15:27:58 2017
(r324981)
@@ -1,6 +1,5 @@
 # $FreeBSD$
 
-BINDIR?=   /boot
 CFLAGS+=   -ffreestanding
 LDFLAGS+=  -nostdlib
 

Modified: head/sys/boot/mips/beri/boot2/Makefile
==
--- head/sys/boot/mips/beri/boot2/Makefile  Wed Oct 25 15:27:53 2017
(r324980)
+++ head/sys/boot/mips/beri/boot2/Makefile  Wed Oct 25 15:27:58 2017
(r324981)
@@ -29,7 +29,6 @@
 #
 # $FreeBSD$
 
-BINDIR?=   /boot
 INSTALLFLAGS=  -b
 
 LOADERS=   flashboot jtagboot

Modified: head/sys/boot/mips/uboot/Makefile
==
--- head/sys/boot/mips/uboot/Makefile   Wed Oct 25 15:27:53 2017
(r324980)
+++ head/sys/boot/mips/uboot/Makefile   Wed Oct 25 15:27:58 2017
(r324981)
@@ -5,7 +5,6 @@
 FILES= ubldr
 
 NEWVERSWHAT=   "U-Boot loader" ${MACHINE_ARCH}
-BINDIR?=   /boot
 INSTALLFLAGS=  -b
 WARNS?=1
 # Address at which ubldr will be loaded.

Modified: head/sys/boot/powerpc/boot1.chrp/Makefile
==
--- head/sys/boot/powerpc/boot1.chrp/Makefile   Wed Oct 25 15:27:53 2017
(r324980)
+++ head/sys/boot/powerpc/boot1.chrp/Makefile   Wed Oct 25 15:27:58 2017
(r324981)
@@ -4,7 +4,6 @@ SSP_CFLAGS=
 
 PROG=   boot1.elf
 NEWVERSWHAT="Open Firmware boot block" ${MACHINE_ARCH}
-BINDIR?=/boot
 INSTALLFLAGS=   -b
 
 FILES= boot1.hfs

Modified: head/sys/boot/powerpc/kboot/Makefile
==
--- head/sys/boot/powerpc/kboot/MakefileWed Oct 25 15:27:53 2017
(r324980)
+++ head/sys/boot/powerpc/kboot/MakefileWed Oct 25 15:27:58 2017
(r324981)
@@ -6,7 +6,6 @@ MAN=
 
 PROG=  loader.kboot
 NEWVERSWHAT=   "kboot loader" ${MACHINE_ARCH}
-BINDIR?=   /boot
 INSTALLFLAGS=  -b
 
 # 

svn commit: r324988 - head/sys/kern

2017-10-25 Thread Warner Losh
Author: imp
Date: Wed Oct 25 15:30:44 2017
New Revision: 324988
URL: https://svnweb.freebsd.org/changeset/base/324988

Log:
  Handle RB_POWERCYCLE in the MI part of the kernel
  
  Signal init with SIGWINCH in shutdown_nice for RB_POWERCYCLE.
  
  Sponsored by: Netflix

Modified:
  head/sys/kern/kern_shutdown.c

Modified: head/sys/kern/kern_shutdown.c
==
--- head/sys/kern/kern_shutdown.c   Wed Oct 25 15:30:40 2017
(r324987)
+++ head/sys/kern/kern_shutdown.c   Wed Oct 25 15:30:44 2017
(r324988)
@@ -283,6 +283,8 @@ shutdown_nice(int howto)
PROC_LOCK(initproc);
if (howto & RB_POWEROFF)
kern_psignal(initproc, SIGUSR2);
+   else if (howto & RB_POWERCYCLE)
+   kern_psignal(initproc, SIGWINCH);
else if (howto & RB_HALT)
kern_psignal(initproc, SIGUSR1);
else
@@ -817,7 +819,7 @@ static void
 poweroff_wait(void *junk, int howto)
 {
 
-   if (!(howto & RB_POWEROFF) || poweroff_delay <= 0)
+   if ((howto & (RB_POWEROFF | RB_POWERCYCLE)) == 0 || poweroff_delay <= 0)
return;
DELAY(poweroff_delay * 1000);
 }
___
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: r324986 - head/sbin/reboot

2017-10-25 Thread Warner Losh
Author: imp
Date: Wed Oct 25 15:30:35 2017
New Revision: 324986
URL: https://svnweb.freebsd.org/changeset/base/324986

Log:
  Add power cycle support to reboot/halt as -c.
  
  When -c is specified, the system will be power cycled if the
  underlying hardware supports it. Otherwise the system will be halted
  or rebooted depending on which command was used.
  
  Sponsored by: Netflix

Modified:
  head/sbin/reboot/reboot.8
  head/sbin/reboot/reboot.c

Modified: head/sbin/reboot/reboot.8
==
--- head/sbin/reboot/reboot.8   Wed Oct 25 15:30:30 2017(r324985)
+++ head/sbin/reboot/reboot.8   Wed Oct 25 15:30:35 2017(r324986)
@@ -28,7 +28,7 @@
 .\"@(#)reboot.88.1 (Berkeley) 6/9/93
 .\" $FreeBSD$
 .\"
-.Dd March 19, 2017
+.Dd October 23, 2017
 .Dt REBOOT 8
 .Os
 .Sh NAME
@@ -42,7 +42,7 @@
 .Op Fl lNnpq
 .Op Fl k Ar kernel
 .Nm
-.Op Fl dlNnpqr
+.Op Fl cdlNnpqr
 .Op Fl k Ar kernel
 .Nm fasthalt
 .Op Fl lNnpq
@@ -66,6 +66,20 @@ accounting database.
 .Pp
 The options are as follows:
 .Bl -tag -width indent
+.It Fl c
+The system will turn off the power and then turn it back on if it can.
+If the power down action fails, the system
+will halt or reboot normally, depending on whether
+.Nm halt
+or
+.Nm
+was called.
+At the present time, only the
+.Xr ipmi 4
+driver implements the power cycle functionality and only on hardware
+with a BMC that supports power cycling.
+Unlike power off, the amount of hardware that supports power cycling
+is small.
 .It Fl d
 The system is requested to create a crash dump.
 This option is
@@ -162,6 +176,7 @@ reboot -r
 .Sh SEE ALSO
 .Xr kenv 1 ,
 .Xr getutxent 3 ,
+.Xr ipmi 4 ,
 .Xr boot 8 ,
 .Xr dumpon 8 ,
 .Xr nextboot 8 ,

Modified: head/sbin/reboot/reboot.c
==
--- head/sbin/reboot/reboot.c   Wed Oct 25 15:30:30 2017(r324985)
+++ head/sbin/reboot/reboot.c   Wed Oct 25 15:30:35 2017(r324986)
@@ -77,8 +77,11 @@ main(int argc, char *argv[])
} else
howto = 0;
lflag = nflag = qflag = Nflag = 0;
-   while ((ch = getopt(argc, argv, "dk:lNnpqr")) != -1)
+   while ((ch = getopt(argc, argv, "cdk:lNnpqr")) != -1)
switch(ch) {
+   case 'c':
+   howto |= RB_POWERCYCLE;
+   break;
case 'd':
howto |= RB_DUMP;
break;
@@ -116,8 +119,10 @@ main(int argc, char *argv[])
errx(1, "cannot dump (-d) when halting; must reboot instead");
if (Nflag && (howto & RB_NOSYNC) != 0)
errx(1, "-N cannot be used with -n");
+   if ((howto & RB_POWEROFF) && (howto & RB_POWERCYCLE))
+   errx(1, "-c and -p cannot be used together");
if ((howto & RB_REROOT) != 0 && howto != RB_REROOT)
-   errx(1, "-r cannot be used with -d, -n, or -p");
+   errx(1, "-r cannot be used with -c, -d, -n, or -p");
if (geteuid()) {
errno = EPERM;
err(1, NULL);
@@ -151,6 +156,12 @@ main(int argc, char *argv[])
} else if (howto & RB_REROOT) {
openlog("reroot", 0, LOG_AUTH | LOG_CONS);
syslog(LOG_CRIT, "rerooted by %s", user);
+   } else if (howto & RB_POWEROFF) {
+   openlog("reboot", 0, LOG_AUTH | LOG_CONS);
+   syslog(LOG_CRIT, "powered off by %s", user);
+   } else if (howto & RB_POWERCYCLE) {
+   openlog("reboot", 0, LOG_AUTH | LOG_CONS);
+   syslog(LOG_CRIT, "power cycled by %s", user);
} else {
openlog("reboot", 0, LOG_AUTH | LOG_CONS);
syslog(LOG_CRIT, "rebooted by %s", user);
___
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: r324983 - in head: lib/libc/sys sys/sys

2017-10-25 Thread Warner Losh
Author: imp
Date: Wed Oct 25 15:30:20 2017
New Revision: 324983
URL: https://svnweb.freebsd.org/changeset/base/324983

Log:
  Define RB_POWERCYCLE
  
  RB_POWERCYCLE instructs the platform to power off and then power back
  on a short time later, if that's possible. Otherwise, degrade to the
  RB_POWEROFF behavior.
  
  Sponsored by: Netflix

Modified:
  head/lib/libc/sys/reboot.2
  head/sys/sys/reboot.h

Modified: head/lib/libc/sys/reboot.2
==
--- head/lib/libc/sys/reboot.2  Wed Oct 25 15:28:05 2017(r324982)
+++ head/lib/libc/sys/reboot.2  Wed Oct 25 15:30:20 2017(r324983)
@@ -28,7 +28,7 @@
 .\" @(#)reboot.2   8.1 (Berkeley) 6/4/93
 .\" $FreeBSD$
 .\"
-.Dd September 18, 2015
+.Dd October 24, 2017
 .Dt REBOOT 2
 .Os
 .Sh NAME
@@ -84,6 +84,14 @@ for more information.
 .It Dv RB_HALT
 The processor is simply halted; no reboot takes place.
 This option should be used with caution.
+.It Dv RB_POWERCYCLE
+After halting, the shutdown code will do what it can to turn
+off the power and then turn the power back on.
+This requires hardware support, usually an auxiliary microprocessor
+that can sequence the power supply.
+At present only the
+.Xr ipmi 4
+driver implements this feature.
 .It Dv RB_POWEROFF
 After halting, the shutdown code will do what it can to turn
 off the power.

Modified: head/sys/sys/reboot.h
==
--- head/sys/sys/reboot.h   Wed Oct 25 15:28:05 2017(r324982)
+++ head/sys/sys/reboot.h   Wed Oct 25 15:30:20 2017(r324983)
@@ -60,6 +60,7 @@
 #defineRB_RESERVED20x8 /* reserved for internal use of boot 
blocks */
 #defineRB_PAUSE0x10 /* pause after each output line during 
probe */
 #defineRB_REROOT   0x20 /* unmount the rootfs and mount it 
again */
+#defineRB_POWERCYCLE   0x40 /* Power cycle if possible */
 #defineRB_MULTIPLE 0x2000  /* use multiple consoles */
 
 #defineRB_BOOTINFO 0x8000  /* have `struct bootinfo *' arg 
*/
___
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: r324977 - head/sbin/nvmecontrol

2017-10-25 Thread Warner Losh
Author: imp
Date: Wed Oct 25 15:25:55 2017
New Revision: 324977
URL: https://svnweb.freebsd.org/changeset/base/324977

Log:
  Add nvme_controller_data argument to all print functions.
  
  It's desirable to access controler data to inform printing log pages
  (such as limiting the printing to valid ranges).
  
  Sponsored by: Netflix

Modified:
  head/sbin/nvmecontrol/logpage.c

Modified: head/sbin/nvmecontrol/logpage.c
==
--- head/sbin/nvmecontrol/logpage.c Wed Oct 25 15:18:09 2017
(r324976)
+++ head/sbin/nvmecontrol/logpage.c Wed Oct 25 15:25:55 2017
(r324977)
@@ -53,7 +53,7 @@ __FBSDID("$FreeBSD$");
 #define DEFAULT_SIZE   (4096)
 #define MAX_FW_SLOTS   (7)
 
-typedef void (*print_fn_t)(void *buf, uint32_t size);
+typedef void (*print_fn_t)(const struct nvme_controller_data *cdata, void 
*buf, uint32_t size);
 
 struct kv_name
 {
@@ -75,8 +75,16 @@ kv_lookup(const struct kv_name *kv, size_t kv_count, u
 }
 
 static void
-print_bin(void *data, uint32_t length)
+print_log_hex(const struct nvme_controller_data *cdata __unused, void *data, 
uint32_t length)
 {
+
+   print_hex(data, length);
+}
+
+static void
+print_bin(const struct nvme_controller_data *cdata __unused, void *data, 
uint32_t length)
+{
+
write(STDOUT_FILENO, data, length);
 }
 
@@ -115,7 +123,7 @@ read_logpage(int fd, uint8_t log_page, int nsid, void 
 }
 
 static void
-print_log_error(void *buf, uint32_t size)
+print_log_error(const struct nvme_controller_data *cdata __unused, void *buf, 
uint32_t size)
 {
int i, nentries;
struct nvme_error_information_entry *entry = buf;
@@ -162,7 +170,7 @@ print_temp(uint16_t t)
 
 
 static void
-print_log_health(void *buf, uint32_t size __unused)
+print_log_health(const struct nvme_controller_data *cdata __unused, void *buf, 
uint32_t size __unused)
 {
struct nvme_health_information_page *health = buf;
char cbuf[UINT128_DIG + 1];
@@ -224,7 +232,7 @@ print_log_health(void *buf, uint32_t size __unused)
 }
 
 static void
-print_log_firmware(void *buf, uint32_t size __unused)
+print_log_firmware(const struct nvme_controller_data *cdata __unused, void 
*buf, uint32_t size __unused)
 {
int i;
const char  *status;
@@ -260,7 +268,7 @@ print_log_firmware(void *buf, uint32_t size __unused)
  * offset 147: it is only 1 byte, not 6.
  */
 static void
-print_intel_temp_stats(void *buf, uint32_t size __unused)
+print_intel_temp_stats(const struct nvme_controller_data *cdata __unused, void 
*buf, uint32_t size __unused)
 {
struct intel_log_temp_stats *temp = buf;
 
@@ -287,7 +295,7 @@ print_intel_temp_stats(void *buf, uint32_t size __unus
  * Read and write stats pages have identical encoding.
  */
 static void
-print_intel_read_write_lat_log(void *buf, uint32_t size __unused)
+print_intel_read_write_lat_log(const struct nvme_controller_data *cdata 
__unused, void *buf, uint32_t size __unused)
 {
const char *walker = buf;
int i;
@@ -303,28 +311,28 @@ print_intel_read_write_lat_log(void *buf, uint32_t siz
 }
 
 static void
-print_intel_read_lat_log(void *buf, uint32_t size)
+print_intel_read_lat_log(const struct nvme_controller_data *cdata __unused, 
void *buf, uint32_t size)
 {
 
printf("Intel Read Latency Log\n");
printf("==\n");
-   print_intel_read_write_lat_log(buf, size);
+   print_intel_read_write_lat_log(cdata, buf, size);
 }
 
 static void
-print_intel_write_lat_log(void *buf, uint32_t size)
+print_intel_write_lat_log(const struct nvme_controller_data *cdata __unused, 
void *buf, uint32_t size)
 {
 
printf("Intel Write Latency Log\n");
printf("===\n");
-   print_intel_read_write_lat_log(buf, size);
+   print_intel_read_write_lat_log(cdata, buf, size);
 }
 
 /*
  * Table 19. 5.4 SMART Attributes. Samsung also implements this and some extra 
data not documented.
  */
 static void
-print_intel_add_smart(void *buf, uint32_t size __unused)
+print_intel_add_smart(const struct nvme_controller_data *cdata __unused, void 
*buf, uint32_t size __unused)
 {
uint8_t *walker = buf;
uint8_t *end = walker + 150;
@@ -753,7 +761,7 @@ kv_indirect(void *buf, uint32_t subtype, uint8_t res, 
 }
 
 static void
-print_hgst_info_log(void *buf, uint32_t size __unused)
+print_hgst_info_log(const struct nvme_controller_data *cdata __unused, void 
*buf, uint32_t size __unused)
 {
uint8_t *walker, *end, *subpage;
int pages;
@@ -928,7 +936,7 @@ logpage(int argc, char *argv[])
"smart/health information");
}
 
-   print_fn = print_hex;
+   print_fn = print_log_hex;
size = DEFAULT_SIZE;
if (binflag)
print_fn = print_bin;
@@ -960,7 +968,7 @@ logpage(int argc, char *argv[])

svn commit: r324979 - head/tools/boot

2017-10-25 Thread Warner Losh
Author: imp
Date: Wed Oct 25 15:27:48 2017
New Revision: 324979
URL: https://svnweb.freebsd.org/changeset/base/324979

Log:
  Do a chdir to SRCTOP/sys/boot before starting the run. This lets one
  run this script from anywhere, but makes it only work on sys/boot.
  
  Sponsored by: Netflix

Modified:
  head/tools/boot/universe.sh

Modified: head/tools/boot/universe.sh
==
--- head/tools/boot/universe.sh Wed Oct 25 15:26:03 2017(r324978)
+++ head/tools/boot/universe.sh Wed Oct 25 15:27:48 2017(r324979)
@@ -19,6 +19,9 @@
 # Output is put into _.boot.$TARGET_ARCH.log in sys.boot.
 #
 
+top=$(make -V SRCTOP)
+cd $top/sys/boot
+
 for i in \
amd64/amd64 \
arm/arm arm/armeb arm/armv7 \
___
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: r324980 - head/sys/boot/arm/uboot

2017-10-25 Thread Warner Losh
Author: imp
Date: Wed Oct 25 15:27:53 2017
New Revision: 324980
URL: https://svnweb.freebsd.org/changeset/base/324980

Log:
  Use BOOTDIR consistently. We need to include bsd.init.mk early to make
  this happen. This will cause src.opts.mk to be included, so remove
  that. This needs to propigate through the sys/boot tree.
  
  Sponsored by: Netflix

Modified:
  head/sys/boot/arm/uboot/Makefile

Modified: head/sys/boot/arm/uboot/Makefile
==
--- head/sys/boot/arm/uboot/MakefileWed Oct 25 15:27:48 2017
(r324979)
+++ head/sys/boot/arm/uboot/MakefileWed Oct 25 15:27:53 2017
(r324980)
@@ -1,6 +1,6 @@
 # $FreeBSD$
 
-.include 
+.include 
 
 FILES= ubldr ubldr.bin
 
@@ -31,7 +31,7 @@ LOADER_BZIP2_SUPPORT?=no
 LOADER_FDT_SUPPORT=${MK_FDT}
 
 # Always add MI sources
-.include   "../../loader.mk"
+.include   "${BOOTSRC}/loader.mk"
 CFLAGS+=   -I.
 
 CLEANFILES+=   loader.help
@@ -42,7 +42,7 @@ LDFLAGS=  -nostdlib -static -T ${.CURDIR}/ldscript.${MA
 LDFLAGS+=  -Wl,-znotext
 
 # Pull in common loader code
-.include   "../../uboot.mk"
+.include   "${BOOTSRC}/uboot.mk"
 
 CFLAGS+=   -fPIC
 
@@ -51,7 +51,7 @@ LDADD=${LIBFICL} ${LIBUBOOT} ${LIBFDT} 
${LIBUBOOT_FD
 
 OBJS+=  ${SRCS:N*.h:R:S/$/.o/g}
 
-loader.help: help.common help.uboot ${.CURDIR}/../../fdt/help.fdt
+loader.help: help.common help.uboot ${BOOTSRC}/fdt/help.fdt
cat ${.ALLSRC} | \
awk -f ${LDRSRC}/merge_help.awk > ${.TARGET}
 
@@ -75,8 +75,8 @@ ubldr.bin: ubldr.pie
 CLEANFILES+=   ldscript.abs ldscript.pie ubldr ubldr.pie ubldr.bin
 
 .if !defined(LOADER_ONLY)
-.PATH: ${.CURDIR}/../../forth
-.include   "${.CURDIR}/../../forth/Makefile.inc"
+.PATH: ${BOOTSRC}/forth
+.include   "${BOOTSRC}/forth/Makefile.inc"
 
 # Install loader.rc.
 FILES+=loader.rc
___
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: r324978 - head/sbin/nvmecontrol

2017-10-25 Thread Warner Losh
Author: imp
Date: Wed Oct 25 15:26:03 2017
New Revision: 324978
URL: https://svnweb.freebsd.org/changeset/base/324978

Log:
  Report only the valid slots in the firmware log page.
  
  Printing the entire log page is causing confusion over available
  slots. Report only those slots that are valid. In the case where the
  firmware download isn't supported, assume that only the first slot is
  valid (I have no hardware to test this assumption though)
  
  Sponsored by: Netflix

Modified:
  head/sbin/nvmecontrol/logpage.c

Modified: head/sbin/nvmecontrol/logpage.c
==
--- head/sbin/nvmecontrol/logpage.c Wed Oct 25 15:25:55 2017
(r324977)
+++ head/sbin/nvmecontrol/logpage.c Wed Oct 25 15:26:03 2017
(r324978)
@@ -234,14 +234,19 @@ print_log_health(const struct nvme_controller_data *cd
 static void
 print_log_firmware(const struct nvme_controller_data *cdata __unused, void 
*buf, uint32_t size __unused)
 {
-   int i;
+   int i, slots;
const char  *status;
struct nvme_firmware_page   *fw = buf;
 
printf("Firmware Slot Log\n");
printf("=\n");
 
-   for (i = 0; i < MAX_FW_SLOTS; i++) {
+   if (cdata->oacs.firmware == 0)
+   slots = 1;
+   else
+   slots = MIN(cdata->frmw.num_slots, MAX_FW_SLOTS);
+
+   for (i = 0; i < slots; i++) {
printf("Slot %d: ", i + 1);
if (fw->afi.slot == i + 1)
status = "  Active";
___
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: r324971 - head/sys/netinet

2017-10-25 Thread Rodney W. Grimes
[ Charset UTF-8 unsupported, converting... ]
> Author: tuexen
> Date: Wed Oct 25 09:12:22 2017
> New Revision: 324971
> URL: https://svnweb.freebsd.org/changeset/base/324971
> 
> Log:
>   Fix a bug reported by Felix Weinrank using the libfuzzer on the
>   userland stack.

Please try to say what the bug was, why it was a bug, and
how it was fixed in any bug commit message.

External vague references are of little value when reading
through a files svn history.

Thanks,
>   
>   MFC after:  3 days
> 
> Modified:
>   head/sys/netinet/sctp_auth.c
> 
> Modified: head/sys/netinet/sctp_auth.c
> ==
> --- head/sys/netinet/sctp_auth.c  Wed Oct 25 05:55:13 2017
> (r324970)
> +++ head/sys/netinet/sctp_auth.c  Wed Oct 25 09:12:22 2017
> (r324971)
> @@ -1606,9 +1606,9 @@ sctp_zero_m(struct mbuf *m, uint32_t m_offset, uint32_
>   /* now use the rest of the mbuf chain */
>   while ((m_tmp != NULL) && (size > 0)) {
>   data = mtod(m_tmp, uint8_t *)+m_offset;
> - if (size > (uint32_t)SCTP_BUF_LEN(m_tmp)) {
> - memset(data, 0, SCTP_BUF_LEN(m_tmp));
> - size -= SCTP_BUF_LEN(m_tmp);
> + if (size > (uint32_t)(SCTP_BUF_LEN(m_tmp) - m_offset)) {
> + memset(data, 0, SCTP_BUF_LEN(m_tmp) - m_offset);
> + size -= SCTP_BUF_LEN(m_tmp) - m_offset;
>   } else {
>   memset(data, 0, size);
>   size = 0;
> 
> 

-- 
Rod Grimes rgri...@freebsd.org
___
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: r324972 - head/usr.bin/top

2017-10-25 Thread Konstantin Belousov
Author: kib
Date: Wed Oct 25 11:44:46 2017
New Revision: 324972
URL: https://svnweb.freebsd.org/changeset/base/324972

Log:
  Limit top display of total swap size by the max swap size system can
  handle.
  
  Keep both pagesize and the new swap_maxpages in the static variables
  to save sysctl calls.
  
  Submitted by: o...@j.email.ne.jp
  PR:   223149
  MFC after:2 weeks

Modified:
  head/usr.bin/top/machine.c

Modified: head/usr.bin/top/machine.c
==
--- head/usr.bin/top/machine.c  Wed Oct 25 09:12:22 2017(r324971)
+++ head/usr.bin/top/machine.c  Wed Oct 25 11:44:46 2017(r324972)
@@ -1671,8 +1671,9 @@ static int
 swapmode(int *retavail, int *retfree)
 {
int n;
-   int pagesize = getpagesize();
struct kvm_swap swapary[1];
+   static int pagesize = 0;
+   static u_long swap_maxpages = 0;
 
*retavail = 0;
*retfree = 0;
@@ -1682,6 +1683,16 @@ swapmode(int *retavail, int *retfree)
n = kvm_getswapinfo(kd, swapary, 1, 0);
if (n < 0 || swapary[0].ksw_total == 0)
return (0);
+
+   if (pagesize == 0)
+   pagesize = getpagesize();
+   if (swap_maxpages == 0)
+   GETSYSCTL("vm.swap_maxpages", swap_maxpages);
+
+   /* ksw_total contains the total size of swap all devices which may
+  exceed the maximum swap size allocatable in the system */
+   if ( swapary[0].ksw_total > swap_maxpages )
+   swapary[0].ksw_total = swap_maxpages;
 
*retavail = CONVERT(swapary[0].ksw_total);
*retfree = CONVERT(swapary[0].ksw_total - swapary[0].ksw_used);
___
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: r324971 - head/sys/netinet

2017-10-25 Thread Michael Tuexen
Author: tuexen
Date: Wed Oct 25 09:12:22 2017
New Revision: 324971
URL: https://svnweb.freebsd.org/changeset/base/324971

Log:
  Fix a bug reported by Felix Weinrank using the libfuzzer on the
  userland stack.
  
  MFC after:3 days

Modified:
  head/sys/netinet/sctp_auth.c

Modified: head/sys/netinet/sctp_auth.c
==
--- head/sys/netinet/sctp_auth.cWed Oct 25 05:55:13 2017
(r324970)
+++ head/sys/netinet/sctp_auth.cWed Oct 25 09:12:22 2017
(r324971)
@@ -1606,9 +1606,9 @@ sctp_zero_m(struct mbuf *m, uint32_t m_offset, uint32_
/* now use the rest of the mbuf chain */
while ((m_tmp != NULL) && (size > 0)) {
data = mtod(m_tmp, uint8_t *)+m_offset;
-   if (size > (uint32_t)SCTP_BUF_LEN(m_tmp)) {
-   memset(data, 0, SCTP_BUF_LEN(m_tmp));
-   size -= SCTP_BUF_LEN(m_tmp);
+   if (size > (uint32_t)(SCTP_BUF_LEN(m_tmp) - m_offset)) {
+   memset(data, 0, SCTP_BUF_LEN(m_tmp) - m_offset);
+   size -= SCTP_BUF_LEN(m_tmp) - m_offset;
} else {
memset(data, 0, size);
size = 0;
___
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"