svn commit: r317727 - head/sys/mips/conf

2017-05-02 Thread Adrian Chadd
Author: adrian
Date: Wed May  3 05:45:43 2017
New Revision: 317727
URL: https://svnweb.freebsd.org/changeset/base/317727

Log:
  [mips] default AR933x/AR934x to include mips24k hwpmc and limit umtx chain 
memory wastage.
  
  Tested:
  
  * AR933x SoC (Carambola2)
  * AR934x SoC (TP-Link WDR3600)

Modified:
  head/sys/mips/conf/CARAMBOLA2
  head/sys/mips/conf/std.AR933X
  head/sys/mips/conf/std.AR934X

Modified: head/sys/mips/conf/CARAMBOLA2
==
--- head/sys/mips/conf/CARAMBOLA2   Wed May  3 05:33:15 2017
(r317726)
+++ head/sys/mips/conf/CARAMBOLA2   Wed May  3 05:45:43 2017
(r317727)
@@ -24,6 +24,8 @@ hints   "CARAMBOLA2.hints"
 # Board memory - 64MB
 options AR71XX_REALMEM=(64*1024*1024)
 
+optionsEARLY_PRINTF
+
 # i2c GPIO bus
 #devicegpioiic
 #deviceiicbb

Modified: head/sys/mips/conf/std.AR933X
==
--- head/sys/mips/conf/std.AR933X   Wed May  3 05:33:15 2017
(r317726)
+++ head/sys/mips/conf/std.AR933X   Wed May  3 05:45:43 2017
(r317727)
@@ -20,7 +20,7 @@ files "../atheros/files.ar71xx"
 hints  "AR933X_BASE.hints"
 
 makeoptionsDEBUG=-g#Build kernel with gdb(1) debug symbols
-makeoptionsMODULES_OVERRIDE="gpio ar71xx if_gif if_vlan if_gre if_tap 
if_tun if_bridge bridgestp usb wlan wlan_xauth wlan_acl wlan_wep wlan_tkip 
wlan_ccmp wlan_rssadapt wlan_amrr hwpmc ipfw ipfw_nat libalias ipfw_nptv6 rtwn 
rtwn_usb rtwnfw otus otusfw"
+makeoptionsMODULES_OVERRIDE="gpio ar71xx if_gif if_vlan if_gre if_tap 
if_tun if_bridge bridgestp usb wlan wlan_xauth wlan_acl wlan_wep wlan_tkip 
wlan_ccmp wlan_rssadapt wlan_amrr hwpmc ipfw ipfw_nat libalias ipfw_nptv6 rtwn 
rtwn_usb rtwnfw otus otusfw hwpmc_mips24k"
 
 optionsDDB
 optionsKDB
@@ -51,10 +51,10 @@ options VM_KMEM_SIZE_SCALE=1
 optionsNBUF=128
 
 # Limit UMTX hash size
-# options  UMTX_NUM_CHAINS=64
+optionsUMTX_CHAINS=64
 
 # PMC
-#options   HWPMC_HOOKS
+optionsHWPMC_HOOKS
 #devicehwpmc
 #devicehwpmc_mips24k
 

Modified: head/sys/mips/conf/std.AR934X
==
--- head/sys/mips/conf/std.AR934X   Wed May  3 05:33:15 2017
(r317726)
+++ head/sys/mips/conf/std.AR934X   Wed May  3 05:45:43 2017
(r317727)
@@ -20,7 +20,7 @@ files "../atheros/files.ar71xx"
 hints  "AR934X_BASE.hints"
 
 makeoptionsDEBUG=-g#Build kernel with gdb(1) debug symbols
-makeoptionsMODULES_OVERRIDE="gpio ar71xx if_gif if_vlan if_gre if_tap 
if_tun if_bridge bridgestp usb wlan wlan_xauth wlan_acl wlan_wep wlan_tkip 
wlan_ccmp wlan_rssadapt wlan_amrr hwpmc ipfw ipfw_nat libalias ipfw_nptv6 rtwn 
rtwn_usb rtwnfw otus otusfw"
+makeoptionsMODULES_OVERRIDE="gpio ar71xx if_gif if_vlan if_gre if_tap 
if_tun if_bridge bridgestp usb wlan wlan_xauth wlan_acl wlan_wep wlan_tkip 
wlan_ccmp wlan_rssadapt wlan_amrr hwpmc ipfw ipfw_nat libalias ipfw_nptv6 rtwn 
rtwn_usb rtwnfw otus otusfw hwpmc_mips24k"
 # makeoptions  MODULES_OVERRIDE=""
 
 optionsDDB
@@ -47,10 +47,10 @@ options NO_SYSCTL_DESCR
 optionsNBUF=128
 
 # Limit UMTX hash size
-# options  UMTX_NUM_CHAINS=64
+optionsUMTX_CHAINS=64
 
 # PMC
-#options   HWPMC_HOOKS
+optionsHWPMC_HOOKS
 #devicehwpmc
 #devicehwpmc_mips24k
 
___
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: r317726 - head/sys/cam

2017-05-02 Thread Scott Long
Author: scottl
Date: Wed May  3 05:33:15 2017
New Revision: 317726
URL: https://svnweb.freebsd.org/changeset/base/317726

Log:
  Fix an unsafe malloc usage with sbufs.
  
  Reported by:  ken
  Sponsored by: Netflix

Modified:
  head/sys/cam/cam_periph.c

