svn commit: r339906 - in stable/12/sys: conf dev/netmap net

2018-10-30 Thread Vincenzo Maffione
Author: vmaffione
Date: Tue Oct 30 08:36:36 2018
New Revision: 339906
URL: https://svnweb.freebsd.org/changeset/base/339906

Log:
  MFC r339639:
  
  netmap: align codebase to the current upstream (sha 8374e1a7e6941)
  
  Changelist:
  - Move large parts of VALE code to a new file and header netmap_bdg.[ch].
This is useful to reuse the code within upcoming projects.
  - Improvements and bug fixes to pipes and monitors.
  - Introduce nm_os_onattach(), nm_os_onenter() and nm_os_onexit() to
handle differences between FreeBSD and Linux.
  - Introduce some new helper functions to handle more host rings and fake
rings (netmap_all_rings(), netmap_real_rings(), ...)
  - Added new sysctl to enable/disable hw checksum in emulated netmap mode.
  - nm_inject: add support for NS_MOREFRAG
  
  Approved by: re (gjb)

Added:
  stable/12/sys/dev/netmap/netmap_bdg.c
 - copied unchanged from r339639, head/sys/dev/netmap/netmap_bdg.c
  stable/12/sys/dev/netmap/netmap_bdg.h
 - copied unchanged from r339639, head/sys/dev/netmap/netmap_bdg.h
Modified:
  stable/12/sys/conf/files
  stable/12/sys/dev/netmap/netmap.c
  stable/12/sys/dev/netmap/netmap_freebsd.c
  stable/12/sys/dev/netmap/netmap_generic.c
  stable/12/sys/dev/netmap/netmap_kern.h
  stable/12/sys/dev/netmap/netmap_mem2.c
  stable/12/sys/dev/netmap/netmap_monitor.c
  stable/12/sys/dev/netmap/netmap_pipe.c
  stable/12/sys/dev/netmap/netmap_vale.c
  stable/12/sys/net/netmap.h
  stable/12/sys/net/netmap_user.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/conf/files
==
--- stable/12/sys/conf/filesTue Oct 30 05:04:18 2018(r339905)
+++ stable/12/sys/conf/filesTue Oct 30 08:36:36 2018(r339906)
@@ -2544,6 +2544,7 @@ dev/netmap/netmap_pipe.c  optional netmap
 dev/netmap/netmap_pt.c optional netmap
 dev/netmap/netmap_vale.c   optional netmap
 dev/netmap/netmap_legacy.c optional netmap
+dev/netmap/netmap_bdg.coptional netmap
 # compile-with "${NORMAL_C} -Wconversion -Wextra"
 dev/nfsmb/nfsmb.c  optional nfsmb pci
 dev/nge/if_nge.c   optional nge

Modified: stable/12/sys/dev/netmap/netmap.c
==
--- stable/12/sys/dev/netmap/netmap.c   Tue Oct 30 05:04:18 2018
(r339905)
+++ stable/12/sys/dev/netmap/netmap.c   Tue Oct 30 08:36:36 2018
(r339906)
@@ -521,6 +521,9 @@ int netmap_generic_txqdisc = 1;
 int netmap_generic_ringsize = 1024;
 int netmap_generic_rings = 1;
 
+/* Non-zero to enable checksum offloading in NIC drivers */
+int netmap_generic_hwcsum = 0;
+
 /* Non-zero if ptnet devices are allowed to use virtio-net headers. */
 int ptnet_vnet_hdr = 1;
 
@@ -549,6 +552,9 @@ SYSCTL_INT(_dev_netmap, OID_AUTO, fwd, CTLFLAG_RW, &ne
 SYSCTL_INT(_dev_netmap, OID_AUTO, admode, CTLFLAG_RW, &netmap_admode, 0,
"Adapter mode. 0 selects the best option available,"
"1 forces native adapter, 2 forces emulated adapter");
+SYSCTL_INT(_dev_netmap, OID_AUTO, generic_hwcsum, CTLFLAG_RW, 
&netmap_generic_hwcsum,
+   0, "Hardware checksums. 0 to disable checksum generation by the 
NIC (default),"
+   "1 to enable checksum generation by the NIC");
 SYSCTL_INT(_dev_netmap, OID_AUTO, generic_mit, CTLFLAG_RW, &netmap_generic_mit,
0, "RX notification interval in nanoseconds");
 SYSCTL_INT(_dev_netmap, OID_AUTO, generic_ringsize, CTLFLAG_RW,
@@ -827,8 +833,8 @@ netmap_krings_create(struct netmap_adapter *na, u_int 
}
 
/* account for the (possibly fake) host rings */
-   n[NR_TX] = na->num_tx_rings + 1;
-   n[NR_RX] = na->num_rx_rings + 1;
+   n[NR_TX] = netmap_all_rings(na, NR_TX);
+   n[NR_RX] = netmap_all_rings(na, NR_RX);
 
len = (n[NR_TX] + n[NR_RX]) *
(sizeof(struct netmap_kring) + sizeof(struct netmap_kring *))
@@ -930,11 +936,14 @@ netmap_krings_delete(struct netmap_adapter *na)
 void
 netmap_hw_krings_delete(struct netmap_adapter *na)
 {
-   struct mbq *q = &na->rx_rings[na->num_rx_rings]->rx_queue;
+   u_int lim = netmap_real_rings(na, NR_RX), i;
 
-   ND("destroy sw mbq with len %d", mbq_len(q));
-   mbq_purge(q);
-   mbq_safe_fini(q);
+   for (i = nma_get_nrings(na, NR_RX); i < lim; i++) {
+   struct mbq *q = &NMR(na, NR_RX)[i]->rx_queue;
+   ND("destroy sw mbq with len %d", mbq_len(q));
+   mbq_purge(q);
+   mbq_safe_fini(q);
+   }
netmap_krings_delete(na);
 }
 
@@ -1535,7 +1544,7 @@ netmap_get_na(struct nmreq_header *hdr,
goto out;
 
/* try to see if this is a bridge port */
-   error = netmap_get_bdg_na(hdr, na, nmd, create);
+   error = netmap_get_vale_na(hdr, na, nmd, create);
if (error)
goto out;
 
@@ 

svn commit: r339907 - head/lib/csu/tests

2018-10-30 Thread Andrew Turner
Author: andrew
Date: Tue Oct 30 09:36:31 2018
New Revision: 339907
URL: https://svnweb.freebsd.org/changeset/base/339907

Log:
  The jcr argument to _Jv_RegisterClasses is used, stop marking it otherwise.
  
  MFC with: r339738
  Sponsored by: DARPA, AFRL

Modified:
  head/lib/csu/tests/init_test.c

Modified: head/lib/csu/tests/init_test.c
==
--- head/lib/csu/tests/init_test.c  Tue Oct 30 08:36:36 2018
(r339906)
+++ head/lib/csu/tests/init_test.c  Tue Oct 30 09:36:31 2018
(r339907)
@@ -51,7 +51,7 @@ void _Jv_RegisterClasses(const func_ptr *);
 __section(".jcr") __used static func_ptr jcr_func = (func_ptr)1;
 
 void
-_Jv_RegisterClasses(const func_ptr *jcr __unused)
+_Jv_RegisterClasses(const func_ptr *jcr)
 {
 
jcr_run = 1;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r339908 - in head: etc/mtree lib/csu/tests lib/csu/tests/dso lib/csu/tests/dynamiclib

2018-10-30 Thread Andrew Turner
Author: andrew
Date: Tue Oct 30 09:43:26 2018
New Revision: 339908
URL: https://svnweb.freebsd.org/changeset/base/339908

Log:
  Run the csu tests on a DSO. This builds the tests into a shared library,
  then runs these from the base test programs. With this we can check
  crtbeginS.o and crtendS.o are working as expected.
  
  MFC with: r339738
  Sponsored by: DARPA, AFRL

Added:
  head/lib/csu/tests/dso/
  head/lib/csu/tests/dso/Makefile   (contents, props changed)
  head/lib/csu/tests/dynamiclib/
  head/lib/csu/tests/dynamiclib/Makefile   (contents, props changed)
Modified:
  head/etc/mtree/BSD.tests.dist
  head/lib/csu/tests/Makefile
  head/lib/csu/tests/cxx_constructors.cc
  head/lib/csu/tests/fini_test.c
  head/lib/csu/tests/init_test.c

Modified: head/etc/mtree/BSD.tests.dist
==
--- head/etc/mtree/BSD.tests.dist   Tue Oct 30 09:36:31 2018
(r339907)
+++ head/etc/mtree/BSD.tests.dist   Tue Oct 30 09:43:26 2018
(r339908)
@@ -273,6 +273,8 @@
 csu
 dynamic
 ..
+dynamiclib
+..
 static
 ..
 ..

Modified: head/lib/csu/tests/Makefile
==
--- head/lib/csu/tests/Makefile Tue Oct 30 09:36:31 2018(r339907)
+++ head/lib/csu/tests/Makefile Tue Oct 30 09:43:26 2018(r339908)
@@ -1,6 +1,8 @@
 # $FreeBSD$
 
+SUBDIR=dso
 TESTS_SUBDIRS= dynamic
+TESTS_SUBDIRS+=dynamiclib
 TESTS_SUBDIRS+=static
 
 .include 

Modified: head/lib/csu/tests/cxx_constructors.cc
==
--- head/lib/csu/tests/cxx_constructors.cc  Tue Oct 30 09:36:31 2018
(r339907)
+++ head/lib/csu/tests/cxx_constructors.cc  Tue Oct 30 09:43:26 2018
(r339908)
@@ -39,10 +39,18 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#ifndef DSO_LIB
 #include 
+#endif
 
-static volatile int constructor_run;
-static bool run_destructor_test = false;
+extern volatile int constructor_run;
+extern bool run_destructor_test;
+
+#ifndef DSO_BASE
+volatile int constructor_run;
+bool run_destructor_test = false;
+#endif
+
 struct Foo {
Foo() {
constructor_run = 1;
@@ -53,8 +61,12 @@ struct Foo {
}
 };
 extern Foo foo;
+
+#ifndef DSO_BASE
 Foo foo;
+#endif
 
+#ifndef DSO_LIB
 ATF_TEST_CASE_WITHOUT_HEAD(cxx_constructor);
 ATF_TEST_CASE_BODY(cxx_constructor)
 {
@@ -90,3 +102,4 @@ ATF_INIT_TEST_CASES(tcs)
ATF_ADD_TEST_CASE(tcs, cxx_constructor);
ATF_ADD_TEST_CASE(tcs, cxx_destructor);
 }
+#endif

Added: head/lib/csu/tests/dso/Makefile
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/lib/csu/tests/dso/Makefile Tue Oct 30 09:43:26 2018
(r339908)
@@ -0,0 +1,25 @@
+# $FreeBSD$
+
+.PATH: ${.CURDIR:H}
+SHLIB= h_csu
+SHLIB_NAME=libh_csu.so
+SHLIB_MAJOR=   1
+
+WITHOUT_STATIC=
+WITHOUT_PROFILE=
+WITHOUT_PIC=
+
+CFLAGS+=   -DDSO_LIB
+
+.include "../Makefile.tests"
+SRCS=
+.for src in ${ATF_TESTS_C}
+SRCS+= ${src}.c
+.endfor
+.for src in ${ATF_TESTS_CXX}
+SRCS+= ${src}.cc
+.endfor
+
+LIBDIR=${TESTSBASE}/lib/csu/dynamiclib/
+
+.include 

Added: head/lib/csu/tests/dynamiclib/Makefile
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/lib/csu/tests/dynamiclib/Makefile  Tue Oct 30 09:43:26 2018
(r339908)
@@ -0,0 +1,17 @@
+# $FreeBSD$
+
+.PATH: ${.CURDIR:H}
+CFLAGS+=   -DDSO_BASE
+DPADD+=${.OBJDIR:H}/dso/libh_csu.so
+LDFLAGS+=  -Wl,-rpath,${TESTSDIR} -L${.OBJDIR:H}/dso
+LDADD+=-lh_csu
+
+.include "../Makefile.tests"
+
+.for test in ${ATF_TESTS_C}
+ATF_TESTS_CXX+=${test}
+SRCS.${test}=  ${test}.c
+.endfor
+ATF_TESTS_C:=
+
+.include 

Modified: head/lib/csu/tests/fini_test.c
==
--- head/lib/csu/tests/fini_test.c  Tue Oct 30 09:36:31 2018
(r339907)
+++ head/lib/csu/tests/fini_test.c  Tue Oct 30 09:43:26 2018
(r339908)
@@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$");
 #include 
 
 #include 
+#include 
 #include 
 #include 
 
@@ -43,10 +44,16 @@ __FBSDID("$FreeBSD$");
 
 #include 
 
+extern bool run_dtors_test;
+extern bool run_fini_array_test;
+void dso_handle_check(void);
+
+
+#ifndef DSO_BASE
 typedef void (*func_ptr)(void);
 
-static bool run_dtors_test = false;
-static bool run_fini_array_test = false;
+bool run_dtors_test = false;
+bool run_fini_array_test = false;
 
 static void
 dtors_handler(void)
@@ -57,7 +64,9 @@ dtors_handler(void)
 }
 __section(".dtors") __used static func_ptr dtors_func =
 &dtors_handler;
+#endif
 
+#ifndef DSO_LIB

svn commit: r339909 - head/sys/net

2018-10-30 Thread Marcelo Araujo
Author: araujo
Date: Tue Oct 30 09:53:57 2018
New Revision: 339909
URL: https://svnweb.freebsd.org/changeset/base/339909

Log:
  Allow changing lagg(4) MTU.
  
  Previously, changing the MTU would require destroying the lagg and
  creating a new one. Now it is allowed to change the MTU of
  the lagg interface and the MTU of the ports will be set to match.
  
  If any port cannot set the new MTU, all ports are reverted to the original
  MTU of the lagg. Additionally, when adding ports, the MTU of a port will be
  automatically set to the MTU of the lagg. As always, the MTU of the lagg is
  initially determined by the MTU of the first port added. If adding an
  interface as a port for some reason fails, that interface is reverted to its
  original MTU.
  
  Submitted by: Ryan Moeller 
  Reviewed by:  mav
  Relnotes: Yes
  Sponsored by: iXsystems Inc.
  Differential Revision:https://reviews.freebsd.org/D17576

Modified:
  head/sys/net/if_lagg.c

Modified: head/sys/net/if_lagg.c
==
--- head/sys/net/if_lagg.c  Tue Oct 30 09:43:26 2018(r339908)
+++ head/sys/net/if_lagg.c  Tue Oct 30 09:53:57 2018(r339909)
@@ -633,11 +633,18 @@ lagg_port_create(struct lagg_softc *sc, struct ifnet *
 {
struct lagg_softc *sc_ptr;
struct lagg_port *lp, *tlp;
-   int error, i;
+   struct ifreq ifr;
+   int error, i, oldmtu;
uint64_t *pval;
 
LAGG_XLOCK_ASSERT(sc);
 
+   if (sc->sc_ifp == ifp) {
+   if_printf(sc->sc_ifp,
+   "cannot add a lagg to itself as a port\n");
+   return (EINVAL);
+   }
+
/* Limit the maximal number of lagg ports */
if (sc->sc_count >= LAGG_MAX_PORTS)
return (ENOSPC);
@@ -656,12 +663,25 @@ lagg_port_create(struct lagg_softc *sc, struct ifnet *
return (EPROTONOSUPPORT);
 
/* Allow the first Ethernet member to define the MTU */
-   if (CK_SLIST_EMPTY(&sc->sc_ports))
+   oldmtu = -1;
+   if (CK_SLIST_EMPTY(&sc->sc_ports)) {
sc->sc_ifp->if_mtu = ifp->if_mtu;
-   else if (sc->sc_ifp->if_mtu != ifp->if_mtu) {
-   if_printf(sc->sc_ifp, "invalid MTU for %s\n",
-   ifp->if_xname);
-   return (EINVAL);
+   } else if (sc->sc_ifp->if_mtu != ifp->if_mtu) {
+   if (ifp->if_ioctl == NULL) {
+   if_printf(sc->sc_ifp, "cannot change MTU for %s\n",
+   ifp->if_xname);
+   return (EINVAL);
+   }
+   oldmtu = ifp->if_mtu;
+   strlcpy(ifr.ifr_name, ifp->if_xname, sizeof(ifr.ifr_name));
+   ifr.ifr_mtu = sc->sc_ifp->if_mtu;
+   error = (*ifp->if_ioctl)(ifp, SIOCSIFMTU, (caddr_t)&ifr);
+   if (error != 0) {
+   if_printf(sc->sc_ifp, "invalid MTU for %s\n",
+   ifp->if_xname);
+   return (error);
+   }
+   ifr.ifr_mtu = oldmtu;
}
 
lp = malloc(sizeof(struct lagg_port), M_DEVBUF, M_WAITOK|M_ZERO);
@@ -673,6 +693,9 @@ lagg_port_create(struct lagg_softc *sc, struct ifnet *
if (ifp == sc_ptr->sc_ifp) {
LAGG_LIST_UNLOCK();
free(lp, M_DEVBUF);
+   if (oldmtu != -1)
+   (*ifp->if_ioctl)(ifp, SIOCSIFMTU,
+   (caddr_t)&ifr);
return (EINVAL);
/* XXX disable stacking for the moment, its untested */
 #ifdef LAGG_PORT_STACKING
@@ -681,6 +704,9 @@ lagg_port_create(struct lagg_softc *sc, struct ifnet *
LAGG_MAX_STACKING) {
LAGG_LIST_UNLOCK();
free(lp, M_DEVBUF);
+   if (oldmtu != -1)
+   (*ifp->if_ioctl)(ifp, SIOCSIFMTU,
+   (caddr_t)&ifr);
return (E2BIG);
}
 #endif
@@ -746,6 +772,8 @@ lagg_port_create(struct lagg_softc *sc, struct ifnet *
if ((error = lagg_proto_addport(sc, lp)) != 0) {
/* Remove the port, without calling pr_delport. */
lagg_port_destroy(lp, 0);
+   if (oldmtu != -1)
+   (*ifp->if_ioctl)(ifp, SIOCSIFMTU, (caddr_t)&ifr);
return (error);
}
 
@@ -1464,8 +1492,31 @@ lagg_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data
break;
 
case SIOCSIFMTU:
-   /* Do not allow the MTU to be directly changed */
-   error = EINVAL;
+   LAGG_XLOCK(sc);
+   CK_SLIST_FOREACH(lp, &sc->sc_ports, lp_entries) {
+   if (lp->lp_ioctl != NULL)
+ 

svn commit: r339910 - in stable/12: share/man/man4 tools/tools/netmap

2018-10-30 Thread Vincenzo Maffione
Author: vmaffione
Date: Tue Oct 30 10:01:15 2018
New Revision: 339910
URL: https://svnweb.freebsd.org/changeset/base/339910

Log:
  MFC r339659:
  
  netmap: add man page for the bridge program
  
  Added bridge(8).
  Also, minor fixes to the netmap "bridge" application:
   - indentation fixes and code cleanup
   - better usage description
   - better processing of netmap flags
  
  Approved by:  re (rgrimes)

Added:
  stable/12/tools/tools/netmap/bridge.8
 - copied unchanged from r339659, head/tools/tools/netmap/bridge.8
Modified:
  stable/12/share/man/man4/netmap.4
  stable/12/tools/tools/netmap/bridge.c
  stable/12/tools/tools/netmap/pkt-gen.8
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/share/man/man4/netmap.4
==
--- stable/12/share/man/man4/netmap.4   Tue Oct 30 09:53:57 2018
(r339909)
+++ stable/12/share/man/man4/netmap.4   Tue Oct 30 10:01:15 2018
(r339910)
@@ -27,7 +27,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd March 2, 2017
+.Dd October 23, 2018
 .Dt NETMAP 4
 .Os
 .Sh NAME
@@ -1073,6 +1073,9 @@ Other
 clients attached to the same switch can now communicate
 with the network card or the host.
 .Sh SEE ALSO
+.Xr pkt-gen 8 ,
+.Xr bridge 8
+.Pp
 .Pa http://info.iet.unipi.it/~luigi/netmap/
 .Pp
 Luigi Rizzo, Revisiting network I/O APIs: the netmap framework,

Copied: stable/12/tools/tools/netmap/bridge.8 (from r339659, 
head/tools/tools/netmap/bridge.8)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ stable/12/tools/tools/netmap/bridge.8   Tue Oct 30 10:01:15 2018
(r339910, copy of r339659, head/tools/tools/netmap/bridge.8)
@@ -0,0 +1,82 @@
+.\" Copyright (c) 2016 Luigi Rizzo, Universita` di Pisa
+.\"
+.\" 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$
+.\"
+.Dd October 23, 2018
+.Dt BRIDGE 8
+.Os
+.Sh NAME
+.Nm bridge
+.Nd netmap client to bridge two netmap ports
+.Sh SYNOPSIS
+.Bk -words
+.Bl -tag -width "bridge"
+.It Nm
+.Op Fl i Ar port
+.Op Fl b Ar batch size
+.Op Fl w Ar wait-link
+.Op Fl v
+.Op Fl c
+.El
+.Ek
+.Sh DESCRIPTION
+.Nm
+is a simple netmap application that bridges packets between two netmap ports.
+If the two netmap ports use the same netmap memory region
+.Nm
+forwards packets without copying the packets payload (zero-copy mode), unless
+explicitly prevented by the
+.Fl c
+flag.
+.Bl -tag -width Ds
+.It Fl i Ar port
+Name of the netmap port.
+It can be supplied up to two times to identify the ports that must be bridged.
+Any netmap port type (physical interface, VALE switch, pipe, monitor port...)
+can be used.
+If the option is supplied only once, then it must be for a physical interface 
and, in that case,
+.Nm
+will bridge the port and the host stack.
+.It Fl b Ar batch-size
+Maximum number of packets to send in one operation.
+.It Fl w Ar wait-link
+indicates the number of seconds to wait before transmitting.
+It defaults to 2, and may be useful when talking to physical
+ports to let link negotiation complete before starting transmission.
+.It Fl v
+Enable verbose mode
+.It Fl c
+Disable zero-copy mode.
+.El
+.Sh SEE ALSO
+.Xr netmap 4 ,
+.Xr pkt-gen 8
+.Sh AUTHORS
+.An -nosplit
+.Nm
+has been written by
+.An Luigi Rizzo
+and
+.An Matteo Landi
+at the Universita` di Pisa, Italy.

Modified: stable/12/tools/tools/netmap/bridge.c
==
--- stable/12/tools/tools/netmap/bridge.c   Tue Oct 30 09:53:57 2018
(r339909)
+++ stable/12/tools/tools/netmap/bridge.c   Tue Oct 30 10:01:15 2018
(r339910)

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

2018-10-30 Thread Marcelo Araujo
Author: araujo
Date: Tue Oct 30 10:02:23 2018
New Revision: 339911
URL: https://svnweb.freebsd.org/changeset/base/339911

Log:
  Emulate machine check related MSR_EXTFEATURES to allow guest OSes to
  boot on AMD FX Series.
  
  PR:   224476
  Submitted by: Keita Uchida 
  Reviewed by:  rgrimes
  Sponsored by: iXsystems Inc.
  Differential Revision:https://reviews.freebsd.org/D17713

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

Modified: head/sys/amd64/vmm/amd/svm_msr.c
==
--- head/sys/amd64/vmm/amd/svm_msr.cTue Oct 30 10:01:15 2018
(r339910)
+++ head/sys/amd64/vmm/amd/svm_msr.cTue Oct 30 10:02:23 2018
(r339911)
@@ -127,6 +127,9 @@ svm_rdmsr(struct svm_softc *sc, int vcpu, u_int num, u
case MSR_AMDK8_IPM:
*result = 0;
break;
+   case MSR_EXTFEATURES:
+   *result = 0;
+   break;
default:
error = EINVAL;
break;
@@ -162,6 +165,8 @@ svm_wrmsr(struct svm_softc *sc, int vcpu, u_int num, u
/*
 * Ignore writes to microcode update register.
 */
+   break;
+   case MSR_EXTFEATURES:
break;
default:
error = EINVAL;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r339912 - head/lib/csu/tests

2018-10-30 Thread Andrew Turner
Author: andrew
Date: Tue Oct 30 10:16:21 2018
New Revision: 339912
URL: https://svnweb.freebsd.org/changeset/base/339912

Log:
  Fix the location of the static keyword.
  
  MFC with: r339738
  Sponsored by: DARPA, AFRL

Modified:
  head/lib/csu/tests/init_test.c

Modified: head/lib/csu/tests/init_test.c
==
--- head/lib/csu/tests/init_test.c  Tue Oct 30 10:02:23 2018
(r339911)
+++ head/lib/csu/tests/init_test.c  Tue Oct 30 10:16:21 2018
(r339912)
@@ -60,7 +60,7 @@ volatile int init_array_state = -1;
 
 void _Jv_RegisterClasses(const func_ptr *);
 
-__section(".jcr") __used func_ptr static jcr_func = (func_ptr)1;
+__section(".jcr") __used static func_ptr jcr_func = (func_ptr)1;
 const void *jcr_func_ptr = &jcr_func;
 
 void
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r339876 - head/libexec/rtld-elf

2018-10-30 Thread Michael Tuexen
> On 29. Oct 2018, at 22:08, Alex Richardson  wrote:
> 
> Author: arichardson
> Date: Mon Oct 29 21:08:02 2018
> New Revision: 339876
> URL: https://svnweb.freebsd.org/changeset/base/339876
> 
> Log:
>  rtld: set obj->textsize correctly
> 
>  With lld-generated binaries the first PT_LOAD will usually be a read-only
>  segment unless you pass --no-rosegment. For those binaries the textsize is
>  determined by the next PT_LOAD. To allow both LLD and bfd 2.17 binaries to
>  be parsed correctly use the end of the last PT_LOAD that is marked as
>  executable instead.
> 
>  I noticed that the value was wrong while adding some debug prints for some 
> rtld
>  changes for CHERI binaries. `obj->textsize` only seems to be used by PPC so 
> the
>  effect is untested. However, the value before was definitely wrong and the 
> new
>  result matches the phdrs.
I build kernel and world with a revision later than this on a PPC. Buildword
ends up with a world where almost all binaries are segfaulting Especially 
gdb
(but svn, ls or so all segfault).

Best regards
Michael
> 
>  Reviewed By: kib
>  Approved By: brooks (mentor)
>  Differential Revision: https://reviews.freebsd.org/D17117
> 
> Modified:
>  head/libexec/rtld-elf/map_object.c
>  head/libexec/rtld-elf/rtld.c
> 
> Modified: head/libexec/rtld-elf/map_object.c
> ==
> --- head/libexec/rtld-elf/map_object.cMon Oct 29 21:03:43 2018
> (r339875)
> +++ head/libexec/rtld-elf/map_object.cMon Oct 29 21:08:02 2018
> (r339876)
> @@ -93,6 +93,7 @@ map_object(int fd, const char *path, const struct stat
> Elf_Addr note_end;
> char *note_map;
> size_t note_map_len;
> +Elf_Addr text_end;
> 
> hdr = get_elf_header(fd, path, sb);
> if (hdr == NULL)
> @@ -116,6 +117,7 @@ map_object(int fd, const char *path, const struct stat
> note_map = NULL;
> segs = alloca(sizeof(segs[0]) * hdr->e_phnum);
> stack_flags = RTLD_DEFAULT_STACK_PF_EXEC | PF_R | PF_W;
> +text_end = 0;
> while (phdr < phlimit) {
>   switch (phdr->p_type) {
> 
> @@ -130,6 +132,10 @@ map_object(int fd, const char *path, const struct stat
>   path, nsegs);
>   goto error;
>   }
> + if ((segs[nsegs]->p_flags & PF_X) == PF_X) {
> + text_end = MAX(text_end,
> + round_page(segs[nsegs]->p_vaddr + segs[nsegs]->p_memsz));
> + }
>   break;
> 
>   case PT_PHDR:
> @@ -280,8 +286,7 @@ map_object(int fd, const char *path, const struct stat
> }
> obj->mapbase = mapbase;
> obj->mapsize = mapsize;
> -obj->textsize = round_page(segs[0]->p_vaddr + segs[0]->p_memsz) -
> -  base_vaddr;
> +obj->textsize = text_end - base_vaddr;
> obj->vaddrbase = base_vaddr;
> obj->relocbase = mapbase - base_vaddr;
> obj->dynamic = (const Elf_Dyn *) (obj->relocbase + phdyn->p_vaddr);
> 
> Modified: head/libexec/rtld-elf/rtld.c
> ==
> --- head/libexec/rtld-elf/rtld.c  Mon Oct 29 21:03:43 2018
> (r339875)
> +++ head/libexec/rtld-elf/rtld.c  Mon Oct 29 21:08:02 2018
> (r339876)
> @@ -1390,13 +1390,15 @@ digest_phdr(const Elf_Phdr *phdr, int phnum, caddr_t e
>   if (nsegs == 0) {   /* First load segment */
>   obj->vaddrbase = trunc_page(ph->p_vaddr);
>   obj->mapbase = obj->vaddrbase + obj->relocbase;
> - obj->textsize = round_page(ph->p_vaddr + ph->p_memsz) -
> -   obj->vaddrbase;
>   } else {/* Last load segment */
>   obj->mapsize = round_page(ph->p_vaddr + ph->p_memsz) -
> obj->vaddrbase;
>   }
>   nsegs++;
> + if ((ph->p_flags & PF_X) == PF_X) {
> + obj->textsize = MAX(obj->textsize,
> + round_page(ph->p_vaddr + ph->p_memsz) - obj->vaddrbase);
> + }
>   break;
> 
>   case PT_DYNAMIC:
> 

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


svn commit: r339913 - head/lib/csu/tests

2018-10-30 Thread Andrew Turner
Author: andrew
Date: Tue Oct 30 11:19:47 2018
New Revision: 339913
URL: https://svnweb.freebsd.org/changeset/base/339913

Log:
  Disable the .preinit_array test in DSOs, ld.bfd fails to link objects with
  the section.
  
  MFC with: r339738
  Sponsored by: DARPA, AFRL

Modified:
  head/lib/csu/tests/init_test.c

Modified: head/lib/csu/tests/init_test.c
==
--- head/lib/csu/tests/init_test.c  Tue Oct 30 10:16:21 2018
(r339912)
+++ head/lib/csu/tests/init_test.c  Tue Oct 30 11:19:47 2018
(r339913)
@@ -107,7 +107,7 @@ ATF_TC_BODY(ctors_test, tc)
 }
 #endif
 
-#ifndef DSO_BASE
+#if !defined(DSO_BASE) && !defined(DSO_LIB)
 static void
 preinit_array_handler(void)
 {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r339914 - head/sys/powerpc/powermac

2018-10-30 Thread Michael Tuexen
Author: tuexen
Date: Tue Oct 30 11:51:09 2018
New Revision: 339914
URL: https://svnweb.freebsd.org/changeset/base/339914

Log:
  Bump the number of fans supported from 8 to 12.
  The number of fans on a PowerMac7,3 with liquid cooling is 9.
  
  Reviewed by:  andreast@
  MFC after:3 days
  Differential Revision:https://reviews.freebsd.org/D17754

Modified:
  head/sys/powerpc/powermac/fcu.c

Modified: head/sys/powerpc/powermac/fcu.c
==
--- head/sys/powerpc/powermac/fcu.c Tue Oct 30 11:19:47 2018
(r339913)
+++ head/sys/powerpc/powermac/fcu.c Tue Oct 30 11:51:09 2018
(r339914)
@@ -451,9 +451,9 @@ fcu_fill_fan_prop(device_t dev)
 {
phandle_t child;
struct fcu_softc *sc;
-   u_int id[8];
-   char location[96];
-   char type[64];
+   u_int id[12];
+   char location[144];
+   char type[96];
int i = 0, j, len = 0, prop_len, prev_len = 0;
 
sc = device_get_softc(dev);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r339915 - stable/12/tools/tools/netmap

2018-10-30 Thread Vincenzo Maffione
Author: vmaffione
Date: Tue Oct 30 14:25:16 2018
New Revision: 339915
URL: https://svnweb.freebsd.org/changeset/base/339915

Log:
  MFC r339685
  
  netmap: add man page for the vale-ctl program
  
  Added man page for vale-ctl program.
  Small fixes to vale-ctl, including the support for -m option
  (to specify the netmap memory allocator id).
  
  Approved by:  re (rgrimes)

Added:
  stable/12/tools/tools/netmap/vale-ctl.4
 - copied unchanged from r339685, head/tools/tools/netmap/vale-ctl.4
Modified:
  stable/12/tools/tools/netmap/vale-ctl.c
Directory Properties:
  stable/12/   (props changed)

Copied: stable/12/tools/tools/netmap/vale-ctl.4 (from r339685, 
head/tools/tools/netmap/vale-ctl.4)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ stable/12/tools/tools/netmap/vale-ctl.4 Tue Oct 30 14:25:16 2018
(r339915, copy of r339685, head/tools/tools/netmap/vale-ctl.4)
@@ -0,0 +1,163 @@
+.\" Copyright (c) 2016 Michio Honda.
+.\" All rights reserved.
+.\"
+.\" 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$
+.\"
+.Dd October 24, 2018
+.Dt VALE-CTL 4
+.Os
+.Sh NAME
+.Nm vale-ctl
+.Nd manage VALE switches provided by netmap
+.Sh SYNOPSIS
+.Bk -words
+.Bl -tag -width "vale-ctl"
+.It Nm
+.Op Fl g Ar valeSSS:PPP
+.Op Fl a Ar valeSSS:interface
+.Op Fl h Ar valeSSS:interface
+.Op Fl d Ar valeSSS:interface
+.Op Fl n Ar interface
+.Op Fl r Ar interface
+.Op Fl l Ar valeSSS:PPP
+.Op Fl l
+.Op Fl p Ar valeSSS:PPP
+.Op Fl P Ar valeSSS:PPP
+.Op Fl C Ar spec
+.Op Fl m Ar memid
+.El
+.Ek
+.Sh DESCRIPTION
+.Nm
+manages and inspects
+.Xr vale 4
+switches, for instance attaching and detaching interfaces, creating
+and deleting persistent VALE ports, or listing the existing switches
+and their ports.
+In the following,
+.Ar valeSSS
+is the name of a VALE switch, while
+.Ar valeSSS:PPP
+is the name of a VALE port of
+.Ar valeSSS .
+.Pp
+When issued without options it lists all the existing switch ports together
+with their internal bridge number and port number.
+.Bl -tag -width Ds
+.It Fl g Ar valeSSS:PPP
+Print the number of receive rings of
+.Ar valeSSS:PPP .
+.It Fl a Ar valeSSS:interface
+Attach
+.Ar interface
+(which must be an existing network interface) to
+.Ar valeSSS
+and detach it from the host stack.
+.It Fl h Ar valeSSS:interface
+Attach
+.Ar interface
+(which must be an existing network interface) to
+.Ar valeSSS
+while keeping it attached to the host stack.
+More precisely, packets coming from
+the host stack and directed to the interface will go through the switch, where
+they can still reach the interface if the switch rules allow it.
+Conversely, packets coming from the interface will go through the switch and,
+if appropriate, will reach the host stack.
+.It Fl d Ar valeSSS:interface
+Detach
+.Ar interface
+from
+.Ar valeSSS .
+.It Fl n Ar interface
+Create a new persistent VALE port with name
+.Ar interface .
+The name must be different from any other network interface
+already present in the system.
+.It Fl d Ar interface
+Destroy the persistent VALE port with name
+.Ar inteface .
+.It Fl l Ar valeSSS:PPP
+Show the internal bridge number and port number of the given switch port.
+.It Fl p Ar valeSSS:PPP
+Enable polling mode for
+.Ar valeSSS:PPP .
+In polling mode, a dedicated kernel thread is spawned to handle packets
+received from
+.Ar valeSSS:PPP
+and push them into the switch.
+The kernel thread busy waits on the switch port rather than relying on
+interrupts or notifications.
+Polling mode can only be used on physical NICs attached to a VALE switch.
+.It Fl P Ar valeSSS:PPP
+Disable polling mode for
+.Ar valeSSS:PPP .
+

svn commit: r339916 - in head/lib/csu: . arm mips powerpc riscv sparc64 tests

2018-10-30 Thread Andrew Turner
Author: andrew
Date: Tue Oct 30 14:44:12 2018
New Revision: 339916
URL: https://svnweb.freebsd.org/changeset/base/339916

Log:
  Build the csu tests on all architectures.
  
  The tests haven't been run them, but this is enough to build them so I can
  get feedback on if the various crt.h headers are correct.
  
  MFC with: r339738
  Sponsored by: DARPA, AFRL

Added:
  head/lib/csu/arm/crt.h   (contents, props changed)
  head/lib/csu/mips/crt.h   (contents, props changed)
  head/lib/csu/powerpc/crt.h   (contents, props changed)
  head/lib/csu/riscv/crt.h   (contents, props changed)
  head/lib/csu/sparc64/crt.h   (contents, props changed)
Modified:
  head/lib/csu/Makefile
  head/lib/csu/tests/Makefile.tests

Modified: head/lib/csu/Makefile
==
--- head/lib/csu/Makefile   Tue Oct 30 14:25:16 2018(r339915)
+++ head/lib/csu/Makefile   Tue Oct 30 14:44:12 2018(r339916)
@@ -8,10 +8,7 @@ SUBDIR+= ${MACHINE_ARCH}
 SUBDIR+= ${MACHINE_CPUARCH}
 .endif
 
-.if ${MACHINE_ARCH} == "aarch64" || ${MACHINE_ARCH} == "amd64" || \
-${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "powerpc64"
 HAS_TESTS=
 SUBDIR.${MK_TESTS}+= tests
-.endif
 
 .include 

Added: head/lib/csu/arm/crt.h
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/lib/csu/arm/crt.h  Tue Oct 30 14:44:12 2018(r339916)
@@ -0,0 +1,2 @@
+/* $FreeBSD$ */
+/* Empty so we can include this unconditionally */

Added: head/lib/csu/mips/crt.h
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/lib/csu/mips/crt.h Tue Oct 30 14:44:12 2018(r339916)
@@ -0,0 +1,31 @@
+/*-
+ * SPDX-License-Identifier: BSD-1-Clause
+ *
+ * Copyright 2018 Andrew Turner
+ *
+ * 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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 _CRT_H_
+#define_CRT_H_
+
+#defineHAVE_CTORS
+
+#endif

Added: head/lib/csu/powerpc/crt.h
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/lib/csu/powerpc/crt.h  Tue Oct 30 14:44:12 2018(r339916)
@@ -0,0 +1,33 @@
+/*-
+ * SPDX-License-Identifier: BSD-1-Clause
+ *
+ * Copyright 2018 Andrew Turner
+ *
+ * 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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 _CRT_H_
+#define_CRT_H_
+
+#defineHAVE_CTORS
+#defineCTORS_CONSTRUCTORS
+#defineINIT_CALL_SEQ(func) "bl " __STRING(func) "; nop"
+
+#endif

Added: head/lib/csu/riscv/crt.h
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/lib/csu/riscv/crt.hTue Oct 30 14:44:12 2018(r339916)
@@ -0,0 +1,2 @@
+/* $FreeBSD$ *

svn commit: r339917 - head/sys/kern

2018-10-30 Thread Eric van Gyzen
Author: vangyzen
Date: Tue Oct 30 14:54:15 2018
New Revision: 339917
URL: https://svnweb.freebsd.org/changeset/base/339917

Log:
  Always stop the scheduler when entering kdb
  
  Set curthread->td_stopsched when entering kdb via any vector.
  Previously, it was only set when entering via panic, so when
  entering kdb another way, mutexes and such were still "live",
  and an attempt to lock an already locked mutex would panic.
  
  Reviewed by:  kib, cem
  Discussed with:   jhb
  Tested by:pho
  MFC after:2 months
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D17687

Modified:
  head/sys/kern/subr_kdb.c

Modified: head/sys/kern/subr_kdb.c
==
--- head/sys/kern/subr_kdb.cTue Oct 30 14:44:12 2018(r339916)
+++ head/sys/kern/subr_kdb.cTue Oct 30 14:54:15 2018(r339917)
@@ -652,9 +652,7 @@ kdb_trap(int type, int code, struct trapframe *tf)
struct kdb_dbbe *be;
register_t intr;
int handled;
-#ifdef SMP
int did_stop_cpus;
-#endif
 
be = kdb_dbbe;
if (be == NULL || be->dbbe_trap == NULL)
@@ -666,16 +664,17 @@ kdb_trap(int type, int code, struct trapframe *tf)
 
intr = intr_disable();
 
-#ifdef SMP
if (!SCHEDULER_STOPPED()) {
+#ifdef SMP
other_cpus = all_cpus;
CPU_NAND(&other_cpus, &stopped_cpus);
CPU_CLR(PCPU_GET(cpuid), &other_cpus);
stop_cpus_hard(other_cpus);
+#endif
+   curthread->td_stopsched = 1;
did_stop_cpus = 1;
} else
did_stop_cpus = 0;
-#endif
 
kdb_active++;
 
@@ -703,12 +702,13 @@ kdb_trap(int type, int code, struct trapframe *tf)
 
kdb_active--;
 
-#ifdef SMP
if (did_stop_cpus) {
+   curthread->td_stopsched = 0;
+#ifdef SMP
CPU_AND(&other_cpus, &stopped_cpus);
restart_cpus(other_cpus);
-   }
 #endif
+   }
 
intr_restore(intr);
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r339918 - stable/12/sys/geom/eli

2018-10-30 Thread Xin LI
Author: delphij
Date: Tue Oct 30 15:11:34 2018
New Revision: 339918
URL: https://svnweb.freebsd.org/changeset/base/339918

Log:
  Restore backward compatibility for "attach" verb.
  
  In r332361 and r333439, two new parameters were added to geli attach
  verb using gctl_get_paraml, which requires the value to be present.
  This would prevent old geli(8) binary from attaching geli(4) device
  as they have no knowledge about the new parameters.
  
  Restore backward compatibility by treating the absense of these two
  values as seeing the default value supplied by userland.
  
  PR:   232595
  Reviewed by:  oshogbo
  Approved by:  re (rgrimes)

Modified:
  stable/12/sys/geom/eli/g_eli_ctl.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/geom/eli/g_eli_ctl.c
==
--- stable/12/sys/geom/eli/g_eli_ctl.c  Tue Oct 30 14:54:15 2018
(r339917)
+++ stable/12/sys/geom/eli/g_eli_ctl.c  Tue Oct 30 15:11:34 2018
(r339918)
@@ -59,8 +59,8 @@ g_eli_ctl_attach(struct gctl_req *req, struct g_class 
struct g_provider *pp;
const char *name;
u_char *key, mkey[G_ELI_DATAIVKEYLEN];
-   int *nargs, *detach, *readonly, *dryrun;
-   int keysize, error, nkey;
+   int *nargs, *detach, *readonly, *dryrunp;
+   int keysize, error, nkey, dryrun, dummy;
intmax_t *valp;
 
g_topology_assert();
@@ -81,12 +81,14 @@ g_eli_ctl_attach(struct gctl_req *req, struct g_class 
return;
}
 
-   valp = gctl_get_paraml(req, "keyno", sizeof(*valp));
-   if (valp == NULL) {
-   gctl_error(req, "No '%s' argument.", "keyno");
-   return;
+   /* "keyno" is optional for backward compatibility */
+   nkey = -1;
+   valp = gctl_get_param(req, "keyno", &dummy);
+   if (valp != NULL) {
+   valp = gctl_get_paraml(req, "keyno", sizeof(*valp));
+   if (valp != NULL)
+   nkey = *valp;
}
-   nkey = *valp;
if (nkey < -1 || nkey >= G_ELI_MAXMKEYS) {
gctl_error(req, "Invalid '%s' argument.", "keyno");
return;
@@ -98,10 +100,13 @@ g_eli_ctl_attach(struct gctl_req *req, struct g_class 
return;
}
 
-   dryrun = gctl_get_paraml(req, "dryrun", sizeof(*dryrun));
-   if (dryrun == NULL) {
-   gctl_error(req, "No '%s' argument.", "dryrun");
-   return;
+   /* "dryrun" is optional for backward compatibility */
+   dryrun = 0;
+   dryrunp = gctl_get_param(req, "dryrun", &dummy);
+   if (dryrunp != NULL) {
+   dryrunp = gctl_get_paraml(req, "dryrun", sizeof(*dryrunp));
+   if (dryrunp != NULL)
+   dryrun = *dryrunp;
}
 
if (*detach && *readonly) {
@@ -161,7 +166,7 @@ g_eli_ctl_attach(struct gctl_req *req, struct g_class 
md.md_flags |= G_ELI_FLAG_WO_DETACH;
if (*readonly)
md.md_flags |= G_ELI_FLAG_RO;
-   if (!*dryrun)
+   if (!dryrun)
g_eli_create(req, mp, pp, &md, mkey, nkey);
explicit_bzero(mkey, sizeof(mkey));
explicit_bzero(&md, sizeof(md));
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r339876 - head/libexec/rtld-elf

2018-10-30 Thread Alexander Richardson
On Tue, 30 Oct 2018 at 10:17, Michael Tuexen
 wrote:
>
> > On 29. Oct 2018, at 22:08, Alex Richardson  wrote:
> >
> > Author: arichardson
> > Date: Mon Oct 29 21:08:02 2018
> > New Revision: 339876
> > URL: https://svnweb.freebsd.org/changeset/base/339876
> >
> > Log:
> >  rtld: set obj->textsize correctly
> >
> >  With lld-generated binaries the first PT_LOAD will usually be a read-only
> >  segment unless you pass --no-rosegment. For those binaries the textsize is
> >  determined by the next PT_LOAD. To allow both LLD and bfd 2.17 binaries to
> >  be parsed correctly use the end of the last PT_LOAD that is marked as
> >  executable instead.
> >
> >  I noticed that the value was wrong while adding some debug prints for some 
> > rtld
> >  changes for CHERI binaries. `obj->textsize` only seems to be used by PPC 
> > so the
> >  effect is untested. However, the value before was definitely wrong and the 
> > new
> >  result matches the phdrs.
> I build kernel and world with a revision later than this on a PPC. Buildword
> ends up with a world where almost all binaries are segfaulting Especially 
> gdb
> (but svn, ls or so all segfault).
>
> Best regards
> Michael

This is rather surprising since if anything the range of the icache
flush should increase rather than decrease after this change.

I can only see this causing a behaviour change if we actually need to
flush more than just the executable segments.
Is it possible that some binary/library contains a non-executable
segment as the first PT_LOAD?
Or is there some linker script that adds custom PHDRS?

Alex


> >
> >  Reviewed By: kib
> >  Approved By: brooks (mentor)
> >  Differential Revision: https://reviews.freebsd.org/D17117
> >
> > Modified:
> >  head/libexec/rtld-elf/map_object.c
> >  head/libexec/rtld-elf/rtld.c
> >
> > Modified: head/libexec/rtld-elf/map_object.c
> > ==
> > --- head/libexec/rtld-elf/map_object.cMon Oct 29 21:03:43 2018  
> >   (r339875)
> > +++ head/libexec/rtld-elf/map_object.cMon Oct 29 21:08:02 2018  
> >   (r339876)
> > @@ -93,6 +93,7 @@ map_object(int fd, const char *path, const struct stat
> > Elf_Addr note_end;
> > char *note_map;
> > size_t note_map_len;
> > +Elf_Addr text_end;
> >
> > hdr = get_elf_header(fd, path, sb);
> > if (hdr == NULL)
> > @@ -116,6 +117,7 @@ map_object(int fd, const char *path, const struct stat
> > note_map = NULL;
> > segs = alloca(sizeof(segs[0]) * hdr->e_phnum);
> > stack_flags = RTLD_DEFAULT_STACK_PF_EXEC | PF_R | PF_W;
> > +text_end = 0;
> > while (phdr < phlimit) {
> >   switch (phdr->p_type) {
> >
> > @@ -130,6 +132,10 @@ map_object(int fd, const char *path, const struct stat
> >   path, nsegs);
> >   goto error;
> >   }
> > + if ((segs[nsegs]->p_flags & PF_X) == PF_X) {
> > + text_end = MAX(text_end,
> > + round_page(segs[nsegs]->p_vaddr + segs[nsegs]->p_memsz));
> > + }
> >   break;
> >
> >   case PT_PHDR:
> > @@ -280,8 +286,7 @@ map_object(int fd, const char *path, const struct stat
> > }
> > obj->mapbase = mapbase;
> > obj->mapsize = mapsize;
> > -obj->textsize = round_page(segs[0]->p_vaddr + segs[0]->p_memsz) -
> > -  base_vaddr;
> > +obj->textsize = text_end - base_vaddr;
> > obj->vaddrbase = base_vaddr;
> > obj->relocbase = mapbase - base_vaddr;
> > obj->dynamic = (const Elf_Dyn *) (obj->relocbase + phdyn->p_vaddr);
> >
> > Modified: head/libexec/rtld-elf/rtld.c
> > ==
> > --- head/libexec/rtld-elf/rtld.c  Mon Oct 29 21:03:43 2018
> > (r339875)
> > +++ head/libexec/rtld-elf/rtld.c  Mon Oct 29 21:08:02 2018
> > (r339876)
> > @@ -1390,13 +1390,15 @@ digest_phdr(const Elf_Phdr *phdr, int phnum, 
> > caddr_t e
> >   if (nsegs == 0) {   /* First load segment */
> >   obj->vaddrbase = trunc_page(ph->p_vaddr);
> >   obj->mapbase = obj->vaddrbase + obj->relocbase;
> > - obj->textsize = round_page(ph->p_vaddr + ph->p_memsz) -
> > -   obj->vaddrbase;
> >   } else {/* Last load segment */
> >   obj->mapsize = round_page(ph->p_vaddr + ph->p_memsz) -
> > obj->vaddrbase;
> >   }
> >   nsegs++;
> > + if ((ph->p_flags & PF_X) == PF_X) {
> > + obj->textsize = MAX(obj->textsize,
> > + round_page(ph->p_vaddr + ph->p_memsz) - obj->vaddrbase);
> > + }
> >   break;
> >
> >   case PT_DYNAMIC:
> >
>
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r339919 - head/usr.sbin/nscd

2018-10-30 Thread Edward Tomasz Napierala
Author: trasz
Date: Tue Oct 30 15:39:33 2018
New Revision: 339919
URL: https://svnweb.freebsd.org/changeset/base/339919

Log:
  Make "nscd -t" work.
  
  Reviewed by:  des@
  MFC after:2 weeks
  Sponsored by: Chalmers University of Technology
  Differential Revision:https://reviews.freebsd.org/D17563

Modified:
  head/usr.sbin/nscd/debug.c
  head/usr.sbin/nscd/debug.h

Modified: head/usr.sbin/nscd/debug.c
==
--- head/usr.sbin/nscd/debug.c  Tue Oct 30 15:11:34 2018(r339918)
+++ head/usr.sbin/nscd/debug.c  Tue Oct 30 15:39:33 2018(r339919)
@@ -131,7 +131,7 @@ nscd_trace_out(const char *s, const char *f, int l)
for (i = 0; i < trace_level; ++i)
printf("\t");
 
-   printf("<= %s\n", s);
+   printf("<= %s, %s: %d\n", s, f, l);
}
 }
 

Modified: head/usr.sbin/nscd/debug.h
==
--- head/usr.sbin/nscd/debug.h  Tue Oct 30 15:11:34 2018(r339918)
+++ head/usr.sbin/nscd/debug.h  Tue Oct 30 15:39:33 2018(r339919)
@@ -31,8 +31,7 @@
 
 #define TRACE_WANTED 32
 
-/* #ifndef NDEBUG */
-#if 0
+#ifndef NDEBUG
 #define TRACE_IN(x)nscd_trace_in(#x, __FILE__, __LINE__)
 #define TRACE_POINT()  nscd_trace_point(__FILE__, __LINE__)
 #define TRACE_MSG(x)   nscd_trace_msg(x, __FILE__, __LINE__)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r339920 - head/contrib/tzcode/stdtime

2018-10-30 Thread Edward Tomasz Napierala
Author: trasz
Date: Tue Oct 30 15:43:06 2018
New Revision: 339920
URL: https://svnweb.freebsd.org/changeset/base/339920

Log:
  Remove useless call to access(2) from tzcode.  Quoting OpenBSD:
  
  > Remove doaccess variable and access(2) call since this interfers with
  > applications like zdump(8) because pledge(2) doesn't allow access(2) to
  > /usr/share/zoneinfo.
  >
  > millert@ better described why this call can go away:
  >
  > "This looks like an attempt to do access checks based on the real uid 
instead
  > of the effective uid.  Basically for setuid programs we don't want to allow 
a
  > user to set TZ to a path they should not be able to otherwise access.
  >
  > However, we already have a check for issetugid() above so I think the 
doaccess
  > bits can just be removed and we can rely on open()."
  >
  > After discussion with tb@, deraadt@ and millert@, this was also OK'ed by 
them
  
  Reviewed by:  imp
  Obtained from:OpenBSD
  MFC after:2 weeks
  Sponsored by: DARPA, AFRL
  Differential Revision:https://reviews.freebsd.org/D17701

Modified:
  head/contrib/tzcode/stdtime/localtime.c

Modified: head/contrib/tzcode/stdtime/localtime.c
==
--- head/contrib/tzcode/stdtime/localtime.c Tue Oct 30 15:39:33 2018
(r339919)
+++ head/contrib/tzcode/stdtime/localtime.c Tue Oct 30 15:43:06 2018
(r339920)
@@ -398,7 +398,6 @@ register const int  doextend;
if (name == NULL && (name = TZDEFAULT) == NULL)
return -1;
{
-   int doaccess;
struct stat stab;
/*
** Section 4.9.1 of the C standard says that
@@ -415,8 +414,7 @@ register const int  doextend;
 
if (name[0] == ':')
++name;
-   doaccess = name[0] == '/';
-   if (!doaccess) {
+   if (name[0] != '/') {
if ((p = TZDIR) == NULL) {
free(fullname);
return -1;
@@ -428,16 +426,7 @@ register const int doextend;
(void) strcpy(fullname, p);
(void) strcat(fullname, "/");
(void) strcat(fullname, name);
-   /*
-   ** Set doaccess if '.' (as in "../") shows up in name.
-   */
-   if (strchr(name, '.') != NULL)
-   doaccess = TRUE;
name = fullname;
-   }
-   if (doaccess && access(name, R_OK) != 0) {
-   free(fullname);
-   return -1;
}
if ((fid = _open(name, OPEN_MODE)) == -1) {
free(fullname);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r339921 - head/contrib/tzcode/stdtime

2018-10-30 Thread Edward Tomasz Napierala
Author: trasz
Date: Tue Oct 30 15:44:16 2018
New Revision: 339921
URL: https://svnweb.freebsd.org/changeset/base/339921

Log:
  Remove no longer relevant comment, as suggested by imp@.
  
  MFC after:2 weeks
  Sponsored by: DARPA, AFRL

Modified:
  head/contrib/tzcode/stdtime/localtime.c

Modified: head/contrib/tzcode/stdtime/localtime.c
==
--- head/contrib/tzcode/stdtime/localtime.c Tue Oct 30 15:43:06 2018
(r339920)
+++ head/contrib/tzcode/stdtime/localtime.c Tue Oct 30 15:44:16 2018
(r339921)
@@ -390,7 +390,6 @@ register const int  doextend;
res = -1;
sp->goback = sp->goahead = FALSE;
 
-   /* XXX The following is from OpenBSD, and I'm not sure it is correct */
if (name != NULL && issetugid() != 0)
if ((name[0] == ':' && name[1] == '/') || 
name[0] == '/' || strchr(name, '.'))
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r339922 - in head: share/man/man5 share/mk sys/conf tools/build/options

2018-10-30 Thread Bjoern A. Zeeb
Author: bz
Date: Tue Oct 30 15:46:30 2018
New Revision: 339922
URL: https://svnweb.freebsd.org/changeset/base/339922

Log:
  Introduce an EXPERIMENTAL option for both src.conf(5) and the kernel.
  
  In the last decade(s) we have seen both short term or long term projects
  committed to the tree which were considered or even marked "experimental".
  While out-of-tree development has become easier than it used to be in
  CVS times, there still is a need to have the code shipping with HEAD but
  not enabled by default.
  
  While people may think about VIMAGE as one of the recent larger, long term
  projects, early protocol implementations (before they are standardised)
  are others.  (Free)BSD historically was one of the operating systems
  which would have running code at early stages and help develop and
  influence standardisation and the industry.
  
  Give developers an opportunity to be more pro-active for early adoption
  or running large scale code changes stumbling over each others but not
  the user's feet.  I have not added the option to NOTES in order to avoid
  breaking supported option builds, which require constant compile testing.
  
  Discussed with:   people in the corridor

Added:
  head/tools/build/options/WITH_EXPERIMENTAL   (contents, props changed)
Modified:
  head/share/man/man5/src.conf.5
  head/share/mk/src.opts.mk
  head/sys/conf/options

Modified: head/share/man/man5/src.conf.5
==
--- head/share/man/man5/src.conf.5  Tue Oct 30 15:44:16 2018
(r339921)
+++ head/share/man/man5/src.conf.5  Tue Oct 30 15:46:30 2018
(r339922)
@@ -1,6 +1,6 @@
 .\" DO NOT EDIT-- this file is @generated by tools/build/options/makeman.
 .\" $FreeBSD$
-.Dd October 25, 2018
+.Dd October 30, 2018
 .Dt SRC.CONF 5
 .Os
 .Sh NAME
@@ -659,6 +659,8 @@ An alternate bootstrap tool chain must be provided.
 .It Va WITHOUT_EXAMPLES
 Set to avoid installing examples to
 .Pa /usr/share/examples/ .
+.It Va WITH_EXPERIMENTAL
+Set to include experimental features in the build.
 .It Va WITH_EXTRA_TCP_STACKS
 Set to build extra TCP stack modules.
 .It Va WITHOUT_FDT

Modified: head/share/mk/src.opts.mk
==
--- head/share/mk/src.opts.mk   Tue Oct 30 15:44:16 2018(r339921)
+++ head/share/mk/src.opts.mk   Tue Oct 30 15:46:30 2018(r339922)
@@ -197,6 +197,7 @@ __DEFAULT_NO_OPTIONS = \
 BSD_GREP \
 CLANG_EXTRAS \
 DTRACE_TESTS \
+EXPERIMENTAL \
 GNU_GREP_COMPAT \
 HESIOD \
 LIBSOFT \

Modified: head/sys/conf/options
==
--- head/sys/conf/options   Tue Oct 30 15:44:16 2018(r339921)
+++ head/sys/conf/options   Tue Oct 30 15:46:30 2018(r339922)
@@ -95,6 +95,7 @@ _COMPAT_LINUX32   opt_compat.h# XXX: make sure 
opt_comp
 COMPILING_LINT opt_global.h
 CY_PCI_FASTINTR
 DEADLKRES  opt_watchdog.h
+EXPERIMENTAL   opt_global.h
 EXT_RESOURCES  opt_global.h
 DIRECTIO
 FILEMONopt_dontuse.h

Added: head/tools/build/options/WITH_EXPERIMENTAL
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tools/build/options/WITH_EXPERIMENTAL  Tue Oct 30 15:46:30 2018
(r339922)
@@ -0,0 +1,2 @@
+.\" $FreeBSD$
+Set to include experimental features in the build.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r339901 - head/sys/conf

2018-10-30 Thread Mark Johnston
On Tue, Oct 30, 2018 at 12:23:38AM +, John Baldwin wrote:
> Author: jhb
> Date: Tue Oct 30 00:23:37 2018
> New Revision: 339901
> URL: https://svnweb.freebsd.org/changeset/base/339901
> 
> Log:
>   Permit local kernel modules to be built as part of a kernel build.
>   
>   Add support for "local" modules.  By default, these modules are
>   located in LOCALBASE/sys/modules (where LOCALBASE defaults to
>   /usr/local).  Individual modules can be built along with a kernel by
>   defining LOCAL_MODULES to the list of modules.  Each is assumed to be
>   a subdirectory containing a valid Makefile.  If LOCAL_MODULES is not
>   specified, all of the modules present in LOCALBASE/sys/modules are
>   built and installed along with the kernel.
>   
>   This means that a port that installs a kernel module can choose to
>   install its source along with a suitable Makefile to
>   /usr/local/sys/modules/.  Future kernel builds will then include
>   that kernel module using the kernel configuration's opt_*.h headers
>   and install it into /boot/kernel along with other kernel-specific
>   modules.
>   
>   This is not trying to solve the issue of folks running GENERIC release
>   kernels, but is instead aimed at folks who build their own kernels.
>   For those folks this ensures that kernel modules from ports will
>   always be using the right KBI, etc.  This includes folks running any
>   KBI-breaking kernel configs (such as PAE).
>   
>   There are still some kinks to be worked out with cross-building (we
>   probably shouldn't include local modules in cross-built kernels by
>   default), but this is a sufficient starting point.
>   
>   Reviewed by:imp
>   MFC after:  3 months
>   Relnotes:   yes
>   Differential Revision:  https://reviews.freebsd.org/D16966
> 
> Modified:
>   head/sys/conf/kern.post.mk
> 
> Modified: head/sys/conf/kern.post.mk
> ==
> --- head/sys/conf/kern.post.mkTue Oct 30 00:22:14 2018
> (r339900)
> +++ head/sys/conf/kern.post.mkTue Oct 30 00:23:37 2018
> (r339901)
> @@ -35,24 +35,41 @@ KERN_DEBUGDIR?=   ${DEBUGDIR}
>  
>  .MAIN: all
>  
> +.if !defined(NO_MODULES)
> +# Default prefix used for modules installed from ports
> +LOCALBASE?=  /usr/local
> +
> +LOCAL_MODULES_DIR?= ${LOCALBASE}/sys/modules
> +
> +# Default to installing all modules installed by ports unless overridden
> +# by the user.
> +.if !defined(LOCAL_MODULES)
> +LOCAL_MODULES!= ls ${LOCAL_MODULES_DIR}
> +.endif
> +.endif

During a buildkernel I now get several instances of:

ls: /usr/local/sys/modules: No such file or directory   
   
make[2]: "/usr/home/markj/src/freebsd-dev/sys/conf/kern.post.mk" line 47: 
warning: "ls /usr/local/sys/modules" returned non-zero status

Perhaps /usr/local/sys/modules should be specified in the BSD.usr.dist
mtree file?
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r339901 - head/sys/conf

2018-10-30 Thread Rodney W. Grimes
> On Tue, Oct 30, 2018 at 12:23:38AM +, John Baldwin wrote:
> > Author: jhb
> > Date: Tue Oct 30 00:23:37 2018
> > New Revision: 339901
> > URL: https://svnweb.freebsd.org/changeset/base/339901
> > 
> > Log:
> >   Permit local kernel modules to be built as part of a kernel build.
> >   
> >   Add support for "local" modules.  By default, these modules are
> >   located in LOCALBASE/sys/modules (where LOCALBASE defaults to
> >   /usr/local).  Individual modules can be built along with a kernel by
> >   defining LOCAL_MODULES to the list of modules.  Each is assumed to be
> >   a subdirectory containing a valid Makefile.  If LOCAL_MODULES is not
> >   specified, all of the modules present in LOCALBASE/sys/modules are
> >   built and installed along with the kernel.
> >   
> >   This means that a port that installs a kernel module can choose to
> >   install its source along with a suitable Makefile to
> >   /usr/local/sys/modules/.  Future kernel builds will then include
> >   that kernel module using the kernel configuration's opt_*.h headers
> >   and install it into /boot/kernel along with other kernel-specific
> >   modules.
> >   
> >   This is not trying to solve the issue of folks running GENERIC release
> >   kernels, but is instead aimed at folks who build their own kernels.
> >   For those folks this ensures that kernel modules from ports will
> >   always be using the right KBI, etc.  This includes folks running any
> >   KBI-breaking kernel configs (such as PAE).
> >   
> >   There are still some kinks to be worked out with cross-building (we
> >   probably shouldn't include local modules in cross-built kernels by
> >   default), but this is a sufficient starting point.
> >   
> >   Reviewed by:  imp
> >   MFC after:3 months
> >   Relnotes: yes
> >   Differential Revision:https://reviews.freebsd.org/D16966
> > 
> > Modified:
> >   head/sys/conf/kern.post.mk
> > 
> > Modified: head/sys/conf/kern.post.mk
> > ==
> > --- head/sys/conf/kern.post.mk  Tue Oct 30 00:22:14 2018
> > (r339900)
> > +++ head/sys/conf/kern.post.mk  Tue Oct 30 00:23:37 2018
> > (r339901)
> > @@ -35,24 +35,41 @@ KERN_DEBUGDIR?= ${DEBUGDIR}
> >  
> >  .MAIN: all
> >  
> > +.if !defined(NO_MODULES)
> > +# Default prefix used for modules installed from ports
> > +LOCALBASE?=/usr/local
> > +

.if exists (${LOCALBASE}/sys/modules)
> > +LOCAL_MODULES_DIR?= ${LOCALBASE}/sys/modules
.endif

> > +
> > +# Default to installing all modules installed by ports unless overridden
> > +# by the user.
> > +.if !defined(LOCAL_MODULES)
> > +LOCAL_MODULES!= ls ${LOCAL_MODULES_DIR}
> > +.endif
> > +.endif
> 
> During a buildkernel I now get several instances of:
> 
> ls: /usr/local/sys/modules: No such file or directory 
>  
> make[2]: "/usr/home/markj/src/freebsd-dev/sys/conf/kern.post.mk" line 47: 
> warning: "ls /usr/local/sys/modules" returned non-zero status
> 
> Perhaps /usr/local/sys/modules should be specified in the BSD.usr.dist
> mtree file?
> 
> 

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


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

2018-10-30 Thread Andriy Gapon
On 30/10/2018 16:54, Eric van Gyzen wrote:
> Author: vangyzen
> Date: Tue Oct 30 14:54:15 2018
> New Revision: 339917
> URL: https://svnweb.freebsd.org/changeset/base/339917
> 
> Log:
>   Always stop the scheduler when entering kdb
>   
>   Set curthread->td_stopsched when entering kdb via any vector.
>   Previously, it was only set when entering via panic, so when
>   entering kdb another way, mutexes and such were still "live",
>   and an attempt to lock an already locked mutex would panic.
>   
>   Reviewed by:kib, cem
>   Discussed with: jhb
>   Tested by:  pho
>   MFC after:  2 months
>   Sponsored by:   Dell EMC Isilon
>   Differential Revision:  https://reviews.freebsd.org/D17687

My recollection from way back then is that the previous behavior was on purpose.
The idea was that the kdb code and code hat services it should be written
specifically to avoid taking locks used by general code.
I am not sure if that approach had any practical benefits, just sharing the 
memory.

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


Re: svn commit: r339901 - head/sys/conf

2018-10-30 Thread John Baldwin
On 10/30/18 8:55 AM, Rodney W. Grimes wrote:
>> On Tue, Oct 30, 2018 at 12:23:38AM +, John Baldwin wrote:
>>> Author: jhb
>>> Date: Tue Oct 30 00:23:37 2018
>>> New Revision: 339901
>>> URL: https://svnweb.freebsd.org/changeset/base/339901
>>>
>>> Log:
>>>   Permit local kernel modules to be built as part of a kernel build.
>>>   
>>>   Add support for "local" modules.  By default, these modules are
>>>   located in LOCALBASE/sys/modules (where LOCALBASE defaults to
>>>   /usr/local).  Individual modules can be built along with a kernel by
>>>   defining LOCAL_MODULES to the list of modules.  Each is assumed to be
>>>   a subdirectory containing a valid Makefile.  If LOCAL_MODULES is not
>>>   specified, all of the modules present in LOCALBASE/sys/modules are
>>>   built and installed along with the kernel.
>>>   
>>>   This means that a port that installs a kernel module can choose to
>>>   install its source along with a suitable Makefile to
>>>   /usr/local/sys/modules/.  Future kernel builds will then include
>>>   that kernel module using the kernel configuration's opt_*.h headers
>>>   and install it into /boot/kernel along with other kernel-specific
>>>   modules.
>>>   
>>>   This is not trying to solve the issue of folks running GENERIC release
>>>   kernels, but is instead aimed at folks who build their own kernels.
>>>   For those folks this ensures that kernel modules from ports will
>>>   always be using the right KBI, etc.  This includes folks running any
>>>   KBI-breaking kernel configs (such as PAE).
>>>   
>>>   There are still some kinks to be worked out with cross-building (we
>>>   probably shouldn't include local modules in cross-built kernels by
>>>   default), but this is a sufficient starting point.
>>>   
>>>   Reviewed by:  imp
>>>   MFC after:3 months
>>>   Relnotes: yes
>>>   Differential Revision:https://reviews.freebsd.org/D16966
>>>
>>> Modified:
>>>   head/sys/conf/kern.post.mk
>>>
>>> Modified: head/sys/conf/kern.post.mk
>>> ==
>>> --- head/sys/conf/kern.post.mk  Tue Oct 30 00:22:14 2018
>>> (r339900)
>>> +++ head/sys/conf/kern.post.mk  Tue Oct 30 00:23:37 2018
>>> (r339901)
>>> @@ -35,24 +35,41 @@ KERN_DEBUGDIR?= ${DEBUGDIR}
>>>  
>>>  .MAIN: all
>>>  
>>> +.if !defined(NO_MODULES)
>>> +# Default prefix used for modules installed from ports
>>> +LOCALBASE?=/usr/local
>>> +
> 
> .if exists (${LOCALBASE}/sys/modules)
>>> +LOCAL_MODULES_DIR?= ${LOCALBASE}/sys/modules
> .endif
> 
>>> +
>>> +# Default to installing all modules installed by ports unless overridden
>>> +# by the user.
>>> +.if !defined(LOCAL_MODULES)
>>> +LOCAL_MODULES!= ls ${LOCAL_MODULES_DIR}
>>> +.endif
>>> +.endif
>>
>> During a buildkernel I now get several instances of:
>>
>> ls: /usr/local/sys/modules: No such file or directory
>>   
>> make[2]: "/usr/home/markj/src/freebsd-dev/sys/conf/kern.post.mk" line 47: 
>> warning: "ls /usr/local/sys/modules" returned non-zero status
>>
>> Perhaps /usr/local/sys/modules should be specified in the BSD.usr.dist
>> mtree file?

I think I prefer Rod's fix.  I'll apply it in a bit.

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


svn commit: r339923 - head/sys/compat/linuxkpi/common/include/linux

2018-10-30 Thread Hans Petter Selasky
Author: hselasky
Date: Tue Oct 30 16:32:52 2018
New Revision: 339923
URL: https://svnweb.freebsd.org/changeset/base/339923

Log:
  Implement __KERNEL_DIV_ROUND_UP() function macro in the LinuxKPI.
  
  Submitted by: Johannes Lundberg 
  MFC after:3 days
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/compat/linuxkpi/common/include/linux/kernel.h

Modified: head/sys/compat/linuxkpi/common/include/linux/kernel.h
==
--- head/sys/compat/linuxkpi/common/include/linux/kernel.h  Tue Oct 30 
15:46:30 2018(r339922)
+++ head/sys/compat/linuxkpi/common/include/linux/kernel.h  Tue Oct 30 
16:32:52 2018(r339923)
@@ -131,6 +131,7 @@
 #undef PTR_ALIGN
 #definePTR_ALIGN(p, a) ((__typeof(p))ALIGN((uintptr_t)(p), 
(a)))
 #defineDIV_ROUND_UP(x, n)  howmany(x, n)
+#define__KERNEL_DIV_ROUND_UP(x, n) howmany(x, n)
 #defineDIV_ROUND_UP_ULL(x, n)  DIV_ROUND_UP((unsigned long long)(x), 
(n))
 #defineFIELD_SIZEOF(t, f)  sizeof(((t *)0)->f)
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r339901 - head/sys/conf

2018-10-30 Thread John Baldwin
On 10/29/18 5:23 PM, John Baldwin wrote:
> Author: jhb
> Date: Tue Oct 30 00:23:37 2018
> New Revision: 339901
> URL: https://svnweb.freebsd.org/changeset/base/339901
> 
> Log:
>   Permit local kernel modules to be built as part of a kernel build.
>   
>   Add support for "local" modules.  By default, these modules are
>   located in LOCALBASE/sys/modules (where LOCALBASE defaults to
>   /usr/local).  Individual modules can be built along with a kernel by
>   defining LOCAL_MODULES to the list of modules.  Each is assumed to be
>   a subdirectory containing a valid Makefile.  If LOCAL_MODULES is not
>   specified, all of the modules present in LOCALBASE/sys/modules are
>   built and installed along with the kernel.
>   
>   This means that a port that installs a kernel module can choose to
>   install its source along with a suitable Makefile to
>   /usr/local/sys/modules/.  Future kernel builds will then include
>   that kernel module using the kernel configuration's opt_*.h headers
>   and install it into /boot/kernel along with other kernel-specific
>   modules.
>   
>   This is not trying to solve the issue of folks running GENERIC release
>   kernels, but is instead aimed at folks who build their own kernels.
>   For those folks this ensures that kernel modules from ports will
>   always be using the right KBI, etc.  This includes folks running any
>   KBI-breaking kernel configs (such as PAE).
>   
>   There are still some kinks to be worked out with cross-building (we
>   probably shouldn't include local modules in cross-built kernels by
>   default), but this is a sufficient starting point.

The intention is that if, say, the drm-kmod ports install a valid module
Makefile to /usr/local/sys/modules/drm/Makefile, then subsequent kernel
builds will automatically pull in that module.  Also, since "local"
modules are built after in-tree modules, if a ports module has the same
filename (foo.ko), it will be installed over top of the in-tree one
in /boot/kernel effectively replacing it.  Note that as with subdirectories
in sys/modules, a Makefile could just be a bsd.subdir.mk that installs
multiple modules.

I do think that as a further step we might consider having certain ports
stop installing binary kernel modules altogether and only ship source
(especially ports with strong KBI ties to the kernel such as virtualbox
or drm).  Probably these ports would then use a post-install step to
compile against whatever source tree is present on the host and install
the module to /boot/modules.  Anyone compiling custom kernels wouldn't
use that module though after the next kernel recompile as the next kernel
would include a kernel-specific version in /boot/kernel that would take
precedence over the version in /boot/modules.  However, that version in
/boot/modules would still be needed for folks running release kernels that
never compile a kernel.  Further thought is probably required for the
"stock kernel" case to make sure we are really happy with that approach.

Cross-building kernels is also a further consideration.  The current
patch always opts-in to building local modules unless you explicitly
out out by setting LOCAL_MODULES to an empty string or LOCALBASE to
something that doesn't exist.  This means that if you have a port/package
installed that ships kernel module sources and do a 'make tinderbox',
we will try to build that module on all architectures that build modules.
This is probably not what we want.  I did want this feature to default
to enabled for native kernels so that installing a port will Just Work(tm)
without requiring kernel config changes to enable modules and I'd like
to keep that.  Some thoughts I'm considering for cross-builds are:

1) Change the buildkernel and installkernel targets in Makefile.inc1
   to explicitly pass LOCALBASE=/nonexistent as a parameter to make
   if TARGET_ARCH != MACHINE_ARCH or TARGET != MACHINE.  A user could
   explicitly request local modules for a kernel build by setting
   LOCALBASE explicitly when invoking buildkernel/installkernel.

   (You could also point LOCALBASE to a sysroot to honor ports
   installed in a sysroot.  For example, I mount my SD card for my
   RPi on my laptop and cross-build my kernel+world and then install
   onto the SD card via DESTDIR, so I could use LOCALBASE=/mnt/usr/local
   with buildkernel/installkernel to honor ports installed for my
   RPi during my cross-builds.)

2) Have make tinderbox explicitly set LOCALBASE so that even native
   kernels on a host don't try to build kernel modules from ports.
   If we didn't do this by default users could always explicitly
   set LOCALBASE to disable them.

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


svn commit: r339924 - in head/sys: compat/linuxkpi/common/include/linux compat/linuxkpi/common/src modules/linuxkpi

2018-10-30 Thread Hans Petter Selasky
Author: hselasky
Date: Tue Oct 30 16:42:56 2018
New Revision: 339924
URL: https://svnweb.freebsd.org/changeset/base/339924

Log:
  Implement the dump_stack() function in the LinuxKPI.
  
  Submitted by: Johannes Lundberg 
  MFC after:3 days
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/compat/linuxkpi/common/include/linux/kernel.h
  head/sys/compat/linuxkpi/common/src/linux_compat.c
  head/sys/modules/linuxkpi/Makefile

Modified: head/sys/compat/linuxkpi/common/include/linux/kernel.h
==
--- head/sys/compat/linuxkpi/common/include/linux/kernel.h  Tue Oct 30 
16:32:52 2018(r339923)
+++ head/sys/compat/linuxkpi/common/include/linux/kernel.h  Tue Oct 30 
16:42:56 2018(r339924)
@@ -138,6 +138,9 @@
 #defineprintk(...) printf(__VA_ARGS__)
 #definevprintk(f, a)   vprintf(f, a)
 
+extern void linux_dump_stack(void);
+#definedump_stack()linux_dump_stack()
+
 struct va_format {
const char *fmt;
va_list *va;

Modified: head/sys/compat/linuxkpi/common/src/linux_compat.c
==
--- head/sys/compat/linuxkpi/common/src/linux_compat.c  Tue Oct 30 16:32:52 
2018(r339923)
+++ head/sys/compat/linuxkpi/common/src/linux_compat.c  Tue Oct 30 16:42:56 
2018(r339924)
@@ -30,6 +30,8 @@
 #include 
 __FBSDID("$FreeBSD$");
 
+#include "opt_stack.h"
+
 #include 
 #include 
 #include 
@@ -46,6 +48,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -2205,6 +2208,18 @@ __unregister_chrdev(unsigned int major, unsigned int b
if (cdevp != NULL)
cdev_del(cdevp);
}
+}
+
+void
+linux_dump_stack(void)
+{
+#ifdef STACK
+   struct stack st;
+
+   stack_zero(&st);
+   stack_save(&st);
+   stack_print(&st);
+#endif
 }
 
 #if defined(__i386__) || defined(__amd64__)

Modified: head/sys/modules/linuxkpi/Makefile
==
--- head/sys/modules/linuxkpi/Makefile  Tue Oct 30 16:32:52 2018
(r339923)
+++ head/sys/modules/linuxkpi/Makefile  Tue Oct 30 16:42:56 2018
(r339924)
@@ -24,7 +24,8 @@ SRCS+=bus_if.h \
pci_if.h \
vnode_if.h \
usb_if.h \
-   opt_usb.h
+   opt_usb.h \
+   opt_stack.h
 
 CFLAGS+= -I${SRCTOP}/sys/compat/linuxkpi/common/include
 CFLAGS+= -I${SRCTOP}/sys/contrib/ck/include
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r339901 - head/sys/conf

2018-10-30 Thread Ian Lepore
On Tue, 2018-10-30 at 09:40 -0700, John Baldwin wrote:
> On 10/29/18 5:23 PM, John Baldwin wrote:
> > 
> > Author: jhb
> > Date: Tue Oct 30 00:23:37 2018
> > New Revision: 339901
> > URL: https://svnweb.freebsd.org/changeset/base/339901
> > 
> > Log:
> >   Permit local kernel modules to be built as part of a kernel build.
> >   
> >   Add support for "local" modules.  By default, these modules are
> >   located in LOCALBASE/sys/modules (where LOCALBASE defaults to
> >   /usr/local).  Individual modules can be built along with a kernel by
> >   defining LOCAL_MODULES to the list of modules.  Each is assumed to be
> >   a subdirectory containing a valid Makefile.  If LOCAL_MODULES is not
> >   specified, all of the modules present in LOCALBASE/sys/modules are
> >   built and installed along with the kernel.
> >   
> >   This means that a port that installs a kernel module can choose to
> >   install its source along with a suitable Makefile to
> >   /usr/local/sys/modules/.  Future kernel builds will then include
> >   that kernel module using the kernel configuration's opt_*.h headers
> >   and install it into /boot/kernel along with other kernel-specific
> >   modules.
> >   
> >   This is not trying to solve the issue of folks running GENERIC release
> >   kernels, but is instead aimed at folks who build their own kernels.
> >   For those folks this ensures that kernel modules from ports will
> >   always be using the right KBI, etc.  This includes folks running any
> >   KBI-breaking kernel configs (such as PAE).
> >   
> >   There are still some kinks to be worked out with cross-building (we
> >   probably shouldn't include local modules in cross-built kernels by
> >   default), but this is a sufficient starting point.
> The intention is that if, say, the drm-kmod ports install a valid module
> Makefile to /usr/local/sys/modules/drm/Makefile, then subsequent kernel
> builds will automatically pull in that module.  Also, since "local"
> modules are built after in-tree modules, if a ports module has the same
> filename (foo.ko), it will be installed over top of the in-tree one
> in /boot/kernel effectively replacing it.  Note that as with subdirectories
> in sys/modules, a Makefile could just be a bsd.subdir.mk that installs
> multiple modules.
> 
> I do think that as a further step we might consider having certain ports
> stop installing binary kernel modules altogether and only ship source
> (especially ports with strong KBI ties to the kernel such as virtualbox
> or drm).  Probably these ports would then use a post-install step to
> compile against whatever source tree is present on the host and install
> the module to /boot/modules.  Anyone compiling custom kernels wouldn't
> use that module though after the next kernel recompile as the next kernel
> would include a kernel-specific version in /boot/kernel that would take
> precedence over the version in /boot/modules.  However, that version in
> /boot/modules would still be needed for folks running release kernels that
> never compile a kernel.  Further thought is probably required for the
> "stock kernel" case to make sure we are really happy with that approach.
> 
> Cross-building kernels is also a further consideration.  The current
> patch always opts-in to building local modules unless you explicitly
> out out by setting LOCAL_MODULES to an empty string or LOCALBASE to
> something that doesn't exist.  This means that if you have a port/package
> installed that ships kernel module sources and do a 'make tinderbox',
> we will try to build that module on all architectures that build modules.
> This is probably not what we want.  I did want this feature to default
> to enabled for native kernels so that installing a port will Just Work(tm)
> without requiring kernel config changes to enable modules and I'd like
> to keep that.  Some thoughts I'm considering for cross-builds are:
> 
> 1) Change the buildkernel and installkernel targets in Makefile.inc1
>    to explicitly pass LOCALBASE=/nonexistent as a parameter to make
>    if TARGET_ARCH != MACHINE_ARCH or TARGET != MACHINE.  A user could
>    explicitly request local modules for a kernel build by setting
>    LOCALBASE explicitly when invoking buildkernel/installkernel.
> 

Or something like

.if ${TARGET_ARCH} != ${MACHINE_ARCH}
LOCALBASE?= /usr/local/${TARGET_ARCH}
.endif

Then it's analogous under /usr/local to the /usr/src/${TARGET_ARCH}
hierarchy that's used for cross-building base. This is how Warner set
up the ports crossbuild mechanisms years ago that we still use at
$work.

-- Ian

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


svn commit: r339925 - in head/sys: kern vm

2018-10-30 Thread Mark Johnston
Author: markj
Date: Tue Oct 30 17:57:40 2018
New Revision: 339925
URL: https://svnweb.freebsd.org/changeset/base/339925

Log:
  Fix some problems that manifest when NUMA domain 0 is empty.
  
  - In uma_prealloc(), we need to check for an empty domain before the
first allocation attempt, not after.  Fix this by switching
uma_prealloc() to use a vm_domainset iterator, which addresses the
secondary issue of using a signed domain identifier in round-robin
iteration.
  - Don't automatically create a page daemon for domain 0.
  - In domainset_empty_vm(), recompute ds_cnt and ds_order after
excluding empty domains; otherwise we may frequently specify an empty
domain when calling in to the page allocator, wasting CPU time.
Convert DOMAINSET_PREF() policies for empty domains to round-robin.
  - When freeing bootstrap pages, don't count them towards the per-domain
total page counts for now: some vm_phys segments are created before
the SRAT is parsed and are thus always identified as being in domain 0
even when they are not.  Then, when bootstrap pages are freed, they
are added to a domain that we had previously thought was empty.  Until
this is corrected, we simply exclude them from the per-domain page
count.
  
  Reported and tested by:   Rajesh Kumar 
  Reviewed by:  gallatin
  MFC after:2 weeks
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D17704

Modified:
  head/sys/kern/kern_cpuset.c
  head/sys/vm/uma_core.c
  head/sys/vm/vm_init.c
  head/sys/vm/vm_kern.c
  head/sys/vm/vm_page.c
  head/sys/vm/vm_pageout.c

Modified: head/sys/kern/kern_cpuset.c
==
--- head/sys/kern/kern_cpuset.c Tue Oct 30 16:42:56 2018(r339924)
+++ head/sys/kern/kern_cpuset.c Tue Oct 30 17:57:40 2018(r339925)
@@ -492,20 +492,29 @@ _domainset_create(struct domainset *domain, struct dom
 }
 
 /*
- * Are any of the domains in the mask empty? If so, silently
- * remove them.  If only empty domains are present, we must
- * return failure.
+ * Are any of the domains in the mask empty?  If so, silently
+ * remove them and update the domainset accordingly.  If only empty
+ * domains are present, we must return failure.
  */
 static bool
 domainset_empty_vm(struct domainset *domain)
 {
-   int i, max;
+   int i, j, max;
 
max = DOMAINSET_FLS(&domain->ds_mask) + 1;
-   for (i = 0; i < max; i++) {
-   if (DOMAINSET_ISSET(i, &domain->ds_mask) &&
-   VM_DOMAIN_EMPTY(i))
+   for (i = 0; i < max; i++)
+   if (DOMAINSET_ISSET(i, &domain->ds_mask) && VM_DOMAIN_EMPTY(i))
DOMAINSET_CLR(i, &domain->ds_mask);
+   domain->ds_cnt = DOMAINSET_COUNT(&domain->ds_mask);
+   max = DOMAINSET_FLS(&domain->ds_mask) + 1;
+   for (i = j = 0; i < max; i++) {
+   if (DOMAINSET_ISSET(i, &domain->ds_mask))
+   domain->ds_order[j++] = i;
+   else if (domain->ds_policy == DOMAINSET_POLICY_PREFER &&
+   domain->ds_prefer == i && domain->ds_cnt > 1) {
+   domain->ds_policy = DOMAINSET_POLICY_ROUNDROBIN;
+   domain->ds_prefer = -1;
+   }
}
 
return (DOMAINSET_EMPTY(&domain->ds_mask));
@@ -1378,7 +1387,7 @@ cpuset_setithread(lwpid_t id, int cpu)
 
 /*
  * Initialize static domainsets after NUMA information is available.  This is
- * called very early during boot.
+ * called before memory allocators are initialized.
  */
 void
 domainset_init(void)
@@ -1407,7 +1416,7 @@ domainset_init(void)
 void
 domainset_zero(void)
 {
-   struct domainset *dset;
+   struct domainset *dset, *tmp;
 
mtx_init(&cpuset_lock, "cpuset", NULL, MTX_SPIN | MTX_RECURSE);
 
@@ -1422,8 +1431,9 @@ domainset_zero(void)
kernel_object->domain.dr_policy = _domainset_create(&domainset2, NULL);
 
/* Remove empty domains from the global policies. */
-   LIST_FOREACH(dset, &cpuset_domains, ds_link)
-   (void)domainset_empty_vm(dset);
+   LIST_FOREACH_SAFE(dset, &cpuset_domains, ds_link, tmp)
+   if (domainset_empty_vm(dset))
+   LIST_REMOVE(dset, ds_link);
 }
 
 /*

Modified: head/sys/vm/uma_core.c
==
--- head/sys/vm/uma_core.c  Tue Oct 30 16:42:56 2018(r339924)
+++ head/sys/vm/uma_core.c  Tue Oct 30 17:57:40 2018(r339925)
@@ -3608,29 +3608,30 @@ uma_zone_reserve_kva(uma_zone_t zone, int count)
 void
 uma_prealloc(uma_zone_t zone, int items)
 {
+   struct vm_domainset_iter di;
uma_domain_t dom;
uma_slab_t slab;
uma_keg_t keg;
-   int domain, slabs;
+   int domain, flags, slabs;
 
keg = zone_first_keg(zone);
if (keg == NULL)
return;
KEG_LOCK(

Re: svn commit: r339876 - head/libexec/rtld-elf

2018-10-30 Thread Konstantin Belousov
On Tue, Oct 30, 2018 at 03:32:40PM +, Alexander Richardson wrote:
> On Tue, 30 Oct 2018 at 10:17, Michael Tuexen
>  wrote:
> >
> > > On 29. Oct 2018, at 22:08, Alex Richardson  
> > > wrote:
> > >
> > > Author: arichardson
> > > Date: Mon Oct 29 21:08:02 2018
> > > New Revision: 339876
> > > URL: https://svnweb.freebsd.org/changeset/base/339876
> > >
> > > Log:
> > >  rtld: set obj->textsize correctly
> > >
> > >  With lld-generated binaries the first PT_LOAD will usually be a read-only
> > >  segment unless you pass --no-rosegment. For those binaries the textsize 
> > > is
> > >  determined by the next PT_LOAD. To allow both LLD and bfd 2.17 binaries 
> > > to
> > >  be parsed correctly use the end of the last PT_LOAD that is marked as
> > >  executable instead.
> > >
> > >  I noticed that the value was wrong while adding some debug prints for 
> > > some rtld
> > >  changes for CHERI binaries. `obj->textsize` only seems to be used by PPC 
> > > so the
> > >  effect is untested. However, the value before was definitely wrong and 
> > > the new
> > >  result matches the phdrs.
> > I build kernel and world with a revision later than this on a PPC. Buildword
> > ends up with a world where almost all binaries are segfaulting 
> > Especially gdb
> > (but svn, ls or so all segfault).
> >
> > Best regards
> > Michael
> 
> This is rather surprising since if anything the range of the icache
> flush should increase rather than decrease after this change.
> 
> I can only see this causing a behaviour change if we actually need to
> flush more than just the executable segments.
> Is it possible that some binary/library contains a non-executable
> segment as the first PT_LOAD?
> Or is there some linker script that adds custom PHDRS?
> 
Could it be that there is a hole between start of the object mapping and
the last PT_LOADable segment eligible for execution ?

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


svn commit: r339926 - head/sys/conf

2018-10-30 Thread John Baldwin
Author: jhb
Date: Tue Oct 30 18:20:34 2018
New Revision: 339926
URL: https://svnweb.freebsd.org/changeset/base/339926

Log:
  Only invoke 'ls' if the local modules directory exists.
  
  This avoids a spurious make warning if /usr/local/sys/modules doesn't
  exist.
  
  Submitted by: rgrimes
  Reported by:  markj

Modified:
  head/sys/conf/kern.post.mk

Modified: head/sys/conf/kern.post.mk
==
--- head/sys/conf/kern.post.mk  Tue Oct 30 17:57:40 2018(r339925)
+++ head/sys/conf/kern.post.mk  Tue Oct 30 18:20:34 2018(r339926)
@@ -43,7 +43,7 @@ LOCAL_MODULES_DIR?= ${LOCALBASE}/sys/modules
 
 # Default to installing all modules installed by ports unless overridden
 # by the user.
-.if !defined(LOCAL_MODULES)
+.if !defined(LOCAL_MODULES) && exists($LOCAL_MODULES_DIR)
 LOCAL_MODULES!= ls ${LOCAL_MODULES_DIR}
 .endif
 .endif
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r339927 - in head: . share/man/man9 sys/dev/hwpmc sys/i386/i386 sys/kern sys/sys sys/vm sys/x86/iommu sys/x86/x86

2018-10-30 Thread Mark Johnston
Author: markj
Date: Tue Oct 30 18:26:34 2018
New Revision: 339927
URL: https://svnweb.freebsd.org/changeset/base/339927

Log:
  Add malloc_domainset(9) and _domainset variants to other allocator KPIs.
  
  Remove malloc_domain(9) and most other _domain KPIs added in r327900.
  The new functions allow the caller to specify a general NUMA domain
  selection policy, rather than specifically requesting an allocation from
  a specific domain.  The latter policy tends to interact poorly with
  M_WAITOK, resulting in situations where a caller is blocked indefinitely
  because the specified domain is depleted.  Most existing consumers of
  the _domain KPIs are converted to instead use a DOMAINSET_PREF() policy,
  in which we fall back to other domains to satisfy the allocation
  request.
  
  This change also defines a set of DOMAINSET_FIXED() policies, which
  only permit allocations from the specified domain.
  
  Discussed with:   gallatin, jeff
  Reported and tested by:   pho (previous version)
  MFC after:2 weeks
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D17418

Modified:
  head/ObsoleteFiles.inc
  head/share/man/man9/Makefile
  head/share/man/man9/contigmalloc.9
  head/share/man/man9/domainset.9
  head/share/man/man9/malloc.9
  head/sys/dev/hwpmc/hwpmc_logging.c
  head/sys/dev/hwpmc/hwpmc_mod.c
  head/sys/i386/i386/pmap.c
  head/sys/kern/kern_cpuset.c
  head/sys/kern/kern_malloc.c
  head/sys/kern/kern_mbuf.c
  head/sys/kern/kern_pmc.c
  head/sys/kern/subr_busdma_bufalloc.c
  head/sys/sys/domainset.h
  head/sys/sys/malloc.h
  head/sys/vm/uma_core.c
  head/sys/vm/vm_extern.h
  head/sys/vm/vm_kern.c
  head/sys/x86/iommu/busdma_dmar.c
  head/sys/x86/x86/busdma_bounce.c

Modified: head/ObsoleteFiles.inc
==
--- head/ObsoleteFiles.inc  Tue Oct 30 18:20:34 2018(r339926)
+++ head/ObsoleteFiles.inc  Tue Oct 30 18:26:34 2018(r339927)
@@ -38,6 +38,8 @@
 #   xargs -n1 | sort | uniq -d;
 # done
 
+# 20181030: malloc_domain(9) KPI change
+OLD_FILES+=share/man/man9/malloc_domain.9.gz
 # 20181026: joy(4) removal
 OLD_FILES+=usr/share/man/man4/joy.4.gz
 # 20181025: OpenSSL libraries version bump to avoid conflict with ports

Modified: head/share/man/man9/Makefile
==
--- head/share/man/man9/MakefileTue Oct 30 18:20:34 2018
(r339926)
+++ head/share/man/man9/MakefileTue Oct 30 18:26:34 2018
(r339927)
@@ -812,7 +812,8 @@ MLINKS+=condvar.9 cv_broadcast.9 \
 MLINKS+=config_intrhook.9 config_intrhook_disestablish.9 \
config_intrhook.9 config_intrhook_establish.9 \
config_intrhook.9 config_intrhook_oneshot.9
-MLINKS+=contigmalloc.9 contigfree.9
+MLINKS+=contigmalloc.9 contigmalloc_domainset.9 \
+   contigmalloc.9 contigfree.9
 MLINKS+=casuword.9 casueword.9 \
casuword.9 casueword32.9 \
casuword.9 casuword32.9
@@ -1289,7 +1290,7 @@ MLINKS+=make_dev.9 destroy_dev.9 \
make_dev.9 make_dev_p.9 \
make_dev.9 make_dev_s.9
 MLINKS+=malloc.9 free.9 \
-   malloc.9 malloc_domain.9 \
+   malloc.9 malloc_domainset.9 \
malloc.9 free_domain.9 \
malloc.9 mallocarray.9 \
malloc.9 MALLOC_DECLARE.9 \

Modified: head/share/man/man9/contigmalloc.9
==
--- head/share/man/man9/contigmalloc.9  Tue Oct 30 18:20:34 2018
(r339926)
+++ head/share/man/man9/contigmalloc.9  Tue Oct 30 18:26:34 2018
(r339927)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd January 29, 2015
+.Dd October 30, 2018
 .Dt CONTIGMALLOC 9
 .Os
 .Sh NAME
@@ -50,6 +50,19 @@
 .Fa "unsigned long size"
 .Fa "struct malloc_type *type"
 .Fc
+.In sys/param.h
+.In sys/domainset.h
+.Ft "void *"
+.Fo contigmalloc_domainset
+.Fa "unsigned long size"
+.Fa "struct malloc_type *type"
+.Fa "struct domainset *ds"
+.Fa "int flags"
+.Fa "vm_paddr_t low"
+.Fa "vm_paddr_t high"
+.Fa "unsigned long alignment"
+.Fa "vm_paddr_t boundary"
+.Fc
 .Sh DESCRIPTION
 The
 .Fn contigmalloc
@@ -70,6 +83,15 @@ address range of
 bytes allocated from the kernel virtual address (KVA) map.
 .Pp
 The
+.Fn contigmalloc_domainset
+variant allows the caller to additionally specify a
+.Xr numa 4
+domain selection policy.
+See
+.Xr domainset 9
+for some example policies.
+.Pp
+The
 .Fa flags
 parameter modifies
 .Fn contigmalloc Ns 's
@@ -90,7 +112,9 @@ Other flags (if present) are ignored.
 The
 .Fn contigfree
 function deallocates memory allocated by a previous call to
-.Fn contigmalloc .
+.Fn contigmalloc
+or
+.Fn contigmalloc_domainset .
 .Sh IMPLEMENTATION NOTES
 The
 .Fn contigmalloc

Modified: head/share/man/man9/domainset.9
==

svn commit: r339928 - stable/11/sys/x86/isa

2018-10-30 Thread John Baldwin
Author: jhb
Date: Tue Oct 30 19:10:41 2018
New Revision: 339928
URL: https://svnweb.freebsd.org/changeset/base/339928

Log:
  MFC 338148: Remove 'imen' global variable from atpic(4).
  
  In pre-SMPng, the global 'imen' was used to track mask state of the
  hardware interrupts and was aligned to the masks used by spl*().
  When the atpic code was converted to using the x86 interrupt source
  abstraction, the global 'imen' was preserved by having each PIC
  instance point to an individual byte in the global 'imen' to hold its
  8-bit interrupt mask.  The global 'imen' is no longer used for
  anything however, so rather than storing pointers in 'struct atpic',
  just store the individual 8-bit mask for each PIC as a char.
  
  While here, convert the ATPIC macro to using C99 initializers.

Modified:
  stable/11/sys/x86/isa/atpic.c
  stable/11/sys/x86/isa/icu.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/x86/isa/atpic.c
==
--- stable/11/sys/x86/isa/atpic.c   Tue Oct 30 18:26:34 2018
(r339927)
+++ stable/11/sys/x86/isa/atpic.c   Tue Oct 30 19:10:41 2018
(r339928)
@@ -73,12 +73,12 @@ __FBSDID("$FreeBSD$");
 #defineMASTER  0
 #defineSLAVE   1
 
+#defineIMEN_MASK(ai)   (IRQ_MASK((ai)->at_irq))
+
 #defineNUM_ISA_IRQS16
 
 static voidatpic_init(void *dummy);
 
-unsigned int imen; /* XXX */
-
 inthand_t
IDTVEC(atpic_intr0), IDTVEC(atpic_intr1), IDTVEC(atpic_intr2),
IDTVEC(atpic_intr3), IDTVEC(atpic_intr4), IDTVEC(atpic_intr5),
@@ -99,12 +99,24 @@ inthand_t
 
 #defineIRQ(ap, ai) ((ap)->at_irqbase + (ai)->at_irq)
 
-#defineATPIC(io, base, eoi, imenptr)   
\
-   { { atpic_enable_source, atpic_disable_source, (eoi),   \
-   atpic_enable_intr, atpic_disable_intr, atpic_vector,\
-   atpic_source_pending, NULL, atpic_resume, atpic_config_intr,\
-   atpic_assign_cpu }, (io), (base), IDT_IO_INTS + (base), \
-   (imenptr) }
+#defineATPIC(io, base, eoi) {  
\
+   .at_pic = { \
+   .pic_enable_source = atpic_enable_source,   \
+   .pic_disable_source = atpic_disable_source, \
+   .pic_eoi_source = (eoi),\
+   .pic_enable_intr = atpic_enable_intr,   \
+   .pic_disable_intr = atpic_disable_intr, \
+   .pic_vector = atpic_vector, \
+   .pic_source_pending = atpic_source_pending, \
+   .pic_resume = atpic_resume, \
+   .pic_config_intr = atpic_config_intr,   \
+   .pic_assign_cpu = atpic_assign_cpu  \
+   },  \
+   .at_ioaddr = (io),  \
+   .at_irqbase = (base),   \
+   .at_intbase = IDT_IO_INTS + (base), \
+   .at_imen = 0xff,\
+   }
 
 #defineINTSRC(irq) 
\
{ { &atpics[(irq) / 8].at_pic }, IDTVEC(atpic_intr ## irq ),\
@@ -115,7 +127,7 @@ struct atpic {
int at_ioaddr;
int at_irqbase;
uint8_t at_intbase;
-   uint8_t *at_imen;
+   uint8_t at_imen;
 };
 
 struct atpic_intsrc {
@@ -142,8 +154,8 @@ static int atpic_assign_cpu(struct intsrc *isrc, u_int
 static void i8259_init(struct atpic *pic, int slave);
 
 static struct atpic atpics[] = {
-   ATPIC(IO_ICU1, 0, atpic_eoi_master, (uint8_t *)&imen),
-   ATPIC(IO_ICU2, 8, atpic_eoi_slave, ((uint8_t *)&imen) + 1)
+   ATPIC(IO_ICU1, 0, atpic_eoi_master),
+   ATPIC(IO_ICU2, 8, atpic_eoi_slave)
 };
 
 static struct atpic_intsrc atintrs[] = {
@@ -203,9 +215,9 @@ atpic_enable_source(struct intsrc *isrc)
struct atpic *ap = (struct atpic *)isrc->is_pic;
 
spinlock_enter();
-   if (*ap->at_imen & IMEN_MASK(ai)) {
-   *ap->at_imen &= ~IMEN_MASK(ai);
-   outb(ap->at_ioaddr + ICU_IMR_OFFSET, *ap->at_imen);
+   if (ap->at_imen & IMEN_MASK(ai)) {
+   ap->at_imen &= ~IMEN_MASK(ai);
+   outb(ap->at_ioaddr + ICU_IMR_OFFSET, ap->at_imen);
}
spinlock_exit();
 }
@@ -218,8 +230,8 @@ atpic_disable_source(struct intsrc *isrc, int eoi)
 
spinlock_enter();
if (ai->at_trigger != INTR_TRIGGER_EDGE) {
-   *ap->at_imen |= IMEN_MASK(ai);
-   outb(ap->at_ioaddr + ICU_IMR_OFFSET, *ap->at_imen);
+

svn commit: r339929 - in head: sbin/ifconfig sys/net sys/netinet sys/netinet6 usr.sbin/ndp usr.sbin/rtadvd

2018-10-30 Thread Bjoern A. Zeeb
Author: bz
Date: Tue Oct 30 20:08:48 2018
New Revision: 339929
URL: https://svnweb.freebsd.org/changeset/base/339929

Log:
  Initial implementation of draft-ietf-6man-ipv6only-flag.
  
  This change defines the RA "6" (IPv6-Only) flag which routers
  may advertise, kernel logic to check if all routers on a link
  have the flag set and accordingly update a per-interface flag.
  
  If all routers agree that it is an IPv6-only link, ether_output_frame(),
  based on the interface flag, will filter out all ETHERTYPE_IP/ARP
  frames, drop them, and return EAFNOSUPPORT to upper layers.
  
  The change also updates ndp to show the "6" flag, ifconfig to
  display the IPV6_ONLY nd6 flag if set, and rtadvd to allow
  announcing the flag.
  
  Further changes to tcpdump (contrib code) are availble and will
  be upstreamed.
  
  Tested the code (slightly earlier version) with 2 FreeBSD
  IPv6 routers, a FreeBSD laptop on ethernet as well as wifi,
  and with Win10 and OSX clients (which did not fall over with
  the "6" flag set but not understood).
  
  We may also want to (a) implement and RX filter, and (b) over
  time enahnce user space to, say, stop dhclient from running
  when the interface flag is set.  Also we might want to start
  IPv6 before IPv4 in the future.
  
  All the code is hidden under the EXPERIMENTAL option and not
  compiled by default as the draft is a work-in-progress and
  we cannot rely on the fact that IANA will assign the bits
  as requested by the draft and hence they may change.
  
  Dear 6man, you have running code.
  
  Discussed with:   Bob Hinden, Brian E Carpenter

Modified:
  head/sbin/ifconfig/Makefile
  head/sbin/ifconfig/af_nd6.c
  head/sys/net/if_ethersubr.c
  head/sys/netinet/icmp6.h
  head/sys/netinet6/nd6.h
  head/sys/netinet6/nd6_rtr.c
  head/usr.sbin/ndp/Makefile
  head/usr.sbin/ndp/ndp.c
  head/usr.sbin/rtadvd/Makefile
  head/usr.sbin/rtadvd/config.c
  head/usr.sbin/rtadvd/rtadvd.c
  head/usr.sbin/rtadvd/rtadvd.h

Modified: head/sbin/ifconfig/Makefile
==
--- head/sbin/ifconfig/Makefile Tue Oct 30 19:10:41 2018(r339928)
+++ head/sbin/ifconfig/Makefile Tue Oct 30 20:08:48 2018(r339929)
@@ -51,6 +51,9 @@ SRCS+=ifpfsync.c  # pfsync(4) support
 SRCS+= ifbridge.c  # bridge support
 SRCS+= iflagg.c# lagg support
 
+.if ${MK_EXPERIMENTAL} != "no"
+CFLAGS+= -DDRAFT_IETF_6MAN_IPV6ONLY_FLAG
+.endif
 .if ${MK_INET6_SUPPORT} != "no"
 CFLAGS+= -DINET6
 .endif

Modified: head/sbin/ifconfig/af_nd6.c
==
--- head/sbin/ifconfig/af_nd6.c Tue Oct 30 19:10:41 2018(r339928)
+++ head/sbin/ifconfig/af_nd6.c Tue Oct 30 20:08:48 2018(r339929)
@@ -57,9 +57,17 @@ static const char rcsid[] =
 #include "ifconfig.h"
 
 #defineMAX_SYSCTL_TRY  5
+#ifdef DRAFT_IETF_6MAN_IPV6ONLY_FLAG
 #defineND6BITS "\020\001PERFORMNUD\002ACCEPT_RTADV\003PREFER_SOURCE" \
"\004IFDISABLED\005DONT_SET_IFROUTE\006AUTO_LINKLOCAL" \
+   "\007NO_RADR\010NO_PREFER_IFACE\011NO_DAD" \
+   "\012IPV6_ONLY" \
+   "\020DEFAULTIF"
+#else
+#defineND6BITS "\020\001PERFORMNUD\002ACCEPT_RTADV\003PREFER_SOURCE" \
+   "\004IFDISABLED\005DONT_SET_IFROUTE\006AUTO_LINKLOCAL" \
"\007NO_RADR\010NO_PREFER_IFACE\011NO_DAD\020DEFAULTIF"
+#endif
 
 static int isnd6defif(int);
 void setnd6flags(const char *, int, int, const struct afswtch *);

Modified: head/sys/net/if_ethersubr.c
==
--- head/sys/net/if_ethersubr.c Tue Oct 30 19:10:41 2018(r339928)
+++ head/sys/net/if_ethersubr.c Tue Oct 30 20:08:48 2018(r339929)
@@ -475,6 +475,26 @@ ether_output_frame(struct ifnet *ifp, struct mbuf *m)
return (0);
}
 
+#ifdef EXPERIMENTAL
+#if defined(INET6) && defined(INET)
+   /* draft-ietf-6man-ipv6only-flag */
+   /* Catch ETHERTYPE_IP, and ETHERTYPE_ARP if we are v6-only. */
+   if ((ND_IFINFO(ifp)->flags & ND6_IFF_IPV6_ONLY) != 0) {
+   struct ether_header *eh;
+
+   eh = mtod(m, struct ether_header *);
+   switch (ntohs(eh->ether_type)) {
+   case ETHERTYPE_IP:
+   case ETHERTYPE_ARP:
+   m_freem(m);
+   return (EAFNOSUPPORT);
+   /* NOTREACHED */
+   break;
+   };
+   }
+#endif
+#endif
+
/*
 * Queue message on interface, update output statistics if
 * successful, and start output if interface not yet active.

Modified: head/sys/netinet/icmp6.h
==
--- head/sys/netinet/icmp6.hTue Oct 30 19:10:41 2018(r339928)
+++ head/sys/netinet/icmp6.h

svn commit: r339930 - head/sys/net

2018-10-30 Thread Bjoern A. Zeeb
Author: bz
Date: Tue Oct 30 20:45:15 2018
New Revision: 339930
URL: https://svnweb.freebsd.org/changeset/base/339930

Log:
  With more excessive use of modules, more kernel parts working with
  VIMAGE, and feature richness and global state increasing the 8k of
  vnet module space are no longer sufficient for people and loading
  multiple modules, e.g., pf(4) and ipl(4) or ipsec(4) will fail on
  the second module.
  
  Increase the module space to 8 * PAGE_SIZE which should be enough
  to hold multiple firewalls, ipsec, multicast (as in the old days was
  a problem), epair, carp, and any kind of other vnet enabled modules.
  
  Sadly this is a global byte array part of the vnet_set, so we cannot
  dynamically change its size;  otherwise a TUNABLE would have been
  a better solution.
  
  PR:   228854
  Reported by:  Ernie Luzar, Marek Zarychta
  Discussed with:   rgrimes on current
  MFC after:3 days

Modified:
  head/sys/net/vnet.c

Modified: head/sys/net/vnet.c
==
--- head/sys/net/vnet.c Tue Oct 30 20:08:48 2018(r339929)
+++ head/sys/net/vnet.c Tue Oct 30 20:45:15 2018(r339930)
@@ -171,7 +171,7 @@ static MALLOC_DEFINE(M_VNET_DATA, "vnet_data", "VNET d
  * we want the virtualized global variable space to be page-sized, we may
  * have more space than that in practice.
  */
-#defineVNET_MODMIN 8192
+#defineVNET_MODMIN (8 * PAGE_SIZE)
 #defineVNET_SIZE   roundup2(VNET_BYTES, PAGE_SIZE)
 
 /*
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r339931 - head/sys/kern

2018-10-30 Thread Bjoern A. Zeeb
Author: bz
Date: Tue Oct 30 20:51:03 2018
New Revision: 339931
URL: https://svnweb.freebsd.org/changeset/base/339931

Log:
  As a follow-up to r339930 and various reports implement logging in case
  we fail during module load because the pcpu or vnet module sections are
  full.  We did return a proper error but not leaving any indication to
  the user as to what the actual problem was.
  
  Even worse, on 12/13 currently we are seeing an unrelated error (ENOSYS
  instead of ENOSPC, which gets skipped over in kern_linker.c) to be
  printed which made problem diagnostics even harder.
  
  PR:   228854
  MFC after:3 days

Modified:
  head/sys/kern/link_elf.c
  head/sys/kern/link_elf_obj.c

Modified: head/sys/kern/link_elf.c
==
--- head/sys/kern/link_elf.cTue Oct 30 20:45:15 2018(r339930)
+++ head/sys/kern/link_elf.cTue Oct 30 20:51:03 2018(r339931)
@@ -637,8 +637,12 @@ parse_dpcpu(elf_file_t ef)
 * all per-cpu storage from that.
 */
ef->pcpu_base = (Elf_Addr)(uintptr_t)dpcpu_alloc(size);
-   if (ef->pcpu_base == 0)
+   if (ef->pcpu_base == 0) {
+   printf("%s: pcpu module space is out of space; "
+   "cannot allocate %d for %s\n",
+   __func__, size, ef->lf.pathname);
return (ENOSPC);
+   }
memcpy((void *)ef->pcpu_base, (void *)ef->pcpu_start, size);
dpcpu_copy((void *)ef->pcpu_base, size);
elf_set_add(&set_pcpu_list, ef->pcpu_start, ef->pcpu_stop,
@@ -670,8 +674,12 @@ parse_vnet(elf_file_t ef)
 * all per-vnet storage from that.
 */
ef->vnet_base = (Elf_Addr)(uintptr_t)vnet_data_alloc(size);
-   if (ef->vnet_base == 0)
+   if (ef->vnet_base == 0) {
+   printf("%s: vnet module space is out of space; "
+   "cannot allocate %d for %s\n",
+   __func__, size, ef->lf.pathname);
return (ENOSPC);
+   }
memcpy((void *)ef->vnet_base, (void *)ef->vnet_start, size);
vnet_data_copy((void *)ef->vnet_base, size);
elf_set_add(&set_vnet_list, ef->vnet_start, ef->vnet_stop,

Modified: head/sys/kern/link_elf_obj.c
==
--- head/sys/kern/link_elf_obj.cTue Oct 30 20:45:15 2018
(r339930)
+++ head/sys/kern/link_elf_obj.cTue Oct 30 20:51:03 2018
(r339931)
@@ -368,6 +368,10 @@ link_elf_link_preload(linker_class_t cls, const char *
 
dpcpu = dpcpu_alloc(shdr[i].sh_size);
if (dpcpu == NULL) {
+   printf("%s: pcpu module space is out "
+   "of space; cannot allocate %ld for "
+   "%s\n", __func__, shdr[i].sh_size,
+   filename);
error = ENOSPC;
goto out;
}
@@ -382,6 +386,10 @@ link_elf_link_preload(linker_class_t cls, const char *
 
vnet_data = vnet_data_alloc(shdr[i].sh_size);
if (vnet_data == NULL) {
+   printf("%s: vnet module space is out "
+   "of space; cannot allocate %ld for "
+   "%s\n", __func__, shdr[i].sh_size,
+   filename);
error = ENOSPC;
goto out;
}
@@ -847,14 +855,28 @@ link_elf_load_file(linker_class_t cls, const char *fil
else
ef->progtab[pb].name = "<>";
if (ef->progtab[pb].name != NULL && 
-   !strcmp(ef->progtab[pb].name, DPCPU_SETNAME))
+   !strcmp(ef->progtab[pb].name, DPCPU_SETNAME)) {
ef->progtab[pb].addr =
dpcpu_alloc(shdr[i].sh_size);
+   if (ef->progtab[pb].addr == NULL) {
+   printf("%s: pcpu module space is out "
+   "of space; cannot allocate %ld for "
+   "%s\n", __func__, shdr[i].sh_size,
+   filename);
+   }
+   }
 #ifdef VIMAGE
else if (ef->progtab[pb].name != NULL &&
-   !strcmp(ef->progtab[pb].name, VNET_SETNAME))
+   !strcmp(ef->progtab[pb].name, VNET_SETNAME)) {
ef->progtab[p

svn commit: r339932 - in stable: 10/sys/dev/pci 11/sys/dev/pci

2018-10-30 Thread John Baldwin
Author: jhb
Date: Tue Oct 30 21:31:32 2018
New Revision: 339932
URL: https://svnweb.freebsd.org/changeset/base/339932

Log:
  MFC 338408: Don't directly dereference a user pointer in the VPD ioctl.
  
  The PCIOCLISTVPD ioctl on /dev/pci is used to fetch a list of VPD
  key-value pairs for a specific PCI function.  It is used by
  'pciconf -l -V'.  The list is stored in a userland-supplied buffer as
  an array of variable-length structures where the key and data length
  are stored in a fixed-size header followed by the variable-length
  value as a byte array.  To facilitate walking this array in userland,
   provides a PVE_NEXT() helper macro to return a pointer
  to the next array element by reading the the length out of the current
  header and using it to compute the address of the next header.
  
  To simplify the implementation, the ioctl handler was also using
  PVE_NEXT() when on the user address of the user buffer to compute the
  user address of the next array element.  However, the PVE_NEXT() macro
  when used with a user address was reading the value's length by
  indirecting the user pointer.  The value was ready after the current
  record had been copied out to the user buffer, so it appeared to work
  on architectures where user addresses are directly dereferencable from
  the kernel (all but powerpc and i386 after the 4:4 split).  The recent
  enablement of SMAP on amd64 caught this violation however.  To fix,
  add a variant of PVE_NEXT() for use in the ioctl handler that takes an
  explicit value length.

Modified:
  stable/11/sys/dev/pci/pci_user.c
Directory Properties:
  stable/11/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/10/sys/dev/pci/pci_user.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/11/sys/dev/pci/pci_user.c
==
--- stable/11/sys/dev/pci/pci_user.cTue Oct 30 20:51:03 2018
(r339931)
+++ stable/11/sys/dev/pci/pci_user.cTue Oct 30 21:31:32 2018
(r339932)
@@ -406,6 +406,14 @@ pci_conf_match_old32(struct pci_match_conf_old32 *matc
 #endif /* COMPAT_FREEBSD32 */
 #endif /* PRE7_COMPAT */
 
+/*
+ * Like PVE_NEXT but takes an explicit length since 'pve' is a user
+ * pointer that cannot be dereferenced.
+ */
+#definePVE_NEXT_LEN(pve, datalen)  
\
+   ((struct pci_vpd_element *)((char *)(pve) + \
+   sizeof(struct pci_vpd_element) + (datalen)))
+
 static int
 pci_list_vpd(device_t dev, struct pci_list_vpd_io *lvio)
 {
@@ -454,7 +462,7 @@ pci_list_vpd(device_t dev, struct pci_list_vpd_io *lvi
strlen(vpd->vpd_ident));
if (error)
return (error);
-   vpd_user = PVE_NEXT(vpd_user);
+   vpd_user = PVE_NEXT_LEN(vpd_user, vpd_element.pve_datalen);
vpd_element.pve_flags = 0;
for (i = 0; i < vpd->vpd_rocnt; i++) {
vpd_element.pve_keyword[0] = vpd->vpd_ros[i].keyword[0];
@@ -467,7 +475,7 @@ pci_list_vpd(device_t dev, struct pci_list_vpd_io *lvi
vpd->vpd_ros[i].len);
if (error)
return (error);
-   vpd_user = PVE_NEXT(vpd_user);
+   vpd_user = PVE_NEXT_LEN(vpd_user, vpd_element.pve_datalen);
}
vpd_element.pve_flags = PVE_FLAG_RW;
for (i = 0; i < vpd->vpd_wcnt; i++) {
@@ -481,7 +489,7 @@ pci_list_vpd(device_t dev, struct pci_list_vpd_io *lvi
vpd->vpd_w[i].len);
if (error)
return (error);
-   vpd_user = PVE_NEXT(vpd_user);
+   vpd_user = PVE_NEXT_LEN(vpd_user, vpd_element.pve_datalen);
}
KASSERT((char *)vpd_user - (char *)lvio->plvi_data == len,
("length mismatch"));
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r339932 - in stable: 10/sys/dev/pci 11/sys/dev/pci

2018-10-30 Thread John Baldwin
Author: jhb
Date: Tue Oct 30 21:31:32 2018
New Revision: 339932
URL: https://svnweb.freebsd.org/changeset/base/339932

Log:
  MFC 338408: Don't directly dereference a user pointer in the VPD ioctl.
  
  The PCIOCLISTVPD ioctl on /dev/pci is used to fetch a list of VPD
  key-value pairs for a specific PCI function.  It is used by
  'pciconf -l -V'.  The list is stored in a userland-supplied buffer as
  an array of variable-length structures where the key and data length
  are stored in a fixed-size header followed by the variable-length
  value as a byte array.  To facilitate walking this array in userland,
   provides a PVE_NEXT() helper macro to return a pointer
  to the next array element by reading the the length out of the current
  header and using it to compute the address of the next header.
  
  To simplify the implementation, the ioctl handler was also using
  PVE_NEXT() when on the user address of the user buffer to compute the
  user address of the next array element.  However, the PVE_NEXT() macro
  when used with a user address was reading the value's length by
  indirecting the user pointer.  The value was ready after the current
  record had been copied out to the user buffer, so it appeared to work
  on architectures where user addresses are directly dereferencable from
  the kernel (all but powerpc and i386 after the 4:4 split).  The recent
  enablement of SMAP on amd64 caught this violation however.  To fix,
  add a variant of PVE_NEXT() for use in the ioctl handler that takes an
  explicit value length.

Modified:
  stable/10/sys/dev/pci/pci_user.c
Directory Properties:
  stable/10/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/11/sys/dev/pci/pci_user.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/10/sys/dev/pci/pci_user.c
==
--- stable/10/sys/dev/pci/pci_user.cTue Oct 30 20:51:03 2018
(r339931)
+++ stable/10/sys/dev/pci/pci_user.cTue Oct 30 21:31:32 2018
(r339932)
@@ -406,6 +406,14 @@ pci_conf_match_old32(struct pci_match_conf_old32 *matc
 #endif /* COMPAT_FREEBSD32 */
 #endif /* PRE7_COMPAT */
 
+/*
+ * Like PVE_NEXT but takes an explicit length since 'pve' is a user
+ * pointer that cannot be dereferenced.
+ */
+#definePVE_NEXT_LEN(pve, datalen)  
\
+   ((struct pci_vpd_element *)((char *)(pve) + \
+   sizeof(struct pci_vpd_element) + (datalen)))
+
 static int
 pci_list_vpd(device_t dev, struct pci_list_vpd_io *lvio)
 {
@@ -454,7 +462,7 @@ pci_list_vpd(device_t dev, struct pci_list_vpd_io *lvi
strlen(vpd->vpd_ident));
if (error)
return (error);
-   vpd_user = PVE_NEXT(vpd_user);
+   vpd_user = PVE_NEXT_LEN(vpd_user, vpd_element.pve_datalen);
vpd_element.pve_flags = 0;
for (i = 0; i < vpd->vpd_rocnt; i++) {
vpd_element.pve_keyword[0] = vpd->vpd_ros[i].keyword[0];
@@ -467,7 +475,7 @@ pci_list_vpd(device_t dev, struct pci_list_vpd_io *lvi
vpd->vpd_ros[i].len);
if (error)
return (error);
-   vpd_user = PVE_NEXT(vpd_user);
+   vpd_user = PVE_NEXT_LEN(vpd_user, vpd_element.pve_datalen);
}
vpd_element.pve_flags = PVE_FLAG_RW;
for (i = 0; i < vpd->vpd_wcnt; i++) {
@@ -481,7 +489,7 @@ pci_list_vpd(device_t dev, struct pci_list_vpd_io *lvi
vpd->vpd_w[i].len);
if (error)
return (error);
-   vpd_user = PVE_NEXT(vpd_user);
+   vpd_user = PVE_NEXT_LEN(vpd_user, vpd_element.pve_datalen);
}
KASSERT((char *)vpd_user - (char *)lvio->plvi_data == len,
("length mismatch"));
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r339933 - head/sys/kern

2018-10-30 Thread Bjoern A. Zeeb
Author: bz
Date: Tue Oct 30 21:35:56 2018
New Revision: 339933
URL: https://svnweb.freebsd.org/changeset/base/339933

Log:
  Fix mips build after r339931.
  I erroneously thought that it was two 64bit platforms which use 
link_elf_obj.c.
  
  PR:   228854
  Reported by:  ci.f.o.
  MFC after:3 days
  X-MFC with:   r339931
  Pointyhat to: bz

Modified:
  head/sys/kern/link_elf_obj.c

Modified: head/sys/kern/link_elf_obj.c
==
--- head/sys/kern/link_elf_obj.cTue Oct 30 21:31:32 2018
(r339932)
+++ head/sys/kern/link_elf_obj.cTue Oct 30 21:35:56 2018
(r339933)
@@ -369,8 +369,9 @@ link_elf_link_preload(linker_class_t cls, const char *
dpcpu = dpcpu_alloc(shdr[i].sh_size);
if (dpcpu == NULL) {
printf("%s: pcpu module space is out "
-   "of space; cannot allocate %ld for "
-   "%s\n", __func__, shdr[i].sh_size,
+   "of space; cannot allocate %#jx "
+   "for %s\n", __func__,
+   (uintmax_t)shdr[i].sh_size,
filename);
error = ENOSPC;
goto out;
@@ -387,8 +388,9 @@ link_elf_link_preload(linker_class_t cls, const char *
vnet_data = vnet_data_alloc(shdr[i].sh_size);
if (vnet_data == NULL) {
printf("%s: vnet module space is out "
-   "of space; cannot allocate %ld for "
-   "%s\n", __func__, shdr[i].sh_size,
+   "of space; cannot allocate %#jx "
+   "for %s\n", __func__,
+   (uintmax_t)shdr[i].sh_size,
filename);
error = ENOSPC;
goto out;
@@ -860,8 +862,9 @@ link_elf_load_file(linker_class_t cls, const char *fil
dpcpu_alloc(shdr[i].sh_size);
if (ef->progtab[pb].addr == NULL) {
printf("%s: pcpu module space is out "
-   "of space; cannot allocate %ld for "
-   "%s\n", __func__, shdr[i].sh_size,
+   "of space; cannot allocate %#jx "
+   "for %s\n", __func__,
+   (uintmax_t)shdr[i].sh_size,
filename);
}
}
@@ -872,8 +875,9 @@ link_elf_load_file(linker_class_t cls, const char *fil
vnet_data_alloc(shdr[i].sh_size);
if (ef->progtab[pb].addr == NULL) {
printf("%s: vnet module space is out "
-   "of space; cannot allocate %ld for "
-   "%s\n", __func__, shdr[i].sh_size,
+   "of space; cannot allocate %#jx "
+   "for %s\n", __func__,
+   (uintmax_t)shdr[i].sh_size,
filename);
}
}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r339934 - head/sys/vm

2018-10-30 Thread Mark Johnston
Author: markj
Date: Tue Oct 30 22:40:40 2018
New Revision: 339934
URL: https://svnweb.freebsd.org/changeset/base/339934

Log:
  Revert r336984.
  
  It appears to be responsible for random segfaults observed when lots
  of paging activity is taking place, but the root cause is not yet
  understood.
  
  Requested by: alc
  MFC after:now

Modified:
  head/sys/vm/vm_object.c

Modified: head/sys/vm/vm_object.c
==
--- head/sys/vm/vm_object.c Tue Oct 30 21:35:56 2018(r339933)
+++ head/sys/vm/vm_object.c Tue Oct 30 22:40:40 2018(r339934)
@@ -2143,9 +2143,8 @@ vm_object_coalesce(vm_object_t prev_object, vm_ooffset
next_size >>= PAGE_SHIFT;
next_pindex = OFF_TO_IDX(prev_offset) + prev_size;
 
-   if (prev_object->ref_count > 1 &&
-   prev_object->size != next_pindex &&
-   (prev_object->flags & OBJ_ONEMAPPING) == 0) {
+   if ((prev_object->ref_count > 1) &&
+   (prev_object->size != next_pindex)) {
VM_OBJECT_WUNLOCK(prev_object);
return (FALSE);
}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r339935 - stable/12/sys/vm

2018-10-30 Thread Mark Johnston
Author: markj
Date: Tue Oct 30 23:09:04 2018
New Revision: 339935
URL: https://svnweb.freebsd.org/changeset/base/339935

Log:
  MFC r339934:
  Revert r336984.
  
  Approved by:  re (kib)

Modified:
  stable/12/sys/vm/vm_object.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/vm/vm_object.c
==
--- stable/12/sys/vm/vm_object.cTue Oct 30 22:40:40 2018
(r339934)
+++ stable/12/sys/vm/vm_object.cTue Oct 30 23:09:04 2018
(r339935)
@@ -2142,9 +2142,8 @@ vm_object_coalesce(vm_object_t prev_object, vm_ooffset
next_size >>= PAGE_SHIFT;
next_pindex = OFF_TO_IDX(prev_offset) + prev_size;
 
-   if (prev_object->ref_count > 1 &&
-   prev_object->size != next_pindex &&
-   (prev_object->flags & OBJ_ONEMAPPING) == 0) {
+   if ((prev_object->ref_count > 1) &&
+   (prev_object->size != next_pindex)) {
VM_OBJECT_WUNLOCK(prev_object);
return (FALSE);
}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2018-10-30 Thread Marcelo Araujo
Author: araujo
Date: Wed Oct 31 01:27:44 2018
New Revision: 339936
URL: https://svnweb.freebsd.org/changeset/base/339936

Log:
  Merge cases with upper block.
  This is a cosmetic change only to simplify code.
  
  Reported by:  anish
  Sponsored by: iXsystems Inc.

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

Modified: head/sys/amd64/vmm/amd/svm_msr.c
==
--- head/sys/amd64/vmm/amd/svm_msr.cTue Oct 30 23:09:04 2018
(r339935)
+++ head/sys/amd64/vmm/amd/svm_msr.cWed Oct 31 01:27:44 2018
(r339936)
@@ -122,11 +122,7 @@ svm_rdmsr(struct svm_softc *sc, int vcpu, u_int num, u
case MSR_MTRR16kBase ... MSR_MTRR16kBase + 1:
case MSR_MTRR64kBase:
case MSR_SYSCFG:
-   *result = 0;
-   break;
case MSR_AMDK8_IPM:
-   *result = 0;
-   break;
case MSR_EXTFEATURES:
*result = 0;
break;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r339937 - stable/12/contrib/tzdata

2018-10-30 Thread Philip Paeps
Author: philip
Date: Wed Oct 31 01:57:51 2018
New Revision: 339937
URL: https://svnweb.freebsd.org/changeset/base/339937

Log:
  MFC r339848: mport tzdata 2018g
  
  Approved by:  re (kib)

Modified:
  stable/12/contrib/tzdata/NEWS
  stable/12/contrib/tzdata/africa
  stable/12/contrib/tzdata/europe
  stable/12/contrib/tzdata/northamerica
  stable/12/contrib/tzdata/theory.html
  stable/12/contrib/tzdata/version
  stable/12/contrib/tzdata/ziguard.awk
  stable/12/contrib/tzdata/zishrink.awk
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/contrib/tzdata/NEWS
==
--- stable/12/contrib/tzdata/NEWS   Wed Oct 31 01:27:44 2018
(r339936)
+++ stable/12/contrib/tzdata/NEWS   Wed Oct 31 01:57:51 2018
(r339937)
@@ -1,5 +1,40 @@
 News for the tz database
 
+Release 2018g - 2018-10-26 22:22:45 -0700
+
+  Briefly:
+Morocco switches to permanent +01 on 2018-10-27.
+
+  Changes to future timestamps
+
+Morocco switches from +00/+01 to permanent +01 effective 2018-10-27,
+so its clocks will not fall back on 2018-10-28 as previously scheduled.
+(Thanks to Mohamed Essedik Najd and Brian Inglis.)
+
+  Changes to code
+
+When generating TZif files with leap seconds, zic no longer uses a
+format that trips up older 32-bit clients, fixing a bug introduced
+in 2018f.  (Reported by Daniel Fischer.)  Also, the zic workaround
+for QTBUG-53071 now also works for TZif files with leap seconds.
+
+The translator to rearguard format now rewrites the line
+"Rule Japan 1948 1951 - Sep Sat>=8 25:00 0 S" to
+"Rule Japan 1948 1951 - Sep Sun>=9  1:00 0 S".
+This caters to zic before 2007 and to Oracle TZUpdater 2.2.0
+and earlier.  (Reported by Christos Zoulas.)
+
+  Changes to past time zone abbreviations
+
+Change HDT to HWT/HPT for WWII-era abbreviations in Hawaii.
+This reverts to 2011h, as the abbreviation change in 2011i was
+likely inadvertent.
+
+  Changes to documentation
+
+tzfile.5 has new sections on interoperability issues.
+
+
 Release 2018f - 2018-10-18 00:14:18 -0700
 
   Briefly:

Modified: stable/12/contrib/tzdata/africa
==
--- stable/12/contrib/tzdata/africa Wed Oct 31 01:27:44 2018
(r339936)
+++ stable/12/contrib/tzdata/africa Wed Oct 31 01:57:51 2018
(r339937)
@@ -844,94 +844,61 @@ Zone Indian/Mauritius 3:50:00 -   LMT 1907 # 
Port Louis
 #  agrees
 # with the patch.
 
-# From Paul Eggert (2015-06-08):
-# For now, guess that later spring and fall transitions will use 2015's rules,
-# and guess that Morocco will switch to standard time at 03:00 the last
-# Sunday before Ramadan, and back to DST at 02:00 the first Sunday after
-# Ramadan.  To implement this, transition dates for 2016 through 2037 were
-# determined by running the following program under GNU Emacs 24.3, with the
-# results integrated by hand into the table below.
-# (let ((islamic-year 1437))
-#   (require 'cal-islam)
-#   (while (< islamic-year 1460)
-# (let ((a (calendar-islamic-to-absolute (list 9 1 islamic-year)))
-#   (b (calendar-islamic-to-absolute (list 10 1 islamic-year)))
-#   (sunday 0))
-#   (while (/= sunday (mod (setq a (1- a)) 7)))
-#   (while (/= sunday (mod b 7))
-# (setq b (1+ b)))
-#   (setq a (calendar-gregorian-from-absolute a))
-#   (setq b (calendar-gregorian-from-absolute b))
-#   (insert
-#(format
-# (concat "Rule\tMorocco\t%d\tonly\t-\t%s\t%2d\t 3:00\t0\t-\n"
-# "Rule\tMorocco\t%d\tonly\t-\t%s\t%2d\t 2:00\t1:00\tS\n")
-# (car (cdr (cdr a))) (calendar-month-name (car a) t) (car (cdr a))
-# (car (cdr (cdr b))) (calendar-month-name (car b) t) (car (cdr b)
-# (setq islamic-year (+ 1 islamic-year
+# From Mohamed Essedik Najd (2018-10-26):
+# Today, a Moroccan government council approved the perpetual addition
+# of 60 minutes to the regular Moroccan timezone.
+# From Brian Inglis (2018-10-26):
+# 
http://www.maroc.ma/fr/actualites/le-conseil-de-gouvernement-adopte-un-projet-de-decret-relatif-lheure-legale-stipulant-le
 
 # RULE NAMEFROMTO  TYPEIN  ON  AT  SAVELETTER/S
-
-Rule   Morocco 1939only-   Sep 12   0:00   1:00S
+Rule   Morocco 1939only-   Sep 12   0:00   1:00-
 Rule   Morocco 1939only-   Nov 19   0:00   0   -
-Rule   Morocco 1940only-   Feb 25   0:00   1:00S
+Rule   Morocco 1940only-   Feb 25   0:00   1:00-
 Rule   Morocco 1945only-   Nov 18   0:00   0   -
-Rule   Morocco 1950only-   Jun 11   0:00   1:00S
+Rule   Morocco 1950only-   Jun 11   0:00   

svn commit: r339939 - in stable/12: share/man/man9 sys/kern sys/sys sys/vm sys/x86/acpica

2018-10-30 Thread Mark Johnston
Author: markj
Date: Wed Oct 31 02:02:12 2018
New Revision: 339939
URL: https://svnweb.freebsd.org/changeset/base/339939

Log:
  MFC r339452, r339664:
  Create some global domainsets and refactor NUMA registration.
  
  Approved by:  re (kib)

Modified:
  stable/12/share/man/man9/domainset.9
  stable/12/sys/kern/kern_cpuset.c
  stable/12/sys/sys/domainset.h
  stable/12/sys/vm/vm_init.c
  stable/12/sys/vm/vm_phys.c
  stable/12/sys/vm/vm_phys.h
  stable/12/sys/x86/acpica/srat.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/share/man/man9/domainset.9
==
--- stable/12/share/man/man9/domainset.9Wed Oct 31 02:01:28 2018
(r339938)
+++ stable/12/share/man/man9/domainset.9Wed Oct 31 02:02:12 2018
(r339939)
@@ -24,14 +24,11 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd March 24, 2018
+.Dd October 20, 2018
 .Dt DOMAINSET 9
 .Os
 .Sh NAME
 .Nm domainset(9)
-\(em
-.Nm domainset_create ,
-.Nm sysctl_handle_domainset .
 .Nd domainset functions and operation
 .Sh SYNOPSIS
 .In sys/_domainset.h
@@ -46,6 +43,8 @@ struct domainset {
 };
 .Ed
 .Pp
+.Fn DOMAINSET_RR
+.Fn DOMAINSET_PREF domain
 .Ft struct domainset *
 .Fn domainset_create "const struct domainset *key"
 .Ft int
@@ -98,6 +97,12 @@ This gives good distribution among memory domains whil
 efficiency higher and is preferential to round-robin for general use.
 .El
 .Pp
+The
+.Fn DOMAINSET_RR
+and
+.Fn DOMAINSET_PREF
+provide pointers to global pre-defined policies for use when the
+desired policy is known at compile time.
 The
 .Fn domainset_create
 function takes a partially filled in domainset as a key and returns a

Modified: stable/12/sys/kern/kern_cpuset.c
==
--- stable/12/sys/kern/kern_cpuset.cWed Oct 31 02:01:28 2018
(r339938)
+++ stable/12/sys/kern/kern_cpuset.cWed Oct 31 02:02:12 2018
(r339939)
@@ -119,6 +119,8 @@ __FBSDID("$FreeBSD$");
  */
 
 LIST_HEAD(domainlist, domainset);
+struct domainset __read_mostly domainset_prefer[MAXMEMDOM];
+struct domainset __read_mostly domainset_roundrobin;
 
 static uma_zone_t cpuset_zone;
 static uma_zone_t domainset_zone;
@@ -1369,28 +1371,53 @@ cpuset_setithread(lwpid_t id, int cpu)
 }
 
 /*
+ * Initialize static domainsets after NUMA information is available.  This is
+ * called very early during boot.
+ */
+void
+domainset_init(void)
+{
+   struct domainset *dset;
+   int i;
+
+   dset = &domainset_roundrobin;
+   DOMAINSET_COPY(&all_domains, &dset->ds_mask);
+   dset->ds_policy = DOMAINSET_POLICY_ROUNDROBIN;
+   dset->ds_prefer = -1;
+   _domainset_create(dset, NULL);
+
+   for (i = 0; i < vm_ndomains; i++) {
+   dset = &domainset_prefer[i];
+   DOMAINSET_COPY(&all_domains, &dset->ds_mask);
+   dset->ds_policy = DOMAINSET_POLICY_PREFER;
+   dset->ds_prefer = i;
+   _domainset_create(dset, NULL);
+   }
+}
+
+/*
  * Create the domainset for cpuset 0, 1 and cpuset 2.
  */
 void
 domainset_zero(void)
 {
struct domainset *dset;
-   int i;
 
mtx_init(&cpuset_lock, "cpuset", NULL, MTX_SPIN | MTX_RECURSE);
 
dset = &domainset0;
-   DOMAINSET_ZERO(&dset->ds_mask);
-   for (i = 0; i < vm_ndomains; i++)
-   DOMAINSET_SET(i, &dset->ds_mask);
+   DOMAINSET_COPY(&all_domains, &dset->ds_mask);
dset->ds_policy = DOMAINSET_POLICY_FIRSTTOUCH;
dset->ds_prefer = -1;
-   (void)domainset_empty_vm(dset);
curthread->td_domain.dr_policy = _domainset_create(dset, NULL);
 
domainset_copy(dset, &domainset2);
domainset2.ds_policy = DOMAINSET_POLICY_INTERLEAVE;
kernel_object->domain.dr_policy = _domainset_create(&domainset2, NULL);
+
+   /* Remove empty domains from the global policies. */
+   LIST_FOREACH(dset, &cpuset_domains, ds_link)
+   (void)domainset_empty_vm(dset);
 }
 
 /*

Modified: stable/12/sys/sys/domainset.h
==
--- stable/12/sys/sys/domainset.h   Wed Oct 31 02:01:28 2018
(r339938)
+++ stable/12/sys/sys/domainset.h   Wed Oct 31 02:02:12 2018
(r339939)
@@ -32,8 +32,8 @@
 #define_SYS_DOMAINSET_H_
 
 #include 
-
 #include 
+#include 
 
 #define_NDOMAINSETBITS _BITSET_BITS
 #define_NDOMAINSETWORDS
__bitset_words(DOMAINSET_SETSIZE)
@@ -96,6 +96,12 @@ struct domainset {
domainid_t  ds_order[MAXMEMDOM];  /* nth domain table. */
 };
 
+extern struct domainset domainset_prefer[MAXMEMDOM];
+#defineDOMAINSET_PREF(domain)  (&domainset_prefer[(domain)])
+extern struct domainset domainset_roundrobin;
+#defineDOMAINSET_RR()  (&domainset_roundrobin)
+
+void domainset_init(void);
 void domainset_zero(void);
 
 /*

Modified: stable

svn commit: r339938 - stable/11/contrib/tzdata

2018-10-30 Thread Philip Paeps
Author: philip
Date: Wed Oct 31 02:01:28 2018
New Revision: 339938
URL: https://svnweb.freebsd.org/changeset/base/339938

Log:
  MFC r339848: Import tzdata 2018g

Modified:
  stable/11/contrib/tzdata/NEWS
  stable/11/contrib/tzdata/africa
  stable/11/contrib/tzdata/europe
  stable/11/contrib/tzdata/northamerica
  stable/11/contrib/tzdata/theory.html
  stable/11/contrib/tzdata/version
  stable/11/contrib/tzdata/ziguard.awk
  stable/11/contrib/tzdata/zishrink.awk
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/contrib/tzdata/NEWS
==
--- stable/11/contrib/tzdata/NEWS   Wed Oct 31 01:57:51 2018
(r339937)
+++ stable/11/contrib/tzdata/NEWS   Wed Oct 31 02:01:28 2018
(r339938)
@@ -1,5 +1,40 @@
 News for the tz database
 
+Release 2018g - 2018-10-26 22:22:45 -0700
+
+  Briefly:
+Morocco switches to permanent +01 on 2018-10-27.
+
+  Changes to future timestamps
+
+Morocco switches from +00/+01 to permanent +01 effective 2018-10-27,
+so its clocks will not fall back on 2018-10-28 as previously scheduled.
+(Thanks to Mohamed Essedik Najd and Brian Inglis.)
+
+  Changes to code
+
+When generating TZif files with leap seconds, zic no longer uses a
+format that trips up older 32-bit clients, fixing a bug introduced
+in 2018f.  (Reported by Daniel Fischer.)  Also, the zic workaround
+for QTBUG-53071 now also works for TZif files with leap seconds.
+
+The translator to rearguard format now rewrites the line
+"Rule Japan 1948 1951 - Sep Sat>=8 25:00 0 S" to
+"Rule Japan 1948 1951 - Sep Sun>=9  1:00 0 S".
+This caters to zic before 2007 and to Oracle TZUpdater 2.2.0
+and earlier.  (Reported by Christos Zoulas.)
+
+  Changes to past time zone abbreviations
+
+Change HDT to HWT/HPT for WWII-era abbreviations in Hawaii.
+This reverts to 2011h, as the abbreviation change in 2011i was
+likely inadvertent.
+
+  Changes to documentation
+
+tzfile.5 has new sections on interoperability issues.
+
+
 Release 2018f - 2018-10-18 00:14:18 -0700
 
   Briefly:

Modified: stable/11/contrib/tzdata/africa
==
--- stable/11/contrib/tzdata/africa Wed Oct 31 01:57:51 2018
(r339937)
+++ stable/11/contrib/tzdata/africa Wed Oct 31 02:01:28 2018
(r339938)
@@ -844,94 +844,61 @@ Zone Indian/Mauritius 3:50:00 -   LMT 1907 # 
Port Louis
 #  agrees
 # with the patch.
 
-# From Paul Eggert (2015-06-08):
-# For now, guess that later spring and fall transitions will use 2015's rules,
-# and guess that Morocco will switch to standard time at 03:00 the last
-# Sunday before Ramadan, and back to DST at 02:00 the first Sunday after
-# Ramadan.  To implement this, transition dates for 2016 through 2037 were
-# determined by running the following program under GNU Emacs 24.3, with the
-# results integrated by hand into the table below.
-# (let ((islamic-year 1437))
-#   (require 'cal-islam)
-#   (while (< islamic-year 1460)
-# (let ((a (calendar-islamic-to-absolute (list 9 1 islamic-year)))
-#   (b (calendar-islamic-to-absolute (list 10 1 islamic-year)))
-#   (sunday 0))
-#   (while (/= sunday (mod (setq a (1- a)) 7)))
-#   (while (/= sunday (mod b 7))
-# (setq b (1+ b)))
-#   (setq a (calendar-gregorian-from-absolute a))
-#   (setq b (calendar-gregorian-from-absolute b))
-#   (insert
-#(format
-# (concat "Rule\tMorocco\t%d\tonly\t-\t%s\t%2d\t 3:00\t0\t-\n"
-# "Rule\tMorocco\t%d\tonly\t-\t%s\t%2d\t 2:00\t1:00\tS\n")
-# (car (cdr (cdr a))) (calendar-month-name (car a) t) (car (cdr a))
-# (car (cdr (cdr b))) (calendar-month-name (car b) t) (car (cdr b)
-# (setq islamic-year (+ 1 islamic-year
+# From Mohamed Essedik Najd (2018-10-26):
+# Today, a Moroccan government council approved the perpetual addition
+# of 60 minutes to the regular Moroccan timezone.
+# From Brian Inglis (2018-10-26):
+# 
http://www.maroc.ma/fr/actualites/le-conseil-de-gouvernement-adopte-un-projet-de-decret-relatif-lheure-legale-stipulant-le
 
 # RULE NAMEFROMTO  TYPEIN  ON  AT  SAVELETTER/S
-
-Rule   Morocco 1939only-   Sep 12   0:00   1:00S
+Rule   Morocco 1939only-   Sep 12   0:00   1:00-
 Rule   Morocco 1939only-   Nov 19   0:00   0   -
-Rule   Morocco 1940only-   Feb 25   0:00   1:00S
+Rule   Morocco 1940only-   Feb 25   0:00   1:00-
 Rule   Morocco 1945only-   Nov 18   0:00   0   -
-Rule   Morocco 1950only-   Jun 11   0:00   1:00S
+Rule   Morocco 1950only-   Jun 11   0:00   1:00-
 Rule   Morocco 1

svn commit: r339940 - stable/10/contrib/tzdata

2018-10-30 Thread Philip Paeps
Author: philip
Date: Wed Oct 31 02:02:41 2018
New Revision: 339940
URL: https://svnweb.freebsd.org/changeset/base/339940

Log:
  MFC r339848: Import tzdata 2018g

Modified:
  stable/10/contrib/tzdata/NEWS
  stable/10/contrib/tzdata/africa
  stable/10/contrib/tzdata/europe
  stable/10/contrib/tzdata/northamerica
  stable/10/contrib/tzdata/theory.html
  stable/10/contrib/tzdata/version
  stable/10/contrib/tzdata/ziguard.awk
  stable/10/contrib/tzdata/zishrink.awk
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/contrib/tzdata/NEWS
==
--- stable/10/contrib/tzdata/NEWS   Wed Oct 31 02:02:12 2018
(r339939)
+++ stable/10/contrib/tzdata/NEWS   Wed Oct 31 02:02:41 2018
(r339940)
@@ -1,5 +1,40 @@
 News for the tz database
 
+Release 2018g - 2018-10-26 22:22:45 -0700
+
+  Briefly:
+Morocco switches to permanent +01 on 2018-10-27.
+
+  Changes to future timestamps
+
+Morocco switches from +00/+01 to permanent +01 effective 2018-10-27,
+so its clocks will not fall back on 2018-10-28 as previously scheduled.
+(Thanks to Mohamed Essedik Najd and Brian Inglis.)
+
+  Changes to code
+
+When generating TZif files with leap seconds, zic no longer uses a
+format that trips up older 32-bit clients, fixing a bug introduced
+in 2018f.  (Reported by Daniel Fischer.)  Also, the zic workaround
+for QTBUG-53071 now also works for TZif files with leap seconds.
+
+The translator to rearguard format now rewrites the line
+"Rule Japan 1948 1951 - Sep Sat>=8 25:00 0 S" to
+"Rule Japan 1948 1951 - Sep Sun>=9  1:00 0 S".
+This caters to zic before 2007 and to Oracle TZUpdater 2.2.0
+and earlier.  (Reported by Christos Zoulas.)
+
+  Changes to past time zone abbreviations
+
+Change HDT to HWT/HPT for WWII-era abbreviations in Hawaii.
+This reverts to 2011h, as the abbreviation change in 2011i was
+likely inadvertent.
+
+  Changes to documentation
+
+tzfile.5 has new sections on interoperability issues.
+
+
 Release 2018f - 2018-10-18 00:14:18 -0700
 
   Briefly:

Modified: stable/10/contrib/tzdata/africa
==
--- stable/10/contrib/tzdata/africa Wed Oct 31 02:02:12 2018
(r339939)
+++ stable/10/contrib/tzdata/africa Wed Oct 31 02:02:41 2018
(r339940)
@@ -844,94 +844,61 @@ Zone Indian/Mauritius 3:50:00 -   LMT 1907 # 
Port Louis
 #  agrees
 # with the patch.
 
-# From Paul Eggert (2015-06-08):
-# For now, guess that later spring and fall transitions will use 2015's rules,
-# and guess that Morocco will switch to standard time at 03:00 the last
-# Sunday before Ramadan, and back to DST at 02:00 the first Sunday after
-# Ramadan.  To implement this, transition dates for 2016 through 2037 were
-# determined by running the following program under GNU Emacs 24.3, with the
-# results integrated by hand into the table below.
-# (let ((islamic-year 1437))
-#   (require 'cal-islam)
-#   (while (< islamic-year 1460)
-# (let ((a (calendar-islamic-to-absolute (list 9 1 islamic-year)))
-#   (b (calendar-islamic-to-absolute (list 10 1 islamic-year)))
-#   (sunday 0))
-#   (while (/= sunday (mod (setq a (1- a)) 7)))
-#   (while (/= sunday (mod b 7))
-# (setq b (1+ b)))
-#   (setq a (calendar-gregorian-from-absolute a))
-#   (setq b (calendar-gregorian-from-absolute b))
-#   (insert
-#(format
-# (concat "Rule\tMorocco\t%d\tonly\t-\t%s\t%2d\t 3:00\t0\t-\n"
-# "Rule\tMorocco\t%d\tonly\t-\t%s\t%2d\t 2:00\t1:00\tS\n")
-# (car (cdr (cdr a))) (calendar-month-name (car a) t) (car (cdr a))
-# (car (cdr (cdr b))) (calendar-month-name (car b) t) (car (cdr b)
-# (setq islamic-year (+ 1 islamic-year
+# From Mohamed Essedik Najd (2018-10-26):
+# Today, a Moroccan government council approved the perpetual addition
+# of 60 minutes to the regular Moroccan timezone.
+# From Brian Inglis (2018-10-26):
+# 
http://www.maroc.ma/fr/actualites/le-conseil-de-gouvernement-adopte-un-projet-de-decret-relatif-lheure-legale-stipulant-le
 
 # RULE NAMEFROMTO  TYPEIN  ON  AT  SAVELETTER/S
-
-Rule   Morocco 1939only-   Sep 12   0:00   1:00S
+Rule   Morocco 1939only-   Sep 12   0:00   1:00-
 Rule   Morocco 1939only-   Nov 19   0:00   0   -
-Rule   Morocco 1940only-   Feb 25   0:00   1:00S
+Rule   Morocco 1940only-   Feb 25   0:00   1:00-
 Rule   Morocco 1945only-   Nov 18   0:00   0   -
-Rule   Morocco 1950only-   Jun 11   0:00   1:00S
+Rule   Morocco 1950only-   Jun 11   0:00   1:00-
 Rule   Morocco 1

svn commit: r339941 - in head/sbin: fsck_ffs fsdb

2018-10-30 Thread Kirk McKusick
Author: mckusick
Date: Wed Oct 31 05:17:53 2018
New Revision: 339941
URL: https://svnweb.freebsd.org/changeset/base/339941

Log:
  In preparation for adding inode check-hashes, change the fsck_ffs
  inodirty() function to have a pointer to the inode being dirtied.
  No functional change (as for now the parameter is ununsed).
  
  Sponsored by: Netflix

Modified:
  head/sbin/fsck_ffs/dir.c
  head/sbin/fsck_ffs/fsck.h
  head/sbin/fsck_ffs/inode.c
  head/sbin/fsck_ffs/pass1.c
  head/sbin/fsck_ffs/pass2.c
  head/sbin/fsdb/fsdb.c

Modified: head/sbin/fsck_ffs/dir.c
==
--- head/sbin/fsck_ffs/dir.cWed Oct 31 02:02:41 2018(r339940)
+++ head/sbin/fsck_ffs/dir.cWed Oct 31 05:17:53 2018(r339941)
@@ -323,7 +323,7 @@ adjust(struct inodesc *idesc, int lcnt)
if (preen || reply("ADJUST") == 1) {
if (bkgrdflag == 0) {
DIP_SET(dp, di_nlink, DIP(dp, di_nlink) - lcnt);
-   inodirty();
+   inodirty(dp);
} else {
cmd.value = idesc->id_number;
cmd.size = -lcnt;
@@ -449,7 +449,7 @@ linkup(ino_t orphan, ino_t parentdir, char *name)
pfatal("SORRY. CANNOT CREATE lost+found DIRECTORY\n\n");
return (0);
}
-   inodirty();
+   inodirty(dp);
idesc.id_type = ADDR;
idesc.id_func = pass4check;
idesc.id_number = oldlfdir;
@@ -474,7 +474,7 @@ linkup(ino_t orphan, ino_t parentdir, char *name)
(void)makeentry(orphan, lfdir, "..");
dp = ginode(lfdir);
DIP_SET(dp, di_nlink, DIP(dp, di_nlink) + 1);
-   inodirty();
+   inodirty(dp);
inoinfo(lfdir)->ino_linkcnt++;
pwarn("DIR I=%lu CONNECTED. ", (u_long)orphan);
if (parentdir != (ino_t)-1) {
@@ -535,7 +535,7 @@ makeentry(ino_t parent, ino_t ino, const char *name)
dp = ginode(parent);
if (DIP(dp, di_size) % DIRBLKSIZ) {
DIP_SET(dp, di_size, roundup(DIP(dp, di_size), DIRBLKSIZ));
-   inodirty();
+   inodirty(dp);
}
if ((ckinode(dp, &idesc) & ALTERED) != 0)
return (1);
@@ -591,7 +591,7 @@ expanddir(union dinode *dp, char *name)
else if (reply("EXPAND") == 0)
goto bad;
dirty(bp);
-   inodirty();
+   inodirty(dp);
return (1);
 bad:
DIP_SET(dp, di_db[lastbn], DIP(dp, di_db[lastbn + 1]));
@@ -632,7 +632,7 @@ allocdir(ino_t parent, ino_t request, int mode)
memmove(cp, &emptydir, sizeof emptydir);
dirty(bp);
DIP_SET(dp, di_nlink, 2);
-   inodirty();
+   inodirty(dp);
if (ino == UFS_ROOTINO) {
inoinfo(ino)->ino_linkcnt = DIP(dp, di_nlink);
cacheino(dp, ino);
@@ -653,7 +653,7 @@ allocdir(ino_t parent, ino_t request, int mode)
}
dp = ginode(parent);
DIP_SET(dp, di_nlink, DIP(dp, di_nlink) + 1);
-   inodirty();
+   inodirty(dp);
return (ino);
 }
 
@@ -668,7 +668,7 @@ freedir(ino_t ino, ino_t parent)
if (ino != parent) {
dp = ginode(parent);
DIP_SET(dp, di_nlink, DIP(dp, di_nlink) - 1);
-   inodirty();
+   inodirty(dp);
}
freeino(ino);
 }

Modified: head/sbin/fsck_ffs/fsck.h
==
--- head/sbin/fsck_ffs/fsck.h   Wed Oct 31 02:02:41 2018(r339940)
+++ head/sbin/fsck_ffs/fsck.h   Wed Oct 31 05:17:53 2018(r339941)
@@ -448,7 +448,7 @@ union dinode   *ginode(ino_t inumber);
 void   infohandler(int sig);
 void   alarmhandler(int sig);
 void   inocleanup(void);
-void   inodirty(void);
+void   inodirty(union dinode *);
 struct inostat *inoinfo(ino_t inum);
 void   IOstats(char *what);
 intlinkup(ino_t orphan, ino_t parentdir, char *name);

Modified: head/sbin/fsck_ffs/inode.c
==
--- head/sbin/fsck_ffs/inode.c  Wed Oct 31 02:02:41 2018(r339940)
+++ head/sbin/fsck_ffs/inode.c  Wed Oct 31 05:17:53 2018(r339941)
@@ -102,7 +102,7 @@ ckinode(union dinode *dp, struct inodesc *idesc)
printf(
"YOU MUST RERUN FSCK AFTERWARDS\n");
rerun = 1;
-   inodirty();
+   inodirty(dp);
 
}
}
@@ -142,7 +142,7 @@ ckinode(union dinode *dp, struct inodesc *id

svn commit: r339942 - stable/10/sys/dev/hyperv/netvsc

2018-10-30 Thread Wei Hu
Author: whu
Date: Wed Oct 31 06:24:07 2018
New Revision: 339942
URL: https://svnweb.freebsd.org/changeset/base/339942

Log:
  MFC: 339585
  
  r339585:
Do not drop UDP traffic when TXCSUM_IPV6 flag is on
  
PR: 231797
Submitted by:   whu
Reviewed by:dexuan
Obtained from:  Kevin Morse
Sponsored by:   Microsoft

Modified:
  stable/10/sys/dev/hyperv/netvsc/if_hn.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/hyperv/netvsc/if_hn.c
==
--- stable/10/sys/dev/hyperv/netvsc/if_hn.c Wed Oct 31 05:17:53 2018
(r339941)
+++ stable/10/sys/dev/hyperv/netvsc/if_hn.c Wed Oct 31 06:24:07 2018
(r339942)
@@ -857,7 +857,8 @@ hn_set_hlen(struct mbuf *m_head)
 
PULLUP_HDR(m_head, ehlen + sizeof(*ip6));
ip6 = mtodo(m_head, ehlen);
-   if (ip6->ip6_nxt != IPPROTO_TCP) {
+   if (ip6->ip6_nxt != IPPROTO_TCP &&
+   ip6->ip6_nxt != IPPROTO_UDP) {
m_freem(m_head);
return (NULL);
}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"