svn commit: r355746 - head/sys/vm

2019-12-13 Thread Ryan Libby
Author: rlibby
Date: Sat Dec 14 05:21:56 2019
New Revision: 355746
URL: https://svnweb.freebsd.org/changeset/base/355746

Log:
  uma dbg: flexible size for slab debug bitset too
  
  Recently (r355315) the size of the struct uma_slab bitset field us_free
  became dynamic instead of conservative.  Now, make the debug bitset
  size dynamic too.  The debug bitset is INVARIANTS-only, so in fact we
  don't care too much about the space savings that results from this, but
  enabling minimally-sized slabs on INVARIANTS builds is still important
  in order to be able to test new slab layouts effectively.
  
  Reviewed by:  jeff (previous version), markj (previous version)
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D22759

Modified:
  head/sys/vm/uma_core.c
  head/sys/vm/uma_int.h

Modified: head/sys/vm/uma_core.c
==
--- head/sys/vm/uma_core.c  Sat Dec 14 03:14:46 2019(r355745)
+++ head/sys/vm/uma_core.c  Sat Dec 14 05:21:56 2019(r355746)
@@ -293,6 +293,8 @@ static int sysctl_handle_uma_zone_flags(SYSCTL_HANDLER
 static int sysctl_handle_uma_slab_efficiency(SYSCTL_HANDLER_ARGS);
 
 #ifdef INVARIANTS
+static inline struct noslabbits *slab_dbg_bits(uma_slab_t slab, uma_keg_t keg);
+
 static bool uma_dbg_kskip(uma_keg_t keg, void *mem);
 static bool uma_dbg_zskip(uma_zone_t zone, void *mem);
 static void uma_dbg_free(uma_zone_t zone, uma_slab_t slab, void *item);
@@ -1204,7 +1206,7 @@ keg_alloc_slab(uma_keg_t keg, uma_zone_t zone, int dom
slab->us_domain = domain;
BIT_FILL(keg->uk_ipers, >us_free);
 #ifdef INVARIANTS
-   BIT_ZERO(SLAB_MAX_SETSIZE, >us_debugfree);
+   BIT_ZERO(keg->uk_ipers, slab_dbg_bits(slab, keg));
 #endif
 
if (keg->uk_init != NULL) {
@@ -1487,6 +1489,15 @@ zero_init(void *mem, int size, int flags)
return (0);
 }
 
+#ifdef INVARIANTS
+struct noslabbits *
+slab_dbg_bits(uma_slab_t slab, uma_keg_t keg)
+{
+
+   return ((void *)((char *)>us_free + BITSET_SIZE(keg->uk_ipers)));
+}
+#endif
+
 /*
  * Actual size of embedded struct slab (!OFFPAGE).
  */
@@ -1495,7 +1506,7 @@ slab_sizeof(int nitems)
 {
size_t s;
 
-   s = sizeof(struct uma_slab) + BITSET_SIZE(nitems);
+   s = sizeof(struct uma_slab) + BITSET_SIZE(nitems) * SLAB_BITSETS;
return (roundup(s, UMA_ALIGN_PTR + 1));
 }
 
@@ -4541,12 +4552,10 @@ uma_dbg_alloc(uma_zone_t zone, uma_slab_t slab, void *
keg = zone->uz_keg;
freei = slab_item_index(slab, keg, item);
 
-   if (BIT_ISSET(SLAB_MAX_SETSIZE, freei, >us_debugfree))
+   if (BIT_ISSET(keg->uk_ipers, freei, slab_dbg_bits(slab, keg)))
panic("Duplicate alloc of %p from zone %p(%s) slab %p(%d)\n",
item, zone, zone->uz_name, slab, freei);
-   BIT_SET_ATOMIC(SLAB_MAX_SETSIZE, freei, >us_debugfree);
-
-   return;
+   BIT_SET_ATOMIC(keg->uk_ipers, freei, slab_dbg_bits(slab, keg));
 }
 
 /*
@@ -4577,11 +4586,11 @@ uma_dbg_free(uma_zone_t zone, uma_slab_t slab, void *i
panic("Unaligned free of %p from zone %p(%s) slab %p(%d)\n",
item, zone, zone->uz_name, slab, freei);
 
-   if (!BIT_ISSET(SLAB_MAX_SETSIZE, freei, >us_debugfree))
+   if (!BIT_ISSET(keg->uk_ipers, freei, slab_dbg_bits(slab, keg)))
panic("Duplicate free of %p from zone %p(%s) slab %p(%d)\n",
item, zone, zone->uz_name, slab, freei);
 
-   BIT_CLR_ATOMIC(SLAB_MAX_SETSIZE, freei, >us_debugfree);
+   BIT_CLR_ATOMIC(keg->uk_ipers, freei, slab_dbg_bits(slab, keg));
 }
 #endif /* INVARIANTS */
 

Modified: head/sys/vm/uma_int.h
==
--- head/sys/vm/uma_int.h   Sat Dec 14 03:14:46 2019(r355745)
+++ head/sys/vm/uma_int.h   Sat Dec 14 05:21:56 2019(r355746)
@@ -254,6 +254,7 @@ struct uma_keg {
 };
 typedef struct uma_keg * uma_keg_t;
 
+#ifdef _KERNEL
 /*
  * Free bits per-slab.
  */
@@ -271,17 +272,26 @@ struct uma_slab {
uint16_tus_freecount;   /* How many are free? */
uint8_t us_flags;   /* Page flags see uma.h */
uint8_t us_domain;  /* Backing NUMA domain. */
-#ifdef INVARIANTS
-   struct slabbits us_debugfree;   /* Debug bitmask. */
-#endif
-   struct noslabbits us_free;  /* Free bitmask. */
+   struct noslabbits us_free;  /* Free bitmask, flexible. */
 };
+_Static_assert(sizeof(struct uma_slab) == offsetof(struct uma_slab, us_free),
+"us_free field must be last");
 #if MAXMEMDOM >= 255
 #error "Slab domain type insufficient"
 #endif
 
 typedef struct uma_slab * uma_slab_t;
 
+/*
+ * On INVARIANTS builds, the slab contains a second bitset of the same size,
+ * "dbg_bits", which is laid out immediately after us_free.
+ */
+#ifdef INVARIANTS
+#define 

svn commit: r355745 - stable/12/contrib/openresolv

2019-12-13 Thread Pedro F. Giffuni
Author: pfg
Date: Sat Dec 14 03:14:46 2019
New Revision: 355745
URL: https://svnweb.freebsd.org/changeset/base/355745

Log:
  MFC 354924:
  MFV 354917, 354918, 354919
  openresolv: update to version 3.9.2

Added:
  stable/12/contrib/openresolv/LICENSE
 - copied unchanged from r354924, head/contrib/openresolv/LICENSE
  stable/12/contrib/openresolv/README.md
 - copied unchanged from r354924, head/contrib/openresolv/README.md
Deleted:
  stable/12/contrib/openresolv/README
Modified:
  stable/12/contrib/openresolv/Makefile
  stable/12/contrib/openresolv/configure
  stable/12/contrib/openresolv/dnsmasq.in
  stable/12/contrib/openresolv/libc.in
  stable/12/contrib/openresolv/named.in
  stable/12/contrib/openresolv/pdns_recursor.in
  stable/12/contrib/openresolv/pdnsd.in
  stable/12/contrib/openresolv/resolvconf.conf
  stable/12/contrib/openresolv/resolvconf.conf.5.in
  stable/12/contrib/openresolv/resolvconf.in
  stable/12/contrib/openresolv/unbound.in

Copied: stable/12/contrib/openresolv/LICENSE (from r354924, 
head/contrib/openresolv/LICENSE)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ stable/12/contrib/openresolv/LICENSESat Dec 14 03:14:46 2019
(r355745, copy of r354924, head/contrib/openresolv/LICENSE)
@@ -0,0 +1,23 @@
+Copyright (c) 2007-2019 Roy Marples 
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+1. Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+   notice, this list of conditions and the following disclaimer in the
+   documentation and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGE.

Modified: stable/12/contrib/openresolv/Makefile
==
--- stable/12/contrib/openresolv/Makefile   Sat Dec 14 02:06:07 2019
(r355744)
+++ stable/12/contrib/openresolv/Makefile   Sat Dec 14 03:14:46 2019
(r355745)
@@ -10,6 +10,7 @@ SYSCONFDIR?=  /etc
 LIBEXECDIR?=   /libexec/resolvconf
 VARDIR?=   /var/run/resolvconf
 
+ECHO?= echo
 INSTALL?=  install
 SED?=  sed
 
@@ -20,7 +21,7 @@ DOCMODE?= 0644
 MANMODE?=  0444
 
 RESOLVCONF=resolvconf resolvconf.8 resolvconf.conf.5
-SUBSCRIBERS=   libc dnsmasq named pdnsd unbound
+SUBSCRIBERS=   libc dnsmasq named pdnsd pdns_recursor unbound
 TARGET=${RESOLVCONF} ${SUBSCRIBERS}
 SRCS=  ${TARGET:C,$,.in,} # pmake
 SRCS:= ${TARGET:=.in} # gmake
@@ -42,7 +43,7 @@ DISTINFOSIGN= ${DISTINFO}.asc
 CKSUM?=cksum -a SHA256
 PGP?=  netpgp
 
-FOSSILID?= current
+GITREF?=   HEAD
 
 .SUFFIXES: .in
 
@@ -79,15 +80,17 @@ maninstall:
 
 install: proginstall maninstall
 
-import:
+dist-git:
+   git archive --prefix=${DISTPREFIX}/ ${GITREF} | xz >${DISTFILE}
+
+dist-inst:
+   mkdir /tmp/${DISTPREFIX}
+   cp -RPp * /tmp/${DISTPREFIX}
+   (cd /tmp/${DISTPREFIX}; make clean)
+   tar -cvjpf ${DISTFILE} -C /tmp ${DISTPREFIX}
rm -rf /tmp/${DISTPREFIX}
-   ${INSTALL} -d /tmp/${DISTPREFIX}
-   cp README ${SRCS} /tmp/${DISTPREFIX}
 
-dist:
-   fossil tarball --name ${DISTPREFIX} ${FOSSILID} ${DISTFILEGZ}
-   gunzip -c ${DISTFILEGZ} | xz >${DISTFILE}
-   rm ${DISTFILEGZ}
+dist: dist-git
 
 distinfo: dist
rm -f ${DISTINFO} ${DISTINFOSIGN}
@@ -96,3 +99,20 @@ distinfo: dist
${PGP} --clearsign --output=${DISTINFOSIGN} ${DISTINFO}
chmod 644 ${DISTINFOSIGN}
ls -l ${DISTFILE} ${DISTINFO} ${DISTINFOSIGN}
+
+import: dist
+   rm -rf /tmp/${DISTPREFIX}
+   ${INSTALL} -d /tmp/${DISTPREFIX}
+   tar xvJpf ${DISTFILE} -C /tmp
+
+_import-src:
+   rm -rf ${DESTDIR}/*
+   ${INSTALL} -d ${DESTDIR}
+   cp LICENSE README.md ${SRCS} resolvconf.conf ${DESTDIR};
+   cp resolvconf.8.in resolvconf.conf.5.in ${DESTDIR};
+   @${ECHO}
+   @${ECHO} 

svn commit: r355744 - head/sys/netpfil/pf

2019-12-13 Thread Kristof Provost
Author: kp
Date: Sat Dec 14 02:06:07 2019
New Revision: 355744
URL: https://svnweb.freebsd.org/changeset/base/355744

Log:
  pf: Make request_maxcount runtime adjustable
  
  There's no reason for this to be a tunable. It's perfectly safe to
  change this at runtime.
  
  Reviewed by:  Lutz Donnerhacke
  Differential Revision:https://reviews.freebsd.org/D22737

Modified:
  head/sys/netpfil/pf/pf.c

Modified: head/sys/netpfil/pf/pf.c
==
--- head/sys/netpfil/pf/pf.cSat Dec 14 02:03:47 2019(r355743)
+++ head/sys/netpfil/pf/pf.cSat Dec 14 02:06:07 2019(r355744)
@@ -381,7 +381,7 @@ SYSCTL_ULONG(_net_pf, OID_AUTO, states_hashsize, CTLFL
 _hashsize, 0, "Size of pf(4) states hashtable");
 SYSCTL_ULONG(_net_pf, OID_AUTO, source_nodes_hashsize, CTLFLAG_RDTUN,
 _srchashsize, 0, "Size of pf(4) source nodes hashtable");
-SYSCTL_ULONG(_net_pf, OID_AUTO, request_maxcount, CTLFLAG_RDTUN,
+SYSCTL_ULONG(_net_pf, OID_AUTO, request_maxcount, CTLFLAG_RW,
 _ioctl_maxcount, 0, "Maximum number of tables, addresses, ... in a 
single ioctl() call");
 
 VNET_DEFINE(void *, pf_swi_cookie);
___
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: r355743 - head/sbin/pfctl

2019-12-13 Thread Kristof Provost
Author: kp
Date: Sat Dec 14 02:03:47 2019
New Revision: 355743
URL: https://svnweb.freebsd.org/changeset/base/355743

Log:
  pfctl: Warn users when they run into kernel limits
  
  Warn users when they try to add/delete/modify more items than the kernel will
  allow.
  
  Reviewed by:  allanjude (previous version), Lutz Donnerhacke
  Differential Revision:https://reviews.freebsd.org/D22733

Modified:
  head/sbin/pfctl/pfctl_radix.c

Modified: head/sbin/pfctl/pfctl_radix.c
==
--- head/sbin/pfctl/pfctl_radix.c   Sat Dec 14 00:43:17 2019
(r355742)
+++ head/sbin/pfctl/pfctl_radix.c   Sat Dec 14 02:03:47 2019
(r355743)
@@ -58,7 +58,24 @@ extern int dev;
 
 static int  pfr_next_token(char buf[], FILE *);
 
+static void
+pfr_report_error(struct pfr_table *tbl, struct pfioc_table *io,
+const char *err)
+{
+   unsigned long maxcount;
+   size_t s;
 
+   s = sizeof(maxcount);
+   if (sysctlbyname("net.pf.request_maxcount", , , NULL,
+   0) == -1)
+   return;
+
+   if (io->pfrio_size > maxcount || io->pfrio_size2 > maxcount)
+   fprintf(stderr, "cannot %s %s: too many elements.\n"
+   "Consider increasing net.pf.request_maxcount.",
+   err, tbl->pfrt_name);
+}
+
 int
 pfr_clr_tables(struct pfr_table *filter, int *ndel, int flags)
 {
@@ -89,8 +106,10 @@ pfr_add_tables(struct pfr_table *tbl, int size, int *n
io.pfrio_buffer = tbl;
io.pfrio_esize = sizeof(*tbl);
io.pfrio_size = size;
-   if (ioctl(dev, DIOCRADDTABLES, ))
+   if (ioctl(dev, DIOCRADDTABLES, )) {
+   pfr_report_error(tbl, , "add table");
return (-1);
+   }
if (nadd != NULL)
*nadd = io.pfrio_nadd;
return (0);
@@ -110,8 +129,10 @@ pfr_del_tables(struct pfr_table *tbl, int size, int *n
io.pfrio_buffer = tbl;
io.pfrio_esize = sizeof(*tbl);
io.pfrio_size = size;
-   if (ioctl(dev, DIOCRDELTABLES, ))
+   if (ioctl(dev, DIOCRDELTABLES, )) {
+   pfr_report_error(tbl, , "delete table");
return (-1);
+   }
if (ndel != NULL)
*ndel = io.pfrio_ndel;
return (0);
@@ -134,8 +155,10 @@ pfr_get_tables(struct pfr_table *filter, struct pfr_ta
io.pfrio_buffer = tbl;
io.pfrio_esize = sizeof(*tbl);
io.pfrio_size = *size;
-   if (ioctl(dev, DIOCRGETTABLES, ))
+   if (ioctl(dev, DIOCRGETTABLES, )) {
+   pfr_report_error(tbl, , "get table");
return (-1);
+   }
*size = io.pfrio_size;
return (0);
 }
@@ -157,8 +180,10 @@ pfr_get_tstats(struct pfr_table *filter, struct pfr_ts
io.pfrio_buffer = tbl;
io.pfrio_esize = sizeof(*tbl);
io.pfrio_size = *size;
-   if (ioctl(dev, DIOCRGETTSTATS, ))
+   if (ioctl(dev, DIOCRGETTSTATS, )) {
+   pfr_report_error(filter, , "get tstats for");
return (-1);
+   }
*size = io.pfrio_size;
return (0);
 }
@@ -198,8 +223,10 @@ pfr_add_addrs(struct pfr_table *tbl, struct pfr_addr *
io.pfrio_buffer = addr;
io.pfrio_esize = sizeof(*addr);
io.pfrio_size = size;
-   if (ioctl(dev, DIOCRADDADDRS, ))
+   if (ioctl(dev, DIOCRADDADDRS, )) {
+   pfr_report_error(tbl, , "add addresses in");
return (-1);
+   }
if (nadd != NULL)
*nadd = io.pfrio_nadd;
return (0);
@@ -221,8 +248,10 @@ pfr_del_addrs(struct pfr_table *tbl, struct pfr_addr *
io.pfrio_buffer = addr;
io.pfrio_esize = sizeof(*addr);
io.pfrio_size = size;
-   if (ioctl(dev, DIOCRDELADDRS, ))
+   if (ioctl(dev, DIOCRDELADDRS, )) {
+   pfr_report_error(tbl, , "delete addresses in");
return (-1);
+   }
if (ndel != NULL)
*ndel = io.pfrio_ndel;
return (0);
@@ -245,8 +274,10 @@ pfr_set_addrs(struct pfr_table *tbl, struct pfr_addr *
io.pfrio_esize = sizeof(*addr);
io.pfrio_size = size;
io.pfrio_size2 = (size2 != NULL) ? *size2 : 0;
-   if (ioctl(dev, DIOCRSETADDRS, ))
+   if (ioctl(dev, DIOCRSETADDRS, )) {
+   pfr_report_error(tbl, , "set addresses in");
return (-1);
+   }
if (nadd != NULL)
*nadd = io.pfrio_nadd;
if (ndel != NULL)
@@ -275,8 +306,10 @@ pfr_get_addrs(struct pfr_table *tbl, struct pfr_addr *
io.pfrio_buffer = addr;
io.pfrio_esize = sizeof(*addr);
io.pfrio_size = *size;
-   if (ioctl(dev, DIOCRGETADDRS, ))
+   if (ioctl(dev, DIOCRGETADDRS, )) {
+   pfr_report_error(tbl, , "get addresses from");
return (-1);
+   }
*size = io.pfrio_size;
return (0);
 }
@@ -298,8 +331,10 @@ pfr_get_astats(struct pfr_table 

svn commit: r355742 - in head/sys: kern sys

2019-12-13 Thread Mateusz Guzik
Author: mjg
Date: Sat Dec 14 00:43:17 2019
New Revision: 355742
URL: https://svnweb.freebsd.org/changeset/base/355742

Log:
  Remove the useless return value from proc_set_cred

Modified:
  head/sys/kern/kern_prot.c
  head/sys/sys/ucred.h

Modified: head/sys/kern/kern_prot.c
==
--- head/sys/kern/kern_prot.c   Fri Dec 13 23:46:59 2019(r355741)
+++ head/sys/kern/kern_prot.c   Sat Dec 14 00:43:17 2019(r355742)
@@ -1995,10 +1995,9 @@ proc_set_cred_init(struct proc *p, struct ucred *newcr
  * only used when the process is about to be freed, at which point it should
  * not be visible anymore).
  */
-struct ucred *
+void
 proc_set_cred(struct proc *p, struct ucred *newcred)
 {
-   struct ucred *oldcred;
 
MPASS(p->p_ucred != NULL);
if (newcred == NULL)
@@ -2006,11 +2005,9 @@ proc_set_cred(struct proc *p, struct ucred *newcred)
else
PROC_LOCK_ASSERT(p, MA_OWNED);
 
-   oldcred = p->p_ucred;
p->p_ucred = newcred;
if (newcred != NULL)
PROC_UPDATE_COW(p);
-   return (oldcred);
 }
 
 struct ucred *

Modified: head/sys/sys/ucred.h
==
--- head/sys/sys/ucred.hFri Dec 13 23:46:59 2019(r355741)
+++ head/sys/sys/ucred.hSat Dec 14 00:43:17 2019(r355742)
@@ -112,7 +112,7 @@ struct ucred*crcopysafe(struct proc *p, struct 
ucred 
 struct ucred   *crdup(struct ucred *cr);
 void   crextend(struct ucred *cr, int n);
 void   proc_set_cred_init(struct proc *p, struct ucred *cr);
-struct ucred   *proc_set_cred(struct proc *p, struct ucred *cr);
+void   proc_set_cred(struct proc *p, struct ucred *cr);
 void   crfree(struct ucred *cr);
 struct ucred   *crget(void);
 struct ucred   *crhold(struct ucred *cr);
___
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: r355741 - in head: sys/dev/pci usr.sbin/pciconf

2019-12-13 Thread Scott Long
Author: scottl
Date: Fri Dec 13 23:46:59 2019
New Revision: 355741
URL: https://svnweb.freebsd.org/changeset/base/355741

Log:
  Add accessors for the Vendor Specific Extended Capability (VSEC)
  Parse out the VSEC.  If the user invokes a second -c command line option,
  do a hex dump of the vendor data.
  
  Reviewed by:  imp
  MFC after:3 days
  Sponsored by: Intel
  Differential Revision:http://reviews.freebsd.org/D22808

Modified:
  head/sys/dev/pci/pcireg.h
  head/usr.sbin/pciconf/cap.c
  head/usr.sbin/pciconf/pciconf.8
  head/usr.sbin/pciconf/pciconf.c
  head/usr.sbin/pciconf/pciconf.h

Modified: head/sys/dev/pci/pcireg.h
==
--- head/sys/dev/pci/pcireg.h   Fri Dec 13 23:33:54 2019(r355740)
+++ head/sys/dev/pci/pcireg.h   Fri Dec 13 23:46:59 2019(r355741)
@@ -1049,6 +1049,13 @@
 #definePCIR_SRIOV_BARS 0x24
 #definePCIR_SRIOV_BAR(x)   (PCIR_SRIOV_BARS + (x) * 4)
 
+/* Extended Capability Vendor-Specific definitions */
+#define PCIR_VSEC_HEADER   0x04
+#define PCIR_VSEC_ID(hdr)  ((hdr) & 0x)
+#define PCIR_VSEC_REV(hdr) (((hdr) & 0xf) >> 16)
+#define PCIR_VSEC_LENGTH(hdr)  (((hdr) & 0xfff0) >> 20)
+#define PCIR_VSEC_DATA 0x08
+
 /*
  * PCI Express Firmware Interface definitions
  */

Modified: head/usr.sbin/pciconf/cap.c
==
--- head/usr.sbin/pciconf/cap.c Fri Dec 13 23:33:54 2019(r355740)
+++ head/usr.sbin/pciconf/cap.c Fri Dec 13 23:46:59 2019(r355741)
@@ -50,6 +50,8 @@ static const char rcsid[] =
 
 static voidlist_ecaps(int fd, struct pci_conf *p);
 
+static int cap_level;
+
 static void
 cap_power(int fd, struct pci_conf *p, uint8_t ptr)
 {
@@ -729,7 +731,7 @@ cap_ea(int fd, struct pci_conf *p, uint8_t ptr)
 }
 
 void
-list_caps(int fd, struct pci_conf *p)
+list_caps(int fd, struct pci_conf *p, int level)
 {
int express;
uint16_t sta;
@@ -740,6 +742,8 @@ list_caps(int fd, struct pci_conf *p)
if (!(sta & PCIM_STATUS_CAPPRESENT))
return;
 
+   cap_level = level;
+
switch (p->pc_hdr & PCIM_HDRTYPE) {
case PCIM_HDRTYPE_NORMAL:
case PCIM_HDRTYPE_BRIDGE:
@@ -875,13 +879,33 @@ ecap_sernum(int fd, struct pci_conf *p, uint16_t ptr, 
 static void
 ecap_vendor(int fd, struct pci_conf *p, uint16_t ptr, uint8_t ver)
 {
-   uint32_t val;
+   uint32_t val, hdr;
+   uint16_t nextptr, len;
+   int i;
 
-   printf("Vendor %d", ver);
-   if (ver < 1)
+   val = read_config(fd, >pc_sel, ptr, 4);
+   nextptr = PCI_EXTCAP_NEXTPTR(val);
+   hdr = read_config(fd, >pc_sel, ptr + PCIR_VSEC_HEADER, 4);
+   len = PCIR_VSEC_LENGTH(hdr);
+   if (len == 0) {
+   if (nextptr == 0)
+   nextptr = 0x1000;
+   len = nextptr - ptr;
+   }
+
+   printf("Vendor [%d] ID %04x Rev %d Length %d\n", ver,
+   PCIR_VSEC_ID(hdr), PCIR_VSEC_REV(hdr), len);
+   if ((ver < 1) || (cap_level <= 1))
return;
-   val = read_config(fd, >pc_sel, ptr + 4, 4);
-   printf(" ID %d\n", val & 0x);
+   for (i = 0; i < len; i += 4) {
+   val = read_config(fd, >pc_sel, ptr + PCIR_VSEC_DATA + i, 4);
+   if ((i % 16) == 0)
+   printf(" ");
+   printf("%02x %02x %02x %02x ", val & 0xff, (val >> 8) & 0xff,
+   (val >> 16) & 0xff, (val >> 24) & 0xff);
+   if i + 4) % 16) == 0 ) || ((i + 4) >= len))
+   printf("\n");
+   }
 }
 
 static void

Modified: head/usr.sbin/pciconf/pciconf.8
==
--- head/usr.sbin/pciconf/pciconf.8 Fri Dec 13 23:33:54 2019
(r355740)
+++ head/usr.sbin/pciconf/pciconf.8 Fri Dec 13 23:46:59 2019
(r355741)
@@ -177,6 +177,9 @@ If the
 option is supplied,
 .Nm
 will list any capabilities supported by each device.
+A second invocation of
+.Fl c
+will print additional data for certain capabilities.
 Each capability is enumerated via a line in the following format:
 .Bd -literal
 cap 10[40] = PCI-Express 1 root port

Modified: head/usr.sbin/pciconf/pciconf.c
==
--- head/usr.sbin/pciconf/pciconf.c Fri Dec 13 23:33:54 2019
(r355740)
+++ head/usr.sbin/pciconf/pciconf.c Fri Dec 13 23:46:59 2019
(r355741)
@@ -131,7 +131,7 @@ main(int argc, char **argv)
break;
 
case 'c':
-   caps = 1;
+   caps++;
break;
 
case 'D':
@@ -282,7 +282,7 @@ list_devs(const char *name, int verbose, int bars, int
if (bridge)

svn commit: r355740 - head/sys/dev/cxgbe/tom

2019-12-13 Thread John Baldwin
Author: jhb
Date: Fri Dec 13 23:33:54 2019
New Revision: 355740
URL: https://svnweb.freebsd.org/changeset/base/355740

Log:
  Expand net epoch in the cxgbe TOE driver to satisfy assertions.
  
  Reviewed by:  np
  Sponsored by: Chelsio Communications
  Differential Revision:https://reviews.freebsd.org/D22483

Modified:
  head/sys/dev/cxgbe/tom/t4_connect.c
  head/sys/dev/cxgbe/tom/t4_listen.c

Modified: head/sys/dev/cxgbe/tom/t4_connect.c
==
--- head/sys/dev/cxgbe/tom/t4_connect.c Fri Dec 13 23:28:52 2019
(r355739)
+++ head/sys/dev/cxgbe/tom/t4_connect.c Fri Dec 13 23:33:54 2019
(r355740)
@@ -237,6 +237,7 @@ t4_connect(struct toedev *tod, struct socket *so, stru
struct tcpcb *tp = intotcpcb(inp);
int reason;
struct offload_settings settings;
+   struct epoch_tracker et;
uint16_t vid = 0xfff, pcp = 0;
 
INP_WLOCK_ASSERT(inp);
@@ -371,7 +372,9 @@ t4_connect(struct toedev *tod, struct socket *so, stru
}
 
offload_socket(so, toep);
+   NET_EPOCH_ENTER(et);
rc = t4_l2t_send(sc, wr, toep->l2te);
+   NET_EPOCH_EXIT(et);
if (rc == 0) {
toep->flags |= TPF_CPL_PENDING;
return (0);

Modified: head/sys/dev/cxgbe/tom/t4_listen.c
==
--- head/sys/dev/cxgbe/tom/t4_listen.c  Fri Dec 13 23:28:52 2019
(r355739)
+++ head/sys/dev/cxgbe/tom/t4_listen.c  Fri Dec 13 23:33:54 2019
(r355740)
@@ -1235,8 +1235,11 @@ found:
 * SYN must be directed to an IP6 address on this ifnet.  This
 * is more restrictive than in6_localip.
 */
-   if (!in6_ifhasaddr(ifp, _laddr))
+   NET_EPOCH_ENTER(et);
+   if (!in6_ifhasaddr(ifp, _laddr)) {
+   NET_EPOCH_EXIT(et);
REJECT_PASS_ACCEPT_REQ(true);
+   }
 
ntids = 2;
} else {
@@ -1249,23 +1252,26 @@ found:
 * SYN must be directed to an IP address on this ifnet.  This
 * is more restrictive than in_localip.
 */
-   if (!in_ifhasaddr(ifp, inc.inc_laddr))
+   NET_EPOCH_ENTER(et);
+   if (!in_ifhasaddr(ifp, inc.inc_laddr)) {
+   NET_EPOCH_EXIT(et);
REJECT_PASS_ACCEPT_REQ(true);
+   }
 
ntids = 1;
}
 
e = get_l2te_for_nexthop(pi, ifp, );
-   if (e == NULL)
+   if (e == NULL) {
+   NET_EPOCH_EXIT(et);
REJECT_PASS_ACCEPT_REQ(true);
+   }
 
/* Don't offload if the 4-tuple is already in use */
-   NET_EPOCH_ENTER(et);/* for 4-tuple check */
if (toe_4tuple_check(, , ifp) != 0) {
NET_EPOCH_EXIT(et);
REJECT_PASS_ACCEPT_REQ(false);
}
-   NET_EPOCH_EXIT(et);
 
inp = lctx->inp;/* listening socket, not owned by TOE */
INP_WLOCK(inp);
@@ -1273,6 +1279,7 @@ found:
/* Don't offload if the listening socket has closed */
if (__predict_false(inp->inp_flags & INP_DROPPED)) {
INP_WUNLOCK(inp);
+   NET_EPOCH_EXIT(et);
REJECT_PASS_ACCEPT_REQ(false);
}
so = inp->inp_socket;
@@ -1282,12 +1289,14 @@ found:
rw_runlock(>policy_lock);
if (!settings.offload) {
INP_WUNLOCK(inp);
+   NET_EPOCH_EXIT(et);
REJECT_PASS_ACCEPT_REQ(true);   /* Rejected by COP. */
}
 
synqe = alloc_synqe(sc, lctx, M_NOWAIT);
if (synqe == NULL) {
INP_WUNLOCK(inp);
+   NET_EPOCH_EXIT(et);
REJECT_PASS_ACCEPT_REQ(true);
}
atomic_store_int(>ok_to_respond, 0);
@@ -1318,15 +1327,19 @@ found:
remove_tid(sc, tid, ntids);
m = synqe->syn;
synqe->syn = NULL;
+   NET_EPOCH_EXIT(et);
REJECT_PASS_ACCEPT_REQ(true);
}
 
CTR6(KTR_CXGBE,
"%s: stid %u, tid %u, synqe %p, opt0 %#016lx, opt2 %#08x",
__func__, stid, tid, synqe, be64toh(opt0), be32toh(opt2));
-   } else
+   } else {
+   NET_EPOCH_EXIT(et);
REJECT_PASS_ACCEPT_REQ(false);
+   }
 
+   NET_EPOCH_EXIT(et);
CURVNET_RESTORE();
return (0);
 reject:
___
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: r355739 - in head/sys/contrib/dev/acpica: . common compiler components/debugger components/dispatcher components/executer components/hardware include include/platform

2019-12-13 Thread Jung-uk Kim
Author: jkim
Date: Fri Dec 13 23:28:52 2019
New Revision: 355739
URL: https://svnweb.freebsd.org/changeset/base/355739

Log:
  MFV:  r355716
  
  Merge ACPICA 20191213.

Modified:
  head/sys/contrib/dev/acpica/changes.txt
  head/sys/contrib/dev/acpica/common/dmtables.c
  head/sys/contrib/dev/acpica/compiler/aslcompile.c
  head/sys/contrib/dev/acpica/compiler/asldefine.h
  head/sys/contrib/dev/acpica/compiler/aslerror.c
  head/sys/contrib/dev/acpica/compiler/aslfiles.c
  head/sys/contrib/dev/acpica/compiler/aslload.c
  head/sys/contrib/dev/acpica/compiler/aslmessages.c
  head/sys/contrib/dev/acpica/compiler/aslmessages.h
  head/sys/contrib/dev/acpica/compiler/aslmethod.c
  head/sys/contrib/dev/acpica/compiler/asloptions.c
  head/sys/contrib/dev/acpica/compiler/aslstartup.c
  head/sys/contrib/dev/acpica/compiler/asltransform.c
  head/sys/contrib/dev/acpica/compiler/aslutils.c
  head/sys/contrib/dev/acpica/compiler/aslxref.c
  head/sys/contrib/dev/acpica/compiler/dtcompile.c
  head/sys/contrib/dev/acpica/compiler/dtcompiler.h
  head/sys/contrib/dev/acpica/compiler/dttable2.c
  head/sys/contrib/dev/acpica/components/debugger/dbinput.c
  head/sys/contrib/dev/acpica/components/debugger/dbnames.c
  head/sys/contrib/dev/acpica/components/dispatcher/dsfield.c
  head/sys/contrib/dev/acpica/components/dispatcher/dsopcode.c
  head/sys/contrib/dev/acpica/components/dispatcher/dswload.c
  head/sys/contrib/dev/acpica/components/executer/exfield.c
  head/sys/contrib/dev/acpica/components/hardware/hwxfsleep.c
  head/sys/contrib/dev/acpica/include/acobject.h
  head/sys/contrib/dev/acpica/include/acpixf.h
  head/sys/contrib/dev/acpica/include/platform/acenv.h
Directory Properties:
  head/sys/contrib/dev/acpica/   (props changed)

Modified: head/sys/contrib/dev/acpica/changes.txt
==
--- head/sys/contrib/dev/acpica/changes.txt Fri Dec 13 23:22:49 2019
(r355738)
+++ head/sys/contrib/dev/acpica/changes.txt Fri Dec 13 23:28:52 2019
(r355739)
@@ -1,4 +1,25 @@
 
+13 December 2019. Summary of changes for version 20191213:
+
+
+1) ACPICA kernel-resident subsystem:
+
+Return a Buffer object for all fields created via the CreateField operator. 
Previously, an Integer would be returned if the size of the field was less than 
or equal to the current size of an Integer. Although this goes against the ACPI 
specification, it provides compatibility with other ACPI implementations. Also 
updated the ASLTS test suite to reflect this new behavior.
+
+2) iASL Compiler/Disassembler and ACPICA tools:
+
+iASL: Implemented detection of (and throw an error for) duplicate values for 
Case statements within a single Switch statement. Duplicate Integers, Strings, 
and Buffers are supported.
+
+iASL: Fix error logging issue during multiple file compilation -- Switch to 
the correct input file during error node creation.
+
+iASL: For duplicate named object creation, now emit an error instead of a 
warning - since this will cause a runtime error.
+
+AcpiSrc: Add unix line-ending support for non-Windows builds.
+
+iASL: Add an error condition for an attempt to create a NameString with > 255 
NameSegs (the max allowable via the AML definition).
+
+
+
 18 October 2019. Summary of changes for version 20191018:
 
 

Modified: head/sys/contrib/dev/acpica/common/dmtables.c
==
--- head/sys/contrib/dev/acpica/common/dmtables.c   Fri Dec 13 23:22:49 
2019(r355738)
+++ head/sys/contrib/dev/acpica/common/dmtables.c   Fri Dec 13 23:28:52 
2019(r355739)
@@ -508,6 +508,8 @@ AdParseTable (
 AmlStart = ((UINT8 *) Table + sizeof (ACPI_TABLE_HEADER));
 ASL_CV_INIT_FILETREE(Table, AmlStart, AmlLength);
 
+AcpiUtSetIntegerWidth (Table->Revision);
+
 /* Create the root object */
 
 AcpiGbl_ParseOpRoot = AcpiPsCreateScopeOp (AmlStart);
@@ -543,7 +545,6 @@ AdParseTable (
 }
 
 WalkState->ParseFlags &= ~ACPI_PARSE_DELETE_TREE;
-WalkState->ParseFlags |= ACPI_PARSE_DISASSEMBLE;
 
 Status = AcpiPsParseAml (WalkState);
 if (ACPI_FAILURE (Status))

Modified: head/sys/contrib/dev/acpica/compiler/aslcompile.c
==
--- head/sys/contrib/dev/acpica/compiler/aslcompile.c   Fri Dec 13 23:22:49 
2019(r355738)
+++ head/sys/contrib/dev/acpica/compiler/aslcompile.c   Fri Dec 13 23:28:52 
2019(r355739)
@@ -220,6 +220,7 @@ CmDoCompile (
 PrDoPreprocess ();
 AslGbl_CurrentLineNumber = 1;
 AslGbl_LogicalLineNumber = 1;
+AslGbl_CurrentLineOffset = 0;
 
 if (AslGbl_PreprocessOnly)
 {
@@ -282,25 +283,6 @@ CmDoCompile (
 
 LsDumpParseTree ();
 
-OpcGetIntegerWidth (AslGbl_ParseTreeRoot->Asl.Child);
-UtEndEvent (Event);
-

svn commit: r355738 - head/sys/modules/i2c/ads111x

2019-12-13 Thread Ian Lepore
Author: ian
Date: Fri Dec 13 23:22:49 2019
New Revision: 355738
URL: https://svnweb.freebsd.org/changeset/base/355738

Log:
  Include ofw_bus_if.h in SRCS only on systems configured with the FDT option.

Modified:
  head/sys/modules/i2c/ads111x/Makefile

Modified: head/sys/modules/i2c/ads111x/Makefile
==
--- head/sys/modules/i2c/ads111x/Makefile   Fri Dec 13 22:32:05 2019
(r355737)
+++ head/sys/modules/i2c/ads111x/Makefile   Fri Dec 13 23:22:49 2019
(r355738)
@@ -9,7 +9,10 @@ SRCS+= \
bus_if.h \
device_if.h \
iicbus_if.h \
-   ofw_bus_if.h \
opt_platform.h \
+
+.if !empty(OPT_FDT)
+SRCS+= ofw_bus_if.h
+.endif
 
 .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: r355737 - head/share/man/man9

2019-12-13 Thread Warner Losh
Author: imp
Date: Fri Dec 13 22:32:05 2019
New Revision: 355737
URL: https://svnweb.freebsd.org/changeset/base/355737

Log:
  Better copyright advice
  
  Document the common practices around copyrights with "all rights reserved" in
  them as new copyright notices get added.
  
  It's an open question qhether to point people at the fact that since the Berne
  convention was ratified, All rights reserved is largely obsolete.
  https://en.wikipedia.org/wiki/All_rights_reserved#Obsolescence has the
  details. The committer's guide will be revised shortly, and it's likely 
that's a
  better place for this discussion. If not, I'll add a blurb here.
  
  Reviewed by: jhb@, brooks@
  Differential Review: https://reviews.freebsd.org/D22800

Modified:
  head/share/man/man9/style.9

Modified: head/share/man/man9/style.9
==
--- head/share/man/man9/style.9 Fri Dec 13 22:04:13 2019(r355736)
+++ head/share/man/man9/style.9 Fri Dec 13 22:32:05 2019(r355737)
@@ -1,6 +1,5 @@
 .\"-
-.\" Copyright (c) 1995-2005 The FreeBSD Project
-.\" All rights reserved.
+.\" Copyright (c) 1995-2019 The FreeBSD Project
 .\"
 .\" Redistribution and use in source and binary forms, with or without
 .\" modification, are permitted provided that the following conditions
@@ -26,7 +25,7 @@
 .\"From: @(#)style 1.14 (Berkeley) 4/28/95
 .\" $FreeBSD$
 .\"
-.Dd June 3, 2019
+.Dd December 13, 2019
 .Dt STYLE 9
 .Os
 .Sh NAME
@@ -84,8 +83,32 @@ comments.
 Comments starting in columns other than the first are never
 considered license statements.
 Use the appropriate SPDX-License-Identifier line before the copyright.
+If the copyright assertion contains the phrase
+.Dq Li "All Rights Reserved"
+that should be on the same line as the word
+.Dq Li "Copyright" .
+You should not insert a new copyright line between an old
+copyright line and this phrase.
+Instead, you should insert a new copyright phrase after
+a pre-existing
+.Dq Li "All Rights Reserved"
+line.
+When making changes, it is acceptable to fold an
+.Dq Li "All Rights Reserved"
+line with each of the
+.Dq Li "Copyright"
+lines.
+For files that have the
+.Dq Li "All Rights Reserved"
+line on the same line(s) as the word
+.Dq Li "Copyright" ,
+new copyright assertions should be added last.
+New
+.Dq Li "Copyright"
+lines should only be added when making substantial changes to the file,
+not for trivial changes.
 .Pp
-After any copyright header, there is a blank line, and the
+After any copyright and license comment, there is a blank line, and the
 .Li $\$
 for non C/C++ language source files.
 Version control system ID tags should only exist once in a file
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r355736 - head/stand/libsa/zfs

2019-12-13 Thread Andriy Gapon
Author: avg
Date: Fri Dec 13 22:04:13 2019
New Revision: 355736
URL: https://svnweb.freebsd.org/changeset/base/355736

Log:
  zfs boot: fix a crash in a rarely taken path in fzap_lookup
  
  Instead of passing NULL to fzap_name_equal and crashing, just return
  ENOENT.  This happened when higher bits of a hash of the searched key
  (its hash prefix) matched a hash prefix of some key in the ZAP, but the
  full hash value of the searched key did not match any key in the ZAP.
  
  I observerved this problem when loader tried to look up
  "features_for_read" in a particular old pool that predates pool
  features.
  
  MFC after:2 weeks
  Sponsored by: Panzura

Modified:
  head/stand/libsa/zfs/zfsimpl.c

Modified: head/stand/libsa/zfs/zfsimpl.c
==
--- head/stand/libsa/zfs/zfsimpl.c  Fri Dec 13 21:39:20 2019
(r355735)
+++ head/stand/libsa/zfs/zfsimpl.c  Fri Dec 13 22:04:13 2019
(r355736)
@@ -2282,10 +2282,8 @@ fzap_lookup(const spa_t *spa, const dnode_phys_t *dnod
return (ENOENT);
zc = _LEAF_CHUNK(, h);
while (zc->l_entry.le_hash != hash) {
-   if (zc->l_entry.le_next == 0x) {
-   zc = NULL;
-   break;
-   }
+   if (zc->l_entry.le_next == 0x)
+   return (ENOENT);
zc = _LEAF_CHUNK(, zc->l_entry.le_next);
}
if (fzap_name_equal(, zc, 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"


Re: svn commit: r355735 - in head/sys: arm/broadcom/bcm2835 arm/mv dev/ow

2019-12-13 Thread Ravi Pokala
Thanks!

-Ravi (rpokala@)

-Original Message-
From:  on behalf of Warner Losh 

Date: 2019-12-13, Friday at 13:39
To: , , 

Subject: svn commit: r355735 - in head/sys: arm/broadcom/bcm2835 arm/mv dev/ow

Author: imp
Date: Fri Dec 13 21:39:20 2019
New Revision: 355735
URL: https://svnweb.freebsd.org/changeset/base/355735

Log:
  Be consistent about checking return value from 
bus_delayed_attach_children.
  
  Most places checked, but a couple last minute changes didn't. Make them 
all use
  the return value.
  
  Noticed by: rpokala@

Modified:
  head/sys/arm/broadcom/bcm2835/bcm2835_bsc.c
  head/sys/arm/mv/a37x0_spi.c
  head/sys/dev/ow/owc_gpiobus.c

Modified: head/sys/arm/broadcom/bcm2835/bcm2835_bsc.c

==
--- head/sys/arm/broadcom/bcm2835/bcm2835_bsc.c Fri Dec 13 21:39:10 
2019(r355734)
+++ head/sys/arm/broadcom/bcm2835/bcm2835_bsc.c Fri Dec 13 21:39:20 
2019(r355735)
@@ -347,9 +347,7 @@ bcm_bsc_attach(device_t dev)
}
 
/* Probe and attach the iicbus when interrupts are available. */
-   bus_delayed_attach_children(dev);
-
-   return (0);
+   return (bus_delayed_attach_children(dev));
 }
 
 static int

Modified: head/sys/arm/mv/a37x0_spi.c

==
--- head/sys/arm/mv/a37x0_spi.c Fri Dec 13 21:39:10 2019
(r355734)
+++ head/sys/arm/mv/a37x0_spi.c Fri Dec 13 21:39:20 2019
(r355735)
@@ -220,9 +220,7 @@ a37x0_spi_attach(device_t dev)
device_add_child(dev, "spibus", -1);
 
/* Probe and attach the spibus when interrupts are available. */
-   bus_delayed_attach_children(dev);
-
-   return (0);
+   return (bus_delayed_attach_children(dev));
 }
 
 static int

Modified: head/sys/dev/ow/owc_gpiobus.c

==
--- head/sys/dev/ow/owc_gpiobus.c   Fri Dec 13 21:39:10 2019
(r355734)
+++ head/sys/dev/ow/owc_gpiobus.c   Fri Dec 13 21:39:20 2019
(r355735)
@@ -131,9 +131,7 @@ owc_gpiobus_attach(device_t dev)
free(kids, M_TEMP);
if (nkid == 0)
device_add_child(dev, "ow", -1);
-   bus_delayed_attach_children(dev);
-
-   return (0);
+   return (bus_delayed_attach_children(dev));
 }
 
 static int



___
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: r355735 - in head/sys: arm/broadcom/bcm2835 arm/mv dev/ow

2019-12-13 Thread Warner Losh
Author: imp
Date: Fri Dec 13 21:39:20 2019
New Revision: 355735
URL: https://svnweb.freebsd.org/changeset/base/355735

Log:
  Be consistent about checking return value from bus_delayed_attach_children.
  
  Most places checked, but a couple last minute changes didn't. Make them all 
use
  the return value.
  
  Noticed by: rpokala@

Modified:
  head/sys/arm/broadcom/bcm2835/bcm2835_bsc.c
  head/sys/arm/mv/a37x0_spi.c
  head/sys/dev/ow/owc_gpiobus.c

Modified: head/sys/arm/broadcom/bcm2835/bcm2835_bsc.c
==
--- head/sys/arm/broadcom/bcm2835/bcm2835_bsc.c Fri Dec 13 21:39:10 2019
(r355734)
+++ head/sys/arm/broadcom/bcm2835/bcm2835_bsc.c Fri Dec 13 21:39:20 2019
(r355735)
@@ -347,9 +347,7 @@ bcm_bsc_attach(device_t dev)
}
 
/* Probe and attach the iicbus when interrupts are available. */
-   bus_delayed_attach_children(dev);
-
-   return (0);
+   return (bus_delayed_attach_children(dev));
 }
 
 static int

Modified: head/sys/arm/mv/a37x0_spi.c
==
--- head/sys/arm/mv/a37x0_spi.c Fri Dec 13 21:39:10 2019(r355734)
+++ head/sys/arm/mv/a37x0_spi.c Fri Dec 13 21:39:20 2019(r355735)
@@ -220,9 +220,7 @@ a37x0_spi_attach(device_t dev)
device_add_child(dev, "spibus", -1);
 
/* Probe and attach the spibus when interrupts are available. */
-   bus_delayed_attach_children(dev);
-
-   return (0);
+   return (bus_delayed_attach_children(dev));
 }
 
 static int

Modified: head/sys/dev/ow/owc_gpiobus.c
==
--- head/sys/dev/ow/owc_gpiobus.c   Fri Dec 13 21:39:10 2019
(r355734)
+++ head/sys/dev/ow/owc_gpiobus.c   Fri Dec 13 21:39:20 2019
(r355735)
@@ -131,9 +131,7 @@ owc_gpiobus_attach(device_t dev)
free(kids, M_TEMP);
if (nkid == 0)
device_add_child(dev, "ow", -1);
-   bus_delayed_attach_children(dev);
-
-   return (0);
+   return (bus_delayed_attach_children(dev));
 }
 
 static int
___
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: r355734 - head/share/man/man9

2019-12-13 Thread Warner Losh
Author: imp
Date: Fri Dec 13 21:39:10 2019
New Revision: 355734
URL: https://svnweb.freebsd.org/changeset/base/355734

Log:
  Don't use contractions. Fix the date.
  
  Contractions cause problems for translators, so s/aren't/are not/ in the one
  place this slipped through.
  
  While here, noticed I commited with the date I did the work, not today's
  date. Fix that too.
  
  Noticed by: bjk@

Modified:
  head/share/man/man9/bus_delayed_attach_children.9

Modified: head/share/man/man9/bus_delayed_attach_children.9
==
--- head/share/man/man9/bus_delayed_attach_children.9   Fri Dec 13 21:38:08 
2019(r355733)
+++ head/share/man/man9/bus_delayed_attach_children.9   Fri Dec 13 21:39:10 
2019(r355734)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd August 29, 2019
+.Dd December 13, 2019
 .Dt BUS_DELAYED_ATTACH_CHILDREN 9
 .Os
 .Sh NAME
@@ -42,7 +42,7 @@ The
 function requests that the children of this device
 be attached when interrupts are running.
 If interrupts are currently running, this happens immediately.
-If interrupts aren't yet running, this happens after interrupts are enabled, 
but
+If interrupts are not yet running, this happens after interrupts are enabled, 
but
 before the system mounts root.
 .Sh RETURN VALUES
 A zero return value indicates 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"


svn commit: r355733 - in head/sys/fs: nfsclient nfsserver

2019-12-13 Thread Rick Macklem
Author: rmacklem
Date: Fri Dec 13 21:38:08 2019
New Revision: 355733
URL: https://svnweb.freebsd.org/changeset/base/355733

Log:
  Silence some "might not be initialized" warnings for riscv64.
  
  None of these case were actually using the variable(s) uninitialized, but
  I figured that silencing the warnings via initializing them made sense.
  
  Some of these predated r355677.

Modified:
  head/sys/fs/nfsclient/nfs_clrpcops.c
  head/sys/fs/nfsserver/nfs_nfsdport.c
  head/sys/fs/nfsserver/nfs_nfsdserv.c
  head/sys/fs/nfsserver/nfs_nfsdstate.c

Modified: head/sys/fs/nfsclient/nfs_clrpcops.c
==
--- head/sys/fs/nfsclient/nfs_clrpcops.cFri Dec 13 21:03:12 2019
(r355732)
+++ head/sys/fs/nfsclient/nfs_clrpcops.cFri Dec 13 21:38:08 2019
(r355733)
@@ -5001,6 +5001,8 @@ nfsrpc_getdeviceinfo(struct nfsmount *nmp, uint8_t *de
uint8_t stripeindex;
sa_family_t af, safilled;
 
+   ssin.sin_port = 0;  /* To shut up compiler. */
+   ssin.sin_addr.s_addr = 0;   /* ditto */
*ndip = NULL;
ndi = NULL;
gotdspp = NULL;
@@ -5436,7 +5438,7 @@ nfsrpc_fillsa(struct nfsmount *nmp, struct sockaddr_in
struct nfsclds *dsp, *tdsp;
int error, firsttry;
enum nfsclds_state retv;
-   uint32_t sequenceid;
+   uint32_t sequenceid = 0;
 
KASSERT(nmp->nm_sockreq.nr_cred != NULL,
("nfsrpc_fillsa: NULL nr_cred"));

Modified: head/sys/fs/nfsserver/nfs_nfsdport.c
==
--- head/sys/fs/nfsserver/nfs_nfsdport.cFri Dec 13 21:03:12 2019
(r355732)
+++ head/sys/fs/nfsserver/nfs_nfsdport.cFri Dec 13 21:38:08 2019
(r355733)
@@ -4670,7 +4670,7 @@ nfsrv_dsgetsockmnt(struct vnode *vp, int lktype, char 
 char *devid, char *fnamep, struct vnode **nvpp, struct nfsmount **newnmpp,
 struct nfsmount *curnmp, int *ippos, int *dsdirp)
 {
-   struct vnode *dvp, *nvp, **tdvpp;
+   struct vnode *dvp, *nvp = NULL, **tdvpp;
struct mount *mp;
struct nfsmount *nmp, *newnmp;
struct sockaddr *sad;

Modified: head/sys/fs/nfsserver/nfs_nfsdserv.c
==
--- head/sys/fs/nfsserver/nfs_nfsdserv.cFri Dec 13 21:03:12 2019
(r355732)
+++ head/sys/fs/nfsserver/nfs_nfsdserv.cFri Dec 13 21:38:08 2019
(r355733)
@@ -4594,7 +4594,7 @@ nfsrvd_layoutcommit(struct nfsrv_descript *nd, __unuse
nfsv4stateid_t stateid;
int error = 0, hasnewoff, hasnewmtime, layouttype, maxcnt, reclaim;
int hasnewsize;
-   uint64_t offset, len, newoff, newsize;
+   uint64_t offset, len, newoff = 0, newsize;
struct timespec newmtime;
char *layp;
struct thread *p = curthread;

Modified: head/sys/fs/nfsserver/nfs_nfsdstate.c
==
--- head/sys/fs/nfsserver/nfs_nfsdstate.c   Fri Dec 13 21:03:12 2019
(r355732)
+++ head/sys/fs/nfsserver/nfs_nfsdstate.c   Fri Dec 13 21:38:08 2019
(r355733)
@@ -4056,10 +4056,10 @@ nfsrv_getclientipaddr(struct nfsrv_descript *nd, struc
int i, j, maxalen = 0, minalen = 0;
sa_family_t af;
 #ifdef INET
-   struct sockaddr_in *rin, *sin;
+   struct sockaddr_in *rin = NULL, *sin;
 #endif
 #ifdef INET6
-   struct sockaddr_in6 *rin6, *sin6;
+   struct sockaddr_in6 *rin6 = NULL, *sin6;
 #endif
u_char *addr;
int error = 0, cantparse = 0;
@@ -7075,7 +7075,7 @@ nfsrv_recalloldlayout(NFSPROC_T *p)
nfsquad_t clientid;
nfsv4stateid_t stateid;
fhandle_t fh;
-   int error, laytype, ret;
+   int error, laytype = 0, ret;
 
lhyp = [arc4random() % nfsrv_layouthashsize];
NFSLOCKLAYOUT(lhyp);
___
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: r355732 - in head: . share/man/man9 sys/kern sys/netgraph sys/sys

2019-12-13 Thread John Baldwin
Author: jhb
Date: Fri Dec 13 21:03:12 2019
New Revision: 355732
URL: https://svnweb.freebsd.org/changeset/base/355732

Log:
  Remove the deprecated timeout(9) interface.
  
  All in-tree consumers have been converted to callout(9).
  
  Reviewed by:  kib, markj
  Differential Revision:https://reviews.freebsd.org/D22602

Added:
  head/share/man/man9/callout.9   (contents, props changed)
 - copied, changed from r355731, head/share/man/man9/timeout.9
Deleted:
  head/share/man/man9/timeout.9
Modified:
  head/ObsoleteFiles.inc
  head/share/man/man9/Makefile
  head/sys/kern/kern_intr.c
  head/sys/kern/kern_timeout.c
  head/sys/netgraph/ng_base.c
  head/sys/sys/interrupt.h
  head/sys/sys/param.h
  head/sys/sys/systm.h

Modified: head/ObsoleteFiles.inc
==
--- head/ObsoleteFiles.inc  Fri Dec 13 20:45:45 2019(r355731)
+++ head/ObsoleteFiles.inc  Fri Dec 13 21:03:12 2019(r355732)
@@ -36,6 +36,9 @@
 #   xargs -n1 | sort | uniq -d;
 # done
 
+# 20191213: remove timeout(9)
+OLD_FILES+=usr/share/man/man9/timeout.9.gz
+OLD_FILES+=usr/share/man/man9/untimeout.9.gz
 # 20191128: Removal of trm(4)
 OLD_FILES+=usr/share/man/man4/trm.4.gz
 # 20191121: Removal of sio(4)

Modified: head/share/man/man9/Makefile
==
--- head/share/man/man9/MakefileFri Dec 13 20:45:45 2019
(r355731)
+++ head/share/man/man9/MakefileFri Dec 13 21:03:12 2019
(r355732)
@@ -56,6 +56,7 @@ MAN=  accept_filter.9 \
BUS_SETUP_INTR.9 \
bus_space.9 \
byteorder.9 \
+   callout.9 \
casuword.9 \
cd.9 \
cnv.9 \
@@ -315,7 +316,6 @@ MAN=accept_filter.9 \
tcp_functions.9 \
thread_exit.9 \
time.9 \
-   timeout.9 \
tvtohz.9 \
ucred.9 \
uidinfo.9 \
@@ -766,6 +766,30 @@ MLINKS+=byteorder.9 be16dec.9 \
byteorder.9 le64dec.9 \
byteorder.9 le64enc.9 \
byteorder.9 le64toh.9
+MLINKS+=callout.9 callout_active.9 \
+   callout.9 callout_async_drain.9 \
+   callout.9 callout_deactivate.9 \
+   callout.9 callout_drain.9 \
+   callout.9 callout_handle_init.9 \
+   callout.9 callout_init.9 \
+   callout.9 callout_init_mtx.9 \
+   callout.9 callout_init_rm.9 \
+   callout.9 callout_init_rw.9 \
+   callout.9 callout_pending.9 \
+   callout.9 callout_reset.9 \
+   callout.9 callout_reset_curcpu.9 \
+   callout.9 callout_reset_on.9 \
+   callout.9 callout_reset_sbt.9 \
+   callout.9 callout_reset_sbt_curcpu.9 \
+   callout.9 callout_reset_sbt_on.9 \
+   callout.9 callout_schedule.9 \
+   callout.9 callout_schedule_curcpu.9 \
+   callout.9 callout_schedule_on.9 \
+   callout.9 callout_schedule_sbt.9 \
+   callout.9 callout_schedule_sbt_curcpu.9 \
+   callout.9 callout_schedule_sbt_on.9 \
+   callout.9 callout_stop.9 \
+   callout.9 callout_when.9
 MLINKS+=cnv.9 cnvlist.9 \
cnv.9 cnvlist_free_binary.9 \
cnv.9 cnvlist_free_bool.9 \
@@ -2097,32 +2121,6 @@ MLINKS+=tcp_functions.9 register_tcp_functions.9 \
 MLINKS+=time.9 boottime.9 \
time.9 time_second.9 \
time.9 time_uptime.9
-MLINKS+=timeout.9 callout.9 \
-   timeout.9 callout_active.9 \
-   timeout.9 callout_async_drain.9 \
-   timeout.9 callout_deactivate.9 \
-   timeout.9 callout_drain.9 \
-   timeout.9 callout_handle_init.9 \
-   timeout.9 callout_init.9 \
-   timeout.9 callout_init_mtx.9 \
-   timeout.9 callout_init_rm.9 \
-   timeout.9 callout_init_rw.9 \
-   timeout.9 callout_pending.9 \
-   timeout.9 callout_reset.9 \
-   timeout.9 callout_reset_curcpu.9 \
-   timeout.9 callout_reset_on.9 \
-   timeout.9 callout_reset_sbt.9 \
-   timeout.9 callout_reset_sbt_curcpu.9 \
-   timeout.9 callout_reset_sbt_on.9 \
-   timeout.9 callout_schedule.9 \
-   timeout.9 callout_schedule_curcpu.9 \
-   timeout.9 callout_schedule_on.9 \
-   timeout.9 callout_schedule_sbt.9 \
-   timeout.9 callout_schedule_sbt_curcpu.9 \
-   timeout.9 callout_schedule_sbt_on.9 \
-   timeout.9 callout_stop.9 \
-   timeout.9 callout_when.9 \
-   timeout.9 untimeout.9
 MLINKS+=ucred.9 crcopy.9 \
ucred.9 crcopysafe.9 \
ucred.9 crdup.9 \

Copied and modified: head/share/man/man9/callout.9 (from r355731, 
head/share/man/man9/timeout.9)
==
--- head/share/man/man9/timeout.9   Fri Dec 13 20:45:45 2019
(r355731, copy source)
+++ head/share/man/man9/callout.9   Fri Dec 13 21:03:12 2019
(r355732)
@@ -29,8 +29,8 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd December 10, 2019
-.Dt TIMEOUT 9
+.Dd December 13, 2019
+.Dt CALLOUT 9
 .Os
 .Sh NAME
 .Nm callout_active ,
@@ -56,17

svn commit: r355731 - stable/11/crypto/openssh

2019-12-13 Thread Ed Maste
Author: emaste
Date: Fri Dec 13 20:45:45 2019
New Revision: 355731
URL: https://svnweb.freebsd.org/changeset/base/355731

Log:
  sftp: disallow creation (of empty files) in read-only mode
  
  Direct commit to stable/11; already fixed in newer OpenSSH in 12 and
  later.
  
  PR:   233801
  Reported by:  Dani
  Obtained from:OpenBSD 1.111
  Security: CVE-2017-15906

Modified:
  stable/11/crypto/openssh/sftp-server.c

Modified: stable/11/crypto/openssh/sftp-server.c
==
--- stable/11/crypto/openssh/sftp-server.c  Fri Dec 13 20:38:58 2019
(r355730)
+++ stable/11/crypto/openssh/sftp-server.c  Fri Dec 13 20:45:45 2019
(r355731)
@@ -691,8 +691,8 @@ process_open(u_int32_t id)
logit("open \"%s\" flags %s mode 0%o",
name, string_from_portable(pflags), mode);
if (readonly &&
-   ((flags & O_ACCMODE) == O_WRONLY ||
-   (flags & O_ACCMODE) == O_RDWR)) {
+   ((flags & O_ACCMODE) != O_RDONLY ||
+   (flags & (O_CREAT|O_TRUNC)) != 0)) {
verbose("Refusing open request in read-only mode");
status = SSH2_FX_PERMISSION_DENIED;
} 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"


svn commit: r355730 - in head/sys/dev/cxgbe: . crypto

2019-12-13 Thread Navdeep Parhar
Author: np
Date: Fri Dec 13 20:38:58 2019
New Revision: 355730
URL: https://svnweb.freebsd.org/changeset/base/355730

Log:
  cxgbe(4): Use the _XT variant of the CPL used to transmit NIC traffic.
  
  CPL_TX_PKT_XT disables the internal parser on the chip and instead
  relies on the driver to provide the exact length of the L2 and L3
  headers.  This allows hw checksumming and TSO to be used with L2 and
  L3 encapsulations that the chip doesn't understand directly.
  
  Note that netmap tx still uses the old CPL as it never uses the hw
  to generate the checksum on tx.
  
  Reviewed by:  jhb@
  MFC after:1 month
  Sponsored by: Chelsio Communications
  Differential Revision:https://reviews.freebsd.org/D22788

Modified:
  head/sys/dev/cxgbe/crypto/t4_kern_tls.c
  head/sys/dev/cxgbe/t4_sched.c
  head/sys/dev/cxgbe/t4_sge.c

Modified: head/sys/dev/cxgbe/crypto/t4_kern_tls.c
==
--- head/sys/dev/cxgbe/crypto/t4_kern_tls.c Fri Dec 13 20:30:26 2019
(r355729)
+++ head/sys/dev/cxgbe/crypto/t4_kern_tls.c Fri Dec 13 20:38:58 2019
(r355730)
@@ -1394,15 +1394,10 @@ ktls_write_tcp_options(struct sge_txq *txq, void *dst,
 
cpl = (void *)(wr + 1);
 
-   /* Checksum offload */
-   ctrl1 = 0;
-   txq->txcsum++;
-
/* CPL header */
cpl->ctrl0 = txq->cpl_ctrl0;
cpl->pack = 0;
cpl->len = htobe16(pktlen);
-   cpl->ctrl1 = htobe64(ctrl1);
 
out = (void *)(cpl + 1);
 
@@ -1419,13 +1414,21 @@ ktls_write_tcp_options(struct sge_txq *txq, void *dst,
if (m->m_pkthdr.l3hlen > sizeof(*ip))
copy_to_txd(>eq, (caddr_t)(ip + 1), ,
m->m_pkthdr.l3hlen - sizeof(*ip));
+   ctrl1 = V_TXPKT_CSUM_TYPE(TX_CSUM_TCPIP) |
+   V_T6_TXPKT_ETHHDR_LEN(m->m_pkthdr.l2hlen - ETHER_HDR_LEN) |
+   V_TXPKT_IPHDR_LEN(m->m_pkthdr.l3hlen);
} else {
ip6 = (void *)((char *)eh + m->m_pkthdr.l2hlen);
newip6 = *ip6;
newip6.ip6_plen = htons(pktlen - m->m_pkthdr.l2hlen);
copy_to_txd(>eq, (caddr_t), , sizeof(newip6));
MPASS(m->m_pkthdr.l3hlen == sizeof(*ip6));
+   ctrl1 = V_TXPKT_CSUM_TYPE(TX_CSUM_TCPIP6) |
+   V_T6_TXPKT_ETHHDR_LEN(m->m_pkthdr.l2hlen - ETHER_HDR_LEN) |
+   V_TXPKT_IPHDR_LEN(m->m_pkthdr.l3hlen);
}
+   cpl->ctrl1 = htobe64(ctrl1);
+   txq->txcsum++;
 
/* Clear PUSH and FIN in the TCP header if present. */
tcp = (void *)((char *)eh + m->m_pkthdr.l2hlen + m->m_pkthdr.l3hlen);
@@ -1493,15 +1496,10 @@ ktls_write_tunnel_packet(struct sge_txq *txq, void *ds
 
cpl = (void *)(wr + 1);
 
-   /* Checksum offload */
-   ctrl1 = 0;
-   txq->txcsum++;
-
/* CPL header */
cpl->ctrl0 = txq->cpl_ctrl0;
cpl->pack = 0;
cpl->len = htobe16(pktlen);
-   cpl->ctrl1 = htobe64(ctrl1);
 
out = (void *)(cpl + 1);
 
@@ -1518,13 +1516,21 @@ ktls_write_tunnel_packet(struct sge_txq *txq, void *ds
if (m->m_pkthdr.l3hlen > sizeof(*ip))
copy_to_txd(>eq, (caddr_t)(ip + 1), ,
m->m_pkthdr.l3hlen - sizeof(*ip));
+   ctrl1 = V_TXPKT_CSUM_TYPE(TX_CSUM_TCPIP) |
+   V_T6_TXPKT_ETHHDR_LEN(m->m_pkthdr.l2hlen - ETHER_HDR_LEN) |
+   V_TXPKT_IPHDR_LEN(m->m_pkthdr.l3hlen);
} else {
ip6 = (void *)((char *)eh + m->m_pkthdr.l2hlen);
newip6 = *ip6;
newip6.ip6_plen = htons(pktlen - m->m_pkthdr.l2hlen);
copy_to_txd(>eq, (caddr_t), , sizeof(newip6));
MPASS(m->m_pkthdr.l3hlen == sizeof(*ip6));
+   ctrl1 = V_TXPKT_CSUM_TYPE(TX_CSUM_TCPIP6) |
+   V_T6_TXPKT_ETHHDR_LEN(m->m_pkthdr.l2hlen - ETHER_HDR_LEN) |
+   V_TXPKT_IPHDR_LEN(m->m_pkthdr.l3hlen);
}
+   cpl->ctrl1 = htobe64(ctrl1);
+   txq->txcsum++;
 
/* Set sequence number in TCP header. */
tcp = (void *)((char *)eh + m->m_pkthdr.l2hlen + m->m_pkthdr.l3hlen);
@@ -2134,15 +2140,10 @@ ktls_write_tcp_fin(struct sge_txq *txq, void *dst, str
 
cpl = (void *)(wr + 1);
 
-   /* Checksum offload */
-   ctrl1 = 0;
-   txq->txcsum++;
-
/* CPL header */
cpl->ctrl0 = txq->cpl_ctrl0;
cpl->pack = 0;
cpl->len = htobe16(pktlen);
-   cpl->ctrl1 = htobe64(ctrl1);
 
out = (void *)(cpl + 1);
 
@@ -2159,13 +2160,21 @@ ktls_write_tcp_fin(struct sge_txq *txq, void *dst, str
if (m->m_pkthdr.l3hlen > sizeof(*ip))
copy_to_txd(>eq, (caddr_t)(ip + 1), ,
m->m_pkthdr.l3hlen - sizeof(*ip));
+   ctrl1 = V_TXPKT_CSUM_TYPE(TX_CSUM_TCPIP) |
+   

svn commit: r355729 - head/lib/libc/powerpc64

2019-12-13 Thread Brandon Bergren
Author: bdragon
Date: Fri Dec 13 20:30:26 2019
New Revision: 355729
URL: https://svnweb.freebsd.org/changeset/base/355729

Log:
  [PowerPC] Fully define gdtoa settings on powerpc64.
  
  The settings in arith.h were not fully defined on powerpc64 after the gdtoa
  switchover. Generate them using arithchk.c, similar to what AMD64 did for
  r114814.
  
  Technically, none of this is necessary in FreeBSD gdtoa, but since the other
  platforms have full definitions, we might as well have full definitions
  too.
  
  Approved by:  jhibbits (in irc)
  Differential Revision:https://reviews.freebsd.org/D22775

Modified:
  head/lib/libc/powerpc64/arith.h

Modified: head/lib/libc/powerpc64/arith.h
==
--- head/lib/libc/powerpc64/arith.h Fri Dec 13 19:56:48 2019
(r355728)
+++ head/lib/libc/powerpc64/arith.h Fri Dec 13 20:30:26 2019
(r355729)
@@ -13,4 +13,7 @@
 
 #define IEEE_MC68k
 #define Arith_Kind_ASL 2
+#define Long int
+#define Intcast (int)(long)
 #define Double_Align
+#define X64_bit_pointers
___
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: r355727 - in head: share/man/man9 sys/arm/broadcom/bcm2835 sys/arm/freescale/imx sys/arm/mv sys/arm/ti sys/dev/glxiic sys/dev/ichsmb sys/dev/ow sys/kern sys/sys

2019-12-13 Thread Ravi Pokala
Hi Warner,

This change takes a bunch of cases of

> config_intrhook_oneshot((ich_func_t)bus_generic_attach, dev);
> return (0)

And replaces them with a *mix* of:

> return (bus_delayed_attach_children(dev));

and

> bus_delayed_attach_children(dev);
> return (0)

Why the two different idioms?

Thanks,

Ravi (rpokala@)

-Original Message-
From:  on behalf of Warner Losh 

Date: 2019-12-13, Friday at 11:39
To: , , 

Subject: svn commit: r355727 - in head: share/man/man9 sys/arm/broadcom/bcm2835 
sys/arm/freescale/imx sys/arm/mv sys/arm/ti sys/dev/glxiic sys/dev/ichsmb 
sys/dev/ow sys/kern sys/sys

Author: imp
Date: Fri Dec 13 19:39:33 2019
New Revision: 355727
URL: https://svnweb.freebsd.org/changeset/base/355727

Log:
  Create new wrapper function: bus_delayed_attach_children()
  
  Delay the attachment of children, when requested, until after interrutps 
are
  running. This is often needed to allow children to run transactions on 
i2c or
  spi busses. It's a common enough idiom that it will be useful to have its 
own
  wrapper.
  
  Reviewed by: ian
  Differential Revision: https://reviews.freebsd.org/D21465

Added:
  head/share/man/man9/bus_delayed_attach_children.9   (contents, props 
changed)
Modified:
  head/share/man/man9/Makefile
  head/sys/arm/broadcom/bcm2835/bcm2835_bsc.c
  head/sys/arm/freescale/imx/imx_i2c.c
  head/sys/arm/freescale/imx/imx_spi.c
  head/sys/arm/mv/a37x0_spi.c
  head/sys/arm/mv/mv_spi.c
  head/sys/arm/ti/ti_i2c.c
  head/sys/dev/glxiic/glxiic.c
  head/sys/dev/ichsmb/ichsmb.c
  head/sys/dev/ow/owc_gpiobus.c
  head/sys/kern/subr_bus.c
  head/sys/sys/bus.h

Modified: head/share/man/man9/Makefile

==
--- head/share/man/man9/MakefileFri Dec 13 19:27:51 2019
(r355726)
+++ head/share/man/man9/MakefileFri Dec 13 19:39:33 2019
(r355727)
@@ -34,6 +34,7 @@ MAN=  accept_filter.9 \
BUS_CHILD_DELETED.9 \
BUS_CHILD_DETACHED.9 \
BUS_CONFIG_INTR.9 \
+   bus_delayed_attach_children.9 \
BUS_DESCRIBE_INTR.9 \
bus_dma.9 \
bus_generic_attach.9 \

Added: head/share/man/man9/bus_delayed_attach_children.9

==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/share/man/man9/bus_delayed_attach_children.9   Fri Dec 13 
19:39:33 2019(r355727)
@@ -0,0 +1,55 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 2019 M. Warner Losh
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\"notice, this list of conditions and the following disclaimer in the
+.\"documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS 
OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 
BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF 
USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd August 29, 2019
+.Dt BUS_DELAYED_ATTACH_CHILDREN 9
+.Os
+.Sh NAME
+.Nm bus_delayed_attach_children
+.Nd "request that the children be attached when interrupts are enabled"
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/bus.h
+.Pp
+.Ft int
+.Fn bus_delayed_attach_children "device_t dev"
+.Sh DESCRIPTION
+The
+.Fn bus_delayed_attach_children
+function requests that the children of this device
+be attached when interrupts are running.
+If interrupts are currently running, this happens immediately.
+If interrupts aren't yet running, this happens after interrupts are 
enabled, but
+before the system mounts root.
+.Sh RETURN VALUES
+A zero return value indicates success.
+.Sh SEE ALSO
+.Xr bus 9 ,
+.Xr device 9 ,
+.Xr driver 9
+.Sh AUTHORS

svn commit: r355728 - head/sys/dev/smartpqi

2019-12-13 Thread John Baldwin
Author: jhb
Date: Fri Dec 13 19:56:48 2019
New Revision: 355728
URL: https://svnweb.freebsd.org/changeset/base/355728

Log:
  Use callout(9) instead of deprecated timeout(9).
  
  Reviewed by:  imp
  Tested by:Scott Benesh
  Differential Revision:https://reviews.freebsd.org/D22598

Modified:
  head/sys/dev/smartpqi/smartpqi_defines.h
  head/sys/dev/smartpqi/smartpqi_main.c
  head/sys/dev/smartpqi/smartpqi_misc.c

Modified: head/sys/dev/smartpqi/smartpqi_defines.h
==
--- head/sys/dev/smartpqi/smartpqi_defines.hFri Dec 13 19:39:33 2019
(r355727)
+++ head/sys/dev/smartpqi/smartpqi_defines.hFri Dec 13 19:56:48 2019
(r355728)
@@ -856,8 +856,8 @@ typedef struct OS_SPECIFIC {
struct cam_path *path;
struct task event_task;
struct cdev *cdev;
-   struct callout_handle   wellness_periodic;  /* periodic event 
handling */
-   struct callout_handle   heartbeat_timeout_id;   /* heart beat event 
handling */
+   struct callout  wellness_periodic;  /* periodic event 
handling */
+   struct callout  heartbeat_timeout_id;   /* heart beat event 
handling */
eventhandler_tageh;
 } OS_SPECIFIC_T;
 

Modified: head/sys/dev/smartpqi/smartpqi_main.c
==
--- head/sys/dev/smartpqi/smartpqi_main.c   Fri Dec 13 19:39:33 2019
(r355727)
+++ head/sys/dev/smartpqi/smartpqi_main.c   Fri Dec 13 19:56:48 2019
(r355728)
@@ -324,6 +324,8 @@ smartpqi_attach(device_t dev)
 mtx_init(>os_specific.cam_lock, "cam_lock", NULL, MTX_DEF);
 softs->os_specific.mtx_init = TRUE;
 mtx_init(>os_specific.map_lock, "map_lock", NULL, MTX_DEF);
+callout_init(>os_specific.wellness_periodic, 1);
+callout_init(>os_specific.heartbeat_timeout_id, 1);
 
 /*
  * Create DMA tag for mapping buffers into controller-addressable 
space.
@@ -355,8 +357,8 @@ smartpqi_attach(device_t dev)
}
 
os_start_heartbeat_timer((void *)softs); /* Start the heart-beat timer 
*/
-   softs->os_specific.wellness_periodic = timeout( os_wellness_periodic, 
-   softs, 120*hz);
+   callout_reset(>os_specific.wellness_periodic, 120*hz,
+ os_wellness_periodic, softs);
/* Register our shutdown handler. */
softs->os_specific.eh = EVENTHANDLER_REGISTER(shutdown_final, 
smartpqi_shutdown, softs, SHUTDOWN_PRI_DEFAULT);
@@ -410,11 +412,9 @@ smartpqi_detach(device_t dev)
EVENTHANDLER_DEREGISTER(shutdown_final, softs->os_specific.eh);
 
/* kill the periodic event */
-   untimeout(os_wellness_periodic, softs, 
-   softs->os_specific.wellness_periodic);
+   callout_drain(>os_specific.wellness_periodic);
/* Kill the heart beat event */
-   untimeout(os_start_heartbeat_timer, softs, 
-   softs->os_specific.heartbeat_timeout_id);
+   callout_drain(>os_specific.heartbeat_timeout_id);
 
smartpqi_shutdown(softs);
destroy_char_dev(softs);

Modified: head/sys/dev/smartpqi/smartpqi_misc.c
==
--- head/sys/dev/smartpqi/smartpqi_misc.c   Fri Dec 13 19:39:33 2019
(r355727)
+++ head/sys/dev/smartpqi/smartpqi_misc.c   Fri Dec 13 19:56:48 2019
(r355728)
@@ -69,8 +69,8 @@ void os_wellness_periodic(void *data)
}
 
/* reschedule ourselves */
-   softs->os_specific.wellness_periodic = timeout(os_wellness_periodic, 
-   softs, OS_HOST_WELLNESS_TIMEOUT * hz);
+   callout_schedule(>os_specific.wellness_periodic,
+   OS_HOST_WELLNESS_TIMEOUT * hz);
 }
 
 /*
@@ -81,8 +81,7 @@ void os_stop_heartbeat_timer(pqisrc_softstate_t *softs
DBG_FUNC("IN\n");
 
/* Kill the heart beat event */
-   untimeout(os_start_heartbeat_timer, softs, 
-   softs->os_specific.heartbeat_timeout_id);
+   callout_stop(>os_specific.heartbeat_timeout_id);
 
DBG_FUNC("OUT\n");
 }
@@ -97,9 +96,9 @@ void os_start_heartbeat_timer(void *data)
 
pqisrc_heartbeat_timer_handler(softs);
if (!pqisrc_ctrl_offline(softs)) {
-   softs->os_specific.heartbeat_timeout_id =
-   timeout(os_start_heartbeat_timer, softs,
-   OS_FW_HEARTBEAT_TIMER_INTERVAL * hz);
+   callout_reset(>os_specific.heartbeat_timeout_id,
+ OS_FW_HEARTBEAT_TIMER_INTERVAL * hz,
+ os_start_heartbeat_timer, softs);
}
 
DBG_FUNC("OUT\n");
___
svn-src-all@freebsd.org mailing list

Re: svn commit: r355725 - in head/sys: kern sys

2019-12-13 Thread John Baldwin
On 12/13/19 11:27 AM, Hans Petter Selasky wrote:
> On 2019-12-13 20:26, John Baldwin wrote:
>> deprecated timeout(9)
> 
> Are you planning to nuke the timeout(9) API?

Yes, only one consumer left and that is in review.

D22602 is the removal.  It always runs under Giant, is unreliable since 
timeout()
can silently fail to schedule, and has been marked deprecated for years in the
manpage.

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


Re: svn commit: r355724 - in head: sys/amd64/include sys/amd64/vmm/amd sys/amd64/vmm/intel usr.sbin/bhyve

2019-12-13 Thread John Baldwin
On 12/13/19 11:21 AM, John Baldwin wrote:
> Author: jhb
> Date: Fri Dec 13 19:21:58 2019
> New Revision: 355724
> URL: https://svnweb.freebsd.org/changeset/base/355724
> 
> Log:
>   Support software breakpoints in the debug server on Intel CPUs.
>   
>   - Allow the userland hypervisor to intercept breakpoint exceptions
> (BP#) in the guest.  A new capability (VM_CAP_BPT_EXIT) is used to
> enable this feature.  These exceptions are reported to userland via
> a new VM_EXITCODE_BPT that includes the length of the original
> breakpoint instruction.  If userland wishes to pass the exception
> through to the guest, it must be explicitly re-injected via
> vm_inject_exception().
>   
>   - Export VMCS_ENTRY_INST_LENGTH as a VM_REG_GUEST_ENTRY_INST_LENGTH
> pseudo-register.  Injecting a BP# on Intel requires setting this to
> the length of the breakpoint instruction.  AMD SVM currently ignores
> writes to this register (but reports success) and fails to read it.
>   
>   - Rework the per-vCPU state tracked by the debug server.  Rather than
> a single 'stepping_vcpu' global, add a structure for each vCPU that
> tracks state about that vCPU ('stepping', 'stepped', and
> 'hit_swbreak').  A global 'stopped_vcpu' tracks which vCPU is
> currently reporting an event.  Event handlers for MTRAP and
> breakpoint exits loop until the associated event is reported to the
> debugger.
>   
> Breakpoint events are discarded if the breakpoint is not present
> when a vCPU resumes in the breakpoint handler to retry submitting
> the breakpoint event.
>   
>   - Maintain a linked-list of active breakpoints in response to the GDB
> 'Z0' and 'z0' packets.
>   
>   Reviewed by:markj (earlier version)
>   MFC after:  2 months
>   Differential Revision:  https://reviews.freebsd.org/D20309

As the manpage notes, there is a pretty large caveat with using breakpoints.
The debugger wants to single-step over a breakpoint after replacing the
original instruction before resuming.  However, the latency between a
breakpoint firing and the user responding in the debugger is such that a
timer interrupt has triggered by the time the vCPU resumes.  Thus, the
single step stops in the first instruction of the interrupt handler.  The
debugger then does the user's requested continue which finishes the interrupt
handler and trips the breakpoint again at the original location when the
interrupt handler returns.  The effect is that doing a continue after a
breakpoint never makes forward progress.  One workaround is to disable
the current breakpoint and use 'until' to set a temporary breakpoint at
the next line in the source.  You can then re-enable the original breakpoint
and continue.

I've thought about various ways to fix this, but they all have downsides.
One way is to clear IF in %eflags while stepping, but then you have to
emulate pushf and possibly popf.  Another option might be to add new commands
to pause and unpause timer devices and pause timers when the vCPUs all exit
and re-enable when either doing a continue or for the duration of a step.
The latter approach feels a bit more of what you want, but it has other
potential downsides, like time jumps in the guest, etc.

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


svn commit: r355727 - in head: share/man/man9 sys/arm/broadcom/bcm2835 sys/arm/freescale/imx sys/arm/mv sys/arm/ti sys/dev/glxiic sys/dev/ichsmb sys/dev/ow sys/kern sys/sys

2019-12-13 Thread Warner Losh
Author: imp
Date: Fri Dec 13 19:39:33 2019
New Revision: 355727
URL: https://svnweb.freebsd.org/changeset/base/355727

Log:
  Create new wrapper function: bus_delayed_attach_children()
  
  Delay the attachment of children, when requested, until after interrutps are
  running. This is often needed to allow children to run transactions on i2c or
  spi busses. It's a common enough idiom that it will be useful to have its own
  wrapper.
  
  Reviewed by: ian
  Differential Revision: https://reviews.freebsd.org/D21465

Added:
  head/share/man/man9/bus_delayed_attach_children.9   (contents, props changed)
Modified:
  head/share/man/man9/Makefile
  head/sys/arm/broadcom/bcm2835/bcm2835_bsc.c
  head/sys/arm/freescale/imx/imx_i2c.c
  head/sys/arm/freescale/imx/imx_spi.c
  head/sys/arm/mv/a37x0_spi.c
  head/sys/arm/mv/mv_spi.c
  head/sys/arm/ti/ti_i2c.c
  head/sys/dev/glxiic/glxiic.c
  head/sys/dev/ichsmb/ichsmb.c
  head/sys/dev/ow/owc_gpiobus.c
  head/sys/kern/subr_bus.c
  head/sys/sys/bus.h

Modified: head/share/man/man9/Makefile
==
--- head/share/man/man9/MakefileFri Dec 13 19:27:51 2019
(r355726)
+++ head/share/man/man9/MakefileFri Dec 13 19:39:33 2019
(r355727)
@@ -34,6 +34,7 @@ MAN=  accept_filter.9 \
BUS_CHILD_DELETED.9 \
BUS_CHILD_DETACHED.9 \
BUS_CONFIG_INTR.9 \
+   bus_delayed_attach_children.9 \
BUS_DESCRIBE_INTR.9 \
bus_dma.9 \
bus_generic_attach.9 \

Added: head/share/man/man9/bus_delayed_attach_children.9
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/share/man/man9/bus_delayed_attach_children.9   Fri Dec 13 19:39:33 
2019(r355727)
@@ -0,0 +1,55 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 2019 M. Warner Losh
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\"notice, this list of conditions and the following disclaimer in the
+.\"documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd August 29, 2019
+.Dt BUS_DELAYED_ATTACH_CHILDREN 9
+.Os
+.Sh NAME
+.Nm bus_delayed_attach_children
+.Nd "request that the children be attached when interrupts are enabled"
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/bus.h
+.Pp
+.Ft int
+.Fn bus_delayed_attach_children "device_t dev"
+.Sh DESCRIPTION
+The
+.Fn bus_delayed_attach_children
+function requests that the children of this device
+be attached when interrupts are running.
+If interrupts are currently running, this happens immediately.
+If interrupts aren't yet running, this happens after interrupts are enabled, 
but
+before the system mounts root.
+.Sh RETURN VALUES
+A zero return value indicates success.
+.Sh SEE ALSO
+.Xr bus 9 ,
+.Xr device 9 ,
+.Xr driver 9
+.Sh AUTHORS
+This manual page was written by
+.An Warner Losh Aq Mt i...@freebsd.org .

Modified: head/sys/arm/broadcom/bcm2835/bcm2835_bsc.c
==
--- head/sys/arm/broadcom/bcm2835/bcm2835_bsc.c Fri Dec 13 19:27:51 2019
(r355726)
+++ head/sys/arm/broadcom/bcm2835/bcm2835_bsc.c Fri Dec 13 19:39:33 2019
(r355727)
@@ -347,7 +347,7 @@ bcm_bsc_attach(device_t dev)
}
 
/* Probe and attach the iicbus when interrupts are available. */
-   config_intrhook_oneshot((ich_func_t)bus_generic_attach, dev);
+   bus_delayed_attach_children(dev);
 
return (0);
 }

Modified: head/sys/arm/freescale/imx/imx_i2c.c
==
--- head/sys/arm/freescale/imx/imx_i2c.cFri Dec 13 19:27:51 2019
(r355726)
+++ head/sys/arm/freescale/imx/imx_i2c.cFri Dec 13 19:39:33 2019
(r355727)
@@ -449,8 +449,7 @@ no_recovery:

Re: svn commit: r355725 - in head/sys: kern sys

2019-12-13 Thread Hans Petter Selasky

On 2019-12-13 20:26, John Baldwin wrote:

deprecated timeout(9)


Are you planning to nuke the timeout(9) API?

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


svn commit: r355726 - in head/sys/cddl: compat/opensolaris/sys contrib/opensolaris/uts/common/fs/zfs contrib/opensolaris/uts/common/fs/zfs/sys

2019-12-13 Thread John Baldwin
Author: jhb
Date: Fri Dec 13 19:27:51 2019
New Revision: 355726
URL: https://svnweb.freebsd.org/changeset/base/355726

Log:
  Use a callout instead of timeout(9) for delayed zio's.
  
  Reviewed by:  avg
  Differential Revision:https://reviews.freebsd.org/D22597

Modified:
  head/sys/cddl/compat/opensolaris/sys/systm.h
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c

Modified: head/sys/cddl/compat/opensolaris/sys/systm.h
==
--- head/sys/cddl/compat/opensolaris/sys/systm.hFri Dec 13 19:26:04 
2019(r355725)
+++ head/sys/cddl/compat/opensolaris/sys/systm.hFri Dec 13 19:27:51 
2019(r355726)
@@ -42,9 +42,6 @@
 
 #definedelay(x)pause("soldelay", (x))
 
-#definetimeout_generic(type, fn, arg, t, r, f) \
-timeout(fn, arg, t / (NANOSEC/hz) + 1)
-
 #endif /* _KERNEL */
 
 #endif /* _OPENSOLARIS_SYS_SYSTM_H_ */

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h   Fri Dec 
13 19:26:04 2019(r355725)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h   Fri Dec 
13 19:27:51 2019(r355726)
@@ -474,6 +474,9 @@ struct zio {
 
 #ifdef __FreeBSD__
struct bio  *io_bio;
+#ifdef _KERNEL
+   struct callout  io_timer;
+#endif
 #endif
 
/* Internal pipeline state */

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c   Fri Dec 13 
19:26:04 2019(r355725)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c   Fri Dec 13 
19:27:51 2019(r355726)
@@ -659,6 +659,9 @@ zio_create(zio_t *pio, spa_t *spa, uint64_t txg, const
 
mutex_init(>io_lock, NULL, MUTEX_DEFAULT, NULL);
cv_init(>io_cv, NULL, CV_DEFAULT, NULL);
+#if defined(__FreeBSD__) && defined(_KERNEL)
+   callout_init(>io_timer, 1);
+#endif
 
list_create(>io_parent_list, sizeof (zio_link_t),
offsetof(zio_link_t, zl_parent_node));
@@ -726,6 +729,10 @@ zio_create(zio_t *pio, spa_t *spa, uint64_t txg, const
 static void
 zio_destroy(zio_t *zio)
 {
+#ifdef __FreeBSD__
+   KASSERT(!(callout_active(>io_timer) ||
+   callout_pending(>io_timer)), ("zio_destroy: timer active"));
+#endif
metaslab_trace_fini(>io_alloc_list);
list_destroy(>io_parent_list);
list_destroy(>io_child_list);
@@ -1710,8 +1717,13 @@ zio_delay_interrupt(zio_t *zio)
DTRACE_PROBE3(zio__delay__hit, zio_t *, zio,
hrtime_t, now, hrtime_t, diff);
 
+#ifdef __FreeBSD__
+   callout_reset_sbt(>io_timer, nstosbt(diff), 0,
+   (void (*)(void *))zio_interrupt, zio, C_HARDCLOCK);
+#else
(void) timeout_generic(CALLOUT_NORMAL,
(void (*)(void *))zio_interrupt, zio, diff, 1, 0);
+#endif
}
 
return;
___
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: r355725 - in head/sys: kern sys

2019-12-13 Thread John Baldwin
Author: jhb
Date: Fri Dec 13 19:26:04 2019
New Revision: 355725
URL: https://svnweb.freebsd.org/changeset/base/355725

Log:
  Use callout(9) instead of deprecated timeout(9) for fail points.
  
  Allocate the callout structure on-demand from
  fail_point_use_timeout_path() since most fail points do not use
  timeouts.
  
  Reviewed by:  markj (earlier version), cem
  Differential Revision:https://reviews.freebsd.org/D22599

Modified:
  head/sys/kern/kern_fail.c
  head/sys/sys/fail.h

Modified: head/sys/kern/kern_fail.c
==
--- head/sys/kern/kern_fail.c   Fri Dec 13 19:21:58 2019(r355724)
+++ head/sys/kern/kern_fail.c   Fri Dec 13 19:26:04 2019(r355725)
@@ -403,6 +403,8 @@ fail_point_drain(struct fail_point *fp, int expected_r
wakeup(FP_PAUSE_CHANNEL(fp));
tsleep(, PWAIT, "fail_point_drain", hz / 100);
}
+   if (fp->fp_callout)
+   callout_drain(fp->fp_callout);
fail_point_swap_settings(fp, entries);
 }
 
@@ -442,8 +444,8 @@ fail_point_sleep(struct fail_point *fp, int msecs,
if (fp->fp_pre_sleep_fn)
fp->fp_pre_sleep_fn(fp->fp_pre_sleep_arg);
 
-   timeout(fp->fp_post_sleep_fn, fp->fp_post_sleep_arg,
-   timo);
+   callout_reset(fp->fp_callout, timo,
+   fp->fp_post_sleep_fn, fp->fp_post_sleep_arg);
*pret = FAIL_POINT_RC_QUEUED;
}
}
@@ -493,6 +495,20 @@ fail_point_init(struct fail_point *fp, const char *fmt
fp->fp_post_sleep_arg = NULL;
 }
 
+void
+fail_point_alloc_callout(struct fail_point *fp)
+{
+
+   /**
+* This assumes that calls to fail_point_use_timeout_path()
+* will not race.
+*/
+   if (fp->fp_callout != NULL)
+   return;
+   fp->fp_callout = fp_malloc(sizeof(*fp->fp_callout), M_WAITOK);
+   callout_init(fp->fp_callout, CALLOUT_MPSAFE);
+}
+
 /**
  * Free the resources held by a fail_point, and wake any paused threads.
  * Thou shalt not allow threads to hit this fail point after you enter this
@@ -510,6 +526,10 @@ fail_point_destroy(struct fail_point *fp)
fp->fp_name = NULL;
}
fp->fp_flags = 0;
+   if (fp->fp_callout) {
+   fp_free(fp->fp_callout);
+   fp->fp_callout = NULL;
+   }
 
sx_xlock(_fp_set);
fail_point_garbage_collect();

Modified: head/sys/sys/fail.h
==
--- head/sys/sys/fail.h Fri Dec 13 19:21:58 2019(r355724)
+++ head/sys/sys/fail.h Fri Dec 13 19:26:04 2019(r355725)
@@ -84,6 +84,8 @@ struct fail_point {
void (*fp_post_sleep_fn)(void *);
/**< Arg for fp_post_sleep_fn */
void *fp_post_sleep_arg;
+
+   struct callout *fp_callout;
 };
 
 #defineFAIL_POINT_DYNAMIC_NAME 0x01/**< Must free name on destroy 
*/
@@ -149,9 +151,12 @@ fail_point_sleep_set_post_arg(struct fail_point *fp, v
 {
fp->fp_post_sleep_arg = sleep_arg;
 }
+
+void fail_point_alloc_callout(struct fail_point *);
+
 /**
  * If the FAIL_POINT_USE_TIMEOUT flag is set on a failpoint, then
- * FAIL_POINT_SLEEP will result in a call to timeout instead of
+ * FAIL_POINT_SLEEP will result in a call to callout_reset instead of
  * msleep. Note that if you sleep while this flag is set, you must
  * set fp_post_sleep_fn or an error will occur upon waking.
  */
@@ -163,9 +168,10 @@ fail_point_use_timeout_path(struct fail_point *fp, boo
(post_sleep_fn == NULL && fp->fp_post_sleep_fn != NULL),
("Setting fp to use timeout, but not setting post_sleep_fn\n"));
 
-   if (use_timeout)
+   if (use_timeout) {
+   fail_point_alloc_callout(fp);
fp->fp_flags |= FAIL_POINT_USE_TIMEOUT_PATH;
-   else
+   } else
fp->fp_flags &= ~FAIL_POINT_USE_TIMEOUT_PATH;
 
if (post_sleep_fn != 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"


svn commit: r355724 - in head: sys/amd64/include sys/amd64/vmm/amd sys/amd64/vmm/intel usr.sbin/bhyve

2019-12-13 Thread John Baldwin
Author: jhb
Date: Fri Dec 13 19:21:58 2019
New Revision: 355724
URL: https://svnweb.freebsd.org/changeset/base/355724

Log:
  Support software breakpoints in the debug server on Intel CPUs.
  
  - Allow the userland hypervisor to intercept breakpoint exceptions
(BP#) in the guest.  A new capability (VM_CAP_BPT_EXIT) is used to
enable this feature.  These exceptions are reported to userland via
a new VM_EXITCODE_BPT that includes the length of the original
breakpoint instruction.  If userland wishes to pass the exception
through to the guest, it must be explicitly re-injected via
vm_inject_exception().
  
  - Export VMCS_ENTRY_INST_LENGTH as a VM_REG_GUEST_ENTRY_INST_LENGTH
pseudo-register.  Injecting a BP# on Intel requires setting this to
the length of the breakpoint instruction.  AMD SVM currently ignores
writes to this register (but reports success) and fails to read it.
  
  - Rework the per-vCPU state tracked by the debug server.  Rather than
a single 'stepping_vcpu' global, add a structure for each vCPU that
tracks state about that vCPU ('stepping', 'stepped', and
'hit_swbreak').  A global 'stopped_vcpu' tracks which vCPU is
currently reporting an event.  Event handlers for MTRAP and
breakpoint exits loop until the associated event is reported to the
debugger.
  
Breakpoint events are discarded if the breakpoint is not present
when a vCPU resumes in the breakpoint handler to retry submitting
the breakpoint event.
  
  - Maintain a linked-list of active breakpoints in response to the GDB
'Z0' and 'z0' packets.
  
  Reviewed by:  markj (earlier version)
  MFC after:2 months
  Differential Revision:https://reviews.freebsd.org/D20309

Modified:
  head/sys/amd64/include/vmm.h
  head/sys/amd64/vmm/amd/svm.c
  head/sys/amd64/vmm/intel/vmcs.c
  head/sys/amd64/vmm/intel/vmx.c
  head/sys/amd64/vmm/intel/vmx.h
  head/usr.sbin/bhyve/bhyve.8
  head/usr.sbin/bhyve/bhyverun.c
  head/usr.sbin/bhyve/gdb.c
  head/usr.sbin/bhyve/gdb.h

Modified: head/sys/amd64/include/vmm.h
==
--- head/sys/amd64/include/vmm.hFri Dec 13 18:44:02 2019
(r355723)
+++ head/sys/amd64/include/vmm.hFri Dec 13 19:21:58 2019
(r355724)
@@ -95,6 +95,7 @@ enum vm_reg_name {
VM_REG_GUEST_DR2,
VM_REG_GUEST_DR3,
VM_REG_GUEST_DR6,
+   VM_REG_GUEST_ENTRY_INST_LENGTH,
VM_REG_LAST
 };
 
@@ -455,6 +456,7 @@ enum vm_cap_type {
VM_CAP_PAUSE_EXIT,
VM_CAP_UNRESTRICTED_GUEST,
VM_CAP_ENABLE_INVPCID,
+   VM_CAP_BPT_EXIT,
VM_CAP_MAX
 };
 
@@ -580,6 +582,7 @@ enum vm_exitcode {
VM_EXITCODE_REQIDLE,
VM_EXITCODE_DEBUG,
VM_EXITCODE_VMINSN,
+   VM_EXITCODE_BPT,
VM_EXITCODE_MAX
 };
 
@@ -666,6 +669,9 @@ struct vm_exit {
uint64_texitinfo1;
uint64_texitinfo2;
} svm;
+   struct {
+   int inst_length;
+   } bpt;
struct {
uint32_tcode;   /* ecx value */
uint64_twval;

Modified: head/sys/amd64/vmm/amd/svm.c
==
--- head/sys/amd64/vmm/amd/svm.cFri Dec 13 18:44:02 2019
(r355723)
+++ head/sys/amd64/vmm/amd/svm.cFri Dec 13 19:21:58 2019
(r355724)
@@ -2187,6 +2187,11 @@ svm_setreg(void *arg, int vcpu, int ident, uint64_t va
return (0);
}
 
+   if (ident == VM_REG_GUEST_ENTRY_INST_LENGTH) {
+   /* Ignore. */
+   return (0);
+   }
+
/*
 * XXX deal with CR3 and invalidate TLB entries tagged with the
 * vcpu's ASID. This needs to be treated differently depending on

Modified: head/sys/amd64/vmm/intel/vmcs.c
==
--- head/sys/amd64/vmm/intel/vmcs.c Fri Dec 13 18:44:02 2019
(r355723)
+++ head/sys/amd64/vmm/intel/vmcs.c Fri Dec 13 19:21:58 2019
(r355724)
@@ -120,6 +120,8 @@ vmcs_field_encoding(int ident)
return (VMCS_GUEST_PDPTE2);
case VM_REG_GUEST_PDPTE3:
return (VMCS_GUEST_PDPTE3);
+   case VM_REG_GUEST_ENTRY_INST_LENGTH:
+   return (VMCS_ENTRY_INST_LENGTH);
default:
return (-1);
}

Modified: head/sys/amd64/vmm/intel/vmx.c
==
--- head/sys/amd64/vmm/intel/vmx.c  Fri Dec 13 18:44:02 2019
(r355723)
+++ head/sys/amd64/vmm/intel/vmx.c  Fri Dec 13 19:21:58 2019
(r355724)
@@ -1071,6 +1071,7 @@ vmx_vminit(struct vm *vm, pmap_t pmap)
vmx->cap[i].set = 0;
vmx->cap[i].proc_ctls = 

svn commit: r355723 - in head/sys: compat/linux kern sys

2019-12-13 Thread Edward Tomasz Napierala
Author: trasz
Date: Fri Dec 13 18:44:02 2019
New Revision: 355723
URL: https://svnweb.freebsd.org/changeset/base/355723

Log:
  Add kern_kill() and use it in Linuxulator.  It's just a cleanup,
  no functional changes.
  
  Reviewed by:  kib
  MFC after:2 weeks
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D22645

Modified:
  head/sys/compat/linux/linux_signal.c
  head/sys/kern/kern_sig.c
  head/sys/sys/syscallsubr.h

Modified: head/sys/compat/linux/linux_signal.c
==
--- head/sys/compat/linux/linux_signal.cFri Dec 13 18:39:36 2019
(r355722)
+++ head/sys/compat/linux/linux_signal.cFri Dec 13 18:44:02 2019
(r355723)
@@ -415,10 +415,7 @@ linux_rt_sigtimedwait(struct thread *td,
 int
 linux_kill(struct thread *td, struct linux_kill_args *args)
 {
-   struct kill_args /* {
-   int pid;
-   int signum;
-   } */ tmp;
+   int l_signum;
 
/*
 * Allow signal 0 as a means to check for privileges
@@ -427,12 +424,11 @@ linux_kill(struct thread *td, struct linux_kill_args *
return (EINVAL);
 
if (args->signum > 0)
-   tmp.signum = linux_to_bsd_signal(args->signum);
+   l_signum = linux_to_bsd_signal(args->signum);
else
-   tmp.signum = 0;
+   l_signum = 0;
 
-   tmp.pid = args->pid;
-   return (sys_kill(td, ));
+   return (kern_kill(td, args->pid, l_signum));
 }
 
 static int

Modified: head/sys/kern/kern_sig.c
==
--- head/sys/kern/kern_sig.cFri Dec 13 18:39:36 2019(r355722)
+++ head/sys/kern/kern_sig.cFri Dec 13 18:44:02 2019(r355723)
@@ -1772,6 +1772,13 @@ struct kill_args {
 int
 sys_kill(struct thread *td, struct kill_args *uap)
 {
+
+   return (kern_kill(td, uap->pid, uap->signum));
+}
+
+int
+kern_kill(struct thread *td, pid_t pid, int signum)
+{
ksiginfo_t ksi;
struct proc *p;
int error;
@@ -1781,38 +1788,38 @@ sys_kill(struct thread *td, struct kill_args *uap)
 * The main rationale behind this is that abort(3) is implemented as
 * kill(getpid(), SIGABRT).
 */
-   if (IN_CAPABILITY_MODE(td) && uap->pid != td->td_proc->p_pid)
+   if (IN_CAPABILITY_MODE(td) && pid != td->td_proc->p_pid)
return (ECAPMODE);
 
-   AUDIT_ARG_SIGNUM(uap->signum);
-   AUDIT_ARG_PID(uap->pid);
-   if ((u_int)uap->signum > _SIG_MAXSIG)
+   AUDIT_ARG_SIGNUM(signum);
+   AUDIT_ARG_PID(pid);
+   if ((u_int)signum > _SIG_MAXSIG)
return (EINVAL);
 
ksiginfo_init();
-   ksi.ksi_signo = uap->signum;
+   ksi.ksi_signo = signum;
ksi.ksi_code = SI_USER;
ksi.ksi_pid = td->td_proc->p_pid;
ksi.ksi_uid = td->td_ucred->cr_ruid;
 
-   if (uap->pid > 0) {
+   if (pid > 0) {
/* kill single process */
-   if ((p = pfind_any(uap->pid)) == NULL)
+   if ((p = pfind_any(pid)) == NULL)
return (ESRCH);
AUDIT_ARG_PROCESS(p);
-   error = p_cansignal(td, p, uap->signum);
-   if (error == 0 && uap->signum)
-   pksignal(p, uap->signum, );
+   error = p_cansignal(td, p, signum);
+   if (error == 0 && signum)
+   pksignal(p, signum, );
PROC_UNLOCK(p);
return (error);
}
-   switch (uap->pid) {
+   switch (pid) {
case -1:/* broadcast signal */
-   return (killpg1(td, uap->signum, 0, 1, ));
+   return (killpg1(td, signum, 0, 1, ));
case 0: /* signal own process group */
-   return (killpg1(td, uap->signum, 0, 0, ));
+   return (killpg1(td, signum, 0, 0, ));
default:/* negative explicit process group */
-   return (killpg1(td, uap->signum, -uap->pid, 0, ));
+   return (killpg1(td, signum, -pid, 0, ));
}
/* NOTREACHED */
 }

Modified: head/sys/sys/syscallsubr.h
==
--- head/sys/sys/syscallsubr.h  Fri Dec 13 18:39:36 2019(r355722)
+++ head/sys/sys/syscallsubr.h  Fri Dec 13 18:44:02 2019(r355723)
@@ -156,6 +156,7 @@ int kern_kevent_anonymous(struct thread *td, int neven
 intkern_kevent_fp(struct thread *td, struct file *fp, int nchanges,
int nevents, struct kevent_copyops *k_ops,
const struct timespec *timeout);
+intkern_kill(struct thread *td, pid_t pid, int signum);
 intkern_kqueue(struct thread *td, int flags, struct filecaps *fcaps);
 intkern_kldload(struct thread *td, const char *file, int *fileid);
 int

svn commit: r355722 - in head/sys: compat/linux kern sys

2019-12-13 Thread Edward Tomasz Napierala
Author: trasz
Date: Fri Dec 13 18:39:36 2019
New Revision: 355722
URL: https://svnweb.freebsd.org/changeset/base/355722

Log:
  Add kern_getsid() and use it in Linuxulator; no functional changes.
  
  Reviewed by:  kib
  MFC after:2 weeks
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D22647

Modified:
  head/sys/compat/linux/linux_misc.c
  head/sys/kern/kern_prot.c
  head/sys/sys/syscallsubr.h

Modified: head/sys/compat/linux/linux_misc.c
==
--- head/sys/compat/linux/linux_misc.c  Fri Dec 13 18:35:48 2019
(r355721)
+++ head/sys/compat/linux/linux_misc.c  Fri Dec 13 18:39:36 2019
(r355722)
@@ -1599,14 +1599,11 @@ linux_getuid(struct thread *td, struct linux_getuid_ar
return (0);
 }
 
-
 int
 linux_getsid(struct thread *td, struct linux_getsid_args *args)
 {
-   struct getsid_args bsd;
 
-   bsd.pid = args->pid;
-   return (sys_getsid(td, ));
+   return (kern_getsid(td, args->pid));
 }
 
 int

Modified: head/sys/kern/kern_prot.c
==
--- head/sys/kern/kern_prot.c   Fri Dec 13 18:35:48 2019(r355721)
+++ head/sys/kern/kern_prot.c   Fri Dec 13 18:39:36 2019(r355722)
@@ -190,14 +190,21 @@ struct getsid_args {
 int
 sys_getsid(struct thread *td, struct getsid_args *uap)
 {
+
+   return (kern_getsid(td, uap->pid));
+}
+
+int
+kern_getsid(struct thread *td, pid_t pid)
+{
struct proc *p;
int error;
 
-   if (uap->pid == 0) {
+   if (pid == 0) {
p = td->td_proc;
PROC_LOCK(p);
} else {
-   p = pfind(uap->pid);
+   p = pfind(pid);
if (p == NULL)
return (ESRCH);
error = p_cansee(td, p);

Modified: head/sys/sys/syscallsubr.h
==
--- head/sys/sys/syscallsubr.h  Fri Dec 13 18:35:48 2019(r355721)
+++ head/sys/sys/syscallsubr.h  Fri Dec 13 18:39:36 2019(r355722)
@@ -140,6 +140,7 @@ int kern_getppid(struct thread *);
 intkern_getpeername(struct thread *td, int fd, struct sockaddr **sa,
socklen_t *alen);
 intkern_getrusage(struct thread *td, int who, struct rusage *rup);
+intkern_getsid(struct thread *td, pid_t pid);
 intkern_getsockname(struct thread *td, int fd, struct sockaddr **sa,
socklen_t *alen);
 intkern_getsockopt(struct thread *td, int s, int level, int 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: r355721 - head/sys/dev/nvme

2019-12-13 Thread Warner Losh
Author: imp
Date: Fri Dec 13 18:35:48 2019
New Revision: 355721
URL: https://svnweb.freebsd.org/changeset/base/355721

Log:
  Move to using bool instead of boolean_t
  
  While there are subtle semantic differences between bool and boolean_t, none 
of
  them matter in these cases. Prefer true/false when dealing with bool
  type. Preserve a couple of TRUEs since they are passed into int args into CAM.
  Preserve a couple of FALSEs when used for status.done, an int.
  
  Differential Revision: https://reviews.freebsd.org/D20999

Modified:
  head/sys/dev/nvme/nvme_ctrlr.c
  head/sys/dev/nvme/nvme_private.h
  head/sys/dev/nvme/nvme_qpair.c

Modified: head/sys/dev/nvme/nvme_ctrlr.c
==
--- head/sys/dev/nvme/nvme_ctrlr.c  Fri Dec 13 18:28:01 2019
(r355720)
+++ head/sys/dev/nvme/nvme_ctrlr.c  Fri Dec 13 18:35:48 2019
(r355721)
@@ -181,7 +181,7 @@ nvme_ctrlr_fail(struct nvme_controller *ctrlr)
 {
int i;
 
-   ctrlr->is_failed = TRUE;
+   ctrlr->is_failed = true;
nvme_admin_qpair_disable(>adminq);
nvme_qpair_fail(>adminq);
if (ctrlr->ioq != NULL) {
@@ -546,7 +546,7 @@ nvme_ctrlr_construct_namespaces(struct nvme_controller
return (0);
 }
 
-static boolean_t
+static bool
 is_log_page_id_valid(uint8_t page_id)
 {
 
@@ -558,10 +558,10 @@ is_log_page_id_valid(uint8_t page_id)
case NVME_LOG_COMMAND_EFFECT:
case NVME_LOG_RES_NOTIFICATION:
case NVME_LOG_SANITIZE_STATUS:
-   return (TRUE);
+   return (true);
}
 
-   return (FALSE);
+   return (false);
 }
 
 static uint32_t
@@ -782,7 +782,7 @@ nvme_ctrlr_construct_and_submit_aer(struct nvme_contro
 * Disable timeout here, since asynchronous event requests should by
 *  nature never be timed out.
 */
-   req->timeout = FALSE;
+   req->timeout = false;
req->cmd.opc = NVME_OPC_ASYNC_EVENT_REQUEST;
nvme_ctrlr_submit_admin_request(ctrlr, req);
 }
@@ -1198,7 +1198,7 @@ nvme_ctrlr_construct(struct nvme_controller *ctrlr, de
TASK_INIT(>reset_task, 0, nvme_ctrlr_reset_task, ctrlr);
TASK_INIT(>fail_req_task, 0, nvme_ctrlr_fail_req_task, ctrlr);
STAILQ_INIT(>fail_req);
-   ctrlr->is_failed = FALSE;
+   ctrlr->is_failed = false;
 
make_dev_args_init(_args);
md_args.mda_devsw = _ctrlr_cdevsw;

Modified: head/sys/dev/nvme/nvme_private.h
==
--- head/sys/dev/nvme/nvme_private.hFri Dec 13 18:28:01 2019
(r355720)
+++ head/sys/dev/nvme/nvme_private.hFri Dec 13 18:35:48 2019
(r355721)
@@ -141,7 +141,7 @@ struct nvme_request {
} u;
uint32_ttype;
uint32_tpayload_size;
-   boolean_t   timeout;
+   booltimeout;
nvme_cb_fn_tcb_fn;
void*cb_arg;
int32_t retries;
@@ -214,7 +214,7 @@ struct nvme_qpair {
 
struct nvme_tracker **act_tr;
 
-   boolean_t   is_enabled;
+   boolis_enabled;
 
struct mtx  lock __aligned(CACHE_LINE_SIZE);
 
@@ -322,7 +322,7 @@ struct nvme_controller {
uint32_tis_initialized;
uint32_tnotification_sent;
 
-   boolean_t   is_failed;
+   boolis_failed;
STAILQ_HEAD(, nvme_request) fail_req;
 };
 
@@ -487,7 +487,7 @@ _nvme_allocate_request(nvme_cb_fn_t cb_fn, void *cb_ar
if (req != NULL) {
req->cb_fn = cb_fn;
req->cb_arg = cb_arg;
-   req->timeout = TRUE;
+   req->timeout = true;
}
return (req);
 }

Modified: head/sys/dev/nvme/nvme_qpair.c
==
--- head/sys/dev/nvme/nvme_qpair.c  Fri Dec 13 18:28:01 2019
(r355720)
+++ head/sys/dev/nvme/nvme_qpair.c  Fri Dec 13 18:35:48 2019
(r355721)
@@ -357,7 +357,7 @@ nvme_qpair_print_completion(struct nvme_qpair *qpair,
cpl->cdw0);
 }
 
-static boolean_t
+static bool
 nvme_completion_is_retry(const struct nvme_completion *cpl)
 {
uint8_t sct, sc, dnr;
@@ -423,7 +423,7 @@ nvme_qpair_complete_tracker(struct nvme_tracker *tr,
 {
struct nvme_qpair * qpair = tr->qpair;
struct nvme_request *req;
-   boolean_t   retry, error, retriable;
+   boolretry, error, retriable;
 
req = tr->req;
error = nvme_completion_is_error(cpl);
@@ -508,7 +508,7 @@ nvme_qpair_manual_complete_request(struct nvme_qpair *
 struct nvme_request *req, uint32_t sct, uint32_t sc)
 {

svn commit: r355720 - head/sys/vm

2019-12-13 Thread Mark Johnston
Author: markj
Date: Fri Dec 13 18:28:01 2019
New Revision: 355720
URL: https://svnweb.freebsd.org/changeset/base/355720

Log:
  Restore the reservation of boot pages for bucket zones after r355707.
  
  uma_startup2() sets booted = BOOT_BUCKETS after calling bucket_init(),
  but before that assignment, startup_alloc() will use pages from the
  reserved pool, so the bucket zones themselves are still allocated using
  startup pages.
  
  Reviewed by:  rlibby
  Reported by:  Jenkins via lwhsu
  Differential Revision:https://reviews.freebsd.org/D22797

Modified:
  head/sys/vm/uma_core.c

Modified: head/sys/vm/uma_core.c
==
--- head/sys/vm/uma_core.c  Fri Dec 13 18:18:14 2019(r355719)
+++ head/sys/vm/uma_core.c  Fri Dec 13 18:28:01 2019(r355720)
@@ -2295,10 +2295,10 @@ zone_foreach(void (*zfunc)(uma_zone_t, void *arg), voi
 /*
  * Count how many pages do we need to bootstrap.  VM supplies
  * its need in early zones in the argument, we add up our zones,
- * which consist of the UMA Slabs and UMA Hash zones. The
+ * which consist of the UMA Slabs, UMA Hash and 9 Bucket zones.  The
  * zone of zones and zone of kegs are accounted separately.
  */
-#defineUMA_BOOT_ZONES  2
+#defineUMA_BOOT_ZONES  11
 /* Zone of zones and zone of kegs have arbitrary alignment. */
 #defineUMA_BOOT_ALIGN  32
 static int zsize, ksize;
___
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: r355719 - head/sys/sys

2019-12-13 Thread Brandon Bergren
Author: bdragon
Date: Fri Dec 13 18:18:14 2019
New Revision: 355719
URL: https://svnweb.freebsd.org/changeset/base/355719

Log:
  [PowerPC] Enable TLS usage in system libraries on ELFv2.
  
  Currently, __NO_TLS is defined to 1 on powerpc64. TLS usage works much
  better on ELFv2 due to the modern tooling, so take the opportunity to
  reenable TLS on ELFv2.
  
  If you are using a self-built ELFv2 environment on powerpc64, you will
  have to run installworld twice due to RuneLocale changes. This is the only
  known regression, and if you are using the ELFv2 isos, you likely already
  have the updated libraries installed, as this change is part of the
  patchset that the isos integrate.
  
  (No UPDATING note about this because ELFv2 is still an unofficial build.)
  
  Reviewed by:  luporl, Alfredo Dal'Ava Junior 
  Differential Revision:https://reviews.freebsd.org/D22524

Modified:
  head/sys/sys/cdefs.h

Modified: head/sys/sys/cdefs.h
==
--- head/sys/sys/cdefs.hFri Dec 13 17:52:09 2019(r355718)
+++ head/sys/sys/cdefs.hFri Dec 13 18:18:14 2019(r355719)
@@ -774,7 +774,8 @@
 #endif
 #endif /* __STDC_WANT_LIB_EXT1__ */
 
-#if defined(__mips) || defined(__powerpc64__) || defined(__riscv)
+#if defined(__mips) || defined(__riscv) || \
+(defined(__powerpc64__) && (!defined(_CALL_ELF) || _CALL_ELF == 1))
 #define__NO_TLS 1
 #endif
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r355718 - head/sbin/devd

2019-12-13 Thread Alexander Motin
Author: mav
Date: Fri Dec 13 17:52:09 2019
New Revision: 355718
URL: https://svnweb.freebsd.org/changeset/base/355718

Log:
  Fix $() handling, broken since the beginning at r108014.
  
  Due to off-by-one error in brackets counting it consumed the rest of the
  string, preventing later variables expansions.
  
  MFC after:2 weeks
  Sponsored by: iXsystems, Inc.

Modified:
  head/sbin/devd/devd.cc

Modified: head/sbin/devd/devd.cc
==
--- head/sbin/devd/devd.cc  Fri Dec 13 16:51:56 2019(r355717)
+++ head/sbin/devd/devd.cc  Fri Dec 13 17:52:09 2019(r355718)
@@ -681,15 +681,15 @@ config::expand_one(const char *, string , bool
// This is the escape hatch for passing down shell subcommands
if (*src == '(') {
dst += '$';
-   count = 1;
+   count = 0;
/* If the string ends before ) is matched , return. */
-   while (count > 0 && *src) {
+   do {
if (*src == ')')
count--;
else if (*src == '(')
count++;
dst += *src++;
-   }
+   } while (count > 0 && *src);
return;
}
 
___
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: r355717 - vendor-sys/acpica/20191213

2019-12-13 Thread Jung-uk Kim
Author: jkim
Date: Fri Dec 13 16:51:56 2019
New Revision: 355717
URL: https://svnweb.freebsd.org/changeset/base/355717

Log:
  Tag ACPICA 20191213.

Added:
  vendor-sys/acpica/20191213/
 - copied from r355716, vendor-sys/acpica/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: r355716 - in vendor-sys/acpica/dist: . source/common source/compiler source/components/debugger source/components/dispatcher source/components/executer source/components/hardware source...

2019-12-13 Thread Jung-uk Kim
Author: jkim
Date: Fri Dec 13 16:51:08 2019
New Revision: 355716
URL: https://svnweb.freebsd.org/changeset/base/355716

Log:
  Import ACPICA 20191213.

Modified:
  vendor-sys/acpica/dist/changes.txt
  vendor-sys/acpica/dist/source/common/dmtables.c
  vendor-sys/acpica/dist/source/compiler/aslcompile.c
  vendor-sys/acpica/dist/source/compiler/aslcompiler.y
  vendor-sys/acpica/dist/source/compiler/asldefine.h
  vendor-sys/acpica/dist/source/compiler/aslerror.c
  vendor-sys/acpica/dist/source/compiler/aslfiles.c
  vendor-sys/acpica/dist/source/compiler/aslload.c
  vendor-sys/acpica/dist/source/compiler/aslmessages.c
  vendor-sys/acpica/dist/source/compiler/aslmessages.h
  vendor-sys/acpica/dist/source/compiler/aslmethod.c
  vendor-sys/acpica/dist/source/compiler/asloptions.c
  vendor-sys/acpica/dist/source/compiler/aslstartup.c
  vendor-sys/acpica/dist/source/compiler/asltransform.c
  vendor-sys/acpica/dist/source/compiler/aslutils.c
  vendor-sys/acpica/dist/source/compiler/aslxref.c
  vendor-sys/acpica/dist/source/compiler/dtcompile.c
  vendor-sys/acpica/dist/source/compiler/dtcompiler.h
  vendor-sys/acpica/dist/source/compiler/dttable2.c
  vendor-sys/acpica/dist/source/components/debugger/dbinput.c
  vendor-sys/acpica/dist/source/components/debugger/dbnames.c
  vendor-sys/acpica/dist/source/components/dispatcher/dsfield.c
  vendor-sys/acpica/dist/source/components/dispatcher/dsopcode.c
  vendor-sys/acpica/dist/source/components/dispatcher/dswload.c
  vendor-sys/acpica/dist/source/components/executer/exfield.c
  vendor-sys/acpica/dist/source/components/hardware/hwxfsleep.c
  vendor-sys/acpica/dist/source/components/utilities/utids.c
  vendor-sys/acpica/dist/source/include/acobject.h
  vendor-sys/acpica/dist/source/include/acpixf.h
  vendor-sys/acpica/dist/source/include/platform/acenv.h
  vendor-sys/acpica/dist/source/tools/acpinames/anstubs.c
  vendor-sys/acpica/dist/source/tools/acpisrc/asmain.c
  vendor-sys/acpica/dist/source/tools/acpisrc/astable.c
  vendor-sys/acpica/dist/tests/misc/badcode.asl

Modified: vendor-sys/acpica/dist/changes.txt
==
--- vendor-sys/acpica/dist/changes.txt  Fri Dec 13 16:28:48 2019
(r355715)
+++ vendor-sys/acpica/dist/changes.txt  Fri Dec 13 16:51:08 2019
(r355716)
@@ -1,4 +1,25 @@
 
+13 December 2019. Summary of changes for version 20191213:
+
+
+1) ACPICA kernel-resident subsystem:
+
+Return a Buffer object for all fields created via the CreateField operator. 
Previously, an Integer would be returned if the size of the field was less than 
or equal to the current size of an Integer. Although this goes against the ACPI 
specification, it provides compatibility with other ACPI implementations. Also 
updated the ASLTS test suite to reflect this new behavior.
+
+2) iASL Compiler/Disassembler and ACPICA tools:
+
+iASL: Implemented detection of (and throw an error for) duplicate values for 
Case statements within a single Switch statement. Duplicate Integers, Strings, 
and Buffers are supported.
+
+iASL: Fix error logging issue during multiple file compilation -- Switch to 
the correct input file during error node creation.
+
+iASL: For duplicate named object creation, now emit an error instead of a 
warning - since this will cause a runtime error.
+
+AcpiSrc: Add unix line-ending support for non-Windows builds.
+
+iASL: Add an error condition for an attempt to create a NameString with > 255 
NameSegs (the max allowable via the AML definition).
+
+
+
 18 October 2019. Summary of changes for version 20191018:
 
 

Modified: vendor-sys/acpica/dist/source/common/dmtables.c
==
--- vendor-sys/acpica/dist/source/common/dmtables.c Fri Dec 13 16:28:48 
2019(r355715)
+++ vendor-sys/acpica/dist/source/common/dmtables.c Fri Dec 13 16:51:08 
2019(r355716)
@@ -508,6 +508,8 @@ AdParseTable (
 AmlStart = ((UINT8 *) Table + sizeof (ACPI_TABLE_HEADER));
 ASL_CV_INIT_FILETREE(Table, AmlStart, AmlLength);
 
+AcpiUtSetIntegerWidth (Table->Revision);
+
 /* Create the root object */
 
 AcpiGbl_ParseOpRoot = AcpiPsCreateScopeOp (AmlStart);
@@ -543,7 +545,6 @@ AdParseTable (
 }
 
 WalkState->ParseFlags &= ~ACPI_PARSE_DELETE_TREE;
-WalkState->ParseFlags |= ACPI_PARSE_DISASSEMBLE;
 
 Status = AcpiPsParseAml (WalkState);
 if (ACPI_FAILURE (Status))

Modified: vendor-sys/acpica/dist/source/compiler/aslcompile.c
==
--- vendor-sys/acpica/dist/source/compiler/aslcompile.c Fri Dec 13 16:28:48 
2019(r355715)
+++ vendor-sys/acpica/dist/source/compiler/aslcompile.c Fri Dec 13 16:51:08 
2019(r355716)
@@ -220,6 +220,7 @@ CmDoCompile (
 PrDoPreprocess ();
 AslGbl_Curre

svn commit: r355715 - head

2019-12-13 Thread Rick Macklem
Author: rmacklem
Date: Fri Dec 13 16:28:48 2019
New Revision: 355715
URL: https://svnweb.freebsd.org/changeset/base/355715

Log:
  Add an entry to RELNOTES for r355677.

Modified:
  head/RELNOTES

Modified: head/RELNOTES
==
--- head/RELNOTES   Fri Dec 13 14:48:44 2019(r355714)
+++ head/RELNOTES   Fri Dec 13 16:28:48 2019(r355715)
@@ -10,6 +10,28 @@ newline.  Entries should be separated by a newline.
 
 Changes to this file should not be MFCed.
 
+r355677:
+   Adds support for NFSv4.2 (RFC-7862) and Extended Attributes
+   (RFC-8276) to the NFS client and server.
+   NFSv4.2 is comprised of several optional features that can be supported
+   in addition to NFSv4.1. This patch adds the following optional features:
+   - posix_fadvise(POSIX_FADV_WILLNEED/POSIX_FADV_DONTNEED)
+   - posix_fallocate()
+   - intra server file range copying via the copy_file_range(2) syscall
+   --> Avoiding data tranfer over the wire to/from the NFS client.
+   - lseek(SEEK_DATA/SEEK_HOLE)
+   - Extended attribute syscalls for "user" namespace attributes as defined
+ by RFC-8276.
+   
+   For the client, NFSv4.2 is only used if the mount command line option
+   minorversion=2 is specified.
+   For the server, two new sysctls called vfs.nfsd.server_min_minorversion4
+   and vfs.nfsd.server_max_minorversion4 have been added that allow
+   sysadmins to limit the minor versions of NFSv4 supported by the nfsd
+   server.
+   Setting vfs.nfsd.server_max_minorversion4 to 0 or 1 will disable NFSv4.2
+   on the server.
+
 r354517:
iwm(4) now supports most Intel 9260, 9460 and 9560 Wi-Fi devices.
 
___
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: r355609 - head

2019-12-13 Thread Ed Maste
On Thu, 12 Dec 2019 at 18:46, Bryan Drewery  wrote:
>
> What ever happened to POLA?
>
> Name 1 good reason this should be an .error?! Or even a .warning for
> that matter.
>
> The argument I keep hearing is "we have to maintain these 3 lines of
> code", ok, well now it's just an annoyance to maintain with no benefit
> to the user.

If it's an error now it can eventually be removed. I'm trying to move
the clean logic to follow standard WITH_/WITHOUT_ so that we can
eventually change the default.

Anyway I've reverted it and will just abandon this.
___
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: r355714 - head

2019-12-13 Thread Ed Maste
Author: emaste
Date: Fri Dec 13 14:48:44 2019
New Revision: 355714
URL: https://svnweb.freebsd.org/changeset/base/355714

Log:
  revert r355609

Modified:
  head/Makefile.inc1

Modified: head/Makefile.inc1
==
--- head/Makefile.inc1  Fri Dec 13 12:36:16 2019(r355713)
+++ head/Makefile.inc1  Fri Dec 13 14:48:44 2019(r355714)
@@ -458,7 +458,8 @@ SUBDIR+=etc
 .endif # !empty(SUBDIR_OVERRIDE)
 
 .if defined(NOCLEAN)
-.error NOCLEAN option is deprecated. Use NO_CLEAN instead.
+.warning NOCLEAN option is deprecated. Use NO_CLEAN instead.
+NO_CLEAN=  ${NOCLEAN}
 .endif
 .if defined(NO_CLEANDIR)
 CLEANDIR=  clean cleandepend
___
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: r341578 - head/sys/dev/mlx5/mlx5_en

2019-12-13 Thread Hans Petter Selasky

On 2019-12-13 14:40, Andrey V. Elsukov wrote:

On 05.12.2018 17:20, Slava Shwartsman wrote:

Author: slavash
Date: Wed Dec  5 14:20:57 2018
New Revision: 341578
URL: https://svnweb.freebsd.org/changeset/base/341578

Log:
   mlx5en: Remove the DRBR and associated logic in the transmit path.
   
   The hardware queues are deep enough currently and using the DRBR and associated

   callbacks only leads to more task switching in the TX path. The is also a 
race
   setting the queue_state which can lead to hung TX rings.


JFYI. We have compared the same router+firewall workloads on the host
with this change and before, and I can say, that without DRBR on TX now
we constantly have several percents of packets drops due to ENOBUFS
error from mlx5e_xmit().



Have you tried to tune the TX/RX parameters?

Especially the tx_queue_size .

--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: r341578 - head/sys/dev/mlx5/mlx5_en

2019-12-13 Thread Andrey V. Elsukov
On 05.12.2018 17:20, Slava Shwartsman wrote:
> Author: slavash
> Date: Wed Dec  5 14:20:57 2018
> New Revision: 341578
> URL: https://svnweb.freebsd.org/changeset/base/341578
> 
> Log:
>   mlx5en: Remove the DRBR and associated logic in the transmit path.
>   
>   The hardware queues are deep enough currently and using the DRBR and 
> associated
>   callbacks only leads to more task switching in the TX path. The is also a 
> race
>   setting the queue_state which can lead to hung TX rings.

JFYI. We have compared the same router+firewall workloads on the host
with this change and before, and I can say, that without DRBR on TX now
we constantly have several percents of packets drops due to ENOBUFS
error from mlx5e_xmit().

-- 
WBR, Andrey V. Elsukov



signature.asc
Description: OpenPGP digital signature


svn commit: r355713 - head/stand/libsa

2019-12-13 Thread Toomas Soome
Author: tsoome
Date: Fri Dec 13 12:36:16 2019
New Revision: 355713
URL: https://svnweb.freebsd.org/changeset/base/355713

Log:
  loader: cd9660_open() warn: is 'buf' large enough for 'struct 
iso_primary_descriptor'?
  
  We do allocate amount of memory (void * or char *), and then assign this
  buffer to struct iso_primary_descriptor *vd. Make sure we do
  allocate enough bytes.
  
  In fact we do allocate enough, but it is good idea to make sure this really
  is so.
  
  MFC after:1 week

Modified:
  head/stand/libsa/cd9660.c
  head/stand/libsa/cd9660read.c

Modified: head/stand/libsa/cd9660.c
==
--- head/stand/libsa/cd9660.c   Fri Dec 13 11:47:58 2019(r355712)
+++ head/stand/libsa/cd9660.c   Fri Dec 13 12:36:16 2019(r355713)
@@ -286,7 +286,7 @@ cd9660_open(const char *path, struct open_file *f)
struct file *fp = NULL;
void *buf;
struct iso_primary_descriptor *vd;
-   size_t buf_size, read, dsize, off;
+   size_t read, dsize, off;
daddr_t bno, boff;
struct iso_directory_record rec;
struct iso_directory_record *dp = NULL;
@@ -294,7 +294,8 @@ cd9660_open(const char *path, struct open_file *f)
bool isdir = false;
 
/* First find the volume descriptor */
-   buf = malloc(buf_size = ISO_DEFAULT_BLOCK_SIZE);
+   buf = malloc(MAX(ISO_DEFAULT_BLOCK_SIZE,
+   sizeof(struct iso_primary_descriptor)));
vd = buf;
for (bno = 16;; bno++) {
twiddle(1);
@@ -438,8 +439,7 @@ cd9660_open(const char *path, struct open_file *f)
return 0;
 
 out:
-   if (fp)
-   free(fp);
+   free(fp);
free(buf);
 
return rc;

Modified: head/stand/libsa/cd9660read.c
==
--- head/stand/libsa/cd9660read.c   Fri Dec 13 11:47:58 2019
(r355712)
+++ head/stand/libsa/cd9660read.c   Fri Dec 13 12:36:16 2019
(r355713)
@@ -35,6 +35,7 @@
 #include 
 __FBSDID("$FreeBSD$");
 
+#include 
 #include 
 #include 
 
@@ -220,7 +221,8 @@ dirmatch(const char *path, struct iso_directory_record
 static uint64_t
 cd9660_lookup(const char *path)
 {
-   static char blkbuf[ISO_DEFAULT_BLOCK_SIZE];
+   static char blkbuf[MAX(ISO_DEFAULT_BLOCK_SIZE,
+   sizeof(struct iso_primary_descriptor))];
struct iso_primary_descriptor *vd;
struct iso_directory_record rec;
struct iso_directory_record *dp = 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"


svn commit: r355712 - head/sys/netpfil/ipfw

2019-12-13 Thread Andrey V. Elsukov
Author: ae
Date: Fri Dec 13 11:47:58 2019
New Revision: 355712
URL: https://svnweb.freebsd.org/changeset/base/355712

Log:
  Make TCP options parsing stricter.
  
  Rework tcpopts_parse() to be more strict. Use const pointer. Add length
  checks for specific TCP options. The main purpose of the change is
  avoiding of possible out of mbuf's data access.
  
  Reported by:  Maxime Villard
  Reviewed by:  melifaro, emaste
  MFC after:1 week

Modified:
  head/sys/netpfil/ipfw/ip_fw2.c

Modified: head/sys/netpfil/ipfw/ip_fw2.c
==
--- head/sys/netpfil/ipfw/ip_fw2.c  Fri Dec 13 11:21:28 2019
(r355711)
+++ head/sys/netpfil/ipfw/ip_fw2.c  Fri Dec 13 11:47:58 2019
(r355712)
@@ -330,22 +330,27 @@ ipopts_match(struct ip *ip, ipfw_insn *cmd)
return (flags_match(cmd, bits));
 }
 
+/*
+ * Parse TCP options. The logic copied from tcp_dooptions().
+ */
 static int
-tcpopts_parse(struct tcphdr *tcp, uint16_t *mss)
+tcpopts_parse(const struct tcphdr *tcp, uint16_t *mss)
 {
-   u_char *cp = (u_char *)(tcp + 1);
+   const u_char *cp = (const u_char *)(tcp + 1);
int optlen, bits = 0;
-   int x = (tcp->th_off << 2) - sizeof(struct tcphdr);
+   int cnt = (tcp->th_off << 2) - sizeof(struct tcphdr);
 
-   for (; x > 0; x -= optlen, cp += optlen) {
+   for (; cnt > 0; cnt -= optlen, cp += optlen) {
int opt = cp[0];
if (opt == TCPOPT_EOL)
break;
if (opt == TCPOPT_NOP)
optlen = 1;
else {
+   if (cnt < 2)
+   break;
optlen = cp[1];
-   if (optlen <= 0)
+   if (optlen < 2 || optlen > cnt)
break;
}
 
@@ -354,22 +359,31 @@ tcpopts_parse(struct tcphdr *tcp, uint16_t *mss)
break;
 
case TCPOPT_MAXSEG:
+   if (optlen != TCPOLEN_MAXSEG)
+   break;
bits |= IP_FW_TCPOPT_MSS;
if (mss != NULL)
*mss = be16dec(cp + 2);
break;
 
case TCPOPT_WINDOW:
-   bits |= IP_FW_TCPOPT_WINDOW;
+   if (optlen == TCPOLEN_WINDOW)
+   bits |= IP_FW_TCPOPT_WINDOW;
break;
 
case TCPOPT_SACK_PERMITTED:
+   if (optlen == TCPOLEN_SACK_PERMITTED)
+   bits |= IP_FW_TCPOPT_SACK;
+   break;
+
case TCPOPT_SACK:
-   bits |= IP_FW_TCPOPT_SACK;
+   if (optlen > 2 && (optlen - 2) % TCPOLEN_SACK == 0)
+   bits |= IP_FW_TCPOPT_SACK;
break;
 
case TCPOPT_TIMESTAMP:
-   bits |= IP_FW_TCPOPT_TS;
+   if (optlen == TCPOLEN_TIMESTAMP)
+   bits |= IP_FW_TCPOPT_TS;
break;
}
}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r355711 - in head: lib/libmemstat sys/vm

2019-12-13 Thread Ryan Libby
Author: rlibby
Date: Fri Dec 13 11:21:28 2019
New Revision: 355711
URL: https://svnweb.freebsd.org/changeset/base/355711

Log:
  Revert r355706 & r355710
  
  The quick fix didn't work.  I'll sort it out tomorrow.
  
  Revert r355710: "libmemstat: unbreak build"
  Revert r355706: "uma dbg: flexible size for slab debug bitset too"

Modified:
  head/lib/libmemstat/memstat_uma.c
  head/sys/vm/uma_core.c
  head/sys/vm/uma_int.h

Modified: head/lib/libmemstat/memstat_uma.c
==
--- head/lib/libmemstat/memstat_uma.c   Fri Dec 13 10:34:19 2019
(r355710)
+++ head/lib/libmemstat/memstat_uma.c   Fri Dec 13 11:21:28 2019
(r355711)
@@ -31,7 +31,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 
 #include 

Modified: head/sys/vm/uma_core.c
==
--- head/sys/vm/uma_core.c  Fri Dec 13 10:34:19 2019(r355710)
+++ head/sys/vm/uma_core.c  Fri Dec 13 11:21:28 2019(r355711)
@@ -293,8 +293,6 @@ static int sysctl_handle_uma_zone_flags(SYSCTL_HANDLER
 static int sysctl_handle_uma_slab_efficiency(SYSCTL_HANDLER_ARGS);
 
 #ifdef INVARIANTS
-static inline struct noslabbits *slab_dbg_bits(uma_slab_t slab, uma_keg_t keg);
-
 static bool uma_dbg_kskip(uma_keg_t keg, void *mem);
 static bool uma_dbg_zskip(uma_zone_t zone, void *mem);
 static void uma_dbg_free(uma_zone_t zone, uma_slab_t slab, void *item);
@@ -1206,7 +1204,7 @@ keg_alloc_slab(uma_keg_t keg, uma_zone_t zone, int dom
slab->us_domain = domain;
BIT_FILL(keg->uk_ipers, >us_free);
 #ifdef INVARIANTS
-   BIT_ZERO(keg->uk_ipers, slab_dbg_bits(slab, keg));
+   BIT_ZERO(SLAB_MAX_SETSIZE, >us_debugfree);
 #endif
 
if (keg->uk_init != NULL) {
@@ -1489,15 +1487,6 @@ zero_init(void *mem, int size, int flags)
return (0);
 }
 
-#ifdef INVARIANTS
-struct noslabbits *
-slab_dbg_bits(uma_slab_t slab, uma_keg_t keg)
-{
-
-   return ((void *)((char *)>us_free + BITSET_SIZE(keg->uk_ipers)));
-}
-#endif
-
 /*
  * Actual size of embedded struct slab (!OFFPAGE).
  */
@@ -1506,7 +1495,7 @@ slab_sizeof(int nitems)
 {
size_t s;
 
-   s = sizeof(struct uma_slab) + BITSET_SIZE(nitems) * SLAB_BITSETS;
+   s = sizeof(struct uma_slab) + BITSET_SIZE(nitems);
return (roundup(s, UMA_ALIGN_PTR + 1));
 }
 
@@ -4552,10 +4541,12 @@ uma_dbg_alloc(uma_zone_t zone, uma_slab_t slab, void *
keg = zone->uz_keg;
freei = slab_item_index(slab, keg, item);
 
-   if (BIT_ISSET(keg->uk_ipers, freei, slab_dbg_bits(slab, keg)))
+   if (BIT_ISSET(SLAB_MAX_SETSIZE, freei, >us_debugfree))
panic("Duplicate alloc of %p from zone %p(%s) slab %p(%d)\n",
item, zone, zone->uz_name, slab, freei);
-   BIT_SET_ATOMIC(keg->uk_ipers, freei, slab_dbg_bits(slab, keg));
+   BIT_SET_ATOMIC(SLAB_MAX_SETSIZE, freei, >us_debugfree);
+
+   return;
 }
 
 /*
@@ -4586,11 +4577,11 @@ uma_dbg_free(uma_zone_t zone, uma_slab_t slab, void *i
panic("Unaligned free of %p from zone %p(%s) slab %p(%d)\n",
item, zone, zone->uz_name, slab, freei);
 
-   if (!BIT_ISSET(keg->uk_ipers, freei, slab_dbg_bits(slab, keg)))
+   if (!BIT_ISSET(SLAB_MAX_SETSIZE, freei, >us_debugfree))
panic("Duplicate free of %p from zone %p(%s) slab %p(%d)\n",
item, zone, zone->uz_name, slab, freei);
 
-   BIT_CLR_ATOMIC(keg->uk_ipers, freei, slab_dbg_bits(slab, keg));
+   BIT_CLR_ATOMIC(SLAB_MAX_SETSIZE, freei, >us_debugfree);
 }
 #endif /* INVARIANTS */
 

Modified: head/sys/vm/uma_int.h
==
--- head/sys/vm/uma_int.h   Fri Dec 13 10:34:19 2019(r355710)
+++ head/sys/vm/uma_int.h   Fri Dec 13 11:21:28 2019(r355711)
@@ -271,26 +271,17 @@ struct uma_slab {
uint16_tus_freecount;   /* How many are free? */
uint8_t us_flags;   /* Page flags see uma.h */
uint8_t us_domain;  /* Backing NUMA domain. */
-   struct noslabbits us_free;  /* Free bitmask, flexible. */
+#ifdef INVARIANTS
+   struct slabbits us_debugfree;   /* Debug bitmask. */
+#endif
+   struct noslabbits us_free;  /* Free bitmask. */
 };
-_Static_assert(sizeof(struct uma_slab) == offsetof(struct uma_slab, us_free),
-"us_free field must be last");
 #if MAXMEMDOM >= 255
 #error "Slab domain type insufficient"
 #endif
 
 typedef struct uma_slab * uma_slab_t;
 
-/*
- * On INVARIANTS builds, the slab contains a second bitset of the same size,
- * "dbg_bits", which is laid out immediately after us_free.
- */
-#ifdef INVARIANTS
-#defineSLAB_BITSETS2
-#else
-#defineSLAB_BITSETS1
-#endif
-
 /* These three functions are for embedded (!OFFPAGE) use only. */
 size_t 

svn commit: r355710 - head/lib/libmemstat

2019-12-13 Thread Ryan Libby
Author: rlibby
Date: Fri Dec 13 10:34:19 2019
New Revision: 355710
URL: https://svnweb.freebsd.org/changeset/base/355710

Log:
  libmemstat: unbreak build
  
  r355706 added an instance of offsetof() to the UMA private kernel header
  file uma_int.h.  Userspace memstat_uma.c includes that header, and
  chokes on offsetof() because apparently the definition in sys/types.h is
  ifdef _KERNEL.  Now, include sys/stddef.h which has an identical
  definition.
  
  Pointyhat to: rlibby
  Sponsored by: Dell EMC Isilon

Modified:
  head/lib/libmemstat/memstat_uma.c

Modified: head/lib/libmemstat/memstat_uma.c
==
--- head/lib/libmemstat/memstat_uma.c   Fri Dec 13 09:32:16 2019
(r355709)
+++ head/lib/libmemstat/memstat_uma.c   Fri Dec 13 10:34:19 2019
(r355710)
@@ -31,6 +31,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #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: r355709 - in head: share/man/man9 sys/i386/i386 sys/kern sys/sparc64/sparc64 sys/sys sys/x86/x86

2019-12-13 Thread Ryan Libby
Author: rlibby
Date: Fri Dec 13 09:32:16 2019
New Revision: 355709
URL: https://svnweb.freebsd.org/changeset/base/355709

Log:
  bitset: rename confusing macro NAND to ANDNOT
  
  s/BIT_NAND/BIT_ANDNOT/, and for CPU and DOMAINSET too.  The actual
  implementation is "and not" (or "but not"), i.e. A but not B.
  Fortunately this does appear to be what all existing callers want.
  
  Don't supply a NAND (not (A and B)) operation at this time.
  
  Discussed with:   jeff
  Reviewed by:  cem
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D22791

Modified:
  head/share/man/man9/Makefile
  head/share/man/man9/bitset.9
  head/share/man/man9/cpuset.9
  head/sys/i386/i386/vm_machdep.c
  head/sys/kern/kern_cpuset.c
  head/sys/kern/kern_rmlock.c
  head/sys/kern/sched_4bsd.c
  head/sys/kern/sched_ule.c
  head/sys/kern/subr_kdb.c
  head/sys/sparc64/sparc64/mp_machdep.c
  head/sys/sys/bitset.h
  head/sys/sys/cpuset.h
  head/sys/sys/domainset.h
  head/sys/x86/x86/cpu_machdep.c

Modified: head/share/man/man9/Makefile
==
--- head/share/man/man9/MakefileFri Dec 13 09:32:09 2019
(r355708)
+++ head/share/man/man9/MakefileFri Dec 13 09:32:16 2019
(r355709)
@@ -607,7 +607,7 @@ MLINKS+=bitset.9 BITSET_DEFINE.9 \
bitset.9 BIT_CMP.9 \
bitset.9 BIT_OR.9 \
bitset.9 BIT_AND.9 \
-   bitset.9 BIT_NAND.9 \
+   bitset.9 BIT_ANDNOT.9 \
bitset.9 BIT_CLR_ATOMIC.9 \
bitset.9 BIT_SET_ATOMIC.9 \
bitset.9 BIT_SET_ATOMIC_ACQ.9 \
@@ -856,7 +856,7 @@ MLINKS+=cpuset.9 CPUSET_T_INITIALIZER.9 \
cpuset.9 CPU_CMP.9 \
cpuset.9 CPU_OR.9 \
cpuset.9 CPU_AND.9 \
-   cpuset.9 CPU_NAND.9 \
+   cpuset.9 CPU_ANDNOT.9 \
cpuset.9 CPU_CLR_ATOMIC.9 \
cpuset.9 CPU_SET_ATOMIC.9 \
cpuset.9 CPU_SET_ATOMIC_ACQ.9 \

Modified: head/share/man/man9/bitset.9
==
--- head/share/man/man9/bitset.9Fri Dec 13 09:32:09 2019
(r355708)
+++ head/share/man/man9/bitset.9Fri Dec 13 09:32:16 2019
(r355709)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd July 7, 2017
+.Dd December 12, 2019
 .Dt BITSET 9
 .Os
 .Sh NAME
@@ -52,8 +52,8 @@
 .Nm BIT_OR2 ,
 .Nm BIT_AND ,
 .Nm BIT_AND2 ,
-.Nm BIT_NAND ,
-.Nm BIT_NAND2 ,
+.Nm BIT_ANDNOT ,
+.Nm BIT_ANDNOT2 ,
 .Nm BIT_XOR ,
 .Nm BIT_XOR2 ,
 .Nm BIT_CLR_ATOMIC ,
@@ -116,8 +116,8 @@
 .Fa "struct STRUCTNAME *src1"
 .Fa "struct STRUCTNAME *src2"
 .Fc
-.Fn BIT_NAND "const SETSIZE" "struct STRUCTNAME *dst" "struct STRUCTNAME *src"
-.Fo BIT_NAND2
+.Fn BIT_ANDNOT "const SETSIZE" "struct STRUCTNAME *dst" "struct STRUCTNAME 
*src"
+.Fo BIT_ANDNOT2
 .Fa "const SETSIZE"
 .Fa "struct STRUCTNAME *dst"
 .Fa "struct STRUCTNAME *src1"
@@ -412,7 +412,7 @@ equivalent of the scalar:
 .Fa src2 . )
 .Pp
 The
-.Fn BIT_NAND
+.Fn BIT_ANDNOT
 macro clears bits set in
 .Fa src
 from
@@ -425,7 +425,7 @@ equivalent of the scalar:
 .Fa ~ src . )
 .Pp
 The
-.Fn BIT_NAND2
+.Fn BIT_ANDNOT2
 macro computes
 .Fa src1
 bitwise and not

Modified: head/share/man/man9/cpuset.9
==
--- head/share/man/man9/cpuset.9Fri Dec 13 09:32:09 2019
(r355708)
+++ head/share/man/man9/cpuset.9Fri Dec 13 09:32:16 2019
(r355709)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd July 29, 2016
+.Dd December 12, 2019
 .Dt CPUSET 9
 .Os
 .Sh NAME
@@ -48,7 +48,7 @@
 .Nm CPU_CMP ,
 .Nm CPU_OR ,
 .Nm CPU_AND ,
-.Nm CPU_NAND ,
+.Nm CPU_ANDNOT ,
 .Nm CPU_CLR_ATOMIC ,
 .Nm CPU_SET_ATOMIC ,
 .Nm CPU_SET_ATOMIC_ACQ ,
@@ -88,7 +88,7 @@
 .Fn CPU_CMP "cpuset_t *cpuset1" "cpuset_t *cpuset2"
 .Fn CPU_OR "cpuset_t *dst" "cpuset_t *src"
 .Fn CPU_AND "cpuset_t *dst" "cpuset_t *src"
-.Fn CPU_NAND "cpuset_t *dst" "cpuset_t *src"
+.Fn CPU_ANDNOT "cpuset_t *dst" "cpuset_t *src"
 .\"
 .Fn CPU_CLR_ATOMIC "size_t cpu_idx" "cpuset_t *cpuset"
 .Fn CPU_SET_ATOMIC "size_t cpu_idx" "cpuset_t *cpuset"
@@ -303,7 +303,7 @@ is similar, with the same atomic semantics as
 .Fn CPU_OR_ATOMIC .
 .Pp
 The
-.Fn CPU_NAND
+.Fn CPU_ANDNOT
 macro removes CPUs in
 .Fa src
 from

Modified: head/sys/i386/i386/vm_machdep.c
==
--- head/sys/i386/i386/vm_machdep.c Fri Dec 13 09:32:09 2019
(r355708)
+++ head/sys/i386/i386/vm_machdep.c Fri Dec 13 09:32:16 2019
(r355709)
@@ -598,7 +598,7 @@ sf_buf_shootdown(struct sf_buf *sf, int flags)
if ((flags & SFB_CPUPRIVATE) == 0) {
other_cpus = all_cpus;
CPU_CLR(cpuid, _cpus);
-   CPU_NAND(_cpus, >cpumask);
+   CPU_ANDNOT(_cpus, >cpumask);
if (!CPU_EMPTY(_cpus)) {
CPU_OR(>cpumask, _cpus);
smp_masked_invlpg(other_cpus, 

svn commit: r355707 - head/sys/vm

2019-12-13 Thread Ryan Libby
Author: rlibby
Date: Fri Dec 13 09:32:03 2019
New Revision: 355707
URL: https://svnweb.freebsd.org/changeset/base/355707

Log:
  uma: delay bucket_init() until we might actually enable buckets
  
  This helps with a bootstrapping problem in upcoming work.
  
  We don't first enable buckets until uma_startup2(), so we can delay
  bucket creation until then.  The other two paths to bucket_enable() are
  both later, one in the pageout daemon (SI_SUB_KTHREAD_PAGE vs SI_SUB_VM)
  and one in uma_timeout() (first activated in uma_startup3()).  Note that
  although some bucket functions are accessible before uma_startup2()
  (e.g. bucket_select() in zone_ctor()), none of them inspect ubz_zone.
  
  Discussed with:   jeff
  Reviewed by:  markj
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D22765

Modified:
  head/sys/vm/uma_core.c

Modified: head/sys/vm/uma_core.c
==
--- head/sys/vm/uma_core.c  Fri Dec 13 09:31:59 2019(r355706)
+++ head/sys/vm/uma_core.c  Fri Dec 13 09:32:03 2019(r355707)
@@ -335,6 +335,8 @@ SYSCTL_INT(_vm, OID_AUTO, zone_warnings, CTLFLAG_RWTUN
 static void
 bucket_enable(void)
 {
+
+   KASSERT(booted >= BOOT_BUCKETS, ("Bucket enable before init"));
bucketdisable = vm_page_count_min();
 }
 
@@ -2299,10 +2301,10 @@ zone_foreach(void (*zfunc)(uma_zone_t, void *arg), voi
 /*
  * Count how many pages do we need to bootstrap.  VM supplies
  * its need in early zones in the argument, we add up our zones,
- * which consist of: UMA Slabs, UMA Hash and 9 Bucket zones. The
+ * which consist of the UMA Slabs and UMA Hash zones. The
  * zone of zones and zone of kegs are accounted separately.
  */
-#defineUMA_BOOT_ZONES  11
+#defineUMA_BOOT_ZONES  2
 /* Zone of zones and zone of kegs have arbitrary alignment. */
 #defineUMA_BOOT_ALIGN  32
 static int zsize, ksize;
@@ -2417,8 +2419,6 @@ uma_startup(void *mem, int npages)
sizeof(struct slabhead *) * UMA_HASH_SIZE_INIT,
NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZFLAG_INTERNAL);
 
-   bucket_init();
-
booted = BOOT_STRAPPED;
 }
 
@@ -2439,8 +2439,9 @@ uma_startup2(void)
 #ifdef DIAGNOSTIC
printf("Entering %s with %d boot pages left\n", __func__, boot_pages);
 #endif
-   booted = BOOT_BUCKETS;
sx_init(_reclaim_lock, "umareclaim");
+   bucket_init();
+   booted = BOOT_BUCKETS;
bucket_enable();
 }
 
___
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: r355706 - head/sys/vm

2019-12-13 Thread Ryan Libby
Author: rlibby
Date: Fri Dec 13 09:31:59 2019
New Revision: 355706
URL: https://svnweb.freebsd.org/changeset/base/355706

Log:
  uma dbg: flexible size for slab debug bitset too
  
  Recently (r355315) the size of the struct uma_slab bitset field us_free
  became dynamic instead of conservative.  Now, make the debug bitset
  size dynamic too.  The debug bitset is INVARIANTS-only, so in fact we
  don't care too much about the space savings that results from this, but
  enabling minimally-sized slabs on INVARIANTS builds is still important
  in order to be able to test new slab layouts effectively.
  
  Reviewed by:  jeff, markj
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D22759

Modified:
  head/sys/vm/uma_core.c
  head/sys/vm/uma_int.h

Modified: head/sys/vm/uma_core.c
==
--- head/sys/vm/uma_core.c  Fri Dec 13 09:28:44 2019(r355705)
+++ head/sys/vm/uma_core.c  Fri Dec 13 09:31:59 2019(r355706)
@@ -292,6 +292,8 @@ static int sysctl_handle_uma_zone_frees(SYSCTL_HANDLER
 static int sysctl_handle_uma_zone_flags(SYSCTL_HANDLER_ARGS);
 
 #ifdef INVARIANTS
+static inline struct noslabbits *slab_dbg_bits(uma_slab_t slab, uma_keg_t keg);
+
 static bool uma_dbg_kskip(uma_keg_t keg, void *mem);
 static bool uma_dbg_zskip(uma_zone_t zone, void *mem);
 static void uma_dbg_free(uma_zone_t zone, uma_slab_t slab, void *item);
@@ -1201,7 +1203,7 @@ keg_alloc_slab(uma_keg_t keg, uma_zone_t zone, int dom
slab->us_domain = domain;
BIT_FILL(keg->uk_ipers, >us_free);
 #ifdef INVARIANTS
-   BIT_ZERO(SLAB_MAX_SETSIZE, >us_debugfree);
+   BIT_ZERO(keg->uk_ipers, slab_dbg_bits(slab, keg));
 #endif
 
if (keg->uk_init != NULL) {
@@ -1484,6 +1486,15 @@ zero_init(void *mem, int size, int flags)
return (0);
 }
 
+#ifdef INVARIANTS
+struct noslabbits *
+slab_dbg_bits(uma_slab_t slab, uma_keg_t keg)
+{
+
+   return ((void *)((char *)>us_free + BITSET_SIZE(keg->uk_ipers)));
+}
+#endif
+
 /*
  * Actual size of embedded struct slab (!OFFPAGE).
  */
@@ -1492,7 +1503,7 @@ slab_sizeof(int nitems)
 {
size_t s;
 
-   s = sizeof(struct uma_slab) + BITSET_SIZE(nitems);
+   s = sizeof(struct uma_slab) + BITSET_SIZE(nitems) * SLAB_BITSETS;
return (roundup(s, UMA_ALIGN_PTR + 1));
 }
 
@@ -4514,12 +4525,10 @@ uma_dbg_alloc(uma_zone_t zone, uma_slab_t slab, void *
keg = zone->uz_keg;
freei = slab_item_index(slab, keg, item);
 
-   if (BIT_ISSET(SLAB_MAX_SETSIZE, freei, >us_debugfree))
+   if (BIT_ISSET(keg->uk_ipers, freei, slab_dbg_bits(slab, keg)))
panic("Duplicate alloc of %p from zone %p(%s) slab %p(%d)\n",
item, zone, zone->uz_name, slab, freei);
-   BIT_SET_ATOMIC(SLAB_MAX_SETSIZE, freei, >us_debugfree);
-
-   return;
+   BIT_SET_ATOMIC(keg->uk_ipers, freei, slab_dbg_bits(slab, keg));
 }
 
 /*
@@ -4550,11 +4559,11 @@ uma_dbg_free(uma_zone_t zone, uma_slab_t slab, void *i
panic("Unaligned free of %p from zone %p(%s) slab %p(%d)\n",
item, zone, zone->uz_name, slab, freei);
 
-   if (!BIT_ISSET(SLAB_MAX_SETSIZE, freei, >us_debugfree))
+   if (!BIT_ISSET(keg->uk_ipers, freei, slab_dbg_bits(slab, keg)))
panic("Duplicate free of %p from zone %p(%s) slab %p(%d)\n",
item, zone, zone->uz_name, slab, freei);
 
-   BIT_CLR_ATOMIC(SLAB_MAX_SETSIZE, freei, >us_debugfree);
+   BIT_CLR_ATOMIC(keg->uk_ipers, freei, slab_dbg_bits(slab, keg));
 }
 #endif /* INVARIANTS */
 

Modified: head/sys/vm/uma_int.h
==
--- head/sys/vm/uma_int.h   Fri Dec 13 09:28:44 2019(r355705)
+++ head/sys/vm/uma_int.h   Fri Dec 13 09:31:59 2019(r355706)
@@ -271,17 +271,26 @@ struct uma_slab {
uint16_tus_freecount;   /* How many are free? */
uint8_t us_flags;   /* Page flags see uma.h */
uint8_t us_domain;  /* Backing NUMA domain. */
-#ifdef INVARIANTS
-   struct slabbits us_debugfree;   /* Debug bitmask. */
-#endif
-   struct noslabbits us_free;  /* Free bitmask. */
+   struct noslabbits us_free;  /* Free bitmask, flexible. */
 };
+_Static_assert(sizeof(struct uma_slab) == offsetof(struct uma_slab, us_free),
+"us_free field must be last");
 #if MAXMEMDOM >= 255
 #error "Slab domain type insufficient"
 #endif
 
 typedef struct uma_slab * uma_slab_t;
 
+/*
+ * On INVARIANTS builds, the slab contains a second bitset of the same size,
+ * "dbg_bits", which is laid out immediately after us_free.
+ */
+#ifdef INVARIANTS
+#defineSLAB_BITSETS2
+#else
+#defineSLAB_BITSETS1
+#endif
+
 /* These three functions are for embedded (!OFFPAGE) use only. */
 size_t slab_sizeof(int nitems);

svn commit: r355708 - head/sys/vm

2019-12-13 Thread Ryan Libby
Author: rlibby
Date: Fri Dec 13 09:32:09 2019
New Revision: 355708
URL: https://svnweb.freebsd.org/changeset/base/355708

Log:
  uma: report slab efficiency
  
  Reviewed by:  jeff
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D22766

Modified:
  head/sys/vm/uma_core.c

Modified: head/sys/vm/uma_core.c
==
--- head/sys/vm/uma_core.c  Fri Dec 13 09:32:03 2019(r355707)
+++ head/sys/vm/uma_core.c  Fri Dec 13 09:32:09 2019(r355708)
@@ -290,6 +290,7 @@ static int sysctl_vm_zone_stats(SYSCTL_HANDLER_ARGS);
 static int sysctl_handle_uma_zone_allocs(SYSCTL_HANDLER_ARGS);
 static int sysctl_handle_uma_zone_frees(SYSCTL_HANDLER_ARGS);
 static int sysctl_handle_uma_zone_flags(SYSCTL_HANDLER_ARGS);
+static int sysctl_handle_uma_slab_efficiency(SYSCTL_HANDLER_ARGS);
 
 #ifdef INVARIANTS
 static inline struct noslabbits *slab_dbg_bits(uma_slab_t slab, uma_keg_t keg);
@@ -1948,6 +1949,10 @@ zone_alloc_sysctl(uma_zone_t zone, void *unused)
SYSCTL_ADD_U32(NULL, SYSCTL_CHILDREN(oid), OID_AUTO,
"free", CTLFLAG_RD, >uk_free, 0,
"items free in the slab layer");
+   SYSCTL_ADD_PROC(NULL, SYSCTL_CHILDREN(oid), OID_AUTO,
+   "efficiency", CTLFLAG_RD | CTLTYPE_INT | CTLFLAG_MPSAFE,
+   keg, 0, sysctl_handle_uma_slab_efficiency, "I",
+   "Slab utilization (100 - internal fragmentation %)");
} else
SYSCTL_ADD_CONST_STRING(NULL, SYSCTL_CHILDREN(oid), OID_AUTO,
"name", CTLFLAG_RD, nokeg, "Keg name");
@@ -4438,6 +4443,27 @@ sysctl_handle_uma_zone_flags(SYSCTL_HANDLER_ARGS)
sbuf_delete();
 
return (error);
+}
+
+static int
+sysctl_handle_uma_slab_efficiency(SYSCTL_HANDLER_ARGS)
+{
+   uma_keg_t keg = arg1;
+   int avail, effpct, total;
+
+   total = keg->uk_ppera * PAGE_SIZE;
+   if ((keg->uk_flags & UMA_ZONE_OFFPAGE) != 0)
+   total += slab_sizeof(SLAB_MAX_SETSIZE);
+   /*
+* We consider the client's requested size and alignment here, not the
+* real size determination uk_rsize, because we also adjust the real
+* size for internal implementation reasons (max bitset size).
+*/
+   avail = keg->uk_ipers * roundup2(keg->uk_size, keg->uk_align + 1);
+   if ((keg->uk_flags & UMA_ZONE_PCPU) != 0)
+   avail *= mp_maxid + 1;
+   effpct = 100 * avail / total;
+   return (sysctl_handle_int(oidp, , 0, req));
 }
 
 #ifdef INVARIANTS
___
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: r355705 - in head: lib/geom/part sys/geom/part

2019-12-13 Thread Edward Tomasz Napierala
Author: trasz
Date: Fri Dec 13 09:28:44 2019
New Revision: 355705
URL: https://svnweb.freebsd.org/changeset/base/355705

Log:
  Add kern.geom.part.separator tunable.  This makes it possible
  to specify an optional separator to insert before partition name;
  eg if it's set to "c/", you'll get "ada0c/s1" instead of "ada0s1".
  (It cannot be set to just “/“, since ada0 is a device node, not
  a directory.)
  
  Reviewed by:  imp
  MFC after:2 weeks
  Sponsored by: Klara Inc.
  Differential Revision:https://reviews.freebsd.org/D22193

Modified:
  head/lib/geom/part/gpart.8
  head/sys/geom/part/g_part.c
  head/sys/geom/part/g_part.h
  head/sys/geom/part/g_part_if.m

Modified: head/lib/geom/part/gpart.8
==
--- head/lib/geom/part/gpart.8  Fri Dec 13 09:19:24 2019(r355704)
+++ head/lib/geom/part/gpart.8  Fri Dec 13 09:28:44 2019(r355705)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd September 3, 2019
+.Dd December 13, 2019
 .Dt GPART 8
 .Os
 .Sh NAME
@@ -1260,6 +1260,14 @@ If this variable is set to a non-zero value, the modul
 recalculate the user-specified offset and size for alignment with the CHS
 geometry.
 Otherwise the values will be left unchanged.
+.It Va kern.geom.part.separator : No ""
+Specify an optional separator that will be inserted between the GEOM name
+and partition name.
+This variable is a
+.Xr loader 8
+tunable.
+Note that setting this variable may break software which assumes a particular
+naming scheme.
 .El
 .Sh EXIT STATUS
 Exit status is 0 on success, and 1 if the command fails.

Modified: head/sys/geom/part/g_part.c
==
--- head/sys/geom/part/g_part.c Fri Dec 13 09:19:24 2019(r355704)
+++ head/sys/geom/part/g_part.c Fri Dec 13 09:28:44 2019(r355705)
@@ -147,6 +147,10 @@ static u_int allow_nesting = 0;
 SYSCTL_UINT(_kern_geom_part, OID_AUTO, allow_nesting,
 CTLFLAG_RWTUN, _nesting, 0,
 "Allow additional levels of nesting");
+char g_part_separator[MAXPATHLEN] = "";
+SYSCTL_STRING(_kern_geom_part, OID_AUTO, separator,
+CTLFLAG_RDTUN, _part_separator, sizeof(g_part_separator),
+"Partition name separator");
 
 /*
  * The GEOM partitioning class.

Modified: head/sys/geom/part/g_part.h
==
--- head/sys/geom/part/g_part.h Fri Dec 13 09:19:24 2019(r355704)
+++ head/sys/geom/part/g_part.h Fri Dec 13 09:28:44 2019(r355705)
@@ -228,6 +228,8 @@ void g_part_geometry_heads(off_t, u_int, off_t *, u_in
 
 int g_part_modevent(module_t, int, struct g_part_scheme *);
 
+extern char g_part_separator[];
+
 #defineG_PART_SCHEME_DECLARE(name) \
 static int name##_modevent(module_t mod, int tp, void *d)  \
 {  \

Modified: head/sys/geom/part/g_part_if.m
==
--- head/sys/geom/part/g_part_if.m  Fri Dec 13 09:19:24 2019
(r355704)
+++ head/sys/geom/part/g_part_if.m  Fri Dec 13 09:28:44 2019
(r355705)
@@ -48,7 +48,7 @@ CODE {
{
char buf[32];
 
-   sbuf_printf(sb, "%s%s", pfx,
+   sbuf_printf(sb, "%s%s%s", pfx, g_part_separator,
G_PART_NAME(table, entry, buf, sizeof(buf)));
}
 
___
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: r355704 - stable/12/sys/mips/mips

2019-12-13 Thread Ryan Libby
Author: rlibby
Date: Fri Dec 13 09:19:24 2019
New Revision: 355704
URL: https://svnweb.freebsd.org/changeset/base/355704

Log:
  MFC r355343:
  
mips busdma: bzero map on alloc

Modified:
  stable/12/sys/mips/mips/busdma_machdep.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/mips/mips/busdma_machdep.c
==
--- stable/12/sys/mips/mips/busdma_machdep.cFri Dec 13 08:41:37 2019
(r355703)
+++ stable/12/sys/mips/mips/busdma_machdep.cFri Dec 13 09:19:24 2019
(r355704)
@@ -155,8 +155,6 @@ struct bus_dmamap {
bus_dma_tag_t   dmat;
struct memdesc  mem;
int flags;
-   void*origbuffer;
-   void*allocbuffer;
TAILQ_ENTRY(bus_dmamap) freelist;
STAILQ_ENTRY(bus_dmamap) links;
bus_dmamap_callback_t *callback;
@@ -204,11 +202,8 @@ dmamap_ctor(void *mem, int size, void *arg, int flags)
 
dmat->map_count++;
 
+   bzero(map, sizeof(*map));
map->dmat = dmat;
-   map->flags = 0;
-   map->slist = NULL;
-   map->allocbuffer = NULL;
-   map->sync_count = 0;
STAILQ_INIT(>bpages);
 
return (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: r355703 - head/stand/common

2019-12-13 Thread Toomas Soome
Author: tsoome
Date: Fri Dec 13 08:41:37 2019
New Revision: 355703
URL: https://svnweb.freebsd.org/changeset/base/355703

Log:
  loader: clean up devopen and devclose a bit
  
  devopen should undo setup of f->f_dev in case of error.
  devclose can just call free().
  
  MFC after:1 week

Modified:
  head/stand/common/devopen.c

Modified: head/stand/common/devopen.c
==
--- head/stand/common/devopen.c Fri Dec 13 08:20:20 2019(r355702)
+++ head/stand/common/devopen.c Fri Dec 13 08:41:37 2019(r355703)
@@ -52,6 +52,7 @@ devopen(struct open_file *f, const char *fname, const 
result = dev->d_dev->dv_open(f, dev);
if (result != 0) {
f->f_devdata = NULL;
+   f->f_dev = NULL;
free(dev);
return (result);
}
@@ -74,8 +75,6 @@ int
 devclose(struct open_file *f)
 {
 
-   if (f->f_devdata != NULL) {
-   free(f->f_devdata);
-   }
+   free(f->f_devdata);
return (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: r355702 - head/stand/common

2019-12-13 Thread Toomas Soome
Author: tsoome
Date: Fri Dec 13 08:20:20 2019
New Revision: 355702
URL: https://svnweb.freebsd.org/changeset/base/355702

Log:
  loader: vdisk dereference after free
  
  print out the information and then free the memory used.
  
  MFC after:1 week

Modified:
  head/stand/common/vdisk.c

Modified: head/stand/common/vdisk.c
==
--- head/stand/common/vdisk.c   Fri Dec 13 06:54:41 2019(r355701)
+++ head/stand/common/vdisk.c   Fri Dec 13 08:20:20 2019(r355702)
@@ -229,10 +229,10 @@ command_unmapvd(int argc, char *argv[])
}
 
STAILQ_REMOVE(_list, vd, vdisk_info, vdisk_link);
-   close(vd->vdisk_fd);
+   (void) close(vd->vdisk_fd);
+   printf("%s (%s) unmapped\n", argv[1], vd->vdisk_path);
free(vd->vdisk_path);
free(vd);
-   printf("%s (%s) unmapped\n", argv[1], vd->vdisk_path);
 
return (CMD_OK);
 }
___
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"