Modified: head/sys/cam/cam_periph.c
==
--- head/sys/cam/cam_periph.c   Wed May  3 04:42:35 2017(r317725)
+++ head/sys/cam/cam_periph.c   Wed May  3 05:33:15 2017(r317726)
@@ -643,8 +643,9 @@ cam_periph_invalidate(struct cam_periph 
CAM_DEBUG(periph->path, CAM_DEBUG_INFO, ("Periph invalidated\n"));
if ((periph->flags & CAM_PERIPH_ANNOUNCED) && !rebooting) {
struct sbuf sb;
+   char buffer[160];
 
-   sbuf_new(, NULL, 160, SBUF_FIXEDLEN);
+   sbuf_new(, buffer, 160, SBUF_FIXEDLEN);
xpt_denounce_periph_sbuf(periph, );
sbuf_finish();
sbuf_putbuf();
___
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: r301198 - head/sys/dev/xen/netfront

2017-05-02 Thread Colin Percival
On 06/02/16 04:16, Roger Pau Monné wrote:
> Author: royger
> Date: Thu Jun  2 11:16:35 2016
> New Revision: 301198
> URL: https://svnweb.freebsd.org/changeset/base/301198

I think this commit is responsible for panics I'm seeing in EC2 on T2 family
instances.  Every time a DHCP request is made, we call into xn_ifinit_locked
(not sure why -- something to do with making the interface promiscuous?) and
hit this code

> @@ -1760,7 +1715,7 @@ xn_ifinit_locked(struct netfront_info *n
>   xn_alloc_rx_buffers(rxq);
>   rxq->ring.sring->rsp_event = rxq->ring.rsp_cons + 1;
>   if (RING_HAS_UNCONSUMED_RESPONSES(>ring))
> - taskqueue_enqueue(rxq->tq, >intrtask);
> + xn_rxeof(rxq);
>   XN_RX_UNLOCK(rxq);
>   }

but under high traffic volumes I think a separate thread can already be
running in xn_rxeof, having dropped the RX lock while it passes a packet
up the stack.  This would result in two different threads trying to process
the same set of responses from the ring, with (unsurprisingly) bad results.

I'm not 100% sure that this is what's causing the panic, but it's definitely
happening under high traffic conditions immediately after xn_ifinit_locked is
called, so I think my speculation is well-founded.

There are a few things I don't understand here:
1. Why DHCP requests are resulting in calls into xn_ifinit_locked.
2. Why the calls into xn_ifinit_locked are only happening on T2 instances
and not on any of the other EC2 instances I've tried.
3. Why xn_ifinit_locked is consuming ring responses.
so I'm not sure what the solution is, but hopefully someone who knows this
code better will be able to help...

-- 
Colin Percival
Security Officer Emeritus, FreeBSD | The power to serve
Founder, Tarsnap | www.tarsnap.com | Online backups for the truly paranoid
___
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: r317725 - vendor/NetBSD/blacklist/20170503

2017-05-02 Thread Kurt Lidl
Author: lidl
Date: Wed May  3 04:42:35 2017
New Revision: 317725
URL: https://svnweb.freebsd.org/changeset/base/317725

Log:
  Tag import of NetBSD's external/bsd/blacklist @ 20170503

Added:
  vendor/NetBSD/blacklist/20170503/
 - copied from r317724, vendor/NetBSD/blacklist/dist/
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r317724 - in vendor/NetBSD/blacklist/dist: . bin etc/rc.d lib libexec port

2017-05-02 Thread Kurt Lidl
Author: lidl
Date: Wed May  3 04:39:43 2017
New Revision: 317724
URL: https://svnweb.freebsd.org/changeset/base/317724

Log:
  Vendor import of NetBSD's external/bsd/blacklist @ 20170503
  
  Sponsored by: The FreeBSD Foundation

Deleted:
  vendor/NetBSD/blacklist/dist/port/config.h
Modified:
  vendor/NetBSD/blacklist/dist/README
  vendor/NetBSD/blacklist/dist/bin/blacklistctl.8
  vendor/NetBSD/blacklist/dist/bin/blacklistctl.c
  vendor/NetBSD/blacklist/dist/bin/blacklistd.8
  vendor/NetBSD/blacklist/dist/bin/blacklistd.c
  vendor/NetBSD/blacklist/dist/bin/blacklistd.conf.5
  vendor/NetBSD/blacklist/dist/bin/state.c
  vendor/NetBSD/blacklist/dist/etc/rc.d/blacklistd
  vendor/NetBSD/blacklist/dist/lib/bl.c
  vendor/NetBSD/blacklist/dist/lib/libblacklist.3
  vendor/NetBSD/blacklist/dist/libexec/blacklistd-helper
  vendor/NetBSD/blacklist/dist/port/Makefile.am
  vendor/NetBSD/blacklist/dist/port/sockaddr_snprintf.c

Modified: vendor/NetBSD/blacklist/dist/README
==
--- vendor/NetBSD/blacklist/dist/README Wed May  3 02:54:11 2017
(r317723)
+++ vendor/NetBSD/blacklist/dist/README Wed May  3 04:39:43 2017
(r317724)
@@ -1,4 +1,4 @@
-# $NetBSD: README,v 1.7 2015/01/26 00:34:50 christos Exp $
+# $NetBSD: README,v 1.8 2017/04/13 17:59:34 christos Exp $
 
 This package contains library that can be used by network daemons to
 communicate with a packet filter via a daemon to enforce opening and
@@ -98,6 +98,16 @@ group "internal" on $int_if {
...
 }
 
+You can use 'blacklistctl dump -a' to list all the current entries
+in the database; the ones that have nfail / where urrent
+>= otal, should have an id assosiated with them; this means that
+there is a packet filter rule added for that entry. For npf, you
+can examine the packet filter dynamic rule entries using 'npfctl
+rule  list'.  The number of current entries can exceed
+the total. This happens because entering packet filter rules is
+asynchronous; there could be other connection before the rule
+becomes activated.
+
 Enjoy,
 
 christos

Modified: vendor/NetBSD/blacklist/dist/bin/blacklistctl.8
==
--- vendor/NetBSD/blacklist/dist/bin/blacklistctl.8 Wed May  3 02:54:11 
2017(r317723)
+++ vendor/NetBSD/blacklist/dist/bin/blacklistctl.8 Wed May  3 04:39:43 
2017(r317724)
@@ -1,4 +1,4 @@
-.\" $NetBSD: blacklistctl.8,v 1.7 2015/04/30 06:20:43 riz Exp $
+.\" $NetBSD: blacklistctl.8,v 1.9 2016/06/08 12:48:37 wiz Exp $
 .\"
 .\" Copyright (c) 2015 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd April 29, 2015
+.Dd June 7, 2016
 .Dt BLACKLISTCTL 8
 .Os
 .Sh NAME
@@ -75,7 +75,12 @@ will first attempt to remove the existin
 it to make sure that there is only one rule active.
 .Sh HISTORY
 .Nm
-appeared in
+first appeared in
 .Nx 7 .
+.Fx
+support for
+.Nm
+was implemented in
+.Fx 11 .
 .Sh AUTHORS
 .An Christos Zoulas

Modified: vendor/NetBSD/blacklist/dist/bin/blacklistctl.c
==
--- vendor/NetBSD/blacklist/dist/bin/blacklistctl.c Wed May  3 02:54:11 
2017(r317723)
+++ vendor/NetBSD/blacklist/dist/bin/blacklistctl.c Wed May  3 04:39:43 
2017(r317724)
@@ -1,4 +1,4 @@
-/* $NetBSD: blacklistctl.c,v 1.20 2016/04/04 15:52:56 christos Exp $   
*/
+/* $NetBSD: blacklistctl.c,v 1.21 2016/11/02 03:15:07 jnemeth Exp $
*/
 
 /*-
  * Copyright (c) 2015 The NetBSD Foundation, Inc.
@@ -33,7 +33,7 @@
 #endif
 
 #include 
-__RCSID("$NetBSD: blacklistctl.c,v 1.20 2016/04/04 15:52:56 christos Exp $");
+__RCSID("$NetBSD: blacklistctl.c,v 1.21 2016/11/02 03:15:07 jnemeth Exp $");
 
 #include 
 #include 
@@ -96,10 +96,10 @@ main(int argc, char *argv[])
break;
case 'b':
blocked = 1;
+   break;
case 'D':
dbname = optarg;
break;
-   break;
case 'd':
debug++;
break;

Modified: vendor/NetBSD/blacklist/dist/bin/blacklistd.8
==
--- vendor/NetBSD/blacklist/dist/bin/blacklistd.8   Wed May  3 02:54:11 
2017(r317723)
+++ vendor/NetBSD/blacklist/dist/bin/blacklistd.8   Wed May  3 04:39:43 
2017(r317724)
@@ -1,4 +1,4 @@
-.\" $NetBSD: blacklistd.8,v 1.15 2016/03/11 17:16:40 christos Exp $
+.\" $NetBSD: blacklistd.8,v 1.18 2016/07/30 06:09:29 dholland Exp $
 .\"
 .\" Copyright (c) 2015 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 

svn commit: r317723 - head/sys/net

2017-05-02 Thread Alexander Motin
Author: mav
Date: Wed May  3 02:54:11 2017
New Revision: 317723
URL: https://svnweb.freebsd.org/changeset/base/317723

Log:
  Fix r317696 build without debug.
  
  MFC after:2 weeks

Modified:
  head/sys/net/if_lagg.c

Modified: head/sys/net/if_lagg.c
==
--- head/sys/net/if_lagg.c  Wed May  3 02:37:44 2017(r317722)
+++ head/sys/net/if_lagg.c  Wed May  3 02:54:11 2017(r317723)
@@ -1533,10 +1533,9 @@ lagg_setmulti(struct lagg_port *lp)
 static int
 lagg_clrmulti(struct lagg_port *lp)
 {
-   struct lagg_softc *sc = lp->lp_softc;
struct lagg_mc *mc;
 
-   LAGG_WLOCK_ASSERT(sc);
+   LAGG_WLOCK_ASSERT(lp->lp_softc);
while ((mc = SLIST_FIRST(>lp_mc_head)) != NULL) {
SLIST_REMOVE(>lp_mc_head, mc, lagg_mc, mc_entries);
if (mc->mc_ifma && lp->lp_detaching == 0)
___
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: r317722 - stable/11/contrib/elftoolchain/libelf

2017-05-02 Thread Ed Maste
Author: emaste
Date: Wed May  3 02:37:44 2017
New Revision: 317722
URL: https://svnweb.freebsd.org/changeset/base/317722

Log:
  MFC r316685: libelf: add an assert that msz is non-zero
  
  Reported by:  Coverity
  CID:  976023
  Sponsored by: The FreeBSD Foundation

Modified:
  stable/11/contrib/elftoolchain/libelf/elf_update.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/contrib/elftoolchain/libelf/elf_update.c
==
--- stable/11/contrib/elftoolchain/libelf/elf_update.c  Wed May  3 02:30:58 
2017(r317721)
+++ stable/11/contrib/elftoolchain/libelf/elf_update.c  Wed May  3 02:37:44 
2017(r317722)
@@ -808,6 +808,7 @@ _libelf_write_scn(Elf *e, unsigned char 
 
assert(d->d_buf != NULL);
assert(d->d_version == e->e_version);
+   assert(msz != 0);
assert(d->d_size % msz == 0);
 
nobjects = (size_t) (d->d_size / msz);
___
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: r317721 - stable/11/contrib/elftoolchain/libelftc

2017-05-02 Thread Ed Maste
Author: emaste
Date: Wed May  3 02:30:58 2017
New Revision: 317721
URL: https://svnweb.freebsd.org/changeset/base/317721

Log:
  MFC r313411 (jhibbits): Add elf*-powerpc-freebsd targets
  
  to the elftoolchain target list
  
  FreeBSD uses the full target triple when generating embedded rootfs images
  (MFS_IMAGE= make option).  Without this change objcopy errors out with:
  
  objcopy: elf64-poewrpc-freebsd: invalid target name

Modified:
  stable/11/contrib/elftoolchain/libelftc/libelftc_bfdtarget.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/contrib/elftoolchain/libelftc/libelftc_bfdtarget.c
==
--- stable/11/contrib/elftoolchain/libelftc/libelftc_bfdtarget.cWed May 
 3 02:25:11 2017(r317720)
+++ stable/11/contrib/elftoolchain/libelftc/libelftc_bfdtarget.cWed May 
 3 02:30:58 2017(r317721)
@@ -127,6 +127,15 @@ struct _Elftc_Bfd_Target _libelftc_targe
},
 
{
+   .bt_name  = "elf32-powerpc-freebsd",
+   .bt_type  = ETF_ELF,
+   .bt_byteorder = ELFDATA2MSB,
+   .bt_elfclass  = ELFCLASS32,
+   .bt_machine   = EM_PPC,
+   .bt_osabi = ELFOSABI_FREEBSD,
+   },
+
+   {
.bt_name  = "elf32-powerpcle",
.bt_type  = ETF_ELF,
.bt_byteorder = ELFDATA2LSB,
@@ -290,6 +299,15 @@ struct _Elftc_Bfd_Target _libelftc_targe
},
 
{
+   .bt_name  = "elf64-powerpc-freebsd",
+   .bt_type  = ETF_ELF,
+   .bt_byteorder = ELFDATA2MSB,
+   .bt_elfclass  = ELFCLASS64,
+   .bt_machine   = EM_PPC64,
+   .bt_osabi = ELFOSABI_FREEBSD,
+   },
+
+   {
.bt_name  = "elf64-powerpcle",
.bt_type  = ETF_ELF,
.bt_byteorder = ELFDATA2LSB,
___
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: r317720 - stable/11/contrib/elftoolchain/elfcopy

2017-05-02 Thread Ed Maste
Author: emaste
Date: Wed May  3 02:25:11 2017
New Revision: 317720
URL: https://svnweb.freebsd.org/changeset/base/317720

Log:
  MFC r307808: elfcopy: select mode by the end of the program name
  
  The mode of operation (elfcopy, mcs, or strip) is chosen based on the
  program name.  Broaden this to allow a substring match at the end of the
  name to allow prefixes - for example, bsdstrip or aarch64-freebsd-strip.
  
  This improves use of these tools as drop-in replacements for GNU objcopy
  and strip, which are often built with a limited set of supported targets
  and installed with a target prefix for cross tools.

Modified:
  stable/11/contrib/elftoolchain/elfcopy/main.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/contrib/elftoolchain/elfcopy/main.c
==
--- stable/11/contrib/elftoolchain/elfcopy/main.c   Wed May  3 02:19:45 
2017(r317719)
+++ stable/11/contrib/elftoolchain/elfcopy/main.c   Wed May  3 02:25:11 
2017(r317720)
@@ -1536,6 +1536,22 @@ print_version(void)
exit(EXIT_SUCCESS);
 }
 
+/*
+ * Compare the ending of s with end.
+ */
+static int
+strrcmp(const char *s, const char *end)
+{
+   size_t endlen, slen;
+
+   slen = strlen(s);
+   endlen = strlen(end);
+
+   if (slen >= endlen)
+   s += slen - endlen;
+   return (strcmp(s, end));
+}
+
 int
 main(int argc, char **argv)
 {
@@ -1569,12 +1585,16 @@ main(int argc, char **argv)
if ((ecp->progname = ELFTC_GETPROGNAME()) == NULL)
ecp->progname = "elfcopy";
 
-   if (strcmp(ecp->progname, "strip") == 0)
+   if (strrcmp(ecp->progname, "strip") == 0)
strip_main(ecp, argc, argv);
-   else if (strcmp(ecp->progname, "mcs") == 0)
+   else if (strrcmp(ecp->progname, "mcs") == 0)
mcs_main(ecp, argc, argv);
-   else
+   else {
+   if (strrcmp(ecp->progname, "elfcopy") != 0 &&
+   strrcmp(ecp->progname, "objcopy") != 0)
+   warnx("program mode not known, defaulting to elfcopy");
elfcopy_main(ecp, argc, argv);
+   }
 
free_sec_add(ecp);
free_sec_act(ecp);
___
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: r317719 - stable/11/contrib/elftoolchain/readelf

2017-05-02 Thread Ed Maste
Author: emaste
Date: Wed May  3 02:19:45 2017
New Revision: 317719
URL: https://svnweb.freebsd.org/changeset/base/317719

Log:
  MFC r309679 (cem): readelf -S: Include zero index and match binutils' no-name
  
  Include the SHN_UNDEF (zero) index special section in extended-attribute
  ELF files, like GNU binutils' readelf.
  
  Additionally, print "" for sections without names, like GNU
  binutils.

Modified:
  stable/11/contrib/elftoolchain/readelf/readelf.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/contrib/elftoolchain/readelf/readelf.c
==
--- stable/11/contrib/elftoolchain/readelf/readelf.cWed May  3 02:12:45 
2017(r317718)
+++ stable/11/contrib/elftoolchain/readelf/readelf.cWed May  3 02:19:45 
2017(r317719)
@@ -6643,13 +6643,14 @@ load_sections(struct readelf *re)
}
if ((name = elf_strptr(re->elf, shstrndx, sh.sh_name)) == NULL) 
{
(void) elf_errno();
-   name = "ERROR";
+   name = "";
}
if ((ndx = elf_ndxscn(scn)) == SHN_UNDEF) {
-   if ((elferr = elf_errno()) != 0)
+   if ((elferr = elf_errno()) != 0) {
warnx("elf_ndxscn failed: %s",
elf_errmsg(elferr));
-   continue;
+   continue;
+   }
}
if (ndx >= re->shnum) {
warnx("section index of '%s' out of range", 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: r317718 - stable/11/contrib/elftoolchain/readelf

2017-05-02 Thread Ed Maste
Author: emaste
Date: Wed May  3 02:12:45 2017
New Revision: 317718
URL: https://svnweb.freebsd.org/changeset/base/317718

Log:
  MFC r309547 (cem): readelf: Add support for extended program header numbers
  
  Add support for extended program header numbers to elftoolchain
  'readelf -h'.

Modified:
  stable/11/contrib/elftoolchain/readelf/readelf.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/contrib/elftoolchain/readelf/readelf.c
==
--- stable/11/contrib/elftoolchain/readelf/readelf.cWed May  3 02:04:38 
2017(r317717)
+++ stable/11/contrib/elftoolchain/readelf/readelf.cWed May  3 02:12:45 
2017(r317718)
@@ -2115,7 +2115,7 @@ dwarf_reg(unsigned int mach, unsigned in
 static void
 dump_ehdr(struct readelf *re)
 {
-   size_t   shnum, shstrndx;
+   size_t   phnum, shnum, shstrndx;
int  i;
 
printf("ELF Header:\n");
@@ -2177,7 +2177,13 @@ dump_ehdr(struct readelf *re)
re->ehdr.e_phentsize);
 
/* e_phnum. */
-   printf("%-37s%u\n", "  Number of program headers:", re->ehdr.e_phnum);
+   printf("%-37s%u", "  Number of program headers:", re->ehdr.e_phnum);
+   if (re->ehdr.e_phnum == PN_XNUM) {
+   /* Extended program header numbering is in use. */
+   if (elf_getphnum(re->elf, ))
+   printf(" (%zu)", phnum);
+   }
+   putchar('\n');
 
/* e_shentsize. */
printf("%-37s%u (bytes)\n", "  Size of section headers:",
___
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: r317717 - stable/11/contrib/elftoolchain/strings

2017-05-02 Thread Ed Maste
Author: emaste
Date: Wed May  3 02:04:38 2017
New Revision: 317717
URL: https://svnweb.freebsd.org/changeset/base/317717

Log:
  MFC r312779: strings: avoid unnecessary trip through handle_file for stdin
  
  Sponsored by: The FreeBSD Foundation

Modified:
  stable/11/contrib/elftoolchain/strings/strings.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/contrib/elftoolchain/strings/strings.c
==
--- stable/11/contrib/elftoolchain/strings/strings.cWed May  3 01:57:06 
2017(r317716)
+++ stable/11/contrib/elftoolchain/strings/strings.cWed May  3 02:04:38 
2017(r317717)
@@ -189,7 +189,7 @@ main(int argc, char **argv)
if (!min_len)
min_len = 4;
if (!*argv)
-   rc = handle_file("{standard input}");
+   rc = find_strings("{standard input}", 0, 0);
else while (*argv) {
if (handle_file(*argv) != 0)
rc = 1;
@@ -205,13 +205,9 @@ handle_file(const char *name)
 
if (name == NULL)
return (1);
-   if (strcmp("{standard input}", name) != 0) {
-   if (freopen(name, "rb", stdin) == NULL) {
-   warnx("'%s': %s", name, strerror(errno));
-   return (1);
-   }
-   } else {
-   return (find_strings(name, (off_t)0, (off_t)0));
+   if (freopen(name, "rb", stdin) == NULL) {
+   warnx("'%s': %s", name, strerror(errno));
+   return (1);
}
 
fd = fileno(stdin);
___
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: r317716 - stable/11/contrib/elftoolchain/libelf

2017-05-02 Thread Ed Maste
Author: emaste
Date: Wed May  3 01:57:06 2017
New Revision: 317716
URL: https://svnweb.freebsd.org/changeset/base/317716

Log:
  MFC libelf: Fix extended numbering
  
  r310136 (cem): libelf: Fix extended numbering detection
  
  Extended numbering is used for any of these fields overflowing.
  
  r310137 (cem): gelf_getphdr: Allow extended indices
  
  Needed for 'readelf -l' of extended phnum files.  (Parity with GNU
  binutils.)

Modified:
  stable/11/contrib/elftoolchain/libelf/gelf_phdr.c
  stable/11/contrib/elftoolchain/libelf/libelf_ehdr.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/contrib/elftoolchain/libelf/gelf_phdr.c
==
--- stable/11/contrib/elftoolchain/libelf/gelf_phdr.c   Wed May  3 01:46:39 
2017(r317715)
+++ stable/11/contrib/elftoolchain/libelf/gelf_phdr.c   Wed May  3 01:57:06 
2017(r317716)
@@ -53,10 +53,17 @@ gelf_getphdr(Elf *e, int index, GElf_Phd
Elf64_Ehdr *eh64;
Elf32_Phdr *ep32;
Elf64_Phdr *ep64;
+   size_t phnum;
 
if (d == NULL || e == NULL ||
((ec = e->e_class) != ELFCLASS32 && ec != ELFCLASS64) ||
-   (e->e_kind != ELF_K_ELF) || index < 0) {
+   (e->e_kind != ELF_K_ELF) || index < 0 ||
+   elf_getphdrnum(e, ) < 0) {
+   LIBELF_SET_ERROR(ARGUMENT, 0);
+   return (NULL);
+   }
+
+   if ((size_t)index >= phnum) {
LIBELF_SET_ERROR(ARGUMENT, 0);
return (NULL);
}
@@ -66,11 +73,6 @@ gelf_getphdr(Elf *e, int index, GElf_Phd
((ep32 = _libelf_getphdr(e, ELFCLASS32)) == NULL))
return (NULL);
 
-   if (index >= eh32->e_phnum) {
-   LIBELF_SET_ERROR(ARGUMENT, 0);
-   return (NULL);
-   }
-
ep32 += index;
 
d->p_type   = ep32->p_type;
@@ -87,11 +89,6 @@ gelf_getphdr(Elf *e, int index, GElf_Phd
(ep64 = _libelf_getphdr(e, ELFCLASS64)) == NULL)
return (NULL);
 
-   if (index >= eh64->e_phnum) {
-   LIBELF_SET_ERROR(ARGUMENT, 0);
-   return (NULL);
-   }
-
ep64 += index;
 
*d = *ep64;
@@ -125,13 +122,15 @@ gelf_newphdr(Elf *e, size_t count)
 int
 gelf_update_phdr(Elf *e, int ndx, GElf_Phdr *s)
 {
-   int ec, phnum;
+   int ec;
+   size_t phnum;
void *ehdr;
Elf32_Phdr *ph32;
Elf64_Phdr *ph64;
 
if (s == NULL || e == NULL || e->e_kind != ELF_K_ELF ||
-   ((ec = e->e_class) != ELFCLASS32 && ec != ELFCLASS64)) {
+   ((ec = e->e_class) != ELFCLASS32 && ec != ELFCLASS64) ||
+   elf_getphdrnum(e, ) < 0) {
LIBELF_SET_ERROR(ARGUMENT, 0);
return (0);
}
@@ -144,12 +143,7 @@ gelf_update_phdr(Elf *e, int ndx, GElf_P
if ((ehdr = _libelf_ehdr(e, ec, 0)) == NULL)
return (0);
 
-   if (ec == ELFCLASS32)
-   phnum = ((Elf32_Ehdr *) ehdr)->e_phnum;
-   else
-   phnum = ((Elf64_Ehdr *) ehdr)->e_phnum;
-
-   if (ndx < 0 || ndx > phnum) {
+   if (ndx < 0 || (size_t)ndx > phnum) {
LIBELF_SET_ERROR(ARGUMENT, 0);
return (0);
}

Modified: stable/11/contrib/elftoolchain/libelf/libelf_ehdr.c
==
--- stable/11/contrib/elftoolchain/libelf/libelf_ehdr.c Wed May  3 01:46:39 
2017(r317715)
+++ stable/11/contrib/elftoolchain/libelf/libelf_ehdr.c Wed May  3 01:57:06 
2017(r317716)
@@ -170,10 +170,6 @@ _libelf_ehdr(Elf *e, int ec, int allocat
(*xlator)((unsigned char*) ehdr, msz, e->e_rawfile, (size_t) 1,
e->e_byteorder != LIBELF_PRIVATE(byteorder));
 
-   /*
-* If extended numbering is being used, read the correct
-* number of sections and program header entries.
-*/
if (ec == ELFCLASS32) {
phnum = ((Elf32_Ehdr *) ehdr)->e_phnum;
shnum = ((Elf32_Ehdr *) ehdr)->e_shnum;
@@ -193,12 +189,19 @@ _libelf_ehdr(Elf *e, int ec, int allocat
return (NULL);
}
 
-   if (shnum != 0 || shoff == 0LL) { /* not using extended numbering */
+   /*
+* If extended numbering is being used, read the correct
+* number of sections and program header entries.
+*/
+   if ((shnum == 0 && shoff != 0) || phnum == PN_XNUM || strndx == 
SHN_XINDEX) {
+   if (_libelf_load_extended(e, ec, shoff, phnum, strndx) == 0)
+   return (NULL);
+   } else {
+   /* not using extended numbering */
e->e_u.e_elf.e_nphdr = phnum;
e->e_u.e_elf.e_nscn = shnum;
e->e_u.e_elf.e_strndx = strndx;
-   } else 

svn commit: r317715 - head/sbin/ifconfig

2017-05-02 Thread Alan Somers
Author: asomers
Date: Wed May  3 01:46:39 2017
New Revision: 317715
URL: https://svnweb.freebsd.org/changeset/base/317715

Log:
  ifconfig displays ND6_IFF_NO_DAD as "IGNORELOOP"
  
  PR:   218958
  Reviewed by:  kristof
  MFC after:3 weeks
  Differential Revision:https://reviews.freebsd.org/D10543

Modified:
  head/sbin/ifconfig/af_nd6.c

Modified: head/sbin/ifconfig/af_nd6.c
==
--- head/sbin/ifconfig/af_nd6.c Wed May  3 01:06:56 2017(r317714)
+++ head/sbin/ifconfig/af_nd6.c Wed May  3 01:46:39 2017(r317715)
@@ -57,8 +57,7 @@ static const char rcsid[] =
 #defineMAX_SYSCTL_TRY  5
 #defineND6BITS "\020\001PERFORMNUD\002ACCEPT_RTADV\003PREFER_SOURCE" \
"\004IFDISABLED\005DONT_SET_IFROUTE\006AUTO_LINKLOCAL" \
-   "\007NO_RADR\010NO_PREFER_IFACE\011IGNORELOOP\012NO_DAD" \
-   "\020DEFAULTIF"
+   "\007NO_RADR\010NO_PREFER_IFACE\011NO_DAD\020DEFAULTIF"
 
 static int isnd6defif(int);
 void setnd6flags(const char *, int, int, const struct afswtch *);
___
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: r317714 - stable/11/contrib/elftoolchain/readelf

2017-05-02 Thread Ed Maste
Author: emaste
Date: Wed May  3 01:06:56 2017
New Revision: 317714
URL: https://svnweb.freebsd.org/changeset/base/317714

Log:
  MFC r317141: readelf: dump MIPS abiflags section
  
  This is not fully fleshed out but is sufficient to dump the
  SHT_MIPS_ABIFLAGS used in FreeBSD.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  stable/11/contrib/elftoolchain/readelf/readelf.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/contrib/elftoolchain/readelf/readelf.c
==
--- stable/11/contrib/elftoolchain/readelf/readelf.cTue May  2 23:31:39 
2017(r317713)
+++ stable/11/contrib/elftoolchain/readelf/readelf.cWed May  3 01:06:56 
2017(r317714)
@@ -296,6 +296,7 @@ static void dump_elf(struct readelf *re)
 static void dump_dyn_val(struct readelf *re, GElf_Dyn *dyn, uint32_t stab);
 static void dump_dynamic(struct readelf *re);
 static void dump_liblist(struct readelf *re);
+static void dump_mips_abiflags(struct readelf *re, struct section *s);
 static void dump_mips_attributes(struct readelf *re, uint8_t *p, uint8_t *pe);
 static void dump_mips_odk_reginfo(struct readelf *re, uint8_t *p, size_t sz);
 static void dump_mips_options(struct readelf *re, struct section *s);
@@ -325,6 +326,7 @@ static const char *dwarf_regname(struct 
 static struct dumpop *find_dumpop(struct readelf *re, size_t si,
 const char *sn, int op, int t);
 static int get_ent_count(struct section *s, int *ent_count);
+static int get_mips_register_size(uint8_t flag);
 static char *get_regoff_str(struct readelf *re, Dwarf_Half reg,
 Dwarf_Addr off);
 static const char *get_string(struct readelf *re, int strtab, size_t off);
@@ -4105,6 +4107,10 @@ dump_mips_specific_info(struct readelf *
}
}
 
+   if (s->name != NULL && (!strcmp(s->name, ".MIPS.abiflags") ||
+   (s->type == SHT_MIPS_ABIFLAGS)))
+   dump_mips_abiflags(re, s);
+
/*
 * Dump .reginfo if present (although it will be ignored by an OS if a
 * .MIPS.options section is present, according to SGI mips64 spec).
@@ -4118,6 +4124,82 @@ dump_mips_specific_info(struct readelf *
 }
 
 static void
+dump_mips_abiflags(struct readelf *re, struct section *s)
+{
+   Elf_Data *d;
+   uint8_t *p;
+   int elferr;
+   uint32_t isa_ext, ases, flags1, flags2;
+   uint16_t version;
+   uint8_t isa_level, isa_rev, gpr_size, cpr1_size, cpr2_size, fp_abi;
+
+   if ((d = elf_rawdata(s->scn, NULL)) == NULL) {
+   elferr = elf_errno();
+   if (elferr != 0)
+   warnx("elf_rawdata failed: %s",
+   elf_errmsg(elferr));
+   return;
+   }
+   if (d->d_size != 24) {
+   warnx("invalid MIPS abiflags section size");
+   return;
+   }
+
+   p = d->d_buf;
+   version = re->dw_decode(, 2);
+   printf("MIPS ABI Flags Version: %u", version);
+   if (version != 0) {
+   printf(" (unknown)\n\n");
+   return;
+   }
+   printf("\n\n");
+
+   isa_level = re->dw_decode(, 1);
+   isa_rev = re->dw_decode(, 1);
+   gpr_size = re->dw_decode(, 1);
+   cpr1_size = re->dw_decode(, 1);
+   cpr2_size = re->dw_decode(, 1);
+   fp_abi = re->dw_decode(, 1);
+   isa_ext = re->dw_decode(, 4);
+   ases = re->dw_decode(, 4);
+   flags1 = re->dw_decode(, 4);
+   flags2 = re->dw_decode(, 4);
+
+   printf("ISA: ");
+   if (isa_rev <= 1)
+   printf("MIPS%u\n", isa_level);
+   else
+   printf("MIPS%ur%u\n", isa_level, isa_rev);
+   printf("GPR size: %d\n", get_mips_register_size(gpr_size));
+   printf("CPR1 size: %d\n", get_mips_register_size(cpr1_size));
+   printf("CPR2 size: %d\n", get_mips_register_size(cpr2_size));
+   printf("FP ABI: ");
+   switch (fp_abi) {
+   case 3:
+   printf("Soft float");
+   break;
+   default:
+   printf("%u", fp_abi);
+   break;
+   }
+   printf("\nISA Extension: %u\n", isa_ext);
+   printf("ASEs: %u\n", ases);
+   printf("FLAGS 1: %08x\n", flags1);
+   printf("FLAGS 2: %08x\n", flags2);
+}
+
+static int
+get_mips_register_size(uint8_t flag)
+{
+   switch (flag) {
+   case 0: return 0;
+   case 1: return 32;
+   case 2: return 64;
+   case 3: return 128;
+   default: return -1;
+   }
+}
+static void
 dump_mips_reginfo(struct readelf *re, struct section *s)
 {
Elf_Data *d;
___
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: r317713 - head/tests/sys/geom/class/mirror

2017-05-02 Thread Mark Johnston
Author: markj
Date: Tue May  2 23:31:39 2017
New Revision: 317713
URL: https://svnweb.freebsd.org/changeset/base/317713

Log:
  Add regression tests for r317712 and r306743.
  
  MFC after:2 weeks
  Sponsored by: Dell EMC Isilon

Added:
  head/tests/sys/geom/class/mirror/8_test.sh   (contents, props changed)
  head/tests/sys/geom/class/mirror/9_test.sh   (contents, props changed)
Modified:
  head/tests/sys/geom/class/mirror/Makefile

Added: head/tests/sys/geom/class/mirror/8_test.sh
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tests/sys/geom/class/mirror/8_test.sh  Tue May  2 23:31:39 2017
(r317713)
@@ -0,0 +1,53 @@
+#!/bin/sh
+# $FreeBSD$
+
+# Regression test for r317712.
+
+. `dirname $0`/conf.sh
+
+echo 1..1
+
+ddbs=2048
+m1=`mktemp $base.XX` || exit 1
+m2=`mktemp $base.XX` || exit 1
+
+dd if=/dev/zero of=$m1 bs=$ddbs count=1024 >/dev/null 2>&1
+dd if=/dev/zero of=$m2 bs=$ddbs count=1024 >/dev/null 2>&1
+
+us0=$(mdconfig -t vnode -f $m1) || exit 1
+us1=$(mdconfig -t vnode -f $m2) || exit 1
+
+gmirror label $name /dev/$us0 /dev/$us1 || exit 1
+devwait
+
+# Ensure that the mirrors are marked dirty, and then disconnect them.
+# We need to have the gmirror provider open when destroying the MDs since
+# gmirror will automatically mark the mirrors clean when the provider is 
closed.
+exec 9>/dev/mirror/$name
+dd if=/dev/zero bs=$ddbs count=1 >&9 2>/dev/null
+mdconfig -d -u ${us0#md} -o force || exit 1
+mdconfig -d -u ${us1#md} -o force || exit 1
+exec 9>&-
+
+dd if=/dev/random of=$m1 bs=$ddbs count=1 conv=notrunc >/dev/null 2>&1
+us0=$(attach_md -t vnode -f $m1) || exit 1
+devwait # This will take kern.geom.mirror.timeout seconds.
+
+# Re-attach the second mirror and wait for it to synchronize.
+us1=$(attach_md -t vnode -f $m2) || exit 1
+while [ $(gmirror status $name | grep ACTIVE | wc -l) -ne 2 ]; do
+sleep 1
+done
+
+# Verify the two mirrors are identical. Destroy the gmirror first so that
+# the mirror metadata is wiped; otherwise the metadata blocks will fail
+# the comparison. It would be nice to do this with a "gmirror verify"
+# command instead.
+gmirror destroy $name
+if cmp -s ${m1} ${m2}; then
+echo "ok 1"
+else
+echo "not ok 1"
+fi
+
+rm -f $m1 $m2

Added: head/tests/sys/geom/class/mirror/9_test.sh
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tests/sys/geom/class/mirror/9_test.sh  Tue May  2 23:31:39 2017
(r317713)
@@ -0,0 +1,62 @@
+#!/bin/sh
+# $FreeBSD$
+
+# Regression test for r306743.
+
+. `dirname $0`/conf.sh
+
+echo 1..1
+
+ddbs=2048
+m1=`mktemp $base.XX` || exit 1
+m2=`mktemp $base.XX` || exit 1
+m3=`mktemp $base.XX` || exit 1
+
+dd if=/dev/zero of=$m1 bs=$ddbs count=1024 >/dev/null 2>&1
+dd if=/dev/zero of=$m2 bs=$ddbs count=1024 >/dev/null 2>&1
+dd if=/dev/zero of=$m3 bs=$ddbs count=1024 >/dev/null 2>&1
+
+us0=$(attach_md -t vnode -f $m1) || exit 1
+us1=$(attach_md -t vnode -f $m2) || exit 1
+us2=$(attach_md -t vnode -f $m3) || exit 1
+
+gmirror label $name /dev/$us0 /dev/$us1 || exit 1
+devwait
+
+# Break one of the mirrors by forcing a single metadata write error.
+# When dd closes the mirror provider, gmirror will attempt to mark the mirrors
+# clean, and will kick one of the mirrors out upon hitting the error.
+sysctl debug.fail_point.g_mirror_metadata_write='1*return(5)' || exit 1
+dd if=/dev/random of=/dev/mirror/$name bs=$ddbs count=1 >/dev/null 2>&1
+sysctl debug.fail_point.g_mirror_metadata_write='off' || exit 1
+
+# Replace the broken mirror, and then stop the gmirror.
+gmirror forget $name || exit 1
+gmirror insert $name /dev/$us2 || exit 1
+while [ $(gmirror status $name | grep ACTIVE | wc -l) -ne 2 ]; do
+sleep 1
+done
+gmirror stop $name || exit 1
+
+# Restart the gmirror on the original two mirrors. One of them is broken,
+# so we should end up with a degraded gmirror.
+gmirror activate $name /dev/$us0 /dev/$us1 || exit 1
+devwait
+dd if=/dev/random of=/dev/mirror/$name bs=$ddbs count=1 >/dev/null 2>&1
+
+# Re-add the replacement mirror and verify the two mirrors are synchronized.
+# Destroy the gmirror first so that the mirror metadata is wiped; otherwise
+# the metadata blocks will fail the comparison. It would be nice to do this
+# with a "gmirror verify" command instead.
+gmirror activate $name /dev/$us2 || exit 1
+while [ $(gmirror status $name | grep ACTIVE | wc -l) -ne 2 ]; do
+sleep 1
+done
+gmirror destroy $name || exit 1
+if cmp -s $m1 $m3; then
+echo "ok 1"
+else
+echo "not ok 1"
+fi
+
+rm -f $m1 $m2 $m3

Modified: head/tests/sys/geom/class/mirror/Makefile
==
--- head/tests/sys/geom/class/mirror/Makefile   Tue May  2 23:29:42 2017
(r317712)
+++ head/tests/sys/geom/class/mirror/Makefile   Tue 

svn commit: r317712 - head/sys/geom/mirror

2017-05-02 Thread Mark Johnston
Author: markj
Date: Tue May  2 23:29:42 2017
New Revision: 317712
URL: https://svnweb.freebsd.org/changeset/base/317712

Log:
  Synchronize unclean mirrors before adding them to a running gmirror.
  
  During gmirror startup, if component mirrors are found to be dirty as is
  typical after a system crash, the mirrors are synchronized to the mirror
  with highest priority. However if a gmirror starts without all of its
  mirrors present, for example because of some transient delays during
  tasting, the remaining mirrors must be synchronized before they may become
  active.
  
  MFC after:2 weeks
  Sponsored by: Dell EMC Isilon

Modified:
  head/sys/geom/mirror/g_mirror.c

Modified: head/sys/geom/mirror/g_mirror.c
==
--- head/sys/geom/mirror/g_mirror.c Tue May  2 22:57:27 2017
(r317711)
+++ head/sys/geom/mirror/g_mirror.c Tue May  2 23:29:42 2017
(r317712)
@@ -2225,7 +2225,9 @@ g_mirror_determine_state(struct g_mirror
sc = disk->d_softc;
if (sc->sc_syncid == disk->d_sync.ds_syncid) {
if ((disk->d_flags &
-   G_MIRROR_DISK_FLAG_SYNCHRONIZING) == 0) {
+   G_MIRROR_DISK_FLAG_SYNCHRONIZING) == 0 &&
+   (g_mirror_ndisks(sc, G_MIRROR_DISK_STATE_ACTIVE) == 0 ||
+(disk->d_flags & G_MIRROR_DISK_FLAG_DIRTY) == 0)) {
/* Disk does not need synchronization. */
state = G_MIRROR_DISK_STATE_ACTIVE;
} else {
___
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: r317709 - head/usr.bin/csplit

2017-05-02 Thread Pedro Giffuni

Very interesting ...

On 2/5/2017 16:56, Jilles Tjoelker wrote:

Author: jilles
Date: Tue May  2 21:56:20 2017
New Revision: 317709
URL: https://svnweb.freebsd.org/changeset/base/317709

Log:
   csplit: Fix check of fputs() return value, making csplit work again.
   
   As of r295638, fputs() returns the number of bytes written (if not more than

   INT_MAX). This broke csplit completely, since csplit assumed only success
   only for the return value 0.
  


Actually r295631 explains better why the change was made.

I now checked with opengrok and it appears only csplit was hit.

Thanks!

Pedro.
___
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: r315333 - in stable/10/sys: conf dev/ixgbe modules/ix modules/ixv

2017-05-02 Thread Eric Joyner
I fixed the netmap build for amd64 at least with r317711. I'm running a
tinderbox build on it now, though, so I'll see if that fixes it.

On Fri, Apr 28, 2017 at 1:40 PM Eric Joyner  wrote:

> I notified Jeb (the original patch submitter) about that netmap symbol
> issue, but we've both been distracted with other development. I'll work on
> updating it.
>
> - Eric
>
> On Thu, Apr 27, 2017 at 3:06 PM Ngie Cooper  wrote:
>
>> On Thu, Apr 27, 2017 at 1:07 PM, Ed Maste  wrote:
>> > On 15 March 2017 at 17:20, Eric Joyner  wrote:
>> >> Author: erj
>> >> Date: Wed Mar 15 21:20:17 2017
>> >> New Revision: 315333
>> >> URL: https://svnweb.freebsd.org/changeset/base/315333
>> >>
>> >> Log:
>> >>   ixgbe(4): Update to 3.2.11-k
>> >
>> > This broke tinderbox on many architectures:
>> >
>> > ia64 GENERIC and powerpc GENERIC64:
>> >
>> > /scratch/tmp/emaste/freebsd/sys/dev/ixgbe/ixv_osdep.c:39: warning: no
>> > previous prototype for 'ixv_read_pci_cfg' [-Wmissing-prototypes]
>> > /scratch/tmp/emaste/freebsd/sys/dev/ixgbe/ixv_osdep.c:45: warning: no
>> > previous prototype for 'ixv_write_pci_cfg' [-Wmissing-prototypes]
>> >
>> > sparc64 LINT:
>> >
>> > /scratch/tmp/emaste/freebsd/sys/dev/ixgbe/ix_txrx.c:43: warning:
>> > redundant redeclaration of 'ix_crcstrip' [-Wredundant-decls]
>> > /scratch/tmp/emaste/freebsd/sys/dev/ixgbe/ixgbe_netmap.h:45: warning:
>> > previous declaration of 'ix_crcstrip' was here
>> >
>> > amd64 LINT:
>> >
>> > /scratch/tmp/emaste/freebsd/sys/dev/ixgbe/ixv_netmap.c:(.text+0x0):
>> > multiple definition of `ixgbe_netmap_attach'
>> >
>> ixgbe_netmap.o:/scratch/tmp/emaste/freebsd/sys/dev/ixgbe/ixgbe_netmap.c:(.text+0x0):
>> > first defined here
>>
>> Hi Ed,
>>
>> It has to do with netmap(4) refactoring on head not being backported,
>> in combination with ixgbe/ix being MFCed in a refactored state back to
>> ^/stable/10 (it wasn't easy to backport due to PCI-IOV only being on
>> ^/stable/10 -- I tried starting this work and failed because I lacked
>> the hardware to test this out with).
>>
>> This has been known to be broken for almost two months -- a surgical
>> fix should probably be applied to do what's required to make the
>> symbol appear in the appropriate places, since this basically was a
>> direct commit to ^/stable/10 in some regards.
>>
>> Thanks,
>> -Ngie
>>
>
___
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: r317711 - stable/10/sys/dev/ixgbe

2017-05-02 Thread Eric Joyner
Author: erj
Date: Tue May  2 22:57:27 2017
New Revision: 317711
URL: https://svnweb.freebsd.org/changeset/base/317711

Log:
  ixgbe(4): Fix build issue when compiling with netmap enabled
  
  Sponsored by: Intel Corporation

Modified:
  stable/10/sys/dev/ixgbe/if_ixv.c
  stable/10/sys/dev/ixgbe/ixv_netmap.c
  stable/10/sys/dev/ixgbe/ixv_netmap.h

Modified: stable/10/sys/dev/ixgbe/if_ixv.c
==
--- stable/10/sys/dev/ixgbe/if_ixv.cTue May  2 22:14:55 2017
(r317710)
+++ stable/10/sys/dev/ixgbe/if_ixv.cTue May  2 22:57:27 2017
(r317711)
@@ -484,7 +484,7 @@ ixv_attach(device_t dev)
ixv_add_stats_sysctls(adapter);
 
if (adapter->feat_en & IXGBE_FEATURE_NETMAP)
-   ixgbe_netmap_attach(adapter);
+   ixv_netmap_attach(adapter);
 
INIT_DEBUGOUT("ixv_attach: end");
 

Modified: stable/10/sys/dev/ixgbe/ixv_netmap.c
==
--- stable/10/sys/dev/ixgbe/ixv_netmap.cTue May  2 22:14:55 2017
(r317710)
+++ stable/10/sys/dev/ixgbe/ixv_netmap.cTue May  2 22:57:27 2017
(r317711)
@@ -83,23 +83,23 @@
 /*
  * device-specific sysctl variables:
  *
- * ix_crcstrip: 0: keep CRC in rx frames (default), 1: strip it.
+ * ixv_crcstrip: 0: keep CRC in rx frames (default), 1: strip it.
  * During regular operations the CRC is stripped, but on some
  * hardware reception of frames not multiple of 64 is slower,
  * so using crcstrip=0 helps in benchmarks.
  *
- * ix_rx_miss, ix_rx_miss_bufs:
+ * ixv_rx_miss, ixv_rx_miss_bufs:
  * count packets that might be missed due to lost interrupts.
  */
 SYSCTL_DECL(_dev_netmap);
-static int ix_rx_miss, ix_rx_miss_bufs;
-int ix_crcstrip;
-SYSCTL_INT(_dev_netmap, OID_AUTO, ix_crcstrip,
-CTLFLAG_RW, _crcstrip, 0, "strip CRC on rx frames");
-SYSCTL_INT(_dev_netmap, OID_AUTO, ix_rx_miss,
-CTLFLAG_RW, _rx_miss, 0, "potentially missed rx intr");
-SYSCTL_INT(_dev_netmap, OID_AUTO, ix_rx_miss_bufs,
-CTLFLAG_RW, _rx_miss_bufs, 0, "potentially missed rx intr bufs");
+static int ixv_rx_miss, ixv_rx_miss_bufs;
+int ixv_crcstrip;
+SYSCTL_INT(_dev_netmap, OID_AUTO, ixv_crcstrip,
+CTLFLAG_RW, _crcstrip, 0, "strip CRC on rx frames");
+SYSCTL_INT(_dev_netmap, OID_AUTO, ixv_rx_miss,
+CTLFLAG_RW, _rx_miss, 0, "potentially missed rx intr");
+SYSCTL_INT(_dev_netmap, OID_AUTO, ixv_rx_miss_bufs,
+CTLFLAG_RW, _rx_miss_bufs, 0, "potentially missed rx intr bufs");
 
 
 static void
@@ -123,7 +123,7 @@ set_crcstrip(struct ixgbe_hw *hw, int on
/* hw requirements ... */
rxc &= ~IXGBE_RDRXCTL_RSCFRSTSIZE;
rxc |= IXGBE_RDRXCTL_RSCACKC;
-   if (onoff && !ix_crcstrip) {
+   if (onoff && !ixv_crcstrip) {
/* keep the crc. Fast rx */
hl &= ~IXGBE_HLREG0_RXCRCSTRP;
rxc &= ~IXGBE_RDRXCTL_CRCSTRIP;
@@ -145,7 +145,7 @@ set_crcstrip(struct ixgbe_hw *hw, int on
  * Only called on the first register or the last unregister.
  */
 static int
-ixgbe_netmap_reg(struct netmap_adapter *na, int onoff)
+ixv_netmap_reg(struct netmap_adapter *na, int onoff)
 {
struct ifnet *ifp = na->ifp;
struct adapter *adapter = ifp->if_softc;
@@ -182,7 +182,7 @@ ixgbe_netmap_reg(struct netmap_adapter *
  * methods should be handled by the individual drivers.
  */
 static int
-ixgbe_netmap_txsync(struct netmap_kring *kring, int flags)
+ixv_netmap_txsync(struct netmap_kring *kring, int flags)
 {
struct netmap_adapter *na = kring->na;
struct ifnet *ifp = na->ifp;
@@ -368,7 +368,7 @@ ixgbe_netmap_txsync(struct netmap_kring 
  * of whether or not we received an interrupt.
  */
 static int
-ixgbe_netmap_rxsync(struct netmap_kring *kring, int flags)
+ixv_netmap_rxsync(struct netmap_kring *kring, int flags)
 {
struct netmap_adapter *na = kring->na;
struct ifnet *ifp = na->ifp;
@@ -407,7 +407,7 @@ ixgbe_netmap_rxsync(struct netmap_kring 
 * rxr->next_to_check is set to 0 on a ring reinit
 */
if (netmap_no_pendintr || force_update) {
-   int crclen = (ix_crcstrip) ? 0 : 4;
+   int crclen = (ixv_crcstrip) ? 0 : 4;
uint16_t slot_flags = kring->nkr_slot_flags;
 
nic_i = rxr->next_to_check; // or also k2n(kring->nr_hwtail)
@@ -429,8 +429,8 @@ ixgbe_netmap_rxsync(struct netmap_kring 
if (n) { /* update the state variables */
if (netmap_no_pendintr && !force_update) {
/* diagnostics */
-   ix_rx_miss ++;
-   ix_rx_miss_bufs += n;
+   ixv_rx_miss ++;
+   ixv_rx_miss_bufs += n;
}
rxr->next_to_check = nic_i;
kring->nr_hwtail = nm_i;
@@ -499,7 

svn commit: r317710 - head/contrib/netbsd-tests/lib/libc/rpc

2017-05-02 Thread Brooks Davis
Author: brooks
Date: Tue May  2 22:14:55 2017
New Revision: 317710
URL: https://svnweb.freebsd.org/changeset/base/317710

Log:
  Remove expected failure now that it was fixed in r317660.
  
  PR:   211804
  Reviewed by:  ngie
  Obtained from:CheriBSD
  MFC after:2 weeks
  Sponsored by: DARPA, AFRL
  Differential Revision:https://reviews.freebsd.org/D10576

Modified:
  head/contrib/netbsd-tests/lib/libc/rpc/t_rpc.c

Modified: head/contrib/netbsd-tests/lib/libc/rpc/t_rpc.c
==
--- head/contrib/netbsd-tests/lib/libc/rpc/t_rpc.c  Tue May  2 21:56:20 
2017(r317709)
+++ head/contrib/netbsd-tests/lib/libc/rpc/t_rpc.c  Tue May  2 22:14:55 
2017(r317710)
@@ -325,10 +325,6 @@ ATF_TC_HEAD(raw, tc)
 
 ATF_TC_BODY(raw, tc)
 {
-#ifdef __FreeBSD__
-   atf_tc_expect_fail("fails with: clnt_call: "
-   "RPC: Can't decode result -- PR # 211804");
-#endif
rawtest(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"


Re: svn commit: r317681 - head/share/man/man7

2017-05-02 Thread Ngie Cooper
On Tue, May 2, 2017 at 12:45 PM, Konstantin Belousov
 wrote:

...

>  .Fx .
>  .Pp
>  .Ss Type sizes
> +If not explicitely mentioned, sizes are in bytes.

*explicitly

> +.Pp
>  On all supported architectures,
>  .Bl -column -offset -indent "long long" "Size"
>  .It Sy Type Ta Sy Size
> @@ -47,8 +49,10 @@ On all supported architectures,
>  .It float Ta 4
>  .It double Ta 8
>  .El
> -.Bl -column -offset indent "Sy Architecture" "Sy sizeof(void *)" "Sy 
> sizeof(long double)" "Sy sizeof(time_t)"
> -.It Sy Architecture Ta Sy sizeof(void *) Ta Sy sizeof(long double) Ta Sy 
> sizeof(time_t)
> +.Pp
> +Machine-dependent type sizes:
> +.Bl -column -offset indent "Sy Architecture" "Sy void *" "Sy long double" 
> "Sy time_t"
> +.It Sy Architecture Ta Sy void * Ta Sy long double Ta Sy time_t
>  .It amd64   Ta 8 Ta 16 Ta 8
>  .It arm Ta 4 Ta  8 Ta 8
>  .It armeb   Ta 4 Ta  8 Ta 8
> @@ -69,6 +73,9 @@ On all supported architectures,
>  .It riscv   Ta 8 Ta 16 Ta 8
>  .It sparc64 Ta 8 Ta 16 Ta 8
>  .El
> +.Pp
> +.Sy time_t
> +is always signed, it is 64-bits everywere except on i386 and 32-bit powerpc.

*everywhere

Thanks!
-Ngie
___
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: r317709 - head/usr.bin/csplit

2017-05-02 Thread Jilles Tjoelker
Author: jilles
Date: Tue May  2 21:56:20 2017
New Revision: 317709
URL: https://svnweb.freebsd.org/changeset/base/317709

Log:
  csplit: Fix check of fputs() return value, making csplit work again.
  
  As of r295638, fputs() returns the number of bytes written (if not more than
  INT_MAX). This broke csplit completely, since csplit assumed only success
  only for the return value 0.
  
  PR:   213510
  Submitted by: J.R. Oldroyd
  MFC after:1 week
  Relnotes: yes

Modified:
  head/usr.bin/csplit/csplit.c

Modified: head/usr.bin/csplit/csplit.c
==
--- head/usr.bin/csplit/csplit.cTue May  2 21:33:27 2017
(r317708)
+++ head/usr.bin/csplit/csplit.cTue May  2 21:56:20 2017
(r317709)
@@ -195,7 +195,7 @@ main(int argc, char *argv[])
/* Copy the rest into a new file. */
if (!feof(infile)) {
ofp = newfile();
-   while ((p = get_line()) != NULL && fputs(p, ofp) == 0)
+   while ((p = get_line()) != NULL && fputs(p, ofp) != EOF)
;
if (!sflag)
printf("%jd\n", (intmax_t)ftello(ofp));
@@ -392,7 +392,7 @@ do_rexp(const char *expr)
/* Read and output lines until we get a match. */
first = 1;
while ((p = get_line()) != NULL) {
-   if (fputs(p, ofp) != 0)
+   if (fputs(p, ofp) == EOF)
break;
if (!first && regexec(, p, 0, NULL, 0) == 0)
break;
@@ -453,7 +453,7 @@ do_lineno(const char *expr)
while (lineno + 1 != lastline) {
if ((p = get_line()) == NULL)
errx(1, "%ld: out of range", lastline);
-   if (fputs(p, ofp) != 0)
+   if (fputs(p, ofp) == EOF)
break;
}
if (!sflag)
___
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: r317708 - head/share/man/man7

2017-05-02 Thread Justin Hibbits
Author: jhibbits
Date: Tue May  2 21:33:27 2017
New Revision: 317708
URL: https://svnweb.freebsd.org/changeset/base/317708

Log:
  Add powerpcspe to arch(7)
  
  Reviewed by:  emaste

Modified:
  head/share/man/man7/arch.7

Modified: head/share/man/man7/arch.7
==
--- head/share/man/man7/arch.7  Tue May  2 21:20:27 2017(r317707)
+++ head/share/man/man7/arch.7  Tue May  2 21:33:27 2017(r317708)
@@ -65,6 +65,7 @@ On all supported architectures,
 .It mips64elhf  Ta 8 Ta  8 Ta 8
 .It mips64hfTa 8 Ta  8 Ta 8
 .It powerpc Ta 4 Ta  8 Ta 4
+.It powerpcspe  Ta 4 Ta  8 Ta 4
 .It powerpc64   Ta 8 Ta  8 Ta 8
 .It riscv   Ta 8 Ta 16 Ta 8
 .It sparc64 Ta 8 Ta 16 Ta 8
@@ -88,6 +89,7 @@ On all supported architectures,
 .It mips64elhf  Ta little Ta   signed
 .It mips64hfTa bigTa   signed
 .It powerpc Ta bigTa unsigned
+.It powerpcspe  Ta bigTa unsigned
 .It powerpc64   Ta bigTa unsigned
 .It riscv   Ta little Ta   signed
 .It sparc64 Ta bigTa   signed
@@ -111,6 +113,7 @@ On all supported architectures,
 .It mips64elhf  Ta 4K
 .It mips64hfTa 4K
 .It powerpc Ta 4K
+.It powerpcspe  Ta 4K
 .It powerpc64   Ta 4K
 .It riscv   Ta 4K
 .It sparc64 Ta 8K
@@ -134,6 +137,7 @@ On all supported architectures,
 .It mips64elhf  Ta hard Ta identical to double
 .It mips64hfTa hard Ta identical to double
 .It powerpc Ta hard Ta hard, double precision
+.It powerpcspe  Ta hard Ta hard, double precision
 .It powerpc64   Ta hard Ta hard, double precision
 .It riscv64 Ta hard Ta hard, double precision
 .It riscv64sf   Ta soft Ta soft, double precision
@@ -180,6 +184,7 @@ Architecture-specific macros:
 .It mips64elhf  Ta Dv __mips__, Dv __mips_n64
 .It mips64hfTa Dv __mips__, Dv __MIPSEB__, Dv __mips_n64
 .It powerpc Ta Dv __powerpc__
+.It powerpcspe  Ta Dv __powerpc__, Dv __SPE__
 .It powerpc64   Ta Dv __powerpc__, Dv __powerpc64__
 .It riscv   Ta Dv __riscv__, Dv __riscv64
 .It sparc64 Ta Dv __sparc64__
___
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: r317707 - head/lib/libc/regex

2017-05-02 Thread Brooks Davis
Author: brooks
Date: Tue May  2 21:20:27 2017
New Revision: 317707
URL: https://svnweb.freebsd.org/changeset/base/317707

Log:
  Correct an out-of-bounds read in regcomp when the RE is bad.
  
  When passed the invalid regular expression "a**", the error is
  eventually detected and seterr() is called. It sets p->error
  appropriatly and p->next and p->end to nuls which is a never used char
  nuls[10] which is zeros due to .bss initialization. Unfortunatly,
  p_ere_exp() and p_simp_re() both have fall through cases where they set
  the error, decrement p->next and access it which means a read from what
  ever .bss variable comes before nuls.
  
  Found with regex_test:repet_multi and CHERI bounds checking.
  
  Reviewed by:  ngie, pfg, emaste
  Obtained from:CheriBSD
  Sponsored by: DARPA, AFRL
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D10541

Modified:
  head/lib/libc/regex/regcomp.c

Modified: head/lib/libc/regex/regcomp.c
==
--- head/lib/libc/regex/regcomp.c   Tue May  2 21:09:07 2017
(r317706)
+++ head/lib/libc/regex/regcomp.c   Tue May  2 21:20:27 2017
(r317707)
@@ -444,6 +444,8 @@ p_ere_exp(struct parse *p)
(void)REQUIRE(!MORE() || !isdigit((uch)PEEK()), REG_BADRPT);
/* FALLTHROUGH */
default:
+   if (p->error != 0)
+   return;
p->next--;
wc = WGETNEXT();
ordinary(p, wc);
@@ -651,6 +653,8 @@ p_simp_re(struct parse *p,
(void)REQUIRE(starordinary, REG_BADRPT);
/* FALLTHROUGH */
default:
+   if (p->error != 0)
+   return(0);  /* Definitely not $... */
p->next--;
wc = WGETNEXT();
ordinary(p, wc);
___
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: r317706 - head/usr.bin/proccontrol

2017-05-02 Thread Brooks Davis
On Tue, May 02, 2017 at 09:09:07PM +, Brooks Davis wrote:
> Author: brooks
> Date: Tue May  2 21:09:07 2017
> New Revision: 317706
> URL: https://svnweb.freebsd.org/changeset/base/317706
> 
> Log:
>   Use MAN= rather than MK_MAN=no to not install a manpage.

With this change, the only remaining ordinary users of MK_MAN=no is
lib/ncurses/ncurses/Makefile where it's set when building libncursesw
(wide).  I'd argue this case is wrong as there are wide-character
specific manpages and they should be installed with the correct library.

-- Brooks


signature.asc
Description: PGP signature


svn commit: r317706 - head/usr.bin/proccontrol

2017-05-02 Thread Brooks Davis
Author: brooks
Date: Tue May  2 21:09:07 2017
New Revision: 317706
URL: https://svnweb.freebsd.org/changeset/base/317706

Log:
  Use MAN= rather than MK_MAN=no to not install a manpage.
  
  MFC after:1 week

Modified:
  head/usr.bin/proccontrol/Makefile

Modified: head/usr.bin/proccontrol/Makefile
==
--- head/usr.bin/proccontrol/Makefile   Tue May  2 21:08:38 2017
(r317705)
+++ head/usr.bin/proccontrol/Makefile   Tue May  2 21:09:07 2017
(r317706)
@@ -2,6 +2,6 @@
 
 PROG=   proccontrol
 WARNS?=6
-MK_MAN=no
+MAN=
 
 .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"


svn commit: r317705 - head/usr.bin/grep

2017-05-02 Thread Ed Maste
Author: emaste
Date: Tue May  2 21:08:38 2017
New Revision: 317705
URL: https://svnweb.freebsd.org/changeset/base/317705

Log:
  bsdgrep: avoid use of magic number for REG_NOSPEC
  
  Submitted by: Kyle Evans 
  Differential Revision:https://reviews.freebsd.org/D10420

Modified:
  head/usr.bin/grep/grep.c

Modified: head/usr.bin/grep/grep.c
==
--- head/usr.bin/grep/grep.cTue May  2 20:44:06 2017(r317704)
+++ head/usr.bin/grep/grep.cTue May  2 21:08:38 2017(r317705)
@@ -716,8 +716,13 @@ main(int argc, char *argv[])
case GREP_BASIC:
break;
case GREP_FIXED:
-   /* XXX: header mess, REG_LITERAL not defined in gnu/regex.h */
-   cflags |= 0020;
+#if defined(REG_NOSPEC)
+   cflags |= REG_NOSPEC;
+#elif defined(REG_LITERAL)
+   cflags |= REG_LITERAL;
+#else
+   errx(2, "literal expressions not supported at compile time");
+#endif
break;
case GREP_EXTENDED:
cflags |= REG_EXTENDED;
___
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: r317704 - head/usr.bin/grep/regex

2017-05-02 Thread Ed Maste
Author: emaste
Date: Tue May  2 20:44:06 2017
New Revision: 317704
URL: https://svnweb.freebsd.org/changeset/base/317704

Log:
  bsdgrep: fix escape map building for multibyte strings
  
  In BSD grep, fix escape map building in the regex parser. It was
  previously using memory not explicitly initialized, and the MBS escape
  map was being built based on a version of the pattern with escapes
  already parsed out.
  
  This is Kyle's change, but I restored the broken style that already
  exists in this file.
  
  Submitted by: Kyle Evans 
  Reviewed by:  cem, Kyle Evans (my style changes)
  Differential Revision:https://reviews.freebsd.org/D10098

Modified:
  head/usr.bin/grep/regex/tre-fastmatch.c

Modified: head/usr.bin/grep/regex/tre-fastmatch.c
==
--- head/usr.bin/grep/regex/tre-fastmatch.c Tue May  2 20:39:33 2017
(r317703)
+++ head/usr.bin/grep/regex/tre-fastmatch.c Tue May  2 20:44:06 2017
(r317704)
@@ -98,6 +98,18 @@ static int   fastcmp(const fastmatch_t *fg
 fg->pattern[siz] = '\0';   \
   }\
 
+#define CONV_MBS_PAT(src, dest, destsz)
\
+  {\
+destsz = wcstombs(NULL, src, 0);   \
+if (destsz == (size_t)-1)  \
+  return REG_BADPAT;   \
+dest = malloc(destsz + 1); \
+if (dest == NULL)  \
+  return REG_ESPACE;   \
+wcstombs(dest, src, destsz);   \
+dest[destsz] = '\0';   \
+  }\
+
 #define IS_OUT_OF_BOUNDS   \
   ((!fg->reversed  \
 ? ((type == STR_WIDE) ? ((j + fg->wlen) > len) \
@@ -723,15 +735,29 @@ badpat:
}
 
   escaped = false;
-  for (unsigned int i = 0; i < fg->len; i++)
-   if (fg->pattern[i] == '\\')
- escaped = !escaped;
-   else if (fg->pattern[i] == '.' && fg->escmap && escaped)
+  char *_checkpat = NULL;
+  size_t _checklen = 0;
+  unsigned int escofs = 0;
+  /*
+   * Make a copy here of the original pattern, because fg->pattern has
+   * already been stripped of all escape sequences in the above processing.
+   * This is necessary if we wish to later treat fg->escmap as an actual,
+   * functional replacement of fg->wescmap.
+   */
+  CONV_MBS_PAT(pat, _checkpat, _checklen);
+  for (unsigned int i = 0; i < n; i++)
+   if (_checkpat[i] == '\\')
+ {
+   escaped = !escaped;
+   if (escaped)
+ ++escofs;
+ }
+   else if (_checkpat[i] == '.' && fg->escmap != NULL && escaped)
  {
-   fg->escmap[i] = true;
+   fg->escmap[i - escofs] = true;
escaped = false;
  }
-   else if (fg->pattern[i] == '.' && !escaped)
+   else if (_checkpat[i] == '.' && !escaped)
  {
hasdot = i;
if (firstdot == -1)
@@ -739,6 +765,7 @@ badpat:
  }
else
  escaped = false;
+  free(_checkpat);
 }
 #else
   SAVE_PATTERN(tmp, pos, fg->pattern, fg->len);
___
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: r317681 - head/share/man/man7

2017-05-02 Thread Konstantin Belousov
On Tue, May 02, 2017 at 02:36:24PM -0600, Ian Lepore wrote:
> On Tue, 2017-05-02 at 22:45 +0300, Konstantin Belousov wrote:
> > +is always signed, it is 64-bits everywere except on i386 and 32-bit
> > powerpc.
> 
> s/everywere/everywhere/

Fixed, thank you.

diff --git a/share/man/man7/arch.7 b/share/man/man7/arch.7
index 1ce397a303e..7cb05ea5271 100644
--- a/share/man/man7/arch.7
+++ b/share/man/man7/arch.7
@@ -37,6 +37,8 @@ Differences between CPU architectures and platforms supported 
by
 .Fx .
 .Pp
 .Ss Type sizes
+If not explicitely mentioned, sizes are in bytes.
+.Pp
 On all supported architectures,
 .Bl -column -offset -indent "long long" "Size"
 .It Sy Type Ta Sy Size
@@ -47,8 +49,10 @@ On all supported architectures,
 .It float Ta 4
 .It double Ta 8
 .El
-.Bl -column -offset indent "Sy Architecture" "Sy sizeof(void *)" "Sy 
sizeof(long double)" "Sy sizeof(time_t)"
-.It Sy Architecture Ta Sy sizeof(void *) Ta Sy sizeof(long double) Ta Sy 
sizeof(time_t)
+.Pp
+Machine-dependent type sizes:
+.Bl -column -offset indent "Sy Architecture" "Sy void *" "Sy long double" "Sy 
time_t"
+.It Sy Architecture Ta Sy void * Ta Sy long double Ta Sy time_t
 .It amd64   Ta 8 Ta 16 Ta 8
 .It arm Ta 4 Ta  8 Ta 8
 .It armeb   Ta 4 Ta  8 Ta 8
@@ -69,6 +73,9 @@ On all supported architectures,
 .It riscv   Ta 8 Ta 16 Ta 8
 .It sparc64 Ta 8 Ta 16 Ta 8
 .El
+.Pp
+.Sy time_t
+is always signed, it is 64-bits everywhere except on i386 and 32-bit powerpc.
 .Ss Endianness and Char Signedness
 .Bl -column -offset indent "Sy Architecture" "Sy Endianness" "Sy char 
Signedness"
 .It Sy Architecture Ta Sy Endianness Ta Sy char Signedness
___
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: r317703 - in head: contrib/netbsd-tests/usr.bin/grep usr.bin/grep usr.bin/grep/tests

2017-05-02 Thread Ed Maste
Author: emaste
Date: Tue May  2 20:39:33 2017
New Revision: 317703
URL: https://svnweb.freebsd.org/changeset/base/317703

Log:
  bsdgrep: fix -w flag matching with an empty pattern
  
  -w flag matching with an empty pattern was generally 'broken', allowing
  matches to occur on any line whether or not it actually matches -w
  criteria.
  
  This fix required a good amount of refactoring to address.  procline()
  is altered to *only* process the line and return whether it was a match
  or not, necessary to be able to short-circuit the whole function in case
  of this matchall flag. -m flag handling is moved out as well because it
  suffers from the same fate as context handling if we bypass any actual
  pattern matching.
  
  The matching context (matches, mostly) didn't previously exist outside
  of procline(), so we go ahead and create context object for file
  processing bits to pass around.  grep_printline() was created due to
  this, for the scenarios where the matches don't actually matter and we
  just want to print a line or two, a la flushing the context queue and
  no -o or --color specified.
  
  Damage from this broken behavior would have been mitigated by the fact
  that it is unlikely users would invoke grep -w with an empty pattern.
  
  This was identified while checking PR 105221 for problems it this may
  cause in BSD grep, but PR 105221 is *not* a report of this behavior.
  
  Submitted by: Kyle Evans 
  Differential Revision:https://reviews.freebsd.org/D10433

Added:
  head/contrib/netbsd-tests/usr.bin/grep/d_context_e.in   (contents, props 
changed)
  head/contrib/netbsd-tests/usr.bin/grep/d_context_e.out   (contents, props 
changed)
  head/contrib/netbsd-tests/usr.bin/grep/d_context_f.out   (contents, props 
changed)
  head/contrib/netbsd-tests/usr.bin/grep/d_context_g.out   (contents, props 
changed)
Modified:
  head/contrib/netbsd-tests/usr.bin/grep/t_grep.sh
  head/usr.bin/grep/grep.c
  head/usr.bin/grep/grep.h
  head/usr.bin/grep/queue.c
  head/usr.bin/grep/tests/Makefile
  head/usr.bin/grep/util.c

Added: head/contrib/netbsd-tests/usr.bin/grep/d_context_e.in
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/contrib/netbsd-tests/usr.bin/grep/d_context_e.in   Tue May  2 
20:39:33 2017(r317703)
@@ -0,0 +1,10 @@
+monkey
+banana
+apple
+fruit
+monkey
+banna
+apple
+fruit
+apple
+monkey

Added: head/contrib/netbsd-tests/usr.bin/grep/d_context_e.out
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/contrib/netbsd-tests/usr.bin/grep/d_context_e.out  Tue May  2 
20:39:33 2017(r317703)
@@ -0,0 +1,9 @@
+monkey
+banana
+apple
+fruit
+monkey
+banna
+--
+apple
+monkey

Added: head/contrib/netbsd-tests/usr.bin/grep/d_context_f.out
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/contrib/netbsd-tests/usr.bin/grep/d_context_f.out  Tue May  2 
20:39:33 2017(r317703)
@@ -0,0 +1,9 @@
+monkey
+banana
+apple
+fruit
+monkey
+banna
+apple
+fruit
+apple

Added: head/contrib/netbsd-tests/usr.bin/grep/d_context_g.out
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/contrib/netbsd-tests/usr.bin/grep/d_context_g.out  Tue May  2 
20:39:33 2017(r317703)
@@ -0,0 +1,8 @@
+apple
+fruit
+--
+banna
+apple
+fruit
+apple
+monkey

Modified: head/contrib/netbsd-tests/usr.bin/grep/t_grep.sh
==
--- head/contrib/netbsd-tests/usr.bin/grep/t_grep.shTue May  2 20:38:10 
2017(r317702)
+++ head/contrib/netbsd-tests/usr.bin/grep/t_grep.shTue May  2 20:39:33 
2017(r317703)
@@ -171,6 +171,12 @@ context_body()
atf_check -o file:d_context_b.out grep -A3 tilt d_context_a.in
atf_check -o file:d_context_c.out grep -B4 Whig d_context_a.in
atf_check -o file:d_context_d.out grep -C1 pig d_context_a.in 
d_context_b.in
+   atf_check -o file:d_context_e.out \
+   grep -E -C1 '(banana|monkey)' d_context_e.in
+   atf_check -o file:d_context_f.out \
+   grep -Ev -B2 '(banana|monkey|fruit)' d_context_e.in
+   atf_check -o file:d_context_g.out \
+   grep -Ev -A1 '(banana|monkey|fruit)' d_context_e.in
 }
 
 atf_test_case file_exp
@@ -386,6 +392,32 @@ zerolen_body()
atf_check -o inline:"Eggs\nCheese\n" grep -v -e "^$" test1
 }
 
+atf_test_case wflag_emptypat
+wflag_emptypat_head()
+{
+   atf_set "descr" "Check for proper handling of -w with an empty pattern 
(PR 105221)"
+}
+wflag_emptypat_body()
+{
+   grep_type
+   if [ $? -eq $GREP_TYPE_GNU_FREEBSD ]; then
+   atf_expect_fail 

svn commit: r317702 - in head/sys: conf dev/cxgbe dev/cxgbe/common modules/cxgbe/if_cxgbe

2017-05-02 Thread Navdeep Parhar
Author: np
Date: Tue May  2 20:38:10 2017
New Revision: 317702
URL: https://svnweb.freebsd.org/changeset/base/317702

Log:
  cxgbe(4): Support routines for Tx traffic scheduling.
  
  - Create a new file, t4_sched.c, and move all of the code related to
traffic management from t4_main.c and t4_sge.c to this file.
  - Track both Channel Rate Limiter (ch_rl) and Class Rate Limiter (cl_rl)
parameters in the PF driver.
  - Initialize all the cl_rl limiters with somewhat arbitrary default
rates and provide routines to update them on the fly.
  - Provide routines to reserve and release traffic classes.
  
  MFC after:1 month
  Sponsored by: Chelsio Communications

Added:
  head/sys/dev/cxgbe/t4_sched.c   (contents, props changed)
Modified:
  head/sys/conf/files
  head/sys/dev/cxgbe/adapter.h
  head/sys/dev/cxgbe/common/common.h
  head/sys/dev/cxgbe/common/t4_hw.c
  head/sys/dev/cxgbe/t4_main.c
  head/sys/dev/cxgbe/t4_sge.c
  head/sys/dev/cxgbe/t4_vf.c
  head/sys/modules/cxgbe/if_cxgbe/Makefile

Modified: head/sys/conf/files
==
--- head/sys/conf/files Tue May  2 20:08:04 2017(r317701)
+++ head/sys/conf/files Tue May  2 20:38:10 2017(r317702)
@@ -1331,6 +1331,8 @@ dev/cxgbe/t4_main.c   optional cxgbe pci 
compile-with "${NORMAL_C} -I$S/dev/cxgbe"
 dev/cxgbe/t4_netmap.c  optional cxgbe pci \
compile-with "${NORMAL_C} -I$S/dev/cxgbe"
+dev/cxgbe/t4_sched.c   optional cxgbe pci \
+   compile-with "${NORMAL_C} -I$S/dev/cxgbe"
 dev/cxgbe/t4_sge.c optional cxgbe pci \
compile-with "${NORMAL_C} -I$S/dev/cxgbe"
 dev/cxgbe/t4_l2t.c optional cxgbe pci \

Modified: head/sys/dev/cxgbe/adapter.h
==
--- head/sys/dev/cxgbe/adapter.hTue May  2 20:08:04 2017
(r317701)
+++ head/sys/dev/cxgbe/adapter.hTue May  2 20:38:10 2017
(r317702)
@@ -231,15 +231,36 @@ struct vi_info {
uint8_t hw_addr[ETHER_ADDR_LEN]; /* factory MAC address, won't change */
 };
 
+struct tx_ch_rl_params {
+   enum fw_sched_params_rate ratemode; /* %port (REL) or kbps (ABS) */
+   uint32_t maxrate;
+};
+
 enum {
-   /* tx_sched_class flags */
-   TX_SC_OK= (1 << 0), /* Set up in hardware, active. */
+   TX_CLRL_REFRESH = (1 << 0), /* Need to update hardware state. */
+   TX_CLRL_ERROR   = (1 << 1), /* Error, hardware state unknown. */
 };
 
-struct tx_sched_class {
+struct tx_cl_rl_params {
int refcount;
-   int flags;
-   struct t4_sched_class_params params;
+   u_int flags;
+   enum fw_sched_params_rate ratemode; /* %port REL or ABS value */
+   enum fw_sched_params_unit rateunit; /* kbps or pps (when ABS) */
+   enum fw_sched_params_mode mode; /* aggr or per-flow */
+   uint32_t maxrate;
+   uint16_t pktsize;
+};
+
+/* Tx scheduler parameters for a channel/port */
+struct tx_sched_params {
+   /* Channel Rate Limiter */
+   struct tx_ch_rl_params ch_rl;
+
+   /* Class WRR */
+   /* XXX */
+
+   /* Class Rate Limiter */
+   struct tx_cl_rl_params cl_rl[];
 };
 
 struct port_info {
@@ -251,7 +272,7 @@ struct port_info {
int up_vis;
int uld_vis;
 
-   struct tx_sched_class *tc;  /* traffic classes for this channel */
+   struct tx_sched_params *sched_params;
 
struct mtx pi_lock;
char lockname[16];
@@ -825,6 +846,9 @@ struct adapter {
 
struct memwin memwin[NUM_MEMWIN];   /* memory windows */
 
+   struct mtx tc_lock;
+   struct task tc_task;
+
const char *last_op;
const void *last_op_thr;
int last_op_flags;
@@ -1106,8 +1130,6 @@ int t4_detach_common(device_t);
 int t4_filter_rpl(struct sge_iq *, const struct rss_header *, struct mbuf *);
 int t4_map_bars_0_and_4(struct adapter *);
 int t4_map_bar_2(struct adapter *);
-int t4_set_sched_class(struct adapter *, struct t4_sched_params *);
-int t4_set_sched_queue(struct adapter *, struct t4_sched_queue *);
 int t4_setup_intr_handlers(struct adapter *);
 void t4_sysctls(struct adapter *);
 int begin_synchronized_op(struct adapter *, struct vi_info *, int, char *);
@@ -1168,6 +1190,15 @@ int t4_set_tracer(struct adapter *, stru
 int t4_trace_pkt(struct sge_iq *, const struct rss_header *, struct mbuf *);
 int t5_trace_pkt(struct sge_iq *, const struct rss_header *, struct mbuf *);
 
+/* t4_sched.c */
+int t4_set_sched_class(struct adapter *, struct t4_sched_params *);
+int t4_set_sched_queue(struct adapter *, struct t4_sched_queue *);
+int t4_init_tx_sched(struct adapter *);
+int t4_free_tx_sched(struct adapter *);
+void t4_update_tx_sched(struct adapter *);
+int t4_reserve_cl_rl_kbps(struct adapter *, int, u_int, int *);
+void t4_release_cl_rl_kbps(struct adapter *, int, int);
+
 static inline struct wrqe *
 

Re: svn commit: r317681 - head/share/man/man7

2017-05-02 Thread Ian Lepore
On Tue, 2017-05-02 at 22:45 +0300, Konstantin Belousov wrote:
> +is always signed, it is 64-bits everywere except on i386 and 32-bit
> powerpc.

s/everywere/everywhere/

-- 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: r317701 - head/usr.bin/grep/regex

2017-05-02 Thread Ed Maste
Author: emaste
Date: Tue May  2 20:08:04 2017
New Revision: 317701
URL: https://svnweb.freebsd.org/changeset/base/317701

Log:
  bsdgrep: correct test sense from r317700
  
  Kyle's change in review D10098 was correct. I introduced the error when
  extracting a portion of that change.

Modified:
  head/usr.bin/grep/regex/tre-fastmatch.c

Modified: head/usr.bin/grep/regex/tre-fastmatch.c
==
--- head/usr.bin/grep/regex/tre-fastmatch.c Tue May  2 19:56:42 2017
(r317700)
+++ head/usr.bin/grep/regex/tre-fastmatch.c Tue May  2 20:08:04 2017
(r317701)
@@ -715,7 +715,7 @@ badpat:
   if (fg->wescmap != NULL)
{
  fg->escmap = calloc(fg->len, sizeof(bool));
- if (fg->escmap != NULL)
+ if (fg->escmap == NULL)
{
  tre_free_fast(fg);
  return REG_ESPACE;
___
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: r317700 - head/usr.bin/grep/regex

2017-05-02 Thread Ed Maste
Author: emaste
Date: Tue May  2 19:56:42 2017
New Revision: 317700
URL: https://svnweb.freebsd.org/changeset/base/317700

Log:
  bsdgrep: use calloc where appropriate in grep's tre-fastmatch
  
  Also apply style(9) to a related NULL check.
  
  Submitted by: Kyle Evans  (D10098)

Modified:
  head/usr.bin/grep/regex/tre-fastmatch.c

Modified: head/usr.bin/grep/regex/tre-fastmatch.c
==
--- head/usr.bin/grep/regex/tre-fastmatch.c Tue May  2 19:30:42 2017
(r317699)
+++ head/usr.bin/grep/regex/tre-fastmatch.c Tue May  2 19:56:42 2017
(r317700)
@@ -630,7 +630,7 @@ tre_compile_fast(fastmatch_t *fg, const 
if (escaped)
  {
if (!_escmap)
- _escmap = malloc(n * sizeof(bool));
+ _escmap = calloc(n, sizeof(bool));
if (!_escmap)
  {
free(tmp);
@@ -714,8 +714,8 @@ badpat:
 {
   if (fg->wescmap != NULL)
{
- fg->escmap = malloc(fg->len * sizeof(bool));
- if (!fg->escmap)
+ fg->escmap = calloc(fg->len, sizeof(bool));
+ if (fg->escmap != NULL)
{
  tre_free_fast(fg);
  return REG_ESPACE;
___
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: r317681 - head/share/man/man7

2017-05-02 Thread Konstantin Belousov
On Wed, May 03, 2017 at 04:41:52AM +1000, Bruce Evans wrote:
> It would be good to mention that the type of time_t is signed somewhere.
> There is a whole column for the signedess of char in another table.
> Signedness can be given consisely using some markup like -8 or 8- for
> signed.  The scale (often bytes or bits) could be given similarly.  E.g,
> 8-B could mean signed 8 bits and 80.b could mean 80 bits floating pint.
> 
> The Page Size table says "Page Sizes" redundantly in 1 column but doesn't
> gives units, and depends on everyone knowing that 4K is real K and bytes.
I added a note at the very beginning, saying that sizes are in bytes.
For time_t, I added a short narration besides the table data.

> 
> The Floating Point table already doesn't say "sizeof()" in the header but
[omited, I do not want to change the scope of the fix]

diff --git a/share/man/man7/arch.7 b/share/man/man7/arch.7
index 1ce397a303e..ad1abccc2e5 100644
--- a/share/man/man7/arch.7
+++ b/share/man/man7/arch.7
@@ -37,6 +37,8 @@ Differences between CPU architectures and platforms supported 
by
 .Fx .
 .Pp
 .Ss Type sizes
+If not explicitely mentioned, sizes are in bytes.
+.Pp
 On all supported architectures,
 .Bl -column -offset -indent "long long" "Size"
 .It Sy Type Ta Sy Size
@@ -47,8 +49,10 @@ On all supported architectures,
 .It float Ta 4
 .It double Ta 8
 .El
-.Bl -column -offset indent "Sy Architecture" "Sy sizeof(void *)" "Sy 
sizeof(long double)" "Sy sizeof(time_t)"
-.It Sy Architecture Ta Sy sizeof(void *) Ta Sy sizeof(long double) Ta Sy 
sizeof(time_t)
+.Pp
+Machine-dependent type sizes:
+.Bl -column -offset indent "Sy Architecture" "Sy void *" "Sy long double" "Sy 
time_t"
+.It Sy Architecture Ta Sy void * Ta Sy long double Ta Sy time_t
 .It amd64   Ta 8 Ta 16 Ta 8
 .It arm Ta 4 Ta  8 Ta 8
 .It armeb   Ta 4 Ta  8 Ta 8
@@ -69,6 +73,9 @@ On all supported architectures,
 .It riscv   Ta 8 Ta 16 Ta 8
 .It sparc64 Ta 8 Ta 16 Ta 8
 .El
+.Pp
+.Sy time_t
+is always signed, it is 64-bits everywere except on i386 and 32-bit powerpc.
 .Ss Endianness and Char Signedness
 .Bl -column -offset indent "Sy Architecture" "Sy Endianness" "Sy char 
Signedness"
 .It Sy Architecture Ta Sy Endianness Ta Sy char Signedness
___
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: r317699 - stable/11/sys/net

2017-05-02 Thread Alexander Motin
Author: mav
Date: Tue May  2 19:30:42 2017
New Revision: 317699
URL: https://svnweb.freebsd.org/changeset/base/317699

Log:
  MFC r317279: Remove unneeded conditions.

Modified:
  stable/11/sys/net/if_lagg.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/net/if_lagg.c
==
--- stable/11/sys/net/if_lagg.c Tue May  2 19:30:05 2017(r317698)
+++ stable/11/sys/net/if_lagg.c Tue May  2 19:30:42 2017(r317699)
@@ -433,10 +433,8 @@ lagg_register_vlan(void *arg, struct ifn
return;
 
LAGG_RLOCK(sc, );
-   if (!SLIST_EMPTY(>sc_ports)) {
-   SLIST_FOREACH(lp, >sc_ports, lp_entries)
-   EVENTHANDLER_INVOKE(vlan_config, lp->lp_ifp, vtag);
-   }
+   SLIST_FOREACH(lp, >sc_ports, lp_entries)
+   EVENTHANDLER_INVOKE(vlan_config, lp->lp_ifp, vtag);
LAGG_RUNLOCK(sc, );
 }
 
@@ -455,10 +453,8 @@ lagg_unregister_vlan(void *arg, struct i
return;
 
LAGG_RLOCK(sc, );
-   if (!SLIST_EMPTY(>sc_ports)) {
-   SLIST_FOREACH(lp, >sc_ports, lp_entries)
-   EVENTHANDLER_INVOKE(vlan_unconfig, lp->lp_ifp, vtag);
-   }
+   SLIST_FOREACH(lp, >sc_ports, lp_entries)
+   EVENTHANDLER_INVOKE(vlan_unconfig, lp->lp_ifp, vtag);
LAGG_RUNLOCK(sc, );
 }
 
___
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: r317698 - stable/11/sys/net

2017-05-02 Thread Alexander Motin
Author: mav
Date: Tue May  2 19:30:05 2017
New Revision: 317698
URL: https://svnweb.freebsd.org/changeset/base/317698

Log:
  MFC r317253: Add interface reference counting to if_lagg.
  
  Using plain ifunit() looks like request for troubles.

Modified:
  stable/11/sys/net/if_lagg.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/net/if_lagg.c
==
--- stable/11/sys/net/if_lagg.c Tue May  2 19:29:31 2017(r317697)
+++ stable/11/sys/net/if_lagg.c Tue May  2 19:30:05 2017(r317698)
@@ -672,6 +672,7 @@ lagg_port_lladdr(struct lagg_port *lp, u
if (llq == NULL)/* XXX what to do */
return;
 
+   if_ref(ifp);
llq->llq_ifp = ifp;
llq->llq_type = llq_type;
bcopy(lladdr, llq->llq_lladdr, ETHER_ADDR_LEN);
@@ -720,6 +721,7 @@ lagg_port_setlladdr(void *arg, int pendi
EVENTHANDLER_INVOKE(iflladdr_event, ifp);
CURVNET_RESTORE();
head = SLIST_NEXT(llq, llq_entries);
+   if_rele(ifp);
free(llq, M_DEVBUF);
}
 }
@@ -794,6 +796,7 @@ lagg_port_create(struct lagg_softc *sc, 
lp->lp_output = ifp->if_output;
ifp->if_output = lagg_port_output;
 
+   if_ref(ifp);
lp->lp_ifp = ifp;
lp->lp_softc = sc;
 
@@ -947,6 +950,7 @@ lagg_port_destroy(struct lagg_port *lp, 
if (llq->llq_ifp == ifp) {
SLIST_REMOVE(>sc_llq_head, llq, lagg_llq,
llq_entries);
+   if_rele(llq->llq_ifp);
free(llq, M_DEVBUF);
break;  /* Only appears once */
}
@@ -956,6 +960,7 @@ lagg_port_destroy(struct lagg_port *lp, 
if (lp->lp_ifflags)
if_printf(ifp, "%s: lp_ifflags unclean\n", __func__);
 
+   if_rele(ifp);
free(lp, M_DEVBUF);
 
/* Update lagg capabilities */
@@ -1432,7 +1437,7 @@ lagg_ioctl(struct ifnet *ifp, u_long cmd
break;
case SIOCGLAGGPORT:
if (rp->rp_portname[0] == '\0' ||
-   (tpif = ifunit(rp->rp_portname)) == NULL) {
+   (tpif = ifunit_ref(rp->rp_portname)) == NULL) {
error = EINVAL;
break;
}
@@ -1442,18 +1447,20 @@ lagg_ioctl(struct ifnet *ifp, u_long cmd
lp->lp_softc != sc) {
error = ENOENT;
LAGG_RUNLOCK(sc, );
+   if_rele(tpif);
break;
}
 
lagg_port2req(lp, rp);
LAGG_RUNLOCK(sc, );
+   if_rele(tpif);
break;
case SIOCSLAGGPORT:
error = priv_check(td, PRIV_NET_LAGG);
if (error)
break;
if (rp->rp_portname[0] == '\0' ||
-   (tpif = ifunit(rp->rp_portname)) == NULL) {
+   (tpif = ifunit_ref(rp->rp_portname)) == NULL) {
error = EINVAL;
break;
}
@@ -1480,13 +1487,14 @@ lagg_ioctl(struct ifnet *ifp, u_long cmd
LAGG_WLOCK(sc);
error = lagg_port_create(sc, tpif);
LAGG_WUNLOCK(sc);
+   if_rele(tpif);
break;
case SIOCSLAGGDELPORT:
error = priv_check(td, PRIV_NET_LAGG);
if (error)
break;
if (rp->rp_portname[0] == '\0' ||
-   (tpif = ifunit(rp->rp_portname)) == NULL) {
+   (tpif = ifunit_ref(rp->rp_portname)) == NULL) {
error = EINVAL;
break;
}
@@ -1496,11 +1504,13 @@ lagg_ioctl(struct ifnet *ifp, u_long cmd
lp->lp_softc != sc) {
error = ENOENT;
LAGG_WUNLOCK(sc);
+   if_rele(tpif);
break;
}
 
error = lagg_port_destroy(lp, 1);
LAGG_WUNLOCK(sc);
+   if_rele(tpif);
break;
case SIOCSIFFLAGS:
/* Set flags on ports too */
___
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: r317697 - stable/11/sys/net

2017-05-02 Thread Alexander Motin
Author: mav
Date: Tue May  2 19:29:31 2017
New Revision: 317697
URL: https://svnweb.freebsd.org/changeset/base/317697

Log:
  MFC r312979 (by loos):
  Do not update the lagg link layer address when destroying a lagg clone.
  
  This would enqueue an event to send the gratuitous arp on a dying lagg
  interface without any physical ports attached to it.
  
  Apart from that, the taskqueue_drain() on lagg_clone_destroy() runs too
  late, when the ifp data structure is already freed.  Fix that too.

Modified:
  stable/11/sys/net/if_lagg.c
  stable/11/sys/net/if_lagg.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/net/if_lagg.c
==
--- stable/11/sys/net/if_lagg.c Tue May  2 19:09:11 2017(r317696)
+++ stable/11/sys/net/if_lagg.c Tue May  2 19:29:31 2017(r317697)
@@ -539,12 +539,15 @@ lagg_clone_destroy(struct ifnet *ifp)
EVENTHANDLER_DEREGISTER(vlan_unconfig, sc->vlan_detach);
 
/* Shutdown and remove lagg ports */
-   while ((lp = SLIST_FIRST(>sc_ports)) != NULL)
+   while ((lp = SLIST_FIRST(>sc_ports)) != NULL) {
+   lp->lp_detaching = LAGG_CLONE_DESTROY;
lagg_port_destroy(lp, 1);
+   }
/* Unhook the aggregation protocol */
lagg_proto_detach(sc);
LAGG_UNLOCK_ASSERT(sc);
 
+   taskqueue_drain(taskqueue_swi, >sc_lladdr_task);
ifmedia_removeall(>sc_media);
ether_ifdetach(ifp);
if_free(ifp);
@@ -553,7 +556,6 @@ lagg_clone_destroy(struct ifnet *ifp)
SLIST_REMOVE(_lagg_list, sc, lagg_softc, sc_entries);
LAGG_LIST_UNLOCK();
 
-   taskqueue_drain(taskqueue_swi, >sc_lladdr_task);
LAGG_LOCK_DESTROY(sc);
free(sc, M_DEVBUF);
 }
@@ -891,7 +893,7 @@ lagg_port_destroy(struct lagg_port *lp, 
 * Remove multicast addresses and interface flags from this port and
 * reset the MAC address, skip if the interface is being detached.
 */
-   if (!lp->lp_detaching) {
+   if (lp->lp_detaching == 0) {
lagg_ether_cmdmulti(lp, 0);
lagg_setflags(lp, 0);
lagg_port_lladdr(lp, lp->lp_lladdr, LAGG_LLQTYPE_PHYS);
@@ -924,7 +926,8 @@ lagg_port_destroy(struct lagg_port *lp, 
bcopy(lp0->lp_lladdr,
lladdr, ETHER_ADDR_LEN);
}
-   lagg_lladdr(sc, lladdr);
+   if (lp->lp_detaching != LAGG_CLONE_DESTROY)
+   lagg_lladdr(sc, lladdr);
 
/* Mark lp0 as new primary */
sc->sc_primary = lp0;
@@ -939,7 +942,7 @@ lagg_port_destroy(struct lagg_port *lp, 
}
 
/* Remove any pending lladdr changes from the queue */
-   if (lp->lp_detaching) {
+   if (lp->lp_detaching != 0) {
SLIST_FOREACH(llq, >sc_llq_head, llq_entries) {
if (llq->llq_ifp == ifp) {
SLIST_REMOVE(>sc_llq_head, llq, lagg_llq,
@@ -1118,7 +1121,7 @@ lagg_port_ifdetach(void *arg __unused, s
sc = lp->lp_softc;
 
LAGG_WLOCK(sc);
-   lp->lp_detaching = 1;
+   lp->lp_detaching = LAGG_PORT_DETACH;
lagg_port_destroy(lp, 1);
LAGG_WUNLOCK(sc);
 }
@@ -1603,7 +1606,7 @@ lagg_ether_cmdmulti(struct lagg_port *lp
} else {
while ((mc = SLIST_FIRST(>lp_mc_head)) != NULL) {
SLIST_REMOVE(>lp_mc_head, mc, lagg_mc, mc_entries);
-   if (mc->mc_ifma && !lp->lp_detaching)
+   if (mc->mc_ifma && lp->lp_detaching == 0)
if_delmulti_ifma(mc->mc_ifma);
free(mc, M_DEVBUF);
}

Modified: stable/11/sys/net/if_lagg.h
==
--- stable/11/sys/net/if_lagg.h Tue May  2 19:09:11 2017(r317696)
+++ stable/11/sys/net/if_lagg.h Tue May  2 19:29:31 2017(r317697)
@@ -261,6 +261,8 @@ struct lagg_port {
void*lh_cookie; /* if state hook */
void*lp_psc;/* protocol data */
int lp_detaching;   /* ifnet is detaching */
+#defineLAGG_PORT_DETACH0x01/* detach lagg 
port */
+#defineLAGG_CLONE_DESTROY  0x02/* destroy lagg 
clone */
 
SLIST_HEAD(__mclhd, lagg_mc)lp_mc_head; /* multicast addresses 
*/
 
___
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: r317696 - head/sys/net

2017-05-02 Thread Alexander Motin
Author: mav
Date: Tue May  2 19:09:11 2017
New Revision: 317696
URL: https://svnweb.freebsd.org/changeset/base/317696

Log:
  Introduce sleepable locks into if_lagg.
  
  Before this change if_lagg was using nonsleepable rmlocks to protect its
  internal state.  This patch introduces another sx lock to protect code
  paths that require sleeping, while still uses old rmlock to protect hot
  nonsleepable data paths.
  
  This change allows to remove taskqueue decoupling used before to change
  interface addresses without holding the lock.  Instead it uses sx lock to
  protect direct if_ioctl() calls.
  
  As another bonus, the new code synchronizes enabled capabilities of member
  interfaces, and allows to control them with ifconfig laggX, that was
  impossible before.  This part should fix interoperation with if_bridge,
  that may need to disable some capabilities, such as TXCSUM or LRO, to allow
  bridging with noncapable interfaces.
  
  MFC after:2 weeks
  Sponsored by: iXsystems, Inc.
  Differential Revision:https://reviews.freebsd.org/D10514

Modified:
  head/sys/net/if_lagg.c
  head/sys/net/if_lagg.h

Modified: head/sys/net/if_lagg.c
==
--- head/sys/net/if_lagg.c  Tue May  2 18:40:41 2017(r317695)
+++ head/sys/net/if_lagg.c  Tue May  2 19:09:11 2017(r317696)
@@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -99,10 +100,7 @@ static VNET_DEFINE(struct if_clone *, la
 #defineV_lagg_cloner   VNET(lagg_cloner)
 static const char laggname[] = "lagg";
 
-static voidlagg_lladdr(struct lagg_softc *, uint8_t *);
 static voidlagg_capabilities(struct lagg_softc *);
-static voidlagg_port_lladdr(struct lagg_port *, uint8_t *, lagg_llqtype);
-static voidlagg_port_setlladdr(void *, int);
 static int lagg_port_create(struct lagg_softc *, struct ifnet *);
 static int lagg_port_destroy(struct lagg_port *, int);
 static struct mbuf *lagg_input(struct ifnet *, struct mbuf *);
@@ -124,8 +122,9 @@ static int  lagg_snd_tag_alloc(struct ifn
union if_snd_tag_alloc_params *,
struct m_snd_tag **);
 #endif
-static int lagg_ether_setmulti(struct lagg_softc *);
-static int lagg_ether_cmdmulti(struct lagg_port *, int);
+static int lagg_setmulti(struct lagg_port *);
+static int lagg_clrmulti(struct lagg_port *);
+static int lagg_setcaps(struct lagg_port *, int cap);
 static int lagg_setflag(struct lagg_port *, int, int,
int (*func)(struct ifnet *, int));
 static int lagg_setflags(struct lagg_port *, int status);
@@ -317,6 +316,7 @@ static void
 lagg_proto_attach(struct lagg_softc *sc, lagg_proto pr)
 {
 
+   LAGG_XLOCK_ASSERT(sc);
KASSERT(sc->sc_proto == LAGG_PROTO_NONE, ("%s: sc %p has proto",
__func__, sc));
 
@@ -333,8 +333,8 @@ lagg_proto_detach(struct lagg_softc *sc)
 {
lagg_proto pr;
 
+   LAGG_XLOCK_ASSERT(sc);
LAGG_WLOCK_ASSERT(sc);
-
pr = sc->sc_proto;
sc->sc_proto = LAGG_PROTO_NONE;
 
@@ -433,15 +433,14 @@ lagg_register_vlan(void *arg, struct ifn
 {
struct lagg_softc *sc = ifp->if_softc;
struct lagg_port *lp;
-   struct rm_priotracker tracker;
 
if (ifp->if_softc !=  arg)   /* Not our event */
return;
 
-   LAGG_RLOCK(sc, );
+   LAGG_SLOCK(sc);
SLIST_FOREACH(lp, >sc_ports, lp_entries)
EVENTHANDLER_INVOKE(vlan_config, lp->lp_ifp, vtag);
-   LAGG_RUNLOCK(sc, );
+   LAGG_SUNLOCK(sc);
 }
 
 /*
@@ -453,15 +452,14 @@ lagg_unregister_vlan(void *arg, struct i
 {
struct lagg_softc *sc = ifp->if_softc;
struct lagg_port *lp;
-   struct rm_priotracker tracker;
 
if (ifp->if_softc !=  arg)   /* Not our event */
return;
 
-   LAGG_RLOCK(sc, );
+   LAGG_SLOCK(sc);
SLIST_FOREACH(lp, >sc_ports, lp_entries)
EVENTHANDLER_INVOKE(vlan_unconfig, lp->lp_ifp, vtag);
-   LAGG_RUNLOCK(sc, );
+   LAGG_SUNLOCK(sc);
 }
 
 static int
@@ -477,7 +475,10 @@ lagg_clone_create(struct if_clone *ifc, 
free(sc, M_DEVBUF);
return (ENOSPC);
}
+   LAGG_LOCK_INIT(sc);
+   LAGG_SX_INIT(sc);
 
+   LAGG_XLOCK(sc);
if (V_def_use_flowid)
sc->sc_opts |= LAGG_OPT_USE_FLOWID;
sc->flowid_shift = V_def_flowid_shift;
@@ -487,9 +488,7 @@ lagg_clone_create(struct if_clone *ifc, 
 
lagg_proto_attach(sc, LAGG_PROTO_DEFAULT);
 
-   LAGG_LOCK_INIT(sc);
SLIST_INIT(>sc_ports);
-   TASK_INIT(>sc_lladdr_task, 0, lagg_port_setlladdr, sc);
 
/* Initialise pseudo media types */
ifmedia_init(>sc_media, 0, lagg_media_change,
@@ -527,6 +526,7 @@ lagg_clone_create(struct if_clone *ifc, 
LAGG_LIST_LOCK();
SLIST_INSERT_HEAD(_lagg_list, sc, 

Re: svn commit: r317681 - head/share/man/man7

2017-05-02 Thread Bruce Evans

On Tue, 2 May 2017, Ed Maste wrote:


On 2 May 2017 at 12:35, Bruce Evans  wrote:


-current man can't handle macros like "Sy" with -width or some other
things including the things used above.  This causes it to produce
excessive column spacing.  The formatting is bad enough without this
(verbose headers but all columns except "Architecture" have only 1-2
digits).  -current man just considers "Sy " as literal and increases
the column spacing by 3, giving a spacing of 7 columns instead of 4,
where we really want a negative number but 2 would work OK.


We discussed this in review D7261. I created arch.7 with ".Sy based on
an example from FreeBSD 10's mdoc(7). In D7261 I noted that there were
existing man pages with both ".Sy and "Sy .


All examples in at least FreeBSD-5's mdoc(7) use ".Sy" if it is the first
macro in a ``subsection''.  "Sy" is used more often but not as the first
macro.  Typically after '.It'.


Do you believe we should remove them altogether?


I think you mean "all of them in .Bl and similar macros".  I don't like
removing features that once worked.  Someone might be using them.  I
only noticed that I was using this one when it stopped working :-).

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


Re: svn commit: r317681 - head/share/man/man7

2017-05-02 Thread Bruce Evans

On Tue, 2 May 2017, Konstantin Belousov wrote:


On Wed, May 03, 2017 at 02:35:17AM +1000, Bruce Evans wrote:

On Tue, 2 May 2017, Konstantin Belousov wrote:


Log:
 Document time_t size.

Modified: head/share/man/man7/arch.7
==
--- head/share/man/man7/arch.7  Tue May  2 14:52:28 2017(r317680)
+++ head/share/man/man7/arch.7  Tue May  2 14:52:35 2017(r317681)
@@ -47,27 +47,27 @@ On all supported architectures,
.It float Ta 4
.It double Ta 8
.El
-.Bl -column -offset indent "Sy Architecture" "Sy sizeof(void *)" "Sy sizeof(long 
double)"
-.It Sy Architecture Ta Sy sizeof(void *) Ta Sy sizeof(long double)
...
+.Bl -column -offset indent "Sy Architecture" "Sy sizeof(void *)" "Sy sizeof(long 
double)" "Sy sizeof(time_t)"
+.It Sy Architecture Ta Sy sizeof(void *) Ta Sy sizeof(long double) Ta Sy 
sizeof(time_t)
+.It amd64   Ta 8 Ta 16 Ta 8
+.It arm Ta 4 Ta  8 Ta 8


Verbose types mess up the formatting of man pages too.

The header is obviously too long.  -current man misformats it to 91 columns
on 80-column terminals.  FreeBSD-5 man respects COLUMNS, but mangles the
header more completely to do this (1).


I removed excessive sizeof(), which fixed width.


Hmm.  It leaves no mention of the scale.  More below.


diff --git a/share/man/man7/arch.7 b/share/man/man7/arch.7
index 1ce397a303e..73552d60209 100644
--- a/share/man/man7/arch.7
+++ b/share/man/man7/arch.7
@@ -47,8 +47,10 @@ On all supported architectures,
.It float Ta 4
.It double Ta 8
.El
-.Bl -column -offset indent "Sy Architecture" "Sy sizeof(void *)" "Sy sizeof(long 
double)" "Sy sizeof(time_t)"
-.It Sy Architecture Ta Sy sizeof(void *) Ta Sy sizeof(long double) Ta Sy 
sizeof(time_t)
+.Pp
+Machine-depended type's sizes:
+.Bl -column -offset indent "Sy Architecture" "Sy void *" "Sy long double" "Sy 
time_t"
+.It Sy Architecture Ta Sy void * Ta Sy long double Ta Sy time_t


Remove the buggy Sy's too.


.It amd64   Ta 8 Ta 16 Ta 8
.It arm Ta 4 Ta  8 Ta 8
.It armeb   Ta 4 Ta  8 Ta 8


It would be good to mention that the type of time_t is signed somewhere.
There is a whole column for the signedess of char in another table.
Signedness can be given consisely using some markup like -8 or 8- for
signed.  The scale (often bytes or bits) could be given similarly.  E.g,
8-B could mean signed 8 bits and 80.b could mean 80 bits floating pint.

The Page Size table says "Page Sizes" redundantly in 1 column but doesn't
gives units, and depends on everyone knowing that 4K is real K and bytes.

The Floating Point table already doesn't say "sizeof()" in the header but
gives a lot of details including units in some cases in the values.  The
long double in the table that you changed would be better placed in the
FP table, except it is short of space too.  The size info for a long double
on {amd64,i386} is in 2 tables in different incomplete forms:
- first table gives sizes {16, 12} with no mention of either sizes or units;
  these are object sizes in bytes
- second table gives values {80, 80} with no mention of sizes but mention of
  bits; these are the unpadded object/register sizes (not really available
  in C), expressed in different units.  This column in the table is mostly
  about the precision.  It says "double precision" in some places, "identical
  to double" in others, and "quad precision" for arm64 and sparc64 ("hard"
  for sparc64 is broken.  sparc64 can have either, but the default is soft
  since hard it is rearely or never implemented in hardware and is emulated
  even more slowly by doing it softly in trap handlers).  The 80's for
  amd64 and i386 are don't give the precision like the others.  The precision
  is 64 bits, and the 80-bit size is not really available in C.

  Better table entries would be something like

  (hard | soft), (8 | 10 | 12 | 16) bytes, (53 | 64 | 113) bit precision

  or for the longest case "hard, 16 bytes, 113 bit precision".  There is
  just enough space for this after removing the Sy's.  I don't like the
  duplication in this.  So better go back to "identical to double" where
  it applies, and apply it more.  Double is described as just hard or soft
  with no mention that the precision is always 53 bits (this should be
  in the ealier table of MI sizes).  Long double is then the same on some
  arches.

arm64 doesn't have an _fpmath.h for it in libc, so I don't see how it
can have the soft quad precision claimed in the table.  Similarly in
msun/arm/Makefile.inc.

riscv has an _fpmath.h stating quad precision, but isn't in any table in
arch.7.  This _fpmath.h seems quite buggy, with inconsistent commenting
out and macros not matching the struct, so I don't see how it can work
either.  msun/riscv/Makefile.inc claims 113 bits, and the struct is
consistent with this,  but the macros consistent with this are commented
out, so I don't see how it can compile.

aarch64 is like riscv except its _fpmath.h seems to be 

svn commit: r317695 - head/sys/vm

2017-05-02 Thread Konstantin Belousov
Author: kib
Date: Tue May  2 18:40:41 2017
New Revision: 317695
URL: https://svnweb.freebsd.org/changeset/base/317695

Log:
  Emulate pre-r317061 ABI.
  
  This restores 32bit-sized accesses to vmcnt sysctls, making old
  binaries like top(1), systat(8) and reboot(8) mostly functional on
  newer kernel.
  
  Reviewed by:  bde
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/vm/vm_meter.c

Modified: head/sys/vm/vm_meter.c
==
--- head/sys/vm/vm_meter.c  Tue May  2 18:37:11 2017(r317694)
+++ head/sys/vm/vm_meter.c  Tue May  2 18:40:41 2017(r317695)
@@ -266,8 +266,27 @@ static SYSCTL_NODE(_vm_stats, OID_AUTO, 
"VM meter vm stats");
 SYSCTL_NODE(_vm_stats, OID_AUTO, misc, CTLFLAG_RW, 0, "VM meter misc stats");
 
+static int
+sysctl_handle_vmstat(SYSCTL_HANDLER_ARGS)
+{
+   uint64_t val;
+#ifdef COMPAT_FREEBSD11
+   uint32_t val32;
+#endif
+
+   val = counter_u64_fetch(*(counter_u64_t *)arg1);
+#ifdef COMPAT_FREEBSD11
+   if (req->oldlen == sizeof(val32)) {
+   val32 = val;/* truncate */
+   return (SYSCTL_OUT(req, , sizeof(val32)));
+   }
+#endif
+   return (SYSCTL_OUT(req, , sizeof(val)));
+}
+
 #defineVM_STATS(parent, var, descr) \
-SYSCTL_COUNTER_U64(parent, OID_AUTO, var, CTLFLAG_RD, _cnt.var, descr)
+SYSCTL_OID(parent, OID_AUTO, var, CTLTYPE_U64 | CTLFLAG_MPSAFE | \
+CTLFLAG_RD, _cnt.var, 0, sysctl_handle_vmstat, "QU", descr);
 #defineVM_STATS_VM(var, descr) VM_STATS(_vm_stats_vm, var, 
descr)
 #defineVM_STATS_SYS(var, descr)VM_STATS(_vm_stats_sys, var, 
descr)
 
___
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: r317694 - head/contrib/netbsd-tests/usr.bin/grep

2017-05-02 Thread Ed Maste
Author: emaste
Date: Tue May  2 18:37:11 2017
New Revision: 317694
URL: https://svnweb.freebsd.org/changeset/base/317694

Log:
  bsdgrep: revise test case which will soon become a failure
  
  Work in progress (D10315) is going to make egrep_empty_invalid an
  actually invalid regex, to be consistent with the equivalent BRE "{"
  behavior, when using regex(3).
  
  Any non-0 exit value is acceptable, depending on how the installed grep
  interprets the expression. GNU grep interprets it as non-matching, and
  in the future BSD grep will interpret it is an error.
  
  Submitted by: Kyle Evans 
  Reviewed by:  cem, ngie
  Differential Revision:https://reviews.freebsd.org/D10572`

Modified:
  head/contrib/netbsd-tests/usr.bin/grep/t_grep.sh

Modified: head/contrib/netbsd-tests/usr.bin/grep/t_grep.sh
==
--- head/contrib/netbsd-tests/usr.bin/grep/t_grep.shTue May  2 18:31:26 
2017(r317693)
+++ head/contrib/netbsd-tests/usr.bin/grep/t_grep.shTue May  2 18:37:11 
2017(r317694)
@@ -369,7 +369,7 @@ egrep_empty_invalid_head()
 }
 egrep_empty_invalid_body()
 {
-   atf_check -s exit:1 egrep '{' /dev/null
+   atf_check -e ignore -s not-exit:0 egrep '{' /dev/null
 }
 
 atf_test_case zerolen
___
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: r317681 - head/share/man/man7

2017-05-02 Thread Konstantin Belousov
On Tue, May 02, 2017 at 02:04:09PM -0400, Ed Maste wrote:
> > +Machine-depended type's sizes:
> 
> Probably "Machine-dependent type sizes"

Sure.

diff --git a/share/man/man7/arch.7 b/share/man/man7/arch.7
index 1ce397a303e..f30dfbb8145 100644
--- a/share/man/man7/arch.7
+++ b/share/man/man7/arch.7
@@ -47,8 +47,10 @@ On all supported architectures,
 .It float Ta 4
 .It double Ta 8
 .El
-.Bl -column -offset indent "Sy Architecture" "Sy sizeof(void *)" "Sy 
sizeof(long double)" "Sy sizeof(time_t)"
-.It Sy Architecture Ta Sy sizeof(void *) Ta Sy sizeof(long double) Ta Sy 
sizeof(time_t)
+.Pp
+Machine-dependent type sizes:
+.Bl -column -offset indent "Sy Architecture" "Sy void *" "Sy long double" "Sy 
time_t"
+.It Sy Architecture Ta Sy void * Ta Sy long double Ta Sy time_t
 .It amd64   Ta 8 Ta 16 Ta 8
 .It arm Ta 4 Ta  8 Ta 8
 .It armeb   Ta 4 Ta  8 Ta 8
___
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: r317693 - vendor/lldb/lldb-trunk-r301939

2017-05-02 Thread Dimitry Andric
Author: dim
Date: Tue May  2 18:31:26 2017
New Revision: 317693
URL: https://svnweb.freebsd.org/changeset/base/317693

Log:
  Tag lldb trunk r301939.

Added:
  vendor/lldb/lldb-trunk-r301939/
 - copied from r317692, vendor/lldb/dist/
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r317691 - vendor/lld/lld-trunk-r301939

2017-05-02 Thread Dimitry Andric
Author: dim
Date: Tue May  2 18:31:13 2017
New Revision: 317691
URL: https://svnweb.freebsd.org/changeset/base/317691

Log:
  Tag lld trunk r301939.

Added:
  vendor/lld/lld-trunk-r301939/
 - copied from r317690, vendor/lld/dist/
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r317692 - in vendor/lldb/dist: . cmake/XcodeHeaderGenerator cmake/modules include/lldb/Core include/lldb/Host include/lldb/Host/common include/lldb/Host/linux include/lldb/Host/posix in...

2017-05-02 Thread Dimitry Andric
Author: dim
Date: Tue May  2 18:31:19 2017
New Revision: 317692
URL: https://svnweb.freebsd.org/changeset/base/317692

Log:
  Vendor import of lldb trunk r301939:
  https://llvm.org/svn/llvm-project/lldb/trunk@301939

Added:
  vendor/lldb/dist/cmake/XcodeHeaderGenerator/
  vendor/lldb/dist/cmake/XcodeHeaderGenerator/CMakeLists.txt   (contents, props 
changed)
  vendor/lldb/dist/cmake/modules/LLDBGenerateConfig.cmake
  vendor/lldb/dist/source/Host/common/MainLoop.cpp   (contents, props changed)
  vendor/lldb/dist/unittests/ObjectFile/ELF/Inputs/
  
vendor/lldb/dist/unittests/ObjectFile/ELF/Inputs/sections-resolve-consistently.yaml
  vendor/lldb/dist/unittests/ObjectFile/ELF/TestObjectFileELF.cpp   (contents, 
props changed)
Deleted:
  vendor/lldb/dist/include/lldb/Host/posix/MainLoopPosix.h
  vendor/lldb/dist/source/Host/posix/MainLoopPosix.cpp
Modified:
  vendor/lldb/dist/CMakeLists.txt
  vendor/lldb/dist/cmake/modules/LLDBConfig.cmake
  vendor/lldb/dist/include/lldb/Core/Module.h
  vendor/lldb/dist/include/lldb/Core/TraceOptions.h
  vendor/lldb/dist/include/lldb/Core/UniqueCStringMap.h
  vendor/lldb/dist/include/lldb/Host/Config.h
  vendor/lldb/dist/include/lldb/Host/Config.h.cmake
  vendor/lldb/dist/include/lldb/Host/MainLoop.h
  vendor/lldb/dist/include/lldb/Host/PosixApi.h
  vendor/lldb/dist/include/lldb/Host/Socket.h
  vendor/lldb/dist/include/lldb/Host/common/TCPSocket.h
  vendor/lldb/dist/include/lldb/Host/common/UDPSocket.h
  vendor/lldb/dist/include/lldb/Host/linux/AbstractSocket.h
  vendor/lldb/dist/include/lldb/Host/posix/DomainSocket.h
  vendor/lldb/dist/include/lldb/Symbol/ObjectFile.h
  vendor/lldb/dist/include/lldb/Symbol/SymbolFile.h
  vendor/lldb/dist/include/lldb/Symbol/Symtab.h
  vendor/lldb/dist/include/lldb/Target/Target.h
  vendor/lldb/dist/lldb.xcodeproj/project.pbxproj
  
vendor/lldb/dist/packages/Python/lldbsuite/test/lang/c/shared_lib/TestSharedLib.py
  vendor/lldb/dist/packages/Python/lldbsuite/test/make/Android.rules
  
vendor/lldb/dist/packages/Python/lldbsuite/test/tools/lldb-mi/control/TestMiExec.py
  vendor/lldb/dist/source/Core/Module.cpp
  vendor/lldb/dist/source/Host/CMakeLists.txt
  vendor/lldb/dist/source/Host/common/Socket.cpp
  vendor/lldb/dist/source/Host/common/SocketAddress.cpp
  vendor/lldb/dist/source/Host/common/TCPSocket.cpp
  vendor/lldb/dist/source/Host/common/UDPSocket.cpp
  vendor/lldb/dist/source/Host/linux/AbstractSocket.cpp
  vendor/lldb/dist/source/Host/posix/ConnectionFileDescriptorPosix.cpp
  vendor/lldb/dist/source/Host/posix/DomainSocket.cpp
  vendor/lldb/dist/source/Interpreter/CommandInterpreter.cpp
  vendor/lldb/dist/source/Interpreter/OptionValueEnumeration.cpp
  vendor/lldb/dist/source/Interpreter/OptionValueProperties.cpp
  vendor/lldb/dist/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
  vendor/lldb/dist/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.h
  vendor/lldb/dist/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp
  vendor/lldb/dist/source/Plugins/Language/CPlusPlus/LibCxxUnorderedMap.cpp
  vendor/lldb/dist/source/Plugins/Language/CPlusPlus/LibCxxVector.cpp
  
vendor/lldb/dist/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp
  
vendor/lldb/dist/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp
  vendor/lldb/dist/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
  vendor/lldb/dist/source/Plugins/ObjectFile/ELF/ObjectFileELF.h
  
vendor/lldb/dist/source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp
  vendor/lldb/dist/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
  vendor/lldb/dist/source/Plugins/SymbolFile/DWARF/NameToDIE.cpp
  vendor/lldb/dist/source/Plugins/SymbolFile/DWARF/NameToDIE.h
  vendor/lldb/dist/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  vendor/lldb/dist/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
  vendor/lldb/dist/source/Symbol/ClangASTContext.cpp
  vendor/lldb/dist/source/Symbol/GoASTContext.cpp
  vendor/lldb/dist/source/Symbol/SymbolFile.cpp
  vendor/lldb/dist/source/Symbol/Symtab.cpp
  vendor/lldb/dist/source/Target/Target.cpp
  vendor/lldb/dist/source/Utility/ConstString.cpp
  vendor/lldb/dist/tools/debugserver/debugserver.xcodeproj/project.pbxproj
  vendor/lldb/dist/tools/debugserver/source/CMakeLists.txt
  vendor/lldb/dist/tools/debugserver/source/RNBSocket.cpp
  vendor/lldb/dist/tools/debugserver/source/debugserver.cpp
  vendor/lldb/dist/tools/lldb-server/Acceptor.cpp
  vendor/lldb/dist/unittests/Host/SocketTest.cpp
  vendor/lldb/dist/unittests/ObjectFile/ELF/CMakeLists.txt
  vendor/lldb/dist/unittests/Process/gdb-remote/GDBRemoteTestUtils.cpp
  vendor/lldb/dist/unittests/debugserver/RNBSocketTest.cpp

Modified: vendor/lldb/dist/CMakeLists.txt
==
--- vendor/lldb/dist/CMakeLists.txt Tue May  2 18:31:13 2017
(r317691)
+++ vendor/lldb/dist/CMakeLists.txt Tue May  2 18:31:19 2017
(r317692)
@@ -1,8 +1,15 @@
 

svn commit: r317687 - in vendor/compiler-rt/dist: cmake/Modules include/sanitizer include/xray lib/asan lib/sanitizer_common lib/scudo lib/tsan/go lib/tsan/rtl lib/tsan/tests/rtl lib/ubsan lib/xray...

2017-05-02 Thread Dimitry Andric
Author: dim
Date: Tue May  2 18:30:55 2017
New Revision: 317687
URL: https://svnweb.freebsd.org/changeset/base/317687

Log:
  Vendor import of compiler-rt trunk r301939:
  https://llvm.org/svn/llvm-project/compiler-rt/trunk@301939

Added:
  vendor/compiler-rt/dist/lib/scudo/scudo_tls.h   (contents, props changed)
  vendor/compiler-rt/dist/lib/scudo/scudo_tls_linux.cpp   (contents, props 
changed)
  vendor/compiler-rt/dist/lib/scudo/scudo_tls_linux.h   (contents, props 
changed)
  vendor/compiler-rt/dist/test/asan/TestCases/Linux/global-overflow-bfd.cc   
(contents, props changed)
  vendor/compiler-rt/dist/test/asan/TestCases/Linux/global-overflow-lld.cc   
(contents, props changed)
  vendor/compiler-rt/dist/test/asan/TestCases/Linux/globals-gc-sections-lld.cc  
 (contents, props changed)
  vendor/compiler-rt/dist/test/asan/TestCases/small_memcpy_test.cc   (contents, 
props changed)
  vendor/compiler-rt/dist/test/sanitizer_common/ios_commands/
  vendor/compiler-rt/dist/test/sanitizer_common/ios_commands/iossim_compile.py  
 (contents, props changed)
  vendor/compiler-rt/dist/test/sanitizer_common/ios_commands/iossim_env.py   
(contents, props changed)
  vendor/compiler-rt/dist/test/sanitizer_common/ios_commands/iossim_run.py   
(contents, props changed)
Deleted:
  vendor/compiler-rt/dist/test/asan/TestCases/Linux/globals-gc-sections.cc
  
vendor/compiler-rt/dist/test/asan/TestCases/Posix/coverage-direct-activation.cc
  vendor/compiler-rt/dist/test/asan/TestCases/Posix/coverage-direct-large.cc
  vendor/compiler-rt/dist/test/asan/TestCases/Posix/coverage-direct.cc
  vendor/compiler-rt/dist/test/asan/TestCases/Posix/coverage-fork-direct.cc
  vendor/compiler-rt/dist/test/asan/TestCases/coverage-levels.cc
Modified:
  vendor/compiler-rt/dist/cmake/Modules/AddCompilerRT.cmake
  vendor/compiler-rt/dist/include/sanitizer/tsan_interface.h
  vendor/compiler-rt/dist/include/xray/xray_log_interface.h
  vendor/compiler-rt/dist/lib/asan/asan_globals.cc
  vendor/compiler-rt/dist/lib/asan/asan_interceptors.cc
  vendor/compiler-rt/dist/lib/asan/asan_interface.inc
  vendor/compiler-rt/dist/lib/asan/asan_interface_internal.h
  vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_coverage_libcdep.cc
  vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_coverage_libcdep_new.cc
  vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_flags.inc
  vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_linux.h
  vendor/compiler-rt/dist/lib/scudo/CMakeLists.txt
  vendor/compiler-rt/dist/lib/scudo/scudo_allocator.cpp
  vendor/compiler-rt/dist/lib/scudo/scudo_allocator.h
  vendor/compiler-rt/dist/lib/scudo/scudo_utils.cpp
  vendor/compiler-rt/dist/lib/scudo/scudo_utils.h
  vendor/compiler-rt/dist/lib/tsan/go/buildgo.sh
  vendor/compiler-rt/dist/lib/tsan/rtl/tsan_external.cc
  vendor/compiler-rt/dist/lib/tsan/rtl/tsan_interface_ann.cc
  vendor/compiler-rt/dist/lib/tsan/rtl/tsan_platform_linux.cc
  vendor/compiler-rt/dist/lib/tsan/rtl/tsan_report.cc
  vendor/compiler-rt/dist/lib/tsan/rtl/tsan_rtl.cc
  vendor/compiler-rt/dist/lib/tsan/rtl/tsan_rtl.h
  vendor/compiler-rt/dist/lib/tsan/rtl/tsan_rtl_mutex.cc
  vendor/compiler-rt/dist/lib/tsan/rtl/tsan_rtl_report.cc
  vendor/compiler-rt/dist/lib/tsan/tests/rtl/tsan_posix.cc
  vendor/compiler-rt/dist/lib/ubsan/ubsan_diag.cc
  vendor/compiler-rt/dist/lib/ubsan/ubsan_handlers.cc
  vendor/compiler-rt/dist/lib/xray/xray_log_interface.cc
  vendor/compiler-rt/dist/test/asan/CMakeLists.txt
  vendor/compiler-rt/dist/test/asan/TestCases/Darwin/dead-strip.c
  vendor/compiler-rt/dist/test/asan/TestCases/Darwin/dump_registers.cc
  
vendor/compiler-rt/dist/test/asan/TestCases/Darwin/reexec-insert-libraries-env.cc
  vendor/compiler-rt/dist/test/asan/TestCases/Darwin/scribble.cc
  
vendor/compiler-rt/dist/test/asan/TestCases/Darwin/unset-insert-libraries-on-exec.cc
  vendor/compiler-rt/dist/test/asan/TestCases/Posix/asan-sigbus.cpp
  vendor/compiler-rt/dist/test/asan/TestCases/Posix/current_allocated_bytes.cc
  vendor/compiler-rt/dist/test/asan/TestCases/Posix/fread_fwrite.cc
  vendor/compiler-rt/dist/test/asan/TestCases/coverage-disabled.cc
  vendor/compiler-rt/dist/test/asan/TestCases/initialization-bug.cc
  vendor/compiler-rt/dist/test/asan/TestCases/strtok.c
  vendor/compiler-rt/dist/test/asan/lit.cfg
  vendor/compiler-rt/dist/test/asan/lit.site.cfg.in
  vendor/compiler-rt/dist/test/lit.common.cfg
  vendor/compiler-rt/dist/test/lit.common.configured.in
  
vendor/compiler-rt/dist/test/sanitizer_common/TestCases/sanitizer_coverage_symbolize.cc
  vendor/compiler-rt/dist/test/tsan/Darwin/xpc-cancel.mm
  vendor/compiler-rt/dist/test/tsan/Darwin/xpc-race.mm
  vendor/compiler-rt/dist/test/tsan/Darwin/xpc.mm
  vendor/compiler-rt/dist/test/tsan/ignore_lib1.cc
  vendor/compiler-rt/dist/test/tsan/ignore_lib5.cc
  vendor/compiler-rt/dist/test/ubsan/TestCases/Float/cast-overflow.cpp
  vendor/compiler-rt/dist/test/ubsan/TestCases/Misc/log-path_test.cc
  

svn commit: r317690 - in vendor/lld/dist: COFF ELF docs test/COFF test/COFF/Inputs test/ELF test/ELF/Inputs test/ELF/linkerscript

2017-05-02 Thread Dimitry Andric
Author: dim
Date: Tue May  2 18:31:09 2017
New Revision: 317690
URL: https://svnweb.freebsd.org/changeset/base/317690

Log:
  Vendor import of lld trunk r301939:
  https://llvm.org/svn/llvm-project/lld/trunk@301939

Added:
  vendor/lld/dist/test/COFF/Inputs/constant-import.s   (contents, props changed)
  vendor/lld/dist/test/COFF/constant.test
  vendor/lld/dist/test/COFF/icf-data.test
  vendor/lld/dist/test/ELF/Inputs/eh-frame-end.s   (contents, props changed)
  vendor/lld/dist/test/ELF/debug-gnu-pubnames.s   (contents, props changed)
  vendor/lld/dist/test/ELF/eh-frame-begin-end.s   (contents, props changed)
  vendor/lld/dist/test/ELF/linkerscript/section-metadata.s   (contents, props 
changed)
Modified:
  vendor/lld/dist/COFF/Chunks.cpp
  vendor/lld/dist/COFF/Error.cpp
  vendor/lld/dist/COFF/ICF.cpp
  vendor/lld/dist/COFF/InputFiles.cpp
  vendor/lld/dist/COFF/InputFiles.h
  vendor/lld/dist/COFF/MapFile.cpp
  vendor/lld/dist/ELF/Config.h
  vendor/lld/dist/ELF/Driver.cpp
  vendor/lld/dist/ELF/Driver.h
  vendor/lld/dist/ELF/Error.cpp
  vendor/lld/dist/ELF/InputFiles.cpp
  vendor/lld/dist/ELF/InputFiles.h
  vendor/lld/dist/ELF/InputSection.cpp
  vendor/lld/dist/ELF/LTO.cpp
  vendor/lld/dist/ELF/LinkerScript.cpp
  vendor/lld/dist/ELF/LinkerScript.h
  vendor/lld/dist/ELF/MapFile.cpp
  vendor/lld/dist/ELF/Options.td
  vendor/lld/dist/ELF/OutputSections.cpp
  vendor/lld/dist/ELF/OutputSections.h
  vendor/lld/dist/ELF/Strings.h
  vendor/lld/dist/ELF/SymbolTable.cpp
  vendor/lld/dist/ELF/SyntheticSections.cpp
  vendor/lld/dist/ELF/Writer.cpp
  vendor/lld/dist/docs/index.rst
  vendor/lld/dist/test/COFF/lldmap.test
  vendor/lld/dist/test/ELF/abs-conflict.s
  vendor/lld/dist/test/ELF/driver-access.test
  vendor/lld/dist/test/ELF/gdb-index.s
  vendor/lld/dist/test/ELF/linkerscript/sections.s
  vendor/lld/dist/test/ELF/map-file.s
  vendor/lld/dist/test/ELF/relocation-in-merge.s

Modified: vendor/lld/dist/COFF/Chunks.cpp
==
--- vendor/lld/dist/COFF/Chunks.cpp Tue May  2 18:31:05 2017
(r317689)
+++ vendor/lld/dist/COFF/Chunks.cpp Tue May  2 18:31:09 2017
(r317690)
@@ -326,41 +326,38 @@ void SEHTableChunk::writeTo(uint8_t *Buf
 // usually loaded to that address. However, if there's already another
 // DLL that overlaps, the loader has to relocate it. To do that, DLLs
 // contain .reloc sections which contain offsets that need to be fixed
-// up at runtime. If the loader find that a DLL cannot be loaded to its
+// up at runtime. If the loader finds that a DLL cannot be loaded to its
 // desired base address, it loads it to somewhere else, and add  -  to each offset that is
-// specified by .reloc section.
+// specified by the .reloc section. In ELF terms, .reloc sections
+// contain relative relocations in REL format (as opposed to RELA.)
 //
-// In ELF terms, .reloc sections contain arrays of relocation offsets.
-// All these offsets in the section are implicitly R_*_RELATIVE, and
-// addends are read from section contents (so it is REL as opposed to
-// RELA).
+// This already significantly reduces the size of relocations compared
+// to ELF .rel.dyn, but Windows does more to reduce it (probably because
+// it was invented for PCs in the late '80s or early '90s.)  Offsets in
+// .reloc are grouped by page where the page size is 12 bits, and
+// offsets sharing the same page address are stored consecutively to
+// represent them with less space. This is very similar to the page
+// table which is grouped by (multiple stages of) pages.
 //
-// This already reduce the size of relocations to 1/3 compared to ELF
-// .dynrel, but Windows does more to reduce it (probably because it was
-// invented for PCs in the late '80s or early '90s.) Offsets in .reloc
-// are grouped by page where page size is 16 bits, and offsets sharing
-// the same page address are stored consecutively to represent them with
-// less space. This is a very similar to the page table which is grouped
-// by (multiple stages of) pages.
-//
-// For example, let's say we have 0x00030, 0x00500, 0x01000, 0x01100,
-// 0x20004, and 0x20008 in a .reloc section. In the section, they are
-// represented like this:
+// For example, let's say we have 0x00030, 0x00500, 0x00700, 0x00A00,
+// 0x20004, and 0x20008 in a .reloc section for x64. The uppermost 4
+// bits have a type IMAGE_REL_BASED_DIR64 or 0xA. In the section, they
+// are represented like this:
 //
 //   0x0  -- page address (4 bytes)
 //   16   -- size of this block (4 bytes)
-// 0x0030 -- entries (2 bytes each)
-// 0x0500
-// 0x1000
-// 0x1100
+// 0xA030 -- entries (2 bytes each)
+// 0xA500
+// 0xA700
+// 0xAA00
 //   0x2  -- page address (4 bytes)
 //   12   -- size of this block (4 bytes)
-// 0x0004 -- entries (2 bytes each)
-// 0x0008
+// 0xA004 -- entries (2 bytes each)
+// 0xA008
 //
-// Usually we have a lot of relocatinos for each page, 

svn commit: r317688 - vendor/compiler-rt/compiler-rt-trunk-r301939

2017-05-02 Thread Dimitry Andric
Author: dim
Date: Tue May  2 18:31:01 2017
New Revision: 317688
URL: https://svnweb.freebsd.org/changeset/base/317688

Log:
  Tag compiler-rt trunk r301939.

Added:
  vendor/compiler-rt/compiler-rt-trunk-r301939/
 - copied from r317687, vendor/compiler-rt/dist/
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r317689 - vendor/libc++/libc++-trunk-r301939

2017-05-02 Thread Dimitry Andric
Author: dim
Date: Tue May  2 18:31:05 2017
New Revision: 317689
URL: https://svnweb.freebsd.org/changeset/base/317689

Log:
  Tag libc++ trunk r301939.

Added:
  vendor/libc++/libc++-trunk-r301939/
 - copied from r317688, vendor/libc++/dist/
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r317686 - vendor/clang/clang-trunk-r301939

2017-05-02 Thread Dimitry Andric
Author: dim
Date: Tue May  2 18:30:52 2017
New Revision: 317686
URL: https://svnweb.freebsd.org/changeset/base/317686

Log:
  Tag clang trunk r301939.

Added:
  vendor/clang/clang-trunk-r301939/
 - copied from r317685, vendor/clang/dist/
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r317685 - in vendor/clang/dist: docs include/clang-c include/clang/AST include/clang/Basic include/clang/CodeGen include/clang/Driver include/clang/Edit include/clang/Frontend include/c...

2017-05-02 Thread Dimitry Andric
Author: dim
Date: Tue May  2 18:30:45 2017
New Revision: 317685
URL: https://svnweb.freebsd.org/changeset/base/317685

Log:
  Vendor import of clang trunk r301939:
  https://llvm.org/svn/llvm-project/cfe/trunk@301939

Added:
  vendor/clang/dist/include/clang/AST/ASTStructuralEquivalence.h   (contents, 
props changed)
  vendor/clang/dist/lib/AST/ASTStructuralEquivalence.cpp   (contents, props 
changed)
  vendor/clang/dist/test/ARCMT/remap-applying.c   (contents, props changed)
  vendor/clang/dist/test/ARCMT/remap-applying.c.result
  vendor/clang/dist/test/CodeGenCXX/attr-x86-no_caller_saved_registers.cpp   
(contents, props changed)
  vendor/clang/dist/test/CodeGenCXX/ubsan-nullability-assign.cpp   (contents, 
props changed)
  vendor/clang/dist/test/CodeGenObjCXX/boxing.mm
  vendor/clang/dist/test/Frontend/Inputs/empty.h   (contents, props changed)
  vendor/clang/dist/test/Headers/stdint-typeof-MINMAX.cpp   (contents, props 
changed)
  vendor/clang/dist/test/Import/in-class-initializer/
  vendor/clang/dist/test/Import/in-class-initializer/Inputs/
  vendor/clang/dist/test/Import/in-class-initializer/Inputs/S.cpp   (contents, 
props changed)
  vendor/clang/dist/test/Import/in-class-initializer/test.cpp   (contents, 
props changed)
  vendor/clang/dist/test/Index/allow-editor-placeholders.cpp   (contents, props 
changed)
  vendor/clang/dist/test/Index/target-info.c   (contents, props changed)
  vendor/clang/dist/test/Modules/Inputs/diag_flags.h   (contents, props changed)
  vendor/clang/dist/test/Modules/Inputs/incomplete-umbrella/
  vendor/clang/dist/test/Modules/Inputs/incomplete-umbrella/Foo.framework/
  
vendor/clang/dist/test/Modules/Inputs/incomplete-umbrella/Foo.framework/Headers/
  
vendor/clang/dist/test/Modules/Inputs/incomplete-umbrella/Foo.framework/Headers/Bar.h
   (contents, props changed)
  
vendor/clang/dist/test/Modules/Inputs/incomplete-umbrella/Foo.framework/Headers/FooPublic.h
   (contents, props changed)
  
vendor/clang/dist/test/Modules/Inputs/incomplete-umbrella/Foo.framework/Modules/
  
vendor/clang/dist/test/Modules/Inputs/incomplete-umbrella/Foo.framework/Modules/module.modulemap
  
vendor/clang/dist/test/Modules/Inputs/incomplete-umbrella/Foo.framework/Modules/module.private.modulemap
  
vendor/clang/dist/test/Modules/Inputs/incomplete-umbrella/Foo.framework/PrivateHeaders/
  
vendor/clang/dist/test/Modules/Inputs/incomplete-umbrella/Foo.framework/PrivateHeaders/Baz.h
   (contents, props changed)
  
vendor/clang/dist/test/Modules/Inputs/incomplete-umbrella/Foo.framework/PrivateHeaders/Foo.h
   (contents, props changed)
  vendor/clang/dist/test/Modules/Inputs/malformed-overload/
  vendor/clang/dist/test/Modules/Inputs/malformed-overload/X.h   (contents, 
props changed)
  vendor/clang/dist/test/Modules/Inputs/malformed-overload/module.modulemap
  vendor/clang/dist/test/Modules/diag-flags.cpp   (contents, props changed)
  vendor/clang/dist/test/Modules/import-syntax.c   (contents, props changed)
  vendor/clang/dist/test/Modules/incomplete-umbrella.m
  vendor/clang/dist/test/Modules/malformed-overload.m
  vendor/clang/dist/test/Modules/preprocess-module.cpp   (contents, props 
changed)
  vendor/clang/dist/test/Preprocessor/Inputs/nonportable-hmaps/
  vendor/clang/dist/test/Preprocessor/Inputs/nonportable-hmaps/foo.hmap   
(contents, props changed)
  vendor/clang/dist/test/Preprocessor/Inputs/nonportable-hmaps/headers/
  vendor/clang/dist/test/Preprocessor/Inputs/nonportable-hmaps/headers/foo/
  
vendor/clang/dist/test/Preprocessor/Inputs/nonportable-hmaps/headers/foo/Foo.h  
 (contents, props changed)
  vendor/clang/dist/test/Preprocessor/nonportable-include-with-hmap.c   
(contents, props changed)
  vendor/clang/dist/test/Preprocessor/pragma_module.c   (contents, props 
changed)
  vendor/clang/dist/test/SemaCXX/attr-non-x86-no_caller_saved_registers.cpp   
(contents, props changed)
  vendor/clang/dist/test/SemaCXX/attr-x86-no_caller_saved_registers.cpp   
(contents, props changed)
  vendor/clang/dist/test/SemaCXX/constexpr-array-unknown-bound.cpp   (contents, 
props changed)
  vendor/clang/dist/test/SemaObjC/x86-method-vector-values.m
Deleted:
  vendor/clang/dist/test/Frontend/Rewriter/
Modified:
  vendor/clang/dist/docs/SanitizerCoverage.rst
  vendor/clang/dist/include/clang-c/Index.h
  vendor/clang/dist/include/clang/AST/DeclBase.h
  vendor/clang/dist/include/clang/AST/Type.h
  vendor/clang/dist/include/clang/Basic/Attr.td
  vendor/clang/dist/include/clang/Basic/AttrDocs.td
  vendor/clang/dist/include/clang/Basic/DiagnosticASTKinds.td
  vendor/clang/dist/include/clang/Basic/DiagnosticDriverKinds.td
  vendor/clang/dist/include/clang/Basic/DiagnosticGroups.td
  vendor/clang/dist/include/clang/Basic/DiagnosticLexKinds.td
  vendor/clang/dist/include/clang/Basic/DiagnosticSemaKinds.td
  vendor/clang/dist/include/clang/Basic/LangOptions.def
  vendor/clang/dist/include/clang/CodeGen/CGFunctionInfo.h
  vendor/clang/dist/include/clang/Driver/CLCompatOptions.td
  

svn commit: r317683 - in vendor/llvm/dist: cmake/modules docs docs/TableGen include/llvm include/llvm/ADT include/llvm/Analysis include/llvm/Bitcode include/llvm/CodeGen include/llvm/CodeGen/Global...

2017-05-02 Thread Dimitry Andric
Author: dim
Date: Tue May  2 18:30:13 2017
New Revision: 317683
URL: https://svnweb.freebsd.org/changeset/base/317683

Log:
  Vendor import of llvm trunk r301939:
  https://llvm.org/svn/llvm-project/llvm/trunk@301939

Added:
  
vendor/llvm/dist/include/llvm/DebugInfo/CodeView/ModuleDebugFileChecksumFragment.h
   (contents, props changed)
  vendor/llvm/dist/include/llvm/DebugInfo/CodeView/ModuleDebugFragment.h   
(contents, props changed)
  vendor/llvm/dist/include/llvm/DebugInfo/CodeView/ModuleDebugFragmentRecord.h  
 (contents, props changed)
  vendor/llvm/dist/include/llvm/DebugInfo/CodeView/ModuleDebugFragmentVisitor.h 
  (contents, props changed)
  
vendor/llvm/dist/include/llvm/DebugInfo/CodeView/ModuleDebugInlineeLinesFragment.h
   (contents, props changed)
  vendor/llvm/dist/include/llvm/DebugInfo/CodeView/ModuleDebugLineFragment.h   
(contents, props changed)
  vendor/llvm/dist/include/llvm/DebugInfo/CodeView/ModuleDebugUnknownFragment.h 
  (contents, props changed)
  vendor/llvm/dist/include/llvm/DebugInfo/PDB/Native/DbiModuleDescriptor.h   
(contents, props changed)
  
vendor/llvm/dist/include/llvm/DebugInfo/PDB/Native/DbiModuleDescriptorBuilder.h 
  (contents, props changed)
  vendor/llvm/dist/include/llvm/DebugInfo/PDB/Native/ModuleDebugStream.h   
(contents, props changed)
  vendor/llvm/dist/include/llvm/DebugInfo/PDB/Native/ModuleDebugStreamBuilder.h 
  (contents, props changed)
  vendor/llvm/dist/include/llvm/Transforms/Scalar/SimpleLoopUnswitch.h   
(contents, props changed)
  vendor/llvm/dist/lib/CodeGen/MachineFrameInfo.cpp   (contents, props changed)
  vendor/llvm/dist/lib/DebugInfo/CodeView/ModuleDebugFileChecksumFragment.cpp   
(contents, props changed)
  vendor/llvm/dist/lib/DebugInfo/CodeView/ModuleDebugFragment.cpp   (contents, 
props changed)
  vendor/llvm/dist/lib/DebugInfo/CodeView/ModuleDebugFragmentRecord.cpp   
(contents, props changed)
  vendor/llvm/dist/lib/DebugInfo/CodeView/ModuleDebugFragmentVisitor.cpp   
(contents, props changed)
  vendor/llvm/dist/lib/DebugInfo/CodeView/ModuleDebugInlineeLinesFragment.cpp   
(contents, props changed)
  vendor/llvm/dist/lib/DebugInfo/CodeView/ModuleDebugLineFragment.cpp   
(contents, props changed)
  vendor/llvm/dist/lib/DebugInfo/CodeView/ModuleDebugUnknownFragment.cpp   
(contents, props changed)
  vendor/llvm/dist/lib/DebugInfo/PDB/Native/DbiModuleDescriptor.cpp   
(contents, props changed)
  vendor/llvm/dist/lib/DebugInfo/PDB/Native/DbiModuleDescriptorBuilder.cpp   
(contents, props changed)
  vendor/llvm/dist/lib/DebugInfo/PDB/Native/ModuleDebugStream.cpp   (contents, 
props changed)
  vendor/llvm/dist/lib/DebugInfo/PDB/Native/ModuleDebugStreamBuilder.cpp   
(contents, props changed)
  vendor/llvm/dist/lib/Support/Unix/DynamicLibrary.inc   (contents, props 
changed)
  vendor/llvm/dist/lib/Target/Mips/MicroMipsSizeReduction.cpp   (contents, 
props changed)
  vendor/llvm/dist/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp   (contents, 
props changed)
  vendor/llvm/dist/test/Analysis/AliasSet/unknown-inst-tracking.ll
  vendor/llvm/dist/test/CodeGen/AMDGPU/llvm.amdgcn.init.exec.ll
  vendor/llvm/dist/test/CodeGen/AVR/rot.ll
  vendor/llvm/dist/test/CodeGen/BPF/mem_offset_be.ll
  vendor/llvm/dist/test/CodeGen/Hexagon/cfgopt-fall-through.ll
  vendor/llvm/dist/test/CodeGen/Hexagon/rdf-def-mask.ll
  vendor/llvm/dist/test/CodeGen/Hexagon/unreachable-mbb-phi-subreg.mir
  vendor/llvm/dist/test/CodeGen/Mips/micromips-sizereduction/
  
vendor/llvm/dist/test/CodeGen/Mips/micromips-sizereduction/micromips-lwsp-swsp.ll
  vendor/llvm/dist/test/CodeGen/X86/GlobalISel/ext-x86-64.ll
  vendor/llvm/dist/test/CodeGen/X86/GlobalISel/ext.ll
  vendor/llvm/dist/test/CodeGen/X86/GlobalISel/legalize-ext-x86-64.mir
  vendor/llvm/dist/test/CodeGen/X86/GlobalISel/legalize-ext.mir
  vendor/llvm/dist/test/CodeGen/X86/GlobalISel/memop-x32.ll
  vendor/llvm/dist/test/CodeGen/X86/GlobalISel/regbankselect-X86_64.mir
  vendor/llvm/dist/test/CodeGen/X86/GlobalISel/select-ext-x86-64.mir
  vendor/llvm/dist/test/CodeGen/X86/GlobalISel/select-ext.mir
  vendor/llvm/dist/test/CodeGen/X86/GlobalISel/select-inc.mir
  vendor/llvm/dist/test/CodeGen/X86/GlobalISel/select-memop-x32.mir
  vendor/llvm/dist/test/CodeGen/X86/addcarry.ll
  vendor/llvm/dist/test/CodeGen/X86/cast-vsel.ll
  vendor/llvm/dist/test/CodeGen/X86/inline-0bh.ll
  vendor/llvm/dist/test/CodeGen/X86/pr28129.ll
  vendor/llvm/dist/test/CodeGen/X86/pr31088.ll
  vendor/llvm/dist/test/CodeGen/X86/stackmap-large-location-size.ll
  vendor/llvm/dist/test/DebugInfo/AMDGPU/dbg-value-sched-crash.ll
  vendor/llvm/dist/test/DebugInfo/Generic/thrownTypes.ll
  vendor/llvm/dist/test/DebugInfo/PDB/Inputs/simple-line-info.yaml
  vendor/llvm/dist/test/DebugInfo/PDB/pdbdump-yaml-lineinfo-write.test
  vendor/llvm/dist/test/Instrumentation/AddressSanitizer/no-globals.ll
  vendor/llvm/dist/test/MC/AArch64/arm32-large-relocs.s   (contents, props 
changed)
  vendor/llvm/dist/test/MC/AArch64/arm32-tls-relocs.s   (contents, props 
changed)
  

svn commit: r317684 - vendor/llvm/llvm-trunk-r301939

2017-05-02 Thread Dimitry Andric
Author: dim
Date: Tue May  2 18:30:20 2017
New Revision: 317684
URL: https://svnweb.freebsd.org/changeset/base/317684

Log:
  Tag llvm trunk r301939.

Added:
  vendor/llvm/llvm-trunk-r301939/
 - copied from r317683, vendor/llvm/dist/
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r317681 - head/share/man/man7

2017-05-02 Thread Ed Maste
On 2 May 2017 at 12:35, Bruce Evans  wrote:
>
> -current man can't handle macros like "Sy" with -width or some other
> things including the things used above.  This causes it to produce
> excessive column spacing.  The formatting is bad enough without this
> (verbose headers but all columns except "Architecture" have only 1-2
> digits).  -current man just considers "Sy " as literal and increases
> the column spacing by 3, giving a spacing of 7 columns instead of 4,
> where we really want a negative number but 2 would work OK.

We discussed this in review D7261. I created arch.7 with ".Sy based on
an example from FreeBSD 10's mdoc(7). In D7261 I noted that there were
existing man pages with both ".Sy and "Sy .

Do you believe we should remove them altogether?

On 2 May 2017 at 13:44, Konstantin Belousov  wrote:
>
> I removed excessive sizeof(), which fixed width.
>
> diff --git a/share/man/man7/arch.7 b/share/man/man7/arch.7
> index 1ce397a303e..73552d60209 100644
> --- a/share/man/man7/arch.7
> +++ b/share/man/man7/arch.7
> @@ -47,8 +47,10 @@ On all supported architectures,
>  .It float Ta 4
>  .It double Ta 8
>  .El
> -.Bl -column -offset indent "Sy Architecture" "Sy sizeof(void *)" "Sy 
> sizeof(long double)" "Sy sizeof(time_t)"
> -.It Sy Architecture Ta Sy sizeof(void *) Ta Sy sizeof(long double) Ta Sy 
> sizeof(time_t)
> +.Pp
> +Machine-depended type's sizes:

Probably "Machine-dependent type sizes"
___
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: r317061 - in head: libexec/rpc.rstatd sys/amd64/amd64 sys/amd64/include sys/arm/arm sys/arm/include sys/arm64/include sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/compat/linprocf

2017-05-02 Thread Bruce Evans

On Tue, 2 May 2017, Konstantin Belousov wrote:


On Wed, May 03, 2017 at 01:31:10AM +1000, Bruce Evans wrote:



On Tue, 2 May 2017, Konstantin Belousov wrote:
I also thought of changing the scale when the values get high.  The values
would increase slower above about 2G instead of stabilizing at 4G-1.
This is basically floating point and too complicated since nothing would
understand it.

Which counters wrap faster than a reasonable refresh interval of 1-10
seconds (which should be shorter if wrapping is a problem)?

Things like various counters for pages freed due to a reason can.  E.g.
freed due to the process exit is the counter which I saw changing fast.


4 billion page operations/second or 10 is impossible. It is difficult
to even increment a register to count events that fast.


Wire counts might fluctuate relatively quickly, but I think that wiring
is slower.  Unwiring might be fast.


The need to zero pages before reuse limits the speed.


I just noticed that this sysctl is r/o (I thought I was preserving support
for resetting 64-bit counters using a 32-bit size in my fix in
sysctl_handle_counter_64().  That function has the dubious feature of not
checking the size, so it allows writes of any length (0 to SIZE_MAX,
possibly larger than the user data) to reset the counter to zero.)

The r/o misfeature goes back to at least FreeBSD-3.  64-bit counters need
resetting less than 32-bit ones, and it is more useful to ever reset them
since they can hold the full counts since boot time, but there is no reason
to limit resetting them now that the low-level code supports it.  Is there
already a better atomic reset of all vm stats?


I do not see why vmstat counters ever need to be reset.  I do not think
that truncating the value to present small values to 32bit readers is
a reasonable cause.


It would be mostly for presenting a consistent set of values.


diff --git a/sys/vm/vm_meter.c b/sys/vm/vm_meter.c
index 5f4cd46ab1e..b4666a400b2 100644
--- a/sys/vm/vm_meter.c
+++ b/sys/vm/vm_meter.c
@@ -266,8 +266,27 @@ static SYSCTL_NODE(_vm_stats, OID_AUTO, vm, CTLFLAG_RW, 0,
"VM meter vm stats");
SYSCTL_NODE(_vm_stats, OID_AUTO, misc, CTLFLAG_RW, 0, "VM meter misc stats");

+static int
+sysctl_handle_vmstat(SYSCTL_HANDLER_ARGS)
+{
+   uint64_t val;
+#ifdef COMPAT_FREEBSD11
+   uint32_t val32;
+#endif
+
+   val = counter_u64_fetch(*(counter_u64_t *)arg1);
+#ifdef COMPAT_FREEBSD11
+   if (req->oldlen == sizeof(val32)) {
+   val32 = val;/* truncate */
+   return (SYSCTL_OUT(req, , sizeof(val32)));
+   }
+#endif
+   return (SYSCTL_OUT(req, , sizeof(val)));
+}
+
#define VM_STATS(parent, var, descr) \
-SYSCTL_COUNTER_U64(parent, OID_AUTO, var, CTLFLAG_RD, _cnt.var, descr)
+SYSCTL_OID(parent, OID_AUTO, var, CTLTYPE_U64 | CTLFLAG_MPSAFE | \
+CTLFLAG_RD, _cnt.var, 0, sysctl_handle_vmstat, "QU", descr);
#define VM_STATS_VM(var, descr) VM_STATS(_vm_stats_vm, var, descr)
#define VM_STATS_SYS(var, descr)VM_STATS(_vm_stats_sys, var, descr)


OK.

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


Re: svn commit: r317681 - head/share/man/man7

2017-05-02 Thread Konstantin Belousov
On Wed, May 03, 2017 at 02:35:17AM +1000, Bruce Evans wrote:
> On Tue, 2 May 2017, Konstantin Belousov wrote:
> 
> > Log:
> >  Document time_t size.
> >
> > Modified: head/share/man/man7/arch.7
> > ==
> > --- head/share/man/man7/arch.7  Tue May  2 14:52:28 2017
> > (r317680)
> > +++ head/share/man/man7/arch.7  Tue May  2 14:52:35 2017
> > (r317681)
> > @@ -47,27 +47,27 @@ On all supported architectures,
> > .It float Ta 4
> > .It double Ta 8
> > .El
> > -.Bl -column -offset indent "Sy Architecture" "Sy sizeof(void *)" "Sy 
> > sizeof(long double)"
> > -.It Sy Architecture Ta Sy sizeof(void *) Ta Sy sizeof(long double)
> > ...
> > +.Bl -column -offset indent "Sy Architecture" "Sy sizeof(void *)" "Sy 
> > sizeof(long double)" "Sy sizeof(time_t)"
> > +.It Sy Architecture Ta Sy sizeof(void *) Ta Sy sizeof(long double) Ta Sy 
> > sizeof(time_t)
> > +.It amd64   Ta 8 Ta 16 Ta 8
> > +.It arm Ta 4 Ta  8 Ta 8
> 
> Verbose types mess up the formatting of man pages too.
> 
> The header is obviously too long.  -current man misformats it to 91 columns
> on 80-column terminals.  FreeBSD-5 man respects COLUMNS, but mangles the
> header more completely to do this (1).

I removed excessive sizeof(), which fixed width.

diff --git a/share/man/man7/arch.7 b/share/man/man7/arch.7
index 1ce397a303e..73552d60209 100644
--- a/share/man/man7/arch.7
+++ b/share/man/man7/arch.7
@@ -47,8 +47,10 @@ On all supported architectures,
 .It float Ta 4
 .It double Ta 8
 .El
-.Bl -column -offset indent "Sy Architecture" "Sy sizeof(void *)" "Sy 
sizeof(long double)" "Sy sizeof(time_t)"
-.It Sy Architecture Ta Sy sizeof(void *) Ta Sy sizeof(long double) Ta Sy 
sizeof(time_t)
+.Pp
+Machine-depended type's sizes:
+.Bl -column -offset indent "Sy Architecture" "Sy void *" "Sy long double" "Sy 
time_t"
+.It Sy Architecture Ta Sy void * Ta Sy long double Ta Sy time_t
 .It amd64   Ta 8 Ta 16 Ta 8
 .It arm Ta 4 Ta  8 Ta 8
 .It armeb   Ta 4 Ta  8 Ta 8
___
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: r317632 - head/sys

2017-05-02 Thread Ngie Cooper (yaneurabeya)

> On May 1, 2017, at 09:34, Warner Losh  wrote:
> 
> On Mon, May 1, 2017 at 10:30 AM, Rodney W. Grimes
>  wrote:
>>> Author: ngie
>>> Date: Mon May  1 05:59:52 2017
>>> New Revision: 317632
>>> URL: https://svnweb.freebsd.org/changeset/base/317632
>>> 
>>> Log:
>>>  Fix "make cscope-clean" when .OBJDIR already exists
>>> 
>>>  The cscope generated files are always put in .CURDIR .
>> 
>> If this is writing to src dir then it should be fixed,
>> or have we abandoned all hope of readonly src tree?
> 
> This is only for the cscope target, which isn't part of the normal build.
> 
> readonly src tree works great still….

Hi Rod,
I can’t personally vouch for readonly src trees working in all cases, 
but readonly src trees work well for installation purposes (I use readonly obj 
and src trees at work when installing over NFS).
As Warner noted, “make cscope” is a developer target that aids with 
building the cscope database in a consistent manner. It doesn’t conform to the 
existing “norms” of build targets in the tree; changing the behavior doesn’t 
seem prudent at this point in time because it would violate POLA.
Thanks!
-Ngie


signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: svn commit: r317631 - head/sys

2017-05-02 Thread Ngie Cooper (yaneurabeya)

> On May 1, 2017, at 09:28, Rodney W. Grimes  
> wrote:
> 
>> Author: ngie
>> Date: Mon May  1 05:54:33 2017
>> New Revision: 317631
>> URL: https://svnweb.freebsd.org/changeset/base/317631
>> 
>> Log:
>>  Fix "make cscope" after r317411
> 
> This commit is disconnect netnatm module from build
> 
> ?  Mixed 2 commit messages perhaps?

No, it was intentional (I made the readers read between the lines as to 
why this commit was necessary, so mea culpa).
r317411 removed sys/netatm, which broke the “make cscope” target, as it 
tried to iterate down that directory with find and failed.
Thanks!
-Ngie

$ svn log -c r317411

r317411 | brooks | 2017-04-25 10:00:08 -0700 (Tue, 25 Apr 2017) | 4 lines

Remove directories made empty by NATM, EISA, and IEEE488 removals.

Reported by:ak

$ svn diff -c r317411 --summarize
D   sbin/atm/atmconfig
D   sbin/atm
D   sys/netnatm
D   sys/dev/eisa
D   sys/dev/fatm
D   sys/dev/hatm
D   sys/dev/patm/genrtab
D   sys/dev/patm
D   sys/dev/ahb
D   sys/dev/ieee488
D   sys/dev/en
D   sys/dev/utopia
D   sys/modules/fatm
D   sys/modules/hatm
D   sys/modules/patm
D   sys/modules/ahb
D   sys/modules/en
D   sys/modules/utopia
D   sys/modules/aic7xxx/ahc/ahc_eisa
D   sys/modules/netgraph/atm/atm
D   usr.sbin/bsnmpd/modules/snmp_atm


signature.asc
Description: Message signed with OpenPGP using GPGMail


svn commit: r317682 - head/sbin/ipfw

2017-05-02 Thread Andrey V. Elsukov
Author: ae
Date: Tue May  2 17:16:24 2017
New Revision: 317682
URL: https://svnweb.freebsd.org/changeset/base/317682

Log:
  Add `ipfw table all destroy` support.
  
  PR:   212669
  MFC after:1 week

Modified:
  head/sbin/ipfw/ipfw.8
  head/sbin/ipfw/tables.c

Modified: head/sbin/ipfw/ipfw.8
==
--- head/sbin/ipfw/ipfw.8   Tue May  2 14:52:35 2017(r317681)
+++ head/sbin/ipfw/ipfw.8   Tue May  2 17:16:24 2017(r317682)
@@ -50,7 +50,9 @@ in-kernel NAT.
 .Nm
 .Oo Cm set Ar N Oc Cm table Ar name Cm create Ar create-options
 .Nm
-.Oo Cm set Ar N Oc Cm table Ar name Cm destroy
+.Oo Cm set Ar N Oc Cm table
+.Brq Ar name | all
+.Cm destroy
 .Nm
 .Oo Cm set Ar N Oc Cm table Ar name Cm modify Ar modify-options
 .Nm

Modified: head/sbin/ipfw/tables.c
==
--- head/sbin/ipfw/tables.c Tue May  2 14:52:35 2017(r317681)
+++ head/sbin/ipfw/tables.c Tue May  2 17:16:24 2017(r317682)
@@ -54,6 +54,7 @@ static int table_swap(ipfw_obj_header *o
 static int table_get_info(ipfw_obj_header *oh, ipfw_xtable_info *i);
 static int table_show_info(ipfw_xtable_info *i, void *arg);
 
+static int table_destroy_one(ipfw_xtable_info *i, void *arg);
 static int table_flush_one(ipfw_xtable_info *i, void *arg);
 static int table_show_one(ipfw_xtable_info *i, void *arg);
 static int table_do_get_list(ipfw_xtable_info *i, ipfw_obj_header **poh);
@@ -132,7 +133,7 @@ lookup_host (char *host, struct in_addr 
  * This one handles all table-related commands
  * ipfw table NAME create ...
  * ipfw table NAME modify ...
- * ipfw table NAME destroy
+ * ipfw table {NAME | all} destroy
  * ipfw table NAME swap NAME
  * ipfw table NAME lock
  * ipfw table NAME unlock
@@ -200,6 +201,7 @@ ipfw_table_handler(int ac, char *av[])
case TOK_INFO:
case TOK_DETAIL:
case TOK_FLUSH:
+   case TOK_DESTROY:
break;
default:
if (is_all != 0)
@@ -223,13 +225,21 @@ ipfw_table_handler(int ac, char *av[])
table_modify(, ac, av);
break;
case TOK_DESTROY:
-   if (table_destroy() == 0)
-   break;
-   if (errno != ESRCH)
-   err(EX_OSERR, "failed to destroy table %s", tablename);
-   /* ESRCH isn't fatal, warn if not quiet mode */
-   if (co.do_quiet == 0)
-   warn("failed to destroy table %s", tablename);
+   if (is_all == 0) {
+   if (table_destroy() == 0)
+   break;
+   if (errno != ESRCH)
+   err(EX_OSERR, "failed to destroy table %s",
+   tablename);
+   /* ESRCH isn't fatal, warn if not quiet mode */
+   if (co.do_quiet == 0)
+   warn("failed to destroy table %s", tablename);
+   } else {
+   error = tables_foreach(table_destroy_one, , 1);
+   if (error != 0)
+   err(EX_OSERR,
+   "failed to destroy tables list");
+   }
break;
case TOK_FLUSH:
if (is_all == 0) {
@@ -567,6 +577,22 @@ table_destroy(ipfw_obj_header *oh)
return (0);
 }
 
+static int
+table_destroy_one(ipfw_xtable_info *i, void *arg)
+{
+   ipfw_obj_header *oh;
+
+   oh = (ipfw_obj_header *)arg;
+   table_fill_ntlv(>ntlv, i->tablename, i->set, 1);
+   if (table_destroy(oh) != 0) {
+   if (co.do_quiet == 0)
+   warn("failed to destroy table(%s) in set %u",
+   i->tablename, i->set);
+   return (-1);
+   }
+   return (0);
+}
+
 /*
  * Flushes given table specified by @oh->ntlv.
  * Returns 0 on success.
___
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: r317061 - in head: libexec/rpc.rstatd sys/amd64/amd64 sys/amd64/include sys/arm/arm sys/arm/include sys/arm64/include sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/compat/linprocf

2017-05-02 Thread Konstantin Belousov
On Wed, May 03, 2017 at 01:31:10AM +1000, Bruce Evans wrote:
> 
> 
> On Tue, 2 May 2017, Konstantin Belousov wrote:
> I also thought of changing the scale when the values get high.  The values
> would increase slower above about 2G instead of stabilizing at 4G-1.
> This is basically floating point and too complicated since nothing would
> understand it.
> 
> Which counters wrap faster than a reasonable refresh interval of 1-10
> seconds (which should be shorter if wrapping is a problem)?
Things like various counters for pages freed due to a reason can.  E.g.
freed due to the process exit is the counter which I saw changing fast.

Wire counts might fluctuate relatively quickly, but I think that wiring
is slower.  Unwiring might be fast.

> Style:
> - redundant cast.  Especially not needed with the commit.  Compilers might
>warn about this since they don't trust programmers, but don't because
>implicit downwards conversions are used often.
> - comment not indented
> 
> I would also omit the ifdefs, and rename 'out' to out64, and may rename
> 'out*' to val*.
Ok.

> I just noticed that this sysctl is r/o (I thought I was preserving support
> for resetting 64-bit counters using a 32-bit size in my fix in
> sysctl_handle_counter_64().  That function has the dubious feature of not
> checking the size, so it allows writes of any length (0 to SIZE_MAX,
> possibly larger than the user data) to reset the counter to zero.)
> 
> The r/o misfeature goes back to at least FreeBSD-3.  64-bit counters need
> resetting less than 32-bit ones, and it is more useful to ever reset them
> since they can hold the full counts since boot time, but there is no reason
> to limit resetting them now that the low-level code supports it.  Is there
> already a better atomic reset of all vm stats?

I do not see why vmstat counters ever need to be reset.  I do not think
that truncating the value to present small values to 32bit readers is
a reasonable cause.

diff --git a/sys/vm/vm_meter.c b/sys/vm/vm_meter.c
index 5f4cd46ab1e..b4666a400b2 100644
--- a/sys/vm/vm_meter.c
+++ b/sys/vm/vm_meter.c
@@ -266,8 +266,27 @@ static SYSCTL_NODE(_vm_stats, OID_AUTO, vm, CTLFLAG_RW, 0,
"VM meter vm stats");
 SYSCTL_NODE(_vm_stats, OID_AUTO, misc, CTLFLAG_RW, 0, "VM meter misc stats");
 
+static int
+sysctl_handle_vmstat(SYSCTL_HANDLER_ARGS)
+{
+   uint64_t val;
+#ifdef COMPAT_FREEBSD11
+   uint32_t val32;
+#endif
+
+   val = counter_u64_fetch(*(counter_u64_t *)arg1);
+#ifdef COMPAT_FREEBSD11
+   if (req->oldlen == sizeof(val32)) {
+   val32 = val;/* truncate */
+   return (SYSCTL_OUT(req, , sizeof(val32)));
+   }
+#endif
+   return (SYSCTL_OUT(req, , sizeof(val)));
+}
+
 #defineVM_STATS(parent, var, descr) \
-SYSCTL_COUNTER_U64(parent, OID_AUTO, var, CTLFLAG_RD, _cnt.var, descr)
+SYSCTL_OID(parent, OID_AUTO, var, CTLTYPE_U64 | CTLFLAG_MPSAFE | \
+CTLFLAG_RD, _cnt.var, 0, sysctl_handle_vmstat, "QU", descr);
 #defineVM_STATS_VM(var, descr) VM_STATS(_vm_stats_vm, var, 
descr)
 #defineVM_STATS_SYS(var, descr)VM_STATS(_vm_stats_sys, var, 
descr)
 
___
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: r317681 - head/share/man/man7

2017-05-02 Thread Bruce Evans

On Tue, 2 May 2017, Konstantin Belousov wrote:


Log:
 Document time_t size.

Modified: head/share/man/man7/arch.7
==
--- head/share/man/man7/arch.7  Tue May  2 14:52:28 2017(r317680)
+++ head/share/man/man7/arch.7  Tue May  2 14:52:35 2017(r317681)
@@ -47,27 +47,27 @@ On all supported architectures,
.It float Ta 4
.It double Ta 8
.El
-.Bl -column -offset indent "Sy Architecture" "Sy sizeof(void *)" "Sy sizeof(long 
double)"
-.It Sy Architecture Ta Sy sizeof(void *) Ta Sy sizeof(long double)
...
+.Bl -column -offset indent "Sy Architecture" "Sy sizeof(void *)" "Sy sizeof(long 
double)" "Sy sizeof(time_t)"
+.It Sy Architecture Ta Sy sizeof(void *) Ta Sy sizeof(long double) Ta Sy 
sizeof(time_t)
+.It amd64   Ta 8 Ta 16 Ta 8
+.It arm Ta 4 Ta  8 Ta 8


Verbose types mess up the formatting of man pages too.

The header is obviously too long.  -current man misformats it to 91 columns
on 80-column terminals.  FreeBSD-5 man respects COLUMNS, but mangles the
header more completely to do this (1).

-current man can't handle macros like "Sy" with -width or some other
things including the things used above.  This causes it to produce
excessive column spacing.  The formatting is bad enough without this
(verbose headers but all columns except "Architecture" have only 1-2
digits).  -current man just considers "Sy " as literal and increases
the column spacing by 3, giving a spacing of 7 columns instead of 4,
where we really want a negative number but 2 would work OK.

Also, these Sy's have syntax errors.  They really are literals, since
they are not preceded by a dot.  With -current man, dots would unimprove
the formatting further by producing an extra column for each dot.
Perhaps that is why it is already left out (it might break other lists).
The syntax is something like ".Sy ... Architecture" where other macros
in "..." don't need (and shouldn't have?) dots.

Removing all 4 Sy's only reduces the column widths by 3*3, so the total
width to 82.  There is a different problem before the first collumn.
The Sy's are already not present in the previous -column directive,
and this might what causes different leading indentation for the
previous list.  But I didn't touch the Sy's in the later -column
directions, and all the following first columns line up with this one.

(1) gnu man/groff splits the long line in the middle of 'long double',
long before the new problem with time_t.  Before that, it produces the
same wrong separation of 7 columns.  It then prints a long line, with
87 blanks to misformat "double)" 1 line and 7 columns into the next
(in the middle of nowhere under "Architecture"), then a further 7 columns
to sizeof(time_t) in the middle of nowhere.  It prints a diagnostic
about not being able to split the long line.

Gnu man/groff does understand .Sy, but treats Sy as literal.  Changing the
Sy's to .Sy's doesn't work any better than removing them in this list,
but it improves all the other lists.

The formatting for the first list can be fixed by changing '-indent' in
it to 'indent' to match the other list.  This [-]indent controls
indentation in ways that I don't understand, but experiment shows that
the '-' in it gives an unwanted extra column of indentation, and adding
more minus signs gives more indentation.  The minus sign is only used
for the first list.

We really want outdentation.  I tried ++indent for that, but it gave
the same indentation as --indent.

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


Re: svn commit: r317061 - in head: libexec/rpc.rstatd sys/amd64/amd64 sys/amd64/include sys/arm/arm sys/arm/include sys/arm64/include sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/compat/linprocf

2017-05-02 Thread Bruce Evans



On Tue, 2 May 2017, Konstantin Belousov wrote:


On Tue, May 02, 2017 at 11:31:21PM +1000, Bruce Evans wrote:

On Tue, 2 May 2017, Konstantin Belousov wrote:

ENOMEM is, of course, the situation which I want to avoid.


Then you have to return no error, but truncate the value instead of
clamping.  Anything else is incompatible.

I do not quite agree with the truncation part, bit I do not think that
it is too important. As I noted before, IMO the absolute numbers for
the counters have more values than per-interval diffs displayed by e.g.
systat. But if truncating causes less disagreement than clamping, lets
do truncation.


This is better.

I also thought of changing the scale when the values get high.  The values
would increase slower above about 2G instead of stabilizing at 4G-1.
This is basically floating point and too complicated since nothing would
understand it.

Which counters wrap faster than a reasonable refresh interval of 1-10
seconds (which should be shorter if wrapping is a problem)?


diff --git a/sys/vm/vm_meter.c b/sys/vm/vm_meter.c
index 5f4cd46ab1e..6266ef670a6 100644
--- a/sys/vm/vm_meter.c
+++ b/sys/vm/vm_meter.c
@@ -266,8 +266,27 @@ static SYSCTL_NODE(_vm_stats, OID_AUTO, vm, CTLFLAG_RW, 0,
"VM meter vm stats");
SYSCTL_NODE(_vm_stats, OID_AUTO, misc, CTLFLAG_RW, 0, "VM meter misc stats");

+static int
+sysctl_handle_vmstat(SYSCTL_HANDLER_ARGS)
+{
+   uint64_t out;
+#ifdef COMPAT_FREEBSD11
+   uint32_t out32;
+#endif
+
+   out = counter_u64_fetch(*(counter_u64_t *)arg1);
+#ifdef COMPAT_FREEBSD11
+   if (req->oldlen == sizeof(out32)) {
+   out32 = (uint32_t)out; /* truncate */


Style:
- redundant cast.  Especially not needed with the commit.  Compilers might
  warn about this since they don't trust programmers, but don't because
  implicit downwards conversions are used often.
- comment not indented

I would also omit the ifdefs, and rename 'out' to out64, and may rename
'out*' to val*.


+   return (SYSCTL_OUT(req, , sizeof(out32)));
+   }
+#endif
+   return (SYSCTL_OUT(req, , sizeof(out)));
+}
+
#define VM_STATS(parent, var, descr) \
-SYSCTL_COUNTER_U64(parent, OID_AUTO, var, CTLFLAG_RD, _cnt.var, descr)
+SYSCTL_OID(parent, OID_AUTO, var, CTLTYPE_U64 | CTLFLAG_MPSAFE | \
+CTLFLAG_RD, _cnt.var, 0, sysctl_handle_vmstat, "QU", descr);
#define VM_STATS_VM(var, descr) VM_STATS(_vm_stats_vm, var, descr)
#define VM_STATS_SYS(var, descr)VM_STATS(_vm_stats_sys, var, descr)


I just noticed that this sysctl is r/o (I thought I was preserving support
for resetting 64-bit counters using a 32-bit size in my fix in
sysctl_handle_counter_64().  That function has the dubious feature of not
checking the size, so it allows writes of any length (0 to SIZE_MAX,
possibly larger than the user data) to reset the counter to zero.)

The r/o misfeature goes back to at least FreeBSD-3.  64-bit counters need
resetting less than 32-bit ones, and it is more useful to ever reset them
since they can hold the full counts since boot time, but there is no reason
to limit resetting them now that the low-level code supports it.  Is there
already a better atomic reset of all vm stats?

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


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

2017-05-02 Thread Kenneth D. Merry
Author: ken
Date: Tue May  2 14:52:28 2017
New Revision: 317680
URL: https://svnweb.freebsd.org/changeset/base/317680

Log:
  Add the SCSI SSC Manufacturer assigned serial number VPD page.
  
  This is current as of SSC-5r03.
  
  Submitted by: Sam Klopsch
  MFC after:3 days

Modified:
  head/sys/cam/scsi/scsi_sa.h

Modified: head/sys/cam/scsi/scsi_sa.h
==
--- head/sys/cam/scsi/scsi_sa.h Tue May  2 13:47:15 2017(r317679)
+++ head/sys/cam/scsi/scsi_sa.h Tue May  2 14:52:28 2017(r317680)
@@ -487,6 +487,19 @@ struct scsi_medium_type_data {
 };
 
 /*
+ * Manufacturer-assigned Serial Number VPD page.
+ * Current as of SSC-5r03, 28 September 2016.
+ */
+struct scsi_vpd_mfg_serial_number
+{
+   u_int8_t device;
+   u_int8_t page_code;
+#defineSVPD_MFG_SERIAL_NUMBER_PAGE_CODE 0xB1
+   u_int8_t page_length[2];
+   u_int8_t mfg_serial_num[];
+};
+
+/*
  * Security Protocol Specific values for the Tape Data Encryption protocol
  * (0x20) used with SECURITY PROTOCOL IN.  See below for values used with
  * SECURITY PROTOCOL OUT.  Current as of SSC4r03.
___
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: r317681 - head/share/man/man7

2017-05-02 Thread Konstantin Belousov
Author: kib
Date: Tue May  2 14:52:35 2017
New Revision: 317681
URL: https://svnweb.freebsd.org/changeset/base/317681

Log:
  Document time_t size.
  
  Reviewed by:  emaste, imp, vangyzen
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week
  Differential revision:https://reviews.freebsd.org/D10568

Modified:
  head/share/man/man7/arch.7

Modified: head/share/man/man7/arch.7
==
--- head/share/man/man7/arch.7  Tue May  2 14:52:28 2017(r317680)
+++ head/share/man/man7/arch.7  Tue May  2 14:52:35 2017(r317681)
@@ -26,7 +26,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd January 21, 2017
+.Dd May 2, 2017
 .Dt ARCH 7
 .Os
 .Sh NAME
@@ -47,27 +47,27 @@ On all supported architectures,
 .It float Ta 4
 .It double Ta 8
 .El
-.Bl -column -offset indent "Sy Architecture" "Sy sizeof(void *)" "Sy 
sizeof(long double)"
-.It Sy Architecture Ta Sy sizeof(void *) Ta Sy sizeof(long double)
-.It amd64   Ta 8 Ta 16
-.It arm Ta 4 Ta  8
-.It armeb   Ta 4 Ta  8
-.It armv6   Ta 4 Ta  8
-.It arm64   Ta 8 Ta 16
-.It i386Ta 4 Ta 12
-.It mipsTa 4 Ta  8
-.It mipsel  Ta 4 Ta  8
-.It mipselhfTa 4 Ta  8
-.It mipshf  Ta 4 Ta  8
-.It mipsn32 Ta 4 Ta  8
-.It mips64  Ta 8 Ta  8
-.It mips64elTa 8 Ta  8
-.It mips64elhf  Ta 8 Ta  8
-.It mips64hfTa 8 Ta  8
-.It powerpc Ta 4 Ta  8
-.It powerpc64   Ta 8 Ta  8
-.It riscv   Ta 8 Ta 16
-.It sparc64 Ta 8 Ta 16
+.Bl -column -offset indent "Sy Architecture" "Sy sizeof(void *)" "Sy 
sizeof(long double)" "Sy sizeof(time_t)"
+.It Sy Architecture Ta Sy sizeof(void *) Ta Sy sizeof(long double) Ta Sy 
sizeof(time_t)
+.It amd64   Ta 8 Ta 16 Ta 8
+.It arm Ta 4 Ta  8 Ta 8
+.It armeb   Ta 4 Ta  8 Ta 8
+.It armv6   Ta 4 Ta  8 Ta 8
+.It arm64   Ta 8 Ta 16 Ta 8
+.It i386Ta 4 Ta 12 Ta 4
+.It mipsTa 4 Ta  8 Ta 8
+.It mipsel  Ta 4 Ta  8 Ta 8
+.It mipselhfTa 4 Ta  8 Ta 8
+.It mipshf  Ta 4 Ta  8 Ta 8
+.It mipsn32 Ta 4 Ta  8 Ta 8
+.It mips64  Ta 8 Ta  8 Ta 8
+.It mips64elTa 8 Ta  8 Ta 8
+.It mips64elhf  Ta 8 Ta  8 Ta 8
+.It mips64hfTa 8 Ta  8 Ta 8
+.It powerpc Ta 4 Ta  8 Ta 4
+.It powerpc64   Ta 8 Ta  8 Ta 8
+.It riscv   Ta 8 Ta 16 Ta 8
+.It sparc64 Ta 8 Ta 16 Ta 8
 .El
 .Ss Endianness and Char Signedness
 .Bl -column -offset indent "Sy Architecture" "Sy Endianness" "Sy char 
Signedness"
___
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: r317061 - in head: libexec/rpc.rstatd sys/amd64/amd64 sys/amd64/include sys/arm/arm sys/arm/include sys/arm64/include sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/compat/linprocf

2017-05-02 Thread Konstantin Belousov
On Tue, May 02, 2017 at 11:31:21PM +1000, Bruce Evans wrote:
> On Tue, 2 May 2017, Konstantin Belousov wrote:
> > ENOMEM is, of course, the situation which I want to avoid.
> 
> Then you have to return no error, but truncate the value instead of
> clamping.  Anything else is incompatible.
I do not quite agree with the truncation part, bit I do not think that
it is too important. As I noted before, IMO the absolute numbers for
the counters have more values than per-interval diffs displayed by e.g.
systat. But if truncating causes less disagreement than clamping, lets
do truncation.

diff --git a/sys/vm/vm_meter.c b/sys/vm/vm_meter.c
index 5f4cd46ab1e..6266ef670a6 100644
--- a/sys/vm/vm_meter.c
+++ b/sys/vm/vm_meter.c
@@ -266,8 +266,27 @@ static SYSCTL_NODE(_vm_stats, OID_AUTO, vm, CTLFLAG_RW, 0,
"VM meter vm stats");
 SYSCTL_NODE(_vm_stats, OID_AUTO, misc, CTLFLAG_RW, 0, "VM meter misc stats");
 
+static int
+sysctl_handle_vmstat(SYSCTL_HANDLER_ARGS)
+{
+   uint64_t out;
+#ifdef COMPAT_FREEBSD11
+   uint32_t out32;
+#endif
+
+   out = counter_u64_fetch(*(counter_u64_t *)arg1);
+#ifdef COMPAT_FREEBSD11
+   if (req->oldlen == sizeof(out32)) {
+   out32 = (uint32_t)out; /* truncate */
+   return (SYSCTL_OUT(req, , sizeof(out32)));
+   }
+#endif
+   return (SYSCTL_OUT(req, , sizeof(out)));
+}
+
 #defineVM_STATS(parent, var, descr) \
-SYSCTL_COUNTER_U64(parent, OID_AUTO, var, CTLFLAG_RD, _cnt.var, descr)
+SYSCTL_OID(parent, OID_AUTO, var, CTLTYPE_U64 | CTLFLAG_MPSAFE | \
+CTLFLAG_RD, _cnt.var, 0, sysctl_handle_vmstat, "QU", descr);
 #defineVM_STATS_VM(var, descr) VM_STATS(_vm_stats_vm, var, 
descr)
 #defineVM_STATS_SYS(var, descr)VM_STATS(_vm_stats_sys, var, 
descr)
 
___
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: r317679 - head/usr.bin/grep/nls

2017-05-02 Thread Ed Maste
Author: emaste
Date: Tue May  2 13:47:15 2017
New Revision: 317679
URL: https://svnweb.freebsd.org/changeset/base/317679

Log:
  bsdgrep: correct nls usage data after r317049
  
  r317049 added -z/--null-data to BSD grep but missed the update to nls
  catalogs.
  
  Submitted by: Kyle Evans 
  Differential Revision:https://reviews.freebsd.org/D10456

Modified:
  head/usr.bin/grep/nls/C.msg
  head/usr.bin/grep/nls/es_ES.ISO8859-1.msg
  head/usr.bin/grep/nls/gl_ES.ISO8859-1.msg
  head/usr.bin/grep/nls/hu_HU.ISO8859-2.msg
  head/usr.bin/grep/nls/ja_JP.SJIS.msg
  head/usr.bin/grep/nls/ja_JP.UTF-8.msg
  head/usr.bin/grep/nls/ja_JP.eucJP.msg
  head/usr.bin/grep/nls/pt_BR.ISO8859-1.msg
  head/usr.bin/grep/nls/ru_RU.KOI8-R.msg
  head/usr.bin/grep/nls/uk_UA.UTF-8.msg
  head/usr.bin/grep/nls/zh_CN.UTF-8.msg

Modified: head/usr.bin/grep/nls/C.msg
==
--- head/usr.bin/grep/nls/C.msg Tue May  2 13:38:20 2017(r317678)
+++ head/usr.bin/grep/nls/C.msg Tue May  2 13:47:15 2017(r317679)
@@ -5,7 +5,7 @@ $quote "
 1 "(standard input)"
 2 "cannot read bzip2 compressed file"
 3 "unknown %s option"
-4 "usage: %s [-abcDEFGHhIiJLlmnOoPqRSsUVvwxZ] [-A num] [-B num] [-C[num]]\n"
+4 "usage: %s [-abcDEFGHhIiJLlmnOoPqRSsUVvwxZz] [-A num] [-B num] [-C[num]]\n"
 5 "\t[-e pattern] [-f file] [--binary-files=value] [--color=when]\n"
 6 "\t[--context[=num]] [--directories=action] [--label] [--line-buffered]\n"
 7 "\t[--null] [pattern] [file ...]\n"

Modified: head/usr.bin/grep/nls/es_ES.ISO8859-1.msg
==
--- head/usr.bin/grep/nls/es_ES.ISO8859-1.msg   Tue May  2 13:38:20 2017
(r317678)
+++ head/usr.bin/grep/nls/es_ES.ISO8859-1.msg   Tue May  2 13:47:15 2017
(r317679)
@@ -5,7 +5,7 @@ $quote "
 1 "(entrada est�ndar)"
 2 "no se puede leer el fichero comprimido bzip2"
 3 "opci�n desconocida de %s"
-4 "uso: %s [-abcDEFGHhIiJLlmnOoPqRSsUVvwxZ] [-A no] [-B no] [-C[no]]\n"
+4 "uso: %s [-abcDEFGHhIiJLlmnOoPqRSsUVvwxZz] [-A no] [-B no] [-C[no]]\n"
 5 "\t[-e pauta] [-f fichero] [--binary-files=valor] [--color=cuando]\n"
 6 "\t[--context[=no]] [--directories=acci�n] [--label] [--line-buffered]\n"
 7 "\t[--null] [pauta] [fichero ...]\n"

Modified: head/usr.bin/grep/nls/gl_ES.ISO8859-1.msg
==
--- head/usr.bin/grep/nls/gl_ES.ISO8859-1.msg   Tue May  2 13:38:20 2017
(r317678)
+++ head/usr.bin/grep/nls/gl_ES.ISO8859-1.msg   Tue May  2 13:47:15 2017
(r317679)
@@ -5,7 +5,7 @@ $quote "
 1 "(entrada est�ndar)"
 2 "non se pode ler o ficheiro comprimido bzip2"
 3 "opci�n desco�ecida de %s"
-4 "uso: %s [-abcDEFGHhIiJLlmnOoPqRSsUVvwxZ] [-A no] [-B no] [-C[no]]\n"
+4 "uso: %s [-abcDEFGHhIiJLlmnOoPqRSsUVvwxZz] [-A no] [-B no] [-C[no]]\n"
 5 "\t[-e pauta] [-f ficheiro] [--binary-files=valor] [--color=cando]\n"
 6 "\t[--context[=no]] [--directories=acci�n] [--label] [--line-buffered]\n"
 7 "\t[--null] [pauta] [ficheiro ...]\n"

Modified: head/usr.bin/grep/nls/hu_HU.ISO8859-2.msg
==
--- head/usr.bin/grep/nls/hu_HU.ISO8859-2.msg   Tue May  2 13:38:20 2017
(r317678)
+++ head/usr.bin/grep/nls/hu_HU.ISO8859-2.msg   Tue May  2 13:47:15 2017
(r317679)
@@ -5,7 +5,7 @@ $quote "
 1 "(szabv�nyos bemenet)"
 2 "bzip2 t�m�r�tett f�jl nem olvashat�"
 3 "ismeretlen %s opci�"
-4 "haszn�lat: %s [-abcDEFGHhIiJLlmnOoPqRSsUVvwxZ] [-A sz�m] [-B sz�m] 
[-C[sz�m]]\n"
+4 "haszn�lat: %s [-abcDEFGHhIiJLlmnOoPqRSsUVvwxZz] [-A sz�m] [-B sz�m] 
[-C[sz�m]]\n"
 5 "\t[-e minta] [-f f�jl] [--binary-files=�rt�k] [--color=mikor]\n"
 6 "\t[--context[=sz�m]] [--directories=m�velet] [--label] [--line-buffered]\n"
 7 "\t[--null] [minta] [f�jl ...]\n"

Modified: head/usr.bin/grep/nls/ja_JP.SJIS.msg
==
--- head/usr.bin/grep/nls/ja_JP.SJIS.msgTue May  2 13:38:20 2017
(r317678)
+++ head/usr.bin/grep/nls/ja_JP.SJIS.msgTue May  2 13:47:15 2017
(r317679)
@@ -5,7 +5,7 @@ $quote "
 1 "(�W��)"
 2 "bzip2 ���k�t�@�C�ǂݍ��ނ��Ƃ��ł��܂���"
 3 "%s �I�v�V�̎w���l�Ɍ��肪�܂�"
-4 "�g: %s [-abcDEFGHhIiJLlmnOoPqRSsUVvwxZ] [-A ] [-B ] 
[-C[]]\n"
+4 "�g: %s [-abcDEFGHhIiJLlmnOoPqRSsUVvwxZz] [-A ] [-B ] 
[-C[]]\n"
 5 "\t[-e �p�^�[��] [-f �t�@�C] [--binary-files=�l] [--color=�l]\n"
 6 "\t[--context[=]] [--directories=] [--label] [--line-buffered]\n"
 7 "\t[--null] [�p�^�[��] [�t�@�C ...]\n"

Modified: head/usr.bin/grep/nls/ja_JP.UTF-8.msg
==
--- head/usr.bin/grep/nls/ja_JP.UTF-8.msg   Tue May  2 13:38:20 2017
(r317678)
+++ head/usr.bin/grep/nls/ja_JP.UTF-8.msg   Tue May  2 13:47:15 2017
(r317679)
@@ -5,7 

svn commit: r317678 - in head/usr.bin/grep: . nls

2017-05-02 Thread Ed Maste
Author: emaste
Date: Tue May  2 13:38:20 2017
New Revision: 317678
URL: https://svnweb.freebsd.org/changeset/base/317678

Log:
  bsdgrep: Add GNU compatible version string indicator
  
  As reported in r218614 it's useful to have an indication of whether or not
  BSD grep was built with GNU_GREP_COMPAT.
  
  Submitted by: Kyle Evans 
  Reported by:  mandree
  Differential Revision:https://reviews.freebsd.org/D10451

Modified:
  head/usr.bin/grep/Makefile
  head/usr.bin/grep/grep.c
  head/usr.bin/grep/nls/C.msg
  head/usr.bin/grep/nls/es_ES.ISO8859-1.msg
  head/usr.bin/grep/nls/gl_ES.ISO8859-1.msg
  head/usr.bin/grep/nls/hu_HU.ISO8859-2.msg
  head/usr.bin/grep/nls/ja_JP.SJIS.msg
  head/usr.bin/grep/nls/ja_JP.UTF-8.msg
  head/usr.bin/grep/nls/ja_JP.eucJP.msg
  head/usr.bin/grep/nls/pt_BR.ISO8859-1.msg
  head/usr.bin/grep/nls/ru_RU.KOI8-R.msg
  head/usr.bin/grep/nls/uk_UA.UTF-8.msg
  head/usr.bin/grep/nls/zh_CN.UTF-8.msg

Modified: head/usr.bin/grep/Makefile
==
--- head/usr.bin/grep/Makefile  Tue May  2 10:13:50 2017(r317677)
+++ head/usr.bin/grep/Makefile  Tue May  2 13:38:20 2017(r317678)
@@ -82,7 +82,7 @@ CFLAGS+= -DWITHOUT_BZIP2
 .endif
 
 .if ${MK_GNU_GREP_COMPAT} != "no"
-CFLAGS+= -I${DESTDIR}/usr/include/gnu
+CFLAGS+= -I${DESTDIR}/usr/include/gnu -DWITH_GNU
 LIBADD+=   gnuregex
 .endif
 

Modified: head/usr.bin/grep/grep.c
==
--- head/usr.bin/grep/grep.cTue May  2 10:13:50 2017(r317677)
+++ head/usr.bin/grep/grep.cTue May  2 13:38:20 2017(r317678)
@@ -74,6 +74,7 @@ const char*errstr[] = {
 /* 7*/ "\t[--null] [pattern] [file ...]\n",
 /* 8*/ "Binary file %s matches\n",
 /* 9*/ "%s (BSD grep) %s\n",
+/* 10*/"%s (BSD grep, GNU compatible) %s\n",
 };
 
 /* Flags passed to regcomp() and regexec() */
@@ -596,7 +597,11 @@ main(int argc, char *argv[])
filebehave = FILE_MMAP;
break;
case 'V':
+#ifdef WITH_GNU
+   printf(getstr(10), getprogname(), VERSION);
+#else
printf(getstr(9), getprogname(), VERSION);
+#endif
exit(0);
case 'v':
vflag = true;

Modified: head/usr.bin/grep/nls/C.msg
==
--- head/usr.bin/grep/nls/C.msg Tue May  2 10:13:50 2017(r317677)
+++ head/usr.bin/grep/nls/C.msg Tue May  2 13:38:20 2017(r317678)
@@ -11,3 +11,4 @@ $quote "
 7 "\t[--null] [pattern] [file ...]\n"
 8 "Binary file %s matches\n"
 9 "%s (BSD grep) %s\n"
+10 "%s (BSD grep, GNU compatible) %s\n"

Modified: head/usr.bin/grep/nls/es_ES.ISO8859-1.msg
==
--- head/usr.bin/grep/nls/es_ES.ISO8859-1.msg   Tue May  2 10:13:50 2017
(r317677)
+++ head/usr.bin/grep/nls/es_ES.ISO8859-1.msg   Tue May  2 13:38:20 2017
(r317678)
@@ -11,3 +11,4 @@ $quote "
 7 "\t[--null] [pauta] [fichero ...]\n"
 8 "fichero binario %s se ajusta\n"
 9 "%s (BSD grep) %s\n"
+10 "%s (BSD grep, GNU compatible) %s\n"

Modified: head/usr.bin/grep/nls/gl_ES.ISO8859-1.msg
==
--- head/usr.bin/grep/nls/gl_ES.ISO8859-1.msg   Tue May  2 10:13:50 2017
(r317677)
+++ head/usr.bin/grep/nls/gl_ES.ISO8859-1.msg   Tue May  2 13:38:20 2017
(r317678)
@@ -11,3 +11,4 @@ $quote "
 7 "\t[--null] [pauta] [ficheiro ...]\n"
 8 "ficheiro binario %s conforma\n"
 9 "%s (BSD grep) %s\n"
+10 "%s (BSD grep, GNU compatible) %s\n"

Modified: head/usr.bin/grep/nls/hu_HU.ISO8859-2.msg
==
--- head/usr.bin/grep/nls/hu_HU.ISO8859-2.msg   Tue May  2 10:13:50 2017
(r317677)
+++ head/usr.bin/grep/nls/hu_HU.ISO8859-2.msg   Tue May  2 13:38:20 2017
(r317678)
@@ -11,3 +11,4 @@ $quote "
 7 "\t[--null] [minta] [f�jl ...]\n"
 8 "%s bin�ris f�jl illeszkedik\n"
 9 "%s (BSD grep) %s\n"
+10 "%s (BSD grep, GNU compatible) %s\n"

Modified: head/usr.bin/grep/nls/ja_JP.SJIS.msg
==
--- head/usr.bin/grep/nls/ja_JP.SJIS.msgTue May  2 10:13:50 2017
(r317677)
+++ head/usr.bin/grep/nls/ja_JP.SJIS.msgTue May  2 13:38:20 2017
(r317678)
@@ -11,3 +11,4 @@ $quote "
 7 "\t[--null] [�p�^�[��] [�t�@�C ...]\n"
 8 "�o�C�i���t�@�C�� %s �Ƀ}�b�`���܂���\n"
 9 "%s (BSD grep) %s\n"
+10 "%s (BSD grep, GNU compatible) %s\n"

Modified: head/usr.bin/grep/nls/ja_JP.UTF-8.msg
==
--- head/usr.bin/grep/nls/ja_JP.UTF-8.msg   Tue May  2 10:13:50 2017
(r317677)
+++ head/usr.bin/grep/nls/ja_JP.UTF-8.msg   Tue May  

Re: svn commit: r317061 - in head: libexec/rpc.rstatd sys/amd64/amd64 sys/amd64/include sys/arm/arm sys/arm/include sys/arm64/include sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/compat/linprocf

2017-05-02 Thread Bruce Evans

On Tue, 2 May 2017, Konstantin Belousov wrote:


On Tue, May 02, 2017 at 09:25:40PM +1000, Bruce Evans wrote:

On Tue, 2 May 2017, Konstantin Belousov wrote:


On Mon, May 01, 2017 at 06:25:11PM +1000, Bruce Evans wrote:

XX Index: subr_counter.c
XX ===
XX --- subr_counter.c   (revision 317604)
XX +++ subr_counter.c   (working copy)
XX @@ -78,11 +78,15 @@
XX  sysctl_handle_counter_u64(SYSCTL_HANDLER_ARGS)
XX  {
XX  uint64_t out;
XX +uint32_t out32;
XX  int error;
XX
XX  out = counter_u64_fetch(*(counter_u64_t *)arg1);
XX
XX -error = SYSCTL_OUT(req, , sizeof(uint64_t));
XX +if (req->oldlen == 4 && (out32 = out) == out)
XX +error = SYSCTL_OUT(req, , sizeof(out32));
XX +else
XX +error = SYSCTL_OUT(req, , sizeof(out));
XX
XX  if (error || !req->newptr)
XX  return (error);

This does the minimum necessary to fix the current problem.

This works until the counters become too large for a u_int.  There
could be an option to get truncation with no error, but that would
require an API change, so applications should be required to do the
truncation for themself if that is what they want.


Yes, this is approximately what I consider to be enough fix, but with
some details which I do not like and which did not worked well on my
test machine with enough memory to generate lot of increments.

Below is what I consider to be good enough.  I will proceed with this
version unless very strong objections appear.


I prefer my version.  It is the same as for sysctl_bufspace(), except
for simplifications and bug fixes that are easier because the types
are unsigned.

Your version is especially broken for the case of a lot of increments.

You consider the 'differentiators' as the main users, but I only want
systat and top to not abort, I have no intent of making them work
for updated counters if overflown.  Instead, I want something human-visible
so that person looking at raw counters values using old tools detected the
failure.


Clamping doesn't work for that either.  Truncating either just works using
differences like it has done for 30 years or so, or gives weirder values
that clamping.

Arguably, the API is that the counters may wrap, and applications must
handle this as well as possible by sampling them more often than they
wrap, so that only the initial values might be wrong.  Applications should
also have attempt to guess when the initial values are wrong, and print
hints about this that are more visible than printing blindly wrapped
value.


Clamping breaks many cases in systat -v which just needs unsigned counters
to calculate small differences.  Not many counters overflow faster than
the refresh interval in systat or top.  These cases used to appear to
work perfectly for most counters when the kernel did blind truncations.
Clamping breaks the API.  Not returing ENOMEM breaks the API.

In my version, this is handled as specified by the API by truncating and
returning ENOMEM.  Then:
- top sees the ENOMEM and mishandles it by aborting
- systat sees the ENOMEM (and also sees a short count, if it has the newer
   breakage of hard-coding 64-bit counters instead of u_int ones, and is
   run on a kernel with u_int counters) and mishandles it better by
   printing an error message but not aborting.  Thus it appears to work
   just as well as when the kernel did blind truncation, except for the
   error message.

ENOMEM is, of course, the situation which I want to avoid.


Then you have to return no error, but truncate the value instead of
clamping.  Anything else is incompatible.

To find the buggy applications, it is better to return a new errno, not
ENOMEM.  EOVERFLOW resulted in top aborting with a useful error message.


...
+   out = counter_u64_fetch(*(counter_u64_t *)arg1);
+#ifdef COMPAT_FREEBSD11
+   if (req->oldlen == sizeof(uint32_t)) {


sizeof(uint32_t) is an obfuscated spelling of '4'.  The size is already
hard-coded in '32'.  This depends on sizeof(char) being 1.  It is, and
won't change.  POSIX started specifying this in 2001, and the mere
existence of uint8_t probably requires 8-bit chars since u_char must
be the smallest type of an object.  This depends on the size of a u_int
being 32 bits/4 bytes in the old ABI.  This won't change, and is already
hard-coded as 32, as it must be because sizeof(u_int) may change.

I prefer the sizeof over 4.


sizeof is really bloated when you handle all the sizes as in my larger
patch.  The basic sizes are 1, 2, 4 and 8 bytes (and possibly a larger
intmax_t), and it is a detail that the sizes in the integer types are
in bits.  However, once we have set up the variables to match the sizes
in bytes, it is not so bad to use sizeof(var) instead of sizeof(typename).
The size is then hard-coded in only 1 place.  That works here too:
use sizeof(out32).


+   out1 = 0x;
+   if (out < out1)
+   

Re: svn commit: r317061 - in head: libexec/rpc.rstatd sys/amd64/amd64 sys/amd64/include sys/arm/arm sys/arm/include sys/arm64/include sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/compat/linprocf

2017-05-02 Thread Konstantin Belousov
On Tue, May 02, 2017 at 09:25:40PM +1000, Bruce Evans wrote:
> On Tue, 2 May 2017, Konstantin Belousov wrote:
> 
> > On Mon, May 01, 2017 at 06:25:11PM +1000, Bruce Evans wrote:
> >> XX Index: subr_counter.c
> >> XX ===
> >> XX --- subr_counter.c  (revision 317604)
> >> XX +++ subr_counter.c  (working copy)
> >> XX @@ -78,11 +78,15 @@
> >> XX  sysctl_handle_counter_u64(SYSCTL_HANDLER_ARGS)
> >> XX  {
> >> XX uint64_t out;
> >> XX +   uint32_t out32;
> >> XX int error;
> >> XX
> >> XX out = counter_u64_fetch(*(counter_u64_t *)arg1);
> >> XX
> >> XX -   error = SYSCTL_OUT(req, , sizeof(uint64_t));
> >> XX +   if (req->oldlen == 4 && (out32 = out) == out)
> >> XX +   error = SYSCTL_OUT(req, , sizeof(out32));
> >> XX +   else
> >> XX +   error = SYSCTL_OUT(req, , sizeof(out));
> >> XX
> >> XX if (error || !req->newptr)
> >> XX return (error);
> >>
> >> This does the minimum necessary to fix the current problem.
> >>
> >> This works until the counters become too large for a u_int.  There
> >> could be an option to get truncation with no error, but that would
> >> require an API change, so applications should be required to do the
> >> truncation for themself if that is what they want.
> >
> > Yes, this is approximately what I consider to be enough fix, but with
> > some details which I do not like and which did not worked well on my
> > test machine with enough memory to generate lot of increments.
> >
> > Below is what I consider to be good enough.  I will proceed with this
> > version unless very strong objections appear.
> 
> I prefer my version.  It is the same as for sysctl_bufspace(), except
> for simplifications and bug fixes that are easier because the types
> are unsigned.
> 
> Your version is especially broken for the case of a lot of increments.
You consider the 'differentiators' as the main users, but I only want
systat and top to not abort, I have no intent of making them work
for updated counters if overflown.  Instead, I want something human-visible
so that person looking at raw counters values using old tools detected the 
failure.

> 
> Clamping breaks many cases in systat -v which just needs unsigned counters
> to calculate small differences.  Not many counters overflow faster than
> the refresh interval in systat or top.  These cases used to appear to
> work perfectly for most counters when the kernel did blind truncations.
> Clamping breaks the API.  Not returing ENOMEM breaks the API.
> 
> In my version, this is handled as specified by the API by truncating and
> returning ENOMEM.  Then:
> - top sees the ENOMEM and mishandles it by aborting
> - systat sees the ENOMEM (and also sees a short count, if it has the newer
>breakage of hard-coding 64-bit counters instead of u_int ones, and is
>run on a kernel with u_int counters) and mishandles it better by
>printing an error message but not aborting.  Thus it appears to work
>just as well as when the kernel did blind truncation, except for the
>error message.
ENOMEM is, of course, the situation which I want to avoid.

> 
> Clamping would be difficult for the application to handle even if an
> error is returned.  This would be like the situation for clamping for
> strtoul(), but worse since it changes the API.  Many applications don't
> understand how to handle errno for strtoul(), but they do do a bogus
> check of the clamped value.  For sysctl(), clamping is not part of
> the API now, so applications shouldn't check for the clamped values.
> Ones that work with deltas like systat -v would see the counters stop
> incrementing when the clamped value is reached, while truncated values
> allow them to continue to appear to work perfectly.
> 
> > diff --git a/sys/vm/vm_meter.c b/sys/vm/vm_meter.c
> > index 5f4cd46ab1e..93d5161de89 100644
> > --- a/sys/vm/vm_meter.c
> > +++ b/sys/vm/vm_meter.c
> > @@ -266,8 +266,29 @@ static SYSCTL_NODE(_vm_stats, OID_AUTO, vm, 
> > CTLFLAG_RW, 0,
> > "VM meter vm stats");
> > SYSCTL_NODE(_vm_stats, OID_AUTO, misc, CTLFLAG_RW, 0, "VM meter misc 
> > stats");
> >
> > +static int
> > +sysctl_handle_vmstat(SYSCTL_HANDLER_ARGS)
> > +{
> > +   uint64_t out;
> > +#ifdef COMPAT_FREEBSD11
> > +   uint32_t out1;
> > +#endif
> 
> The extra wrapper and the ifdef limit the damage from the API change.
> Otherwise, I don't like them.
> 
> I prefer my variable name out32 to the nondescript out1.  ('out' should
> also be renamed out64, but I wanted to keep the diffs small.)
Changed to the out32 name.

> 
> > +
> > +   out = counter_u64_fetch(*(counter_u64_t *)arg1);
> > +#ifdef COMPAT_FREEBSD11
> > +   if (req->oldlen == sizeof(uint32_t)) {
> 
> sizeof(uint32_t) is an obfuscated spelling of '4'.  The size is already
> hard-coded in '32'.  This depends on sizeof(char) being 1.  It is, and
> won't change.  POSIX started specifying this in 2001, and the 

Re: svn commit: r317061 - in head: libexec/rpc.rstatd sys/amd64/amd64 sys/amd64/include sys/arm/arm sys/arm/include sys/arm64/include sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/compat/linprocf

2017-05-02 Thread Bruce Evans

On Tue, 2 May 2017, Konstantin Belousov wrote:


On Tue, May 02, 2017 at 12:02:32PM +0200, Hans Petter Selasky wrote:

On 05/02/17 11:55, Konstantin Belousov wrote:

+   out1 = 0x;


Nitpicking:

Should this be written: 0xU ??


No, 0xU should be written 0x except in very delicate code
which needs it to have type precisely u_int (and u_int has at least 32
bits, else the constant would still not be u_int).


Compiler must do it on its own.  The constant is not representable as
int so it is auto-promoted to unsigned int, if fitting.


It doesn't really matter here, but we must make too many assumptions and
do too many type analyses to see that it doesn't matter (or too see that
either 0x or 0xU is correct or needed, but plain
0x usually works better since it lets the compiler decide).

Here you assume <= 32-bit ints for simplicity (otherwise, 0x would
be int).  POSIX and practice also requires >= 32-bit ints.  So ints are
assumed to be precisely 32 bits, and then 0x is just a better
spelling of 0xU.

Here we only need that the constant is non-negative.  Its type is
irrelevant, so it would be a style bug to force the type to unsigned or
larger (with < 32-bit ints) using a U suffix.  All integer constants
are non-negative.  We could even spell the constant in decimal here.
It would then have type int64_t.  Spelling it in hex makes its value
clearer and allows its type to be unsigned.

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


Re: svn commit: r317061 - in head: libexec/rpc.rstatd sys/amd64/amd64 sys/amd64/include sys/arm/arm sys/arm/include sys/arm64/include sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/compat/linprocf

2017-05-02 Thread Bruce Evans

On Tue, 2 May 2017, Konstantin Belousov wrote:


On Mon, May 01, 2017 at 06:25:11PM +1000, Bruce Evans wrote:

XX Index: subr_counter.c
XX ===
XX --- subr_counter.c   (revision 317604)
XX +++ subr_counter.c   (working copy)
XX @@ -78,11 +78,15 @@
XX  sysctl_handle_counter_u64(SYSCTL_HANDLER_ARGS)
XX  {
XX  uint64_t out;
XX +uint32_t out32;
XX  int error;
XX
XX  out = counter_u64_fetch(*(counter_u64_t *)arg1);
XX
XX -error = SYSCTL_OUT(req, , sizeof(uint64_t));
XX +if (req->oldlen == 4 && (out32 = out) == out)
XX +error = SYSCTL_OUT(req, , sizeof(out32));
XX +else
XX +error = SYSCTL_OUT(req, , sizeof(out));
XX
XX  if (error || !req->newptr)
XX  return (error);

This does the minimum necessary to fix the current problem.

This works until the counters become too large for a u_int.  There
could be an option to get truncation with no error, but that would
require an API change, so applications should be required to do the
truncation for themself if that is what they want.


Yes, this is approximately what I consider to be enough fix, but with
some details which I do not like and which did not worked well on my
test machine with enough memory to generate lot of increments.

Below is what I consider to be good enough.  I will proceed with this
version unless very strong objections appear.


I prefer my version.  It is the same as for sysctl_bufspace(), except
for simplifications and bug fixes that are easier because the types
are unsigned.

Your version is especially broken for the case of a lot of increments.

Clamping breaks many cases in systat -v which just needs unsigned counters
to calculate small differences.  Not many counters overflow faster than
the refresh interval in systat or top.  These cases used to appear to
work perfectly for most counters when the kernel did blind truncations.
Clamping breaks the API.  Not returing ENOMEM breaks the API.

In my version, this is handled as specified by the API by truncating and
returning ENOMEM.  Then:
- top sees the ENOMEM and mishandles it by aborting
- systat sees the ENOMEM (and also sees a short count, if it has the newer
  breakage of hard-coding 64-bit counters instead of u_int ones, and is
  run on a kernel with u_int counters) and mishandles it better by
  printing an error message but not aborting.  Thus it appears to work
  just as well as when the kernel did blind truncation, except for the
  error message.

Clamping would be difficult for the application to handle even if an
error is returned.  This would be like the situation for clamping for
strtoul(), but worse since it changes the API.  Many applications don't
understand how to handle errno for strtoul(), but they do do a bogus
check of the clamped value.  For sysctl(), clamping is not part of
the API now, so applications shouldn't check for the clamped values.
Ones that work with deltas like systat -v would see the counters stop
incrementing when the clamped value is reached, while truncated values
allow them to continue to appear to work perfectly.


diff --git a/sys/vm/vm_meter.c b/sys/vm/vm_meter.c
index 5f4cd46ab1e..93d5161de89 100644
--- a/sys/vm/vm_meter.c
+++ b/sys/vm/vm_meter.c
@@ -266,8 +266,29 @@ static SYSCTL_NODE(_vm_stats, OID_AUTO, vm, CTLFLAG_RW, 0,
"VM meter vm stats");
SYSCTL_NODE(_vm_stats, OID_AUTO, misc, CTLFLAG_RW, 0, "VM meter misc stats");

+static int
+sysctl_handle_vmstat(SYSCTL_HANDLER_ARGS)
+{
+   uint64_t out;
+#ifdef COMPAT_FREEBSD11
+   uint32_t out1;
+#endif


The extra wrapper and the ifdef limit the damage from the API change.
Otherwise, I don't like them.

I prefer my variable name out32 to the nondescript out1.  ('out' should
also be renamed out64, but I wanted to keep the diffs small.)


+
+   out = counter_u64_fetch(*(counter_u64_t *)arg1);
+#ifdef COMPAT_FREEBSD11
+   if (req->oldlen == sizeof(uint32_t)) {


sizeof(uint32_t) is an obfuscated spelling of '4'.  The size is already
hard-coded in '32'.  This depends on sizeof(char) being 1.  It is, and
won't change.  POSIX started specifying this in 2001, and the mere
existence of uint8_t probably requires 8-bit chars since u_char must
be the smallest type of an object.  This depends on the size of a u_int
being 32 bits/4 bytes in the old ABI.  This won't change, and is already
hard-coded as 32, as it must be because sizeof(u_int) may change.


+   out1 = 0x;
+   if (out < out1)
+   out1 = out;


This does the clamping.  Clamping is probably better expressed as:

out1 = MIN(out, 0x)


+   return (SYSCTL_OUT(req, , sizeof(uint32_t)));


Here sizeof(uint32_t) is an obfuscated spelling of sizeof(out1).  I think
the sizeof() is justified in this case, to limit the hard-coding to of
sizes to 1 place.  Truncation by assigment to the destination variable also
helps limit this
 

Re: svn commit: r317061 - in head: libexec/rpc.rstatd sys/amd64/amd64 sys/amd64/include sys/arm/arm sys/arm/include sys/arm64/include sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/compat/linprocf

2017-05-02 Thread Konstantin Belousov
On Tue, May 02, 2017 at 12:02:32PM +0200, Hans Petter Selasky wrote:
> On 05/02/17 11:55, Konstantin Belousov wrote:
> > +   out1 = 0x;
> 
> Nitpicking:
> 
> Should this be written: 0xU ??

Compiler must do it on its own.  The constant is not representable as
int so it is auto-promoted to unsigned int, if fitting.
___
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: r317061 - in head: libexec/rpc.rstatd sys/amd64/amd64 sys/amd64/include sys/arm/arm sys/arm/include sys/arm64/include sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/compat/linprocf

2017-05-02 Thread Hans Petter Selasky

On 05/02/17 11:55, Konstantin Belousov wrote:

+   out1 = 0x;


Nitpicking:

Should this be written: 0xU ??

--HPS
___
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: r317061 - in head: libexec/rpc.rstatd sys/amd64/amd64 sys/amd64/include sys/arm/arm sys/arm/include sys/arm64/include sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/compat/linprocf

2017-05-02 Thread Konstantin Belousov
On Mon, May 01, 2017 at 06:25:11PM +1000, Bruce Evans wrote:
> XX Index: subr_counter.c
> XX ===
> XX --- subr_counter.c (revision 317604)
> XX +++ subr_counter.c (working copy)
> XX @@ -78,11 +78,15 @@
> XX  sysctl_handle_counter_u64(SYSCTL_HANDLER_ARGS)
> XX  {
> XXuint64_t out;
> XX +  uint32_t out32;
> XXint error;
> XX 
> XXout = counter_u64_fetch(*(counter_u64_t *)arg1);
> XX 
> XX -  error = SYSCTL_OUT(req, , sizeof(uint64_t));
> XX +  if (req->oldlen == 4 && (out32 = out) == out)
> XX +  error = SYSCTL_OUT(req, , sizeof(out32));
> XX +  else
> XX +  error = SYSCTL_OUT(req, , sizeof(out));
> XX 
> XXif (error || !req->newptr)
> XXreturn (error);
> 
> This does the minimum necessary to fix the current problem.
> 
> This works until the counters become too large for a u_int.  There
> could be an option to get truncation with no error, but that would
> require an API change, so applications should be required to do the
> truncation for themself if that is what they want.

Yes, this is approximately what I consider to be enough fix, but with
some details which I do not like and which did not worked well on my
test machine with enough memory to generate lot of increments.

Below is what I consider to be good enough.  I will proceed with this
version unless very strong objections appear.

diff --git a/sys/vm/vm_meter.c b/sys/vm/vm_meter.c
index 5f4cd46ab1e..93d5161de89 100644
--- a/sys/vm/vm_meter.c
+++ b/sys/vm/vm_meter.c
@@ -266,8 +266,29 @@ static SYSCTL_NODE(_vm_stats, OID_AUTO, vm, CTLFLAG_RW, 0,
"VM meter vm stats");
 SYSCTL_NODE(_vm_stats, OID_AUTO, misc, CTLFLAG_RW, 0, "VM meter misc stats");
 
+static int
+sysctl_handle_vmstat(SYSCTL_HANDLER_ARGS)
+{
+   uint64_t out;
+#ifdef COMPAT_FREEBSD11
+   uint32_t out1;
+#endif
+
+   out = counter_u64_fetch(*(counter_u64_t *)arg1);
+#ifdef COMPAT_FREEBSD11
+   if (req->oldlen == sizeof(uint32_t)) {
+   out1 = 0x;
+   if (out < out1)
+   out1 = out;
+   return (SYSCTL_OUT(req, , sizeof(uint32_t)));
+   }
+#endif
+   return (SYSCTL_OUT(req, , sizeof(uint64_t)));
+}
+
 #defineVM_STATS(parent, var, descr) \
-SYSCTL_COUNTER_U64(parent, OID_AUTO, var, CTLFLAG_RD, _cnt.var, descr)
+SYSCTL_OID(parent, OID_AUTO, var, CTLTYPE_U64 | CTLFLAG_MPSAFE | \
+CTLFLAG_RD, _cnt.var, 0, sysctl_handle_vmstat, "QU", descr);
 #defineVM_STATS_VM(var, descr) VM_STATS(_vm_stats_vm, var, 
descr)
 #defineVM_STATS_SYS(var, descr)VM_STATS(_vm_stats_sys, var, 
descr)
 
___
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: r317673 - stable/11/sys/dev/ahci

2017-05-02 Thread Alexander Motin
Author: mav
Date: Tue May  2 06:27:46 2017
New Revision: 317673
URL: https://svnweb.freebsd.org/changeset/base/317673

Log:
  MFC r317080: Block FPDMA TRIM for ASMedia HBAs.
  
  Experiments show FPDMA TRIM command timeouts on ASMedia HBAs, while the
  same SSDs working fine on Intel HBAs.

Modified:
  stable/11/sys/dev/ahci/ahci.c
  stable/11/sys/dev/ahci/ahci.h
  stable/11/sys/dev/ahci/ahci_pci.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/ahci/ahci.c
==
--- stable/11/sys/dev/ahci/ahci.c   Tue May  2 06:16:35 2017
(r317672)
+++ stable/11/sys/dev/ahci/ahci.c   Tue May  2 06:27:46 2017
(r317673)
@@ -2684,7 +2684,9 @@ ahciaction(struct cam_sim *sim, union cc
if (ch->caps & AHCI_CAP_SPM)
cpi->hba_inquiry |= PI_SATAPM;
cpi->target_sprt = 0;
-   cpi->hba_misc = PIM_SEQSCAN | PIM_UNMAPPED | PIM_ATA_EXT;
+   cpi->hba_misc = PIM_SEQSCAN | PIM_UNMAPPED;
+   if ((ch->quirks & AHCI_Q_NOAUX) == 0)
+   cpi->hba_misc |= PIM_ATA_EXT;
cpi->hba_eng_cnt = 0;
if (ch->caps & AHCI_CAP_SPM)
cpi->max_target = 15;

Modified: stable/11/sys/dev/ahci/ahci.h
==
--- stable/11/sys/dev/ahci/ahci.h   Tue May  2 06:16:35 2017
(r317672)
+++ stable/11/sys/dev/ahci/ahci.h   Tue May  2 06:27:46 2017
(r317673)
@@ -599,6 +599,7 @@ enum ahci_err_type {
 #define AHCI_Q_RESTORE_CAP 0x0008
 #define AHCI_Q_NOMSIX  0x0010
 #define AHCI_Q_NOCCS   0x0040
+#define AHCI_Q_NOAUX   0x0080
 
 #define AHCI_Q_BIT_STRING  \
"\020"  \
@@ -623,7 +624,8 @@ enum ahci_err_type {
"\023FORCE_PI"  \
"\024RESTORE_CAP"   \
"\025NOMSIX"\
-   "\027NOCCS"
+   "\027NOCCS" \
+   "\030NOAUX"
 
 int ahci_attach(device_t dev);
 int ahci_detach(device_t dev);

Modified: stable/11/sys/dev/ahci/ahci_pci.c
==
--- stable/11/sys/dev/ahci/ahci_pci.c   Tue May  2 06:16:35 2017
(r317672)
+++ stable/11/sys/dev/ahci/ahci_pci.c   Tue May  2 06:27:46 2017
(r317673)
@@ -73,15 +73,15 @@ static const struct {
{0x78021022, 0x00, "AMD Hudson-2",  0},
{0x78031022, 0x00, "AMD Hudson-2",  0},
{0x78041022, 0x00, "AMD Hudson-2",  0},
-   {0x06011b21, 0x00, "ASMedia ASM1060",   AHCI_Q_NOCCS},
-   {0x06021b21, 0x00, "ASMedia ASM1060",   AHCI_Q_NOCCS},
-   {0x06111b21, 0x00, "ASMedia ASM1061",   AHCI_Q_NOCCS},
-   {0x06121b21, 0x00, "ASMedia ASM1062",   AHCI_Q_NOCCS},
-   {0x06201b21, 0x00, "ASMedia ASM106x",   AHCI_Q_NOCCS},
-   {0x06211b21, 0x00, "ASMedia ASM106x",   AHCI_Q_NOCCS},
-   {0x06221b21, 0x00, "ASMedia ASM106x",   AHCI_Q_NOCCS},
-   {0x06241b21, 0x00, "ASMedia ASM106x",   AHCI_Q_NOCCS},
-   {0x06251b21, 0x00, "ASMedia ASM106x",   AHCI_Q_NOCCS},
+   {0x06011b21, 0x00, "ASMedia ASM1060",   AHCI_Q_NOCCS|AHCI_Q_NOAUX},
+   {0x06021b21, 0x00, "ASMedia ASM1060",   AHCI_Q_NOCCS|AHCI_Q_NOAUX},
+   {0x06111b21, 0x00, "ASMedia ASM1061",   AHCI_Q_NOCCS|AHCI_Q_NOAUX},
+   {0x06121b21, 0x00, "ASMedia ASM1062",   AHCI_Q_NOCCS|AHCI_Q_NOAUX},
+   {0x06201b21, 0x00, "ASMedia ASM106x",   AHCI_Q_NOCCS|AHCI_Q_NOAUX},
+   {0x06211b21, 0x00, "ASMedia ASM106x",   AHCI_Q_NOCCS|AHCI_Q_NOAUX},
+   {0x06221b21, 0x00, "ASMedia ASM106x",   AHCI_Q_NOCCS|AHCI_Q_NOAUX},
+   {0x06241b21, 0x00, "ASMedia ASM106x",   AHCI_Q_NOCCS|AHCI_Q_NOAUX},
+   {0x06251b21, 0x00, "ASMedia ASM106x",   AHCI_Q_NOCCS|AHCI_Q_NOAUX},
{0x26528086, 0x00, "Intel ICH6",AHCI_Q_NOFORCE},
{0x26538086, 0x00, "Intel ICH6M",   AHCI_Q_NOFORCE},
{0x26818086, 0x00, "Intel ESB2",0},
___
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"