svn commit: r309353 - in head/sys: dev/hyperv/netvsc modules/hyperv/netvsc

2016-11-30 Thread Sepherosa Ziehau
Author: sephe
Date: Thu Dec  1 05:37:29 2016
New Revision: 309353
URL: https://svnweb.freebsd.org/changeset/base/309353

Log:
  hyperv/hn: Add 'options RSS' support.
  
  Reviewed by:  adrian
  MFC after:1 week
  Sponsored by: Microsoft
  Differential Revision:https://reviews.freebsd.org/D8676

Modified:
  head/sys/dev/hyperv/netvsc/if_hn.c
  head/sys/modules/hyperv/netvsc/Makefile

Modified: head/sys/dev/hyperv/netvsc/if_hn.c
==
--- head/sys/dev/hyperv/netvsc/if_hn.c  Thu Dec  1 05:16:27 2016
(r309352)
+++ head/sys/dev/hyperv/netvsc/if_hn.c  Thu Dec  1 05:37:29 2016
(r309353)
@@ -55,9 +55,10 @@
 #include 
 __FBSDID("$FreeBSD$");
 
+#include "opt_hn.h"
 #include "opt_inet6.h"
 #include "opt_inet.h"
-#include "opt_hn.h"
+#include "opt_rss.h"
 
 #include 
 #include 
@@ -87,6 +88,9 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#ifdef RSS
+#include 
+#endif
 
 #include 
 #include 
@@ -170,7 +174,11 @@ do {   
\
 #define HN_PKTSIZE(m, align)   \
roundup2((m)->m_pkthdr.len + HN_RNDIS_PKT_LEN, (align))
 
+#ifdef RSS
+#define HN_RING_IDX2CPU(sc, idx)   rss_getcpu((idx) % rss_getnumbuckets())
+#else
 #define HN_RING_IDX2CPU(sc, idx)   (((sc)->hn_cpu + (idx)) % mp_ncpus)
+#endif
 
 struct hn_txdesc {
 #ifndef HN_USE_TXDESC_BUFRING
@@ -276,8 +284,10 @@ static int hn_ndis_version_sysctl(SYSC
 static int hn_caps_sysctl(SYSCTL_HANDLER_ARGS);
 static int hn_hwassist_sysctl(SYSCTL_HANDLER_ARGS);
 static int hn_rxfilter_sysctl(SYSCTL_HANDLER_ARGS);
+#ifndef RSS
 static int hn_rss_key_sysctl(SYSCTL_HANDLER_ARGS);
 static int hn_rss_ind_sysctl(SYSCTL_HANDLER_ARGS);
+#endif
 static int hn_rss_hash_sysctl(SYSCTL_HANDLER_ARGS);
 static int hn_txagg_size_sysctl(SYSCTL_HANDLER_ARGS);
 static int hn_txagg_pkts_sysctl(SYSCTL_HANDLER_ARGS);
@@ -321,7 +331,9 @@ static int  hn_create_rx_data(struct hn
 static voidhn_destroy_rx_data(struct hn_softc *);
 static int hn_check_iplen(const struct mbuf *, int);
 static int hn_set_rxfilter(struct hn_softc *);
+#ifndef RSS
 static int hn_rss_reconfig(struct hn_softc *);
+#endif
 static voidhn_rss_ind_fixup(struct hn_softc *);
 static int hn_rxpkt(struct hn_rx_ring *, const void *,
int, const struct hn_rxinfo *);
@@ -478,6 +490,7 @@ SYSCTL_INT(_hw_hn, OID_AUTO, tx_agg_pkts
 static u_int   hn_cpu_index;   /* next CPU for channel */
 static struct taskqueue**hn_tx_taskque;/* shared TX taskqueues 
*/
 
+#ifndef RSS
 static const uint8_t
 hn_rss_key_default[NDIS_HASH_KEYSIZE_TOEPLITZ] = {
0x6d, 0x5a, 0x56, 0xda, 0x25, 0x5b, 0x0e, 0xc2,
@@ -486,6 +499,7 @@ hn_rss_key_default[NDIS_HASH_KEYSIZE_TOE
0x77, 0xcb, 0x2d, 0xa3, 0x80, 0x30, 0xf2, 0x0c,
0x6a, 0x42, 0xb7, 0x3b, 0xbe, 0xac, 0x01, 0xfa
 };
+#endif /* !RSS */
 
 static device_method_t hn_methods[] = {
/* Device interface */
@@ -783,6 +797,7 @@ hn_get_txswq_depth(const struct hn_tx_ri
return hn_tx_swq_depth;
 }
 
+#ifndef RSS
 static int
 hn_rss_reconfig(struct hn_softc *sc)
 {
@@ -821,6 +836,7 @@ hn_rss_reconfig(struct hn_softc *sc)
}
return (0);
 }
+#endif /* !RSS */
 
 static void
 hn_rss_ind_fixup(struct hn_softc *sc)
@@ -969,6 +985,10 @@ hn_attach(device_t dev)
} else if (ring_cnt > mp_ncpus) {
ring_cnt = mp_ncpus;
}
+#ifdef RSS
+   if (ring_cnt > rss_getnumbuckets())
+   ring_cnt = rss_getnumbuckets();
+#endif
 
tx_ring_cnt = hn_tx_ring_cnt;
if (tx_ring_cnt <= 0 || tx_ring_cnt > ring_cnt)
@@ -1068,12 +1088,17 @@ hn_attach(device_t dev)
hn_rss_hash_sysctl, "A", "RSS hash");
SYSCTL_ADD_INT(ctx, child, OID_AUTO, "rss_ind_size",
CTLFLAG_RD, >hn_rss_ind_size, 0, "RSS indirect entry count");
+#ifndef RSS
+   /*
+* Don't allow RSS key/indirect table changes, if RSS is defined.
+*/
SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "rss_key",
CTLTYPE_OPAQUE | CTLFLAG_RW | CTLFLAG_MPSAFE, sc, 0,
hn_rss_key_sysctl, "IU", "RSS key");
SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "rss_ind",
CTLTYPE_OPAQUE | CTLFLAG_RW | CTLFLAG_MPSAFE, sc, 0,
hn_rss_ind_sysctl, "IU", "RSS indirect table");
+#endif
SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "rndis_agg_size",
CTLFLAG_RD, >hn_rndis_agg_size, 0,
"RNDIS offered packet transmission aggregation size limit");
@@ -2905,6 +2930,8 @@ hn_rxfilter_sysctl(SYSCTL_HANDLER_ARGS)
return 

svn commit: r309352 - in head/etc: . defaults

2016-11-30 Thread Warner Losh
Author: imp
Date: Thu Dec  1 05:16:27 2016
New Revision: 309352
URL: https://svnweb.freebsd.org/changeset/base/309352

Log:
  Finish incomplete comments in prior revision. I was going to fix this
  after I tested it, but didn't.

Modified:
  head/etc/defaults/rc.conf
  head/etc/rc.subr

Modified: head/etc/defaults/rc.conf
==
--- head/etc/defaults/rc.conf   Thu Dec  1 04:35:43 2016(r309351)
+++ head/etc/defaults/rc.conf   Thu Dec  1 05:16:27 2016(r309352)
@@ -21,6 +21,8 @@
 ###  Important initial Boot-time options  
 ##
 
+# rc_debug can't be set here without interferring with rc.subr's setting it
+# when the kenv variable rc.debug is set.
 #rc_debug="NO" # Set to YES to enable debugging output from rc.d
 rc_info="NO"   # Enables display of informational messages at boot.
 rc_startmsgs="YES" # Show "Starting foo:" messages at boot

Modified: head/etc/rc.subr
==
--- head/etc/rc.subrThu Dec  1 04:35:43 2016(r309351)
+++ head/etc/rc.subrThu Dec  1 05:16:27 2016(r309352)
@@ -2120,7 +2120,8 @@ _echoonce()
 }
 
 # If the loader env variable rc.debug is set, turn on debugging. rc.conf will
-# still override this, but /etc/defaults/rc.conf.a
+# still override this, but /etc/defaults/rc.conf can't unconditionally set this
+# since it would undo what we've done here.
 if kenv -q rc.debug > /dev/null ; then
rc_debug=YES
 fi
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r309351 - head/etc/defaults

2016-11-30 Thread Warner Losh
Author: imp
Date: Thu Dec  1 04:35:43 2016
New Revision: 309351
URL: https://svnweb.freebsd.org/changeset/base/309351

Log:
  Revert the 'performance' setting to 'NONE' from C2. C2 has issues with
  USB in places, as well as having the potential for reducing
  performance. Since this is used even when powerd isn't enabled, these
  two problems can cause on servers. Supermicro X9 motherboards, for
  example, have problems with the virtual IPMI USB keyboards and mice
  attaching and detaching repeatedly. Since there are issues on some
  CPUs with C2, fail safe by defaulting to not altering it.
  
  MFC After: 3 days

Modified:
  head/etc/defaults/rc.conf

Modified: head/etc/defaults/rc.conf
==
--- head/etc/defaults/rc.conf   Thu Dec  1 04:35:41 2016(r309350)
+++ head/etc/defaults/rc.conf   Thu Dec  1 04:35:43 2016(r309351)
@@ -672,7 +672,7 @@ devfs_system_ruleset="" # The name (NOT 
 devfs_set_rulesets=""  # A list of /mount/dev=ruleset_name settings to
# apply (must be mounted already, i.e. fstab(5))
 devfs_load_rulesets="YES"  # Enable to always load the default rulesets
-performance_cx_lowest="C2" # Online CPU idle state
+performance_cx_lowest="NONE"   # Online CPU idle state
 performance_cpu_freq="NONE"# Online CPU frequency
 economy_cx_lowest="Cmax"   # Offline CPU idle state
 economy_cpu_freq="NONE"# Offline CPU frequency
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r309350 - head/etc

2016-11-30 Thread Warner Losh
Author: imp
Date: Thu Dec  1 04:35:41 2016
New Revision: 309350
URL: https://svnweb.freebsd.org/changeset/base/309350

Log:
  If the kenv variable rc_debug is set, turn on rc_debug.

Modified:
  head/etc/rc.subr

Modified: head/etc/rc.subr
==
--- head/etc/rc.subrThu Dec  1 04:35:38 2016(r309349)
+++ head/etc/rc.subrThu Dec  1 04:35:41 2016(r309350)
@@ -2119,6 +2119,12 @@ _echoonce()
esac
 }
 
+# If the loader env variable rc.debug is set, turn on debugging. rc.conf will
+# still override this, but /etc/defaults/rc.conf.a
+if kenv -q rc.debug > /dev/null ; then
+   rc_debug=YES
+fi
+
 fi # [ -z "${_rc_subr_loaded}" ]
 
 _rc_subr_loaded=:
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r309349 - head/sbin/devd

2016-11-30 Thread Warner Losh
Author: imp
Date: Thu Dec  1 04:35:38 2016
New Revision: 309349
URL: https://svnweb.freebsd.org/changeset/base/309349

Log:
  Simplify test.

Modified:
  head/sbin/devd/devd.cc

Modified: head/sbin/devd/devd.cc
==
--- head/sbin/devd/devd.cc  Thu Dec  1 03:39:34 2016(r309348)
+++ head/sbin/devd/devd.cc  Thu Dec  1 04:35:38 2016(r309349)
@@ -1193,7 +1193,7 @@ devdlog(int priority, const char* fmt, .
va_start(argp, fmt);
if (no_daemon)
vfprintf(stderr, fmt, argp);
-   else if ((! quiet_mode) || (priority <= LOG_WARNING))
+   else if (quiet_mode == 0 || priority <= LOG_WARNING)
vsyslog(priority, fmt, argp);
va_end(argp);
 }
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r309348 - head/sys/dev/hyperv/netvsc

2016-11-30 Thread Sepherosa Ziehau
Author: sephe
Date: Thu Dec  1 03:39:34 2016
New Revision: 309348
URL: https://svnweb.freebsd.org/changeset/base/309348

Log:
  hyperv/hn: Don't hold txdesc, if no BPFs are attached.
  
  MFC after:1 week
  Sponsored by: Microsoft
  Differential Revision:https://reviews.freebsd.org/D8675

Modified:
  head/sys/dev/hyperv/netvsc/if_hn.c

Modified: head/sys/dev/hyperv/netvsc/if_hn.c
==
--- head/sys/dev/hyperv/netvsc/if_hn.c  Thu Dec  1 03:34:04 2016
(r309347)
+++ head/sys/dev/hyperv/netvsc/if_hn.c  Thu Dec  1 03:39:34 2016
(r309348)
@@ -1924,17 +1924,20 @@ done:
 static int
 hn_txpkt(struct ifnet *ifp, struct hn_tx_ring *txr, struct hn_txdesc *txd)
 {
-   int error, send_failed = 0;
+   int error, send_failed = 0, has_bpf;
 
 again:
-   /*
-* Make sure that this txd and any aggregated txds are not freed
-* before ETHER_BPF_MTAP.
-*/
-   hn_txdesc_hold(txd);
+   has_bpf = bpf_peers_present(ifp->if_bpf);
+   if (has_bpf) {
+   /*
+* Make sure that this txd and any aggregated txds are not
+* freed before ETHER_BPF_MTAP.
+*/
+   hn_txdesc_hold(txd);
+   }
error = txr->hn_sendpkt(txr, txd);
if (!error) {
-   if (bpf_peers_present(ifp->if_bpf)) {
+   if (has_bpf) {
const struct hn_txdesc *tmp_txd;
 
ETHER_BPF_MTAP(ifp, txd->m);
@@ -1957,7 +1960,8 @@ again:
txr->hn_pkts += txr->hn_stat_pkts;
txr->hn_sends++;
}
-   hn_txdesc_put(txr, txd);
+   if (has_bpf)
+   hn_txdesc_put(txr, txd);
 
if (__predict_false(error)) {
int freed;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r309347 - head/sys/arm/ti/cpsw

2016-11-30 Thread Luiz Otavio O Souza
Author: loos
Date: Thu Dec  1 03:34:04 2016
New Revision: 309347
URL: https://svnweb.freebsd.org/changeset/base/309347

Log:
  MDIO_PHYACCESS_ACK is only valid for read access, remove it from
  miibus_writereg.
  
  Reduce the DELAY() between reads while waiting for MII access.
  
  Spotted by:   yongari
  Sponsored by: Rubicon Communications, LLC (Netgate)

Modified:
  head/sys/arm/ti/cpsw/if_cpsw.c
  head/sys/arm/ti/cpsw/if_cpswvar.h

Modified: head/sys/arm/ti/cpsw/if_cpsw.c
==
--- head/sys/arm/ti/cpsw/if_cpsw.c  Thu Dec  1 03:27:16 2016
(r309346)
+++ head/sys/arm/ti/cpsw/if_cpsw.c  Thu Dec  1 03:34:04 2016
(r309347)
@@ -1512,9 +1512,6 @@ cpswp_miibus_writereg(device_t dev, int 
return (0);
}
 
-   if ((cpsw_read_4(sc->swsc, sc->phyaccess) & MDIO_PHYACCESS_ACK) == 0)
-   device_printf(dev, "Failed to write to PHY.\n");
-
return (0);
 }
 

Modified: head/sys/arm/ti/cpsw/if_cpswvar.h
==
--- head/sys/arm/ti/cpsw/if_cpswvar.h   Thu Dec  1 03:27:16 2016
(r309346)
+++ head/sys/arm/ti/cpsw/if_cpswvar.h   Thu Dec  1 03:34:04 2016
(r309347)
@@ -33,8 +33,8 @@
 #defineCPSW_INTR_COUNT 4
 
 /* MII BUS  */
-#defineCPSW_MIIBUS_RETRIES 5
-#defineCPSW_MIIBUS_DELAY   1000
+#defineCPSW_MIIBUS_RETRIES 20
+#defineCPSW_MIIBUS_DELAY   100
 
 #defineCPSW_MAX_ALE_ENTRIES1024
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r309346 - in head/sys: conf dev/hyperv/netvsc modules/hyperv/netvsc

2016-11-30 Thread Sepherosa Ziehau
Author: sephe
Date: Thu Dec  1 03:27:16 2016
New Revision: 309346
URL: https://svnweb.freebsd.org/changeset/base/309346

Log:
  hyperv/hn: Add HN_DEBUG kernel option.
  
  If bufring is used for per-TX ring descs, don't update "available"
  counter, which is only used to help debugging.
  
  MFC after:1 week
  Sponsored by: Microsoft
  Differential Revision:https://reviews.freebsd.org/D8674

Modified:
  head/sys/conf/options
  head/sys/dev/hyperv/netvsc/if_hn.c
  head/sys/modules/hyperv/netvsc/Makefile

Modified: head/sys/conf/options
==
--- head/sys/conf/options   Thu Dec  1 02:35:15 2016(r309345)
+++ head/sys/conf/options   Thu Dec  1 03:27:16 2016(r309346)
@@ -1001,3 +1001,5 @@ EVDEV_SUPPORT opt_evdev.h
 EVDEV_DEBUGopt_evdev.h
 UINPUT_DEBUG   opt_evdev.h
 
+# Hyper-V network driver
+HN_DEBUG   opt_hn.h

Modified: head/sys/dev/hyperv/netvsc/if_hn.c
==
--- head/sys/dev/hyperv/netvsc/if_hn.c  Thu Dec  1 02:35:15 2016
(r309345)
+++ head/sys/dev/hyperv/netvsc/if_hn.c  Thu Dec  1 03:27:16 2016
(r309346)
@@ -57,6 +57,7 @@ __FBSDID("$FreeBSD$");
 
 #include "opt_inet6.h"
 #include "opt_inet.h"
+#include "opt_hn.h"
 
 #include 
 #include 
@@ -1428,10 +1429,12 @@ hn_txdesc_put(struct hn_tx_ring *txr, st
txr->hn_txdesc_avail++;
SLIST_INSERT_HEAD(>hn_txlist, txd, link);
mtx_unlock_spin(>hn_txlist_spin);
-#else
+#else  /* HN_USE_TXDESC_BUFRING */
+#ifdef HN_DEBUG
atomic_add_int(>hn_txdesc_avail, 1);
-   buf_ring_enqueue(txr->hn_txdesc_br, txd);
 #endif
+   buf_ring_enqueue(txr->hn_txdesc_br, txd);
+#endif /* !HN_USE_TXDESC_BUFRING */
 
return 1;
 }
@@ -1457,8 +1460,10 @@ hn_txdesc_get(struct hn_tx_ring *txr)
 
if (txd != NULL) {
 #ifdef HN_USE_TXDESC_BUFRING
+#ifdef HN_DEBUG
atomic_subtract_int(>hn_txdesc_avail, 1);
 #endif
+#endif /* HN_USE_TXDESC_BUFRING */
KASSERT(txd->m == NULL && txd->refs == 0 &&
STAILQ_EMPTY(>agg_list) &&
txd->chim_index == HN_NVS_CHIM_IDX_INVALID &&
@@ -3467,9 +3472,11 @@ hn_tx_ring_create(struct hn_softc *sc, i
if (txr->hn_tx_sysctl_tree != NULL) {
child = SYSCTL_CHILDREN(txr->hn_tx_sysctl_tree);
 
+#ifdef HN_DEBUG
SYSCTL_ADD_INT(ctx, child, OID_AUTO, "txdesc_avail",
CTLFLAG_RD, >hn_txdesc_avail, 0,
"# of available TX descs");
+#endif
 #ifdef HN_IFSTART_SUPPORT
if (!hn_use_if_start)
 #endif

Modified: head/sys/modules/hyperv/netvsc/Makefile
==
--- head/sys/modules/hyperv/netvsc/Makefile Thu Dec  1 02:35:15 2016
(r309345)
+++ head/sys/modules/hyperv/netvsc/Makefile Thu Dec  1 03:27:16 2016
(r309346)
@@ -5,7 +5,7 @@
 
 KMOD=  hv_netvsc
 SRCS=  hn_nvs.c hn_rndis.c if_hn.c
-SRCS+= bus_if.h device_if.h opt_inet.h opt_inet6.h vmbus_if.h
+SRCS+= bus_if.h device_if.h opt_inet.h opt_inet6.h vmbus_if.h opt_hn.h
 
 CFLAGS+= -I${.CURDIR}/../../../dev/hyperv/netvsc
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r309344 - head/lib/libutil

2016-11-30 Thread Ngie Cooper

> On Nov 30, 2016, at 18:21, Conrad E. Meyer  wrote:
> 
> Author: cem
> Date: Thu Dec  1 02:21:36 2016
> New Revision: 309344
> URL: https://svnweb.freebsd.org/changeset/base/309344
> 
> Log:
>  Remove a death threat from the FreeBSD sources
> 
>  Reported by:koobs@, araujo@, linimon@, bjk@, emaste@, jhb@, ngie@, cem@
>  Maintainer timeout:des@

Really?? I wish you hadn't added me to this list.. I don't in any way endorse 
the way that you went about dealing with this disagreement. You kind of just 
pissed all over what des@ did out of spite.


> Modified:
>  head/lib/libutil/flopen.c
> 
> Modified: head/lib/libutil/flopen.c
> ==
> --- head/lib/libutil/flopen.cThu Dec  1 01:56:34 2016(r309343)
> +++ head/lib/libutil/flopen.cThu Dec  1 02:21:36 2016(r309344)
> @@ -40,10 +40,10 @@ __FBSDID("$FreeBSD$");
> /*
>  * Reliably open and lock a file.
>  *
> - * DO NOT, UNDER PAIN OF DEATH, modify this code without first reading the
> - * revision history and discussing your changes with .
> - * Don't be fooled by the code's apparent simplicity; there would be no
> - * need for this function if it was as easy to get right as you think.
> + * Please do not modify this code without first reading the revision history
> + * and discussing your changes with .  Don't be fooled by 
> the
> + * code's apparent simplicity; there would be no need for this function if it
> + * was easy to get right.
>  */
> int
> flopen(const char *path, int flags, ...)
> @@ -108,7 +108,11 @@ flopen(const char *path, int flags, ...)
>errno = serrno;
>return (-1);
>}
> -#ifdef DONT_EVEN_THINK_ABOUT_IT
> +/*
> + * The following change is provided as a specific example to
> + * avoid.
> + */
> +#if 0
>if (fcntl(fd, F_SETFD, FD_CLOEXEC) != 0) {
>serrno = errno;
>(void)close(fd);
> 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r309345 - head/sys/arm/ti/cpsw

2016-11-30 Thread Luiz Otavio O Souza
Author: loos
Date: Thu Dec  1 02:35:15 2016
New Revision: 309345
URL: https://svnweb.freebsd.org/changeset/base/309345

Log:
  The RX_FREEBUFFER registers are a write to increment field.
  
  Writing the full queue size to it every time was makeing it overflow with a
  lot of bogus values.
  
  This fixes the interrupt storms on irq 40.
  
  Sponsored by: Rubicon Communications, LLC (Netgate)

Modified:
  head/sys/arm/ti/cpsw/if_cpsw.c

Modified: head/sys/arm/ti/cpsw/if_cpsw.c
==
--- head/sys/arm/ti/cpsw/if_cpsw.c  Thu Dec  1 02:21:36 2016
(r309344)
+++ head/sys/arm/ti/cpsw/if_cpsw.c  Thu Dec  1 02:35:15 2016
(r309345)
@@ -1760,7 +1760,7 @@ cpsw_rx_enqueue(struct cpsw_softc *sc)
sc->rx.queue_adds += added;
sc->rx.avail_queue_len -= added;
sc->rx.active_queue_len += added;
-   cpsw_write_4(sc, CPSW_CPDMA_RX_FREEBUFFER(0), sc->rx.active_queue_len);
+   cpsw_write_4(sc, CPSW_CPDMA_RX_FREEBUFFER(0), added);
if (sc->rx.active_queue_len > sc->rx.max_active_queue_len) {
sc->rx.max_active_queue_len = sc->rx.active_queue_len;
}
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r309344 - head/lib/libutil

2016-11-30 Thread Conrad E. Meyer
Author: cem
Date: Thu Dec  1 02:21:36 2016
New Revision: 309344
URL: https://svnweb.freebsd.org/changeset/base/309344

Log:
  Remove a death threat from the FreeBSD sources
  
  Reported by:  koobs@, araujo@, linimon@, bjk@, emaste@, jhb@, ngie@, cem@
  Maintainer timeout:   des@

Modified:
  head/lib/libutil/flopen.c

Modified: head/lib/libutil/flopen.c
==
--- head/lib/libutil/flopen.c   Thu Dec  1 01:56:34 2016(r309343)
+++ head/lib/libutil/flopen.c   Thu Dec  1 02:21:36 2016(r309344)
@@ -40,10 +40,10 @@ __FBSDID("$FreeBSD$");
 /*
  * Reliably open and lock a file.
  *
- * DO NOT, UNDER PAIN OF DEATH, modify this code without first reading the
- * revision history and discussing your changes with .
- * Don't be fooled by the code's apparent simplicity; there would be no
- * need for this function if it was as easy to get right as you think.
+ * Please do not modify this code without first reading the revision history
+ * and discussing your changes with .  Don't be fooled by the
+ * code's apparent simplicity; there would be no need for this function if it
+ * was easy to get right.
  */
 int
 flopen(const char *path, int flags, ...)
@@ -108,7 +108,11 @@ flopen(const char *path, int flags, ...)
errno = serrno;
return (-1);
}
-#ifdef DONT_EVEN_THINK_ABOUT_IT
+   /*
+* The following change is provided as a specific example to
+* avoid.
+*/
+#if 0
if (fcntl(fd, F_SETFD, FD_CLOEXEC) != 0) {
serrno = errno;
(void)close(fd);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2016-11-30 Thread Pedro F. Giffuni
Author: pfg
Date: Thu Dec  1 01:56:34 2016
New Revision: 309343
URL: https://svnweb.freebsd.org/changeset/base/309343

Log:
  indent(1): Don't unnecessarily add a blank before a comment ends.
  
  pr_comment() did avoid adding surplus space character when a comment
  contained it at the end. Now it's also paying attention to tabs.
  
  Taken from:Piotr Stefaniak

Modified:
  head/usr.bin/indent/pr_comment.c

Modified: head/usr.bin/indent/pr_comment.c
==
--- head/usr.bin/indent/pr_comment.cThu Dec  1 01:48:56 2016
(r309342)
+++ head/usr.bin/indent/pr_comment.cThu Dec  1 01:56:34 2016
(r309343)
@@ -293,7 +293,7 @@ pr_comment(void)
s_com = e_com;
*e_com++ = ' ';
}
-   if (e_com[-1] != ' ' && !ps.box_com)
+   if (e_com[-1] != ' ' && e_com[-1] != '\t' && !ps.box_com)
*e_com++ = ' '; /* ensure blank before end */
*e_com++ = '*', *e_com++ = '/', *e_com = '\0';
ps.just_saw_decl = l_just_saw_decl;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2016-11-30 Thread Pedro F. Giffuni
Author: pfg
Date: Thu Dec  1 01:48:56 2016
New Revision: 309342
URL: https://svnweb.freebsd.org/changeset/base/309342

Log:
  indent(1): Don't ignore newlines after comments that follow braces.
  
  indent.c has a special loop that stores tokens from between an if () and
  the next statement into a buffer. The loop ignored all newlines, but that
  resulted in not calling dump_line() when it was needed to produce the
  final line of the buffered up comment.
  
  Taken from:Piotr Stefaniak

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

Modified: head/usr.bin/indent/indent.c
==
--- head/usr.bin/indent/indent.cThu Dec  1 01:32:13 2016
(r309341)
+++ head/usr.bin/indent/indent.cThu Dec  1 01:48:56 2016
(r309342)
@@ -335,8 +335,10 @@ main(int argc, char **argv)
switch (type_code) {
case newline:
++line_no;
-   if (sc_end != NULL)
-   goto sw_buffer; /* dump comment, if any */
+   if (sc_end != NULL) {   /* dump comment, if any */
+   *sc_end++ = '\n';   /* newlines are needed in this case */
+   goto sw_buffer;
+   }
flushed_nl = true;
case form_feed:
break;  /* form feeds and newlines found here will be
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2016-11-30 Thread Pedro F. Giffuni
Author: pfg
Date: Thu Dec  1 01:32:13 2016
New Revision: 309341
URL: https://svnweb.freebsd.org/changeset/base/309341

Log:
  indent(1): Avoid out of bound access of array in_buffer
  
  Work-around a somewhat complex interaction within the code. From
  Piotr's commit [1]:
  
  When pr_comment() calls dump_line() for the first line of a multiline
  comment, it doesn't include any indentation - it starts with the "/*".
  This is consistent for both boxed and not boxed comments. Where the logic
  diverges is in how it treats the rest of the lines of the comment. For box
  comments indent assumes that it must not change anything, so lines are
  dumped as they were, including the indentation where it exists. For the
  rest of comments, it will first remove the indentation to store plain text
  of the comment and then add it again where indent thinks it's appropriate
  -- this is part of comment re-indenting process.
  
  For continuations of multi-line comments, the code that handles comments
  in dump_line() will use pad_output() to create indentation from the
  beginning of the line (what indent calls the first column) and then write
  string pointed by s_com afterwards. But if it's a box comment, the string
  will include original indentation, unless it's the first line of the
  comment. This is why tab characters from s_com have to be considered when
  calculating how much padding is needed and the "while (*com_st == '\t')
  com_st++, target += 8;" does that.
  
  In dump_line(), /target/ is initially set to ps.com_col, so it always
  assumes that indentation needs to be produced in this function, regardless
  of which line of a box comment it is. But for the first line of a box
  comment it is not true, so pr_comment() signals it by setting
  ps.n_comment_delta, the negative comment delta, to a negative number which
  is then added to /target/ in dump_line() on all lines except the first
  one, so that the function produces adequate indentation in this special
  case.
  
  The bug was in how that negative offset was calculated: pr_comment() used
  count_spaces() on in_buffer, which pr_comment() expected to contain
  non-null terminated sequence of characters, originating from whatever
  originally was on the left side of the comment. Understanding that
  count_spaces() requires a string, pr_comment() temporarily set buf_ptr[-2]
  to 0 in hope that it would nul-terminate the right thing in in_buffer and
  calling count_spaces() would be safe and do the expected thing. This was
  false whenever buf_ptr would point into save_com, an entirely different
  char array than in_buffer.
  
  The short-term fix is to recognize whether buf_ptr points into in_buffer
  or save_com.
  
  Reference:
  [1]
  
https://github.com/pstef/freebsd_indent/commit/ea486a2aa3b056b146bdfbb8e94843159750f200
  
  Taken from:Piotr Stefaniak

Modified:
  head/usr.bin/indent/io.c
  head/usr.bin/indent/pr_comment.c

Modified: head/usr.bin/indent/io.c
==
--- head/usr.bin/indent/io.cWed Nov 30 22:20:23 2016(r309340)
+++ head/usr.bin/indent/io.cThu Dec  1 01:32:13 2016(r309341)
@@ -225,8 +225,9 @@ dump_line(void)
char *com_st = s_com;
 
target += ps.comment_delta;
-   while (*com_st == '\t')
-   com_st++, target += 8;  /* ? */
+   while (*com_st == '\t') /* consider original indentation in
+* case this is a box comment */
+   com_st++, target += 8;
while (target <= 0)
if (*com_st == ' ')
target++, com_st++;

Modified: head/usr.bin/indent/pr_comment.c
==
--- head/usr.bin/indent/pr_comment.cWed Nov 30 22:20:23 2016
(r309340)
+++ head/usr.bin/indent/pr_comment.cThu Dec  1 01:32:13 2016
(r309341)
@@ -147,9 +147,16 @@ pr_comment(void)
}
 }
 if (ps.box_com) {
-   buf_ptr[-2] = 0;
-   ps.n_comment_delta = 1 - count_spaces(1, in_buffer);
-   buf_ptr[-2] = '/';
+   /*
+* Find out how much indentation there was originally, because that
+* much will have to be ignored by pad_output() in dump_line(). This
+* is a box comment, so nothing changes -- not even indentation.
+*
+* The comment we're about to read usually comes from in_buffer,
+* unless it has been copied into save_com.
+*/
+   char *start = buf_ptr >= save_com && buf_ptr < save_com + sc_size ? 
bp_save : buf_ptr;
+   ps.n_comment_delta = 1 - count_spaces_until(1, in_buffer, start - 2);
 }
 else {
ps.n_comment_delta = 0;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to 

Re: svn commit: r309331 - head/usr.bin/locale

2016-11-30 Thread Bruce Evans

On Wed, 30 Nov 2016, Eric van Gyzen wrote:


Log:
 Include limits.h for CHAR_MAX

 This was needed on stable/10.  Apparently, sys/param.h supplies CHAR_MAX
 on head.  Include limits.h anyway, for consistency, and because C says so.


sys/param.actually supplies CHAR_MAX (undocumented namespace pollution) in
all versions of FreeBSD.

The function that uses this has many bugs, but most are only style bugs due
to various magic.

X char *
X format_grouping(const char *binary)
X {
X   static char rval[64];
X   const char *cp;
X   size_t len;
X 
X 	rval[0] = '\0';

X   for (cp = binary; *cp != '\0'; ++cp) {
X   char group[sizeof("127;")];

This hard-codes CHAR_MAX is 127.  This works accidentally on POSIX >= 2100
since POSIX now specifies 8-bit chars, and even if chars are unsigned so
that CHAR_MAX is 255, that fits in the same space as 127.

X   snprintf(group, sizeof(group), "%hhd;", *cp);
X   len = strlcat(rval, group, sizeof(rval));
X   if (len >= sizeof(rval)) {
X   len = sizeof(rval) - 1;
X   break;
X   }

I don't like the error handling.  It is too careful, yet not careful
enough to be correct.  Use of snprintf() with no error handling instead
of sprintf() has no effect unless there are bugs, but there are bugs.
The first few are:
- if chars are signed, then *cp may be negative.  This is an invalid
  format, but we should check it.  Negative chars are converted to
  garbage starting with a minus sign.  group[] is too small to hold
  large ones.  We defend against buffer overruns by using snprintf(),
  but don't check for errors.  Truncation gives further garbage.
- %hhd is a bogus format if chars are signed.  Then hh in it has no
  effect
- %hhd is a broken format if chars are unsigned.  It says to convert
  the arg to signed char.  On non-exotic machines with CHAR_MAX = 255,
  this corrupts values between 128 and 255 to negative ones.  Large
  values are unlikely/physically impossible, but CHAR_MAX is a magic
  sentinel value which I think we want to print as itself (users also
  need to know what CHAR_MAX is to decode it).
- on exotic machines, CHAR_MAX can be UINT_MAX.  Then char promotes to
  u_int and %d format would give undefined behaviour if the value
  exceeds INT_MAX.  %hhd is no better for avoiding the undefined
  behviour, and when it works normally it corrupts large values as for
  the non-exotic case.

X   if (*cp == CHAR_MAX) {
X   break;
X   }
X   }
X 
X 	/* Remove the trailing ';'. */

X   rval[len - 1] = '\0';

This writes outside of rval when binary is the null string.  Possible
for at least invalid formats.  len should be initialized to 0 in this
case, but it actually uninitialized, so compilers will warn at high
WARNS even if this case is unreachable.

X 
X 	return (rval);

X }

Untested fixes and cleanups:

Y diff -u2 locale.c~ locale.c
Y --- locale.c~ 2016-11-25 08:26:48.0 +
Y +++ locale.c  2016-12-01 00:09:23.603179000 +
Y @@ -495,27 +495,27 @@
Y   static char rval[64];
Y   const char *cp;
Y - size_t len;
Y + size_t roff;
Y + int len;
Y 
Y  	rval[0] = '\0';

Y + roff = 0;
Y   for (cp = binary; *cp != '\0'; ++cp) {
Y - char group[sizeof("127;")];
Y - snprintf(group, sizeof(group), "%hhd;", *cp);
Y - len = strlcat(rval, group, sizeof(rval));
Y - if (len >= sizeof(rval)) {
Y - len = sizeof(rval) - 1;
Y - break;
Y - }
Y - if (*cp == CHAR_MAX) {
Y - break;
Y - }
Y + if (*cp < 0)
Y + break;  /* garbage input */
Y + len = snprintf([roff], sizeof(rval) - roff, "%u;", *cp);
Y + if (len < 0 || len >= sizeof(rval) - roff)
Y + break;  /* insufficient space for output */
Y + roff += len;
Y + if (*cp == CHAR_MAX)
Y + break;  /* special termination */
Y   }
Y 
Y -	/* Remove the trailing ';'. */

Y - rval[len - 1] = '\0';
Y + /* Truncate at the last successfully snprintf()ed semicolon. */
Y + if (roff != 0)
Y + rval[roff - 1] = '\0';
Y 
Y -	return (rval);

Y + return ([0]);
Y  }
Y 
Y -

Y  /*
Y   * keyword value lookup helper (via localeconv())

It was much easier to just use snprintf().

The error handling can be further simplified by checking if rval[] is
large enough up front.  It needs to have size

strlen("255;") * strlen(binary) + 1,

where 255 is POSIX CHAR_MAX hard-coded.

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


svn commit: r309339 - in head: . release/scripts share/mk

2016-11-30 Thread Glen Barber
Author: gjb
Date: Wed Nov 30 22:00:25 2016
New Revision: 309339
URL: https://svnweb.freebsd.org/changeset/base/309339

Log:
  Revert r309314, which breaks installing ports.
  
  Requested by: antoine
  Differential Revision:https://reviews.freebsd.org/D8120 (related)
  Sponsored by: The FreeBSD Foundation

Modified:
  head/Makefile.inc1
  head/release/scripts/make-pkg-package.sh
  head/share/mk/bsd.own.mk

Modified: head/Makefile.inc1
==
--- head/Makefile.inc1  Wed Nov 30 21:59:52 2016(r309338)
+++ head/Makefile.inc1  Wed Nov 30 22:00:25 2016(r309339)
@@ -1379,8 +1379,7 @@ packages: .PHONY
 package-pkg: .PHONY
rm -rf /tmp/ports.${TARGET} || :
env ${WMAKEENV:Q} SRCDIR=${.CURDIR} PORTSDIR=${PORTSDIR} 
REVISION=${_REVISION} \
-   PKG_CMD=${PKG_CMD} PKG_VERSION=${PKG_VERSION} 
REPODIR=${REPODIR} \
-   WSTAGEDIR=${WSTAGEDIR} \
+   PKG_VERSION=${PKG_VERSION} REPODIR=${REPODIR} 
WSTAGEDIR=${WSTAGEDIR} \
sh ${.CURDIR}/release/scripts/make-pkg-package.sh
 
 real-packages: stage-packages create-packages sign-packages .PHONY
@@ -1418,11 +1417,11 @@ create-world-packages:  _pkgbootstrap .PH
/^name/ { printf("===> Creating %s-", $$2); next } \
/^version/ { print $$2; next } \
' ${WSTAGEDIR}/$${pkgname}.ucl ; \
-   ${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/bin/sh -o 
ALLOW_BASE_SHLIBS=yes \
+   pkg -o ABI_FILE=${WSTAGEDIR}/bin/sh -o ALLOW_BASE_SHLIBS=yes \
create -M ${WSTAGEDIR}/$${pkgname}.ucl \
-p ${WSTAGEDIR}/$${pkgname}.plist \
-r ${WSTAGEDIR} \
-   -o ${REPODIR}/$$(${PKG_CMD} -o 
ABI_FILE=${WSTAGEDIR}/bin/sh config ABI)/${PKG_VERSION} ; \
+   -o ${REPODIR}/$$(pkg -o ABI_FILE=${WSTAGEDIR}/bin/sh 
config ABI)/${PKG_VERSION} ; \
done
 
 create-kernel-packages:_pkgbootstrap .PHONY
@@ -1446,11 +1445,11 @@ create-kernel-packages: _pkgbootstrap .P
/name/ { printf("===> Creating %s-", $$2); next } \
/version/ {print $$2; next } ' \
${KSTAGEDIR}/${DISTDIR}/kernel.${INSTALLKERNEL}${flavor}.ucl ; \
-   ${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/bin/sh -o ALLOW_BASE_SHLIBS=yes \
+   pkg -o ABI_FILE=${WSTAGEDIR}/bin/sh -o ALLOW_BASE_SHLIBS=yes \
create -M 
${KSTAGEDIR}/${DISTDIR}/kernel.${INSTALLKERNEL}${flavor}.ucl \
-p 
${KSTAGEDIR}/${DISTDIR}/kernel.${INSTALLKERNEL}${flavor}.plist \
-r ${KSTAGEDIR}/${DISTDIR} \
-   -o ${REPODIR}/$$(${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/bin/sh 
config ABI)/${PKG_VERSION}
+   -o ${REPODIR}/$$(pkg -o ABI_FILE=${WSTAGEDIR}/bin/sh config 
ABI)/${PKG_VERSION}
 .endfor
 .endif
 .if ${BUILDKERNELS:[#]} > 1 && ${NO_INSTALLEXTRAKERNELS} != "yes"
@@ -1475,25 +1474,25 @@ create-kernel-packages: _pkgbootstrap .P
/name/ { printf("===> Creating %s-", $$2); next } \
/version/ {print $$2; next } ' \
${KSTAGEDIR}/kernel.${_kernel}/kernel.${_kernel}${flavor}.ucl ; 
\
-   ${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/bin/sh -o ALLOW_BASE_SHLIBS=yes \
+   pkg -o ABI_FILE=${WSTAGEDIR}/bin/sh -o ALLOW_BASE_SHLIBS=yes \
create -M 
${KSTAGEDIR}/kernel.${_kernel}/kernel.${_kernel}${flavor}.ucl \
-p 
${KSTAGEDIR}/kernel.${_kernel}/kernel.${_kernel}${flavor}.plist \
-r ${KSTAGEDIR}/kernel.${_kernel} \
-   -o ${REPODIR}/$$(${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/bin/sh 
config ABI)/${PKG_VERSION}
+   -o ${REPODIR}/$$(pkg -o ABI_FILE=${WSTAGEDIR}/bin/sh config 
ABI)/${PKG_VERSION}
 .endfor
 .endif
 .endfor
 .endif
 
 sign-packages: _pkgbootstrap .PHONY
-   @[ -L "${REPODIR}/$$(${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/bin/sh config 
ABI)/latest" ] && \
-   unlink ${REPODIR}/$$(${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/bin/sh 
config ABI)/latest ; \
-   ${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/bin/sh repo \
-   -o ${REPODIR}/$$(${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/bin/sh 
config ABI)/${PKG_VERSION} \
-   ${REPODIR}/$$(${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/bin/sh config 
ABI)/${PKG_VERSION} \
+   @[ -L "${REPODIR}/$$(pkg -o ABI_FILE=${WSTAGEDIR}/bin/sh config 
ABI)/latest" ] && \
+   unlink ${REPODIR}/$$(pkg -o ABI_FILE=${WSTAGEDIR}/bin/sh config 
ABI)/latest ; \
+   pkg -o ABI_FILE=${WSTAGEDIR}/bin/sh repo \
+   -o ${REPODIR}/$$(pkg -o ABI_FILE=${WSTAGEDIR}/bin/sh config 
ABI)/${PKG_VERSION} \
+   ${REPODIR}/$$(pkg -o ABI_FILE=${WSTAGEDIR}/bin/sh config 
ABI)/${PKG_VERSION} \
${PKGSIGNKEY} ; \
-   ln -s ${REPODIR}/$$(${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/bin/sh config 
ABI)/${PKG_VERSION} \
-   

svn commit: r309338 - head/sys/dev/ioat

2016-11-30 Thread Conrad E. Meyer
Author: cem
Date: Wed Nov 30 21:59:52 2016
New Revision: 309338
URL: https://svnweb.freebsd.org/changeset/base/309338

Log:
  ioat(4): Fix 'bogus completion_pending' KASSERT
  
  Fix ioat_release to only set is_completion_pending if DMAs were actually
  queued.  Otherwise, the spurious flag could trigger an assert in the
  reset path on INVARIANTS kernels.
  
  Reviewed by:  bdrewery, Suraj Raju @ Isilon
  Sponsored by: Dell EMC Isilon

Modified:
  head/sys/dev/ioat/ioat.c
  head/sys/dev/ioat/ioat_internal.h

Modified: head/sys/dev/ioat/ioat.c
==
--- head/sys/dev/ioat/ioat.cWed Nov 30 21:53:06 2016(r309337)
+++ head/sys/dev/ioat/ioat.cWed Nov 30 21:59:52 2016(r309338)
@@ -947,6 +947,7 @@ ioat_acquire(bus_dmaengine_t dmaengine)
ioat = to_ioat_softc(dmaengine);
mtx_lock(>submit_lock);
CTR2(KTR_IOAT, "%s channel=%u", __func__, ioat->chan_idx);
+   ioat->acq_head = ioat->head;
 }
 
 int
@@ -976,12 +977,15 @@ ioat_release(bus_dmaengine_t dmaengine)
CTR4(KTR_IOAT, "%s channel=%u dispatch2 hw_head=%u head=%u", __func__,
ioat->chan_idx, ioat->hw_head & UINT16_MAX, ioat->head);
 
-   ioat_write_2(ioat, IOAT_DMACOUNT_OFFSET, (uint16_t)ioat->hw_head);
-
-   if (!ioat->is_completion_pending) {
-   ioat->is_completion_pending = TRUE;
-   callout_reset(>poll_timer, 1, ioat_poll_timer_callback,
-   ioat);
+   if (ioat->acq_head != ioat->head) {
+   ioat_write_2(ioat, IOAT_DMACOUNT_OFFSET,
+   (uint16_t)ioat->hw_head);
+
+   if (!ioat->is_completion_pending) {
+   ioat->is_completion_pending = TRUE;
+   callout_reset(>poll_timer, 1,
+   ioat_poll_timer_callback, ioat);
+   }
}
mtx_unlock(>submit_lock);
 }

Modified: head/sys/dev/ioat/ioat_internal.h
==
--- head/sys/dev/ioat/ioat_internal.h   Wed Nov 30 21:53:06 2016
(r309337)
+++ head/sys/dev/ioat/ioat_internal.h   Wed Nov 30 21:59:52 2016
(r309338)
@@ -483,6 +483,7 @@ struct ioat_softc {
boolean_t   resetting_cleanup;  /* cleanup_lock */
 
uint32_thead;
+   uint32_tacq_head;
uint32_ttail;
uint32_thw_head;
uint32_tring_size_order;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r309121 - head/usr.sbin/bhyve

2016-11-30 Thread Ian Lepore
On Thu, 2016-11-24 at 23:27 +0100, Jakub Klama wrote:
> > 
> > Wiadomość napisana przez Ian Lepore  w dniu
> > 24.11.2016, o godz. 23:23:
> > 
> > On Thu, 2016-11-24 at 22:16 +, Jakub Wojciech Klama wrote:
> > > 
> > > Author: jceel
> > > Date: Thu Nov 24 22:16:18 2016
> > > New Revision: 309121
> > > URL: https://svnweb.freebsd.org/changeset/base/309121
> > > 
> > > Log:
> > >  virtio_console: handle short writes to an Unix domain socket
> > > gracefully.
> > > 
> > >  writev() can do a short write.  Retrying it results in a very
> > > convoluted
> > >  and complex code, so we iterate over iovec and do regular
> > > stream_write()
> > >  instead.
> > > 
> > Doesn't pwritev(2) simplify iterating to handle short writes?
> > 
> Correct me if I'm wrong, but pwritev(2) is a writev(2) with offset.
> We're writing to an Unix domain socket here, which is not seekable.
> 
> Thanks,
> Jakub
> 
> 

My bad, I was under the impression the offset was an offset into the
iovec, not into the file.  So, ummm... nevermind. :)

-- Ian

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


Re: svn commit: r308996 - head/lib/libfetch

2016-11-30 Thread Jan Beich
Dag-Erling Smørgrav  writes:

>  conn_t *
>  fetch_connect(const char *host, int port, int af, int verbose)
>  {
[...]
> + fetch_info("resolved");

Can you hide it behind "verbose" flag to avoid confusion?

  $ pkg
  The package management tool is not yet installed on your system.
  Do you want to fetch and install it now? [y/N]: y
  Bootstrapping pkg from pkg+http://pkg.FreeBSD.org/FreeBSD:12:amd64/latest, 
please wait...
  resolved
  resolved
  [...]

  $ fetch -q http://example.com
  resolved
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

svn commit: r309332 - head

2016-11-30 Thread Dimitry Andric
Author: dim
Date: Wed Nov 30 19:06:47 2016
New Revision: 309332
URL: https://svnweb.freebsd.org/changeset/base/309332

Log:
  Cleanup old debug dirs in delete-old-dirs target
  
  Any .debug or .symbols files under /usr/lib/debug which correspond to
  OLD_FILES entries in ObsoleteFiles.inc are also automatically cleaned up
  by the delete-old target.  Make this also apply to any OLD_DIRS entries.
  
  Reviewed by:  emaste
  MFC after:3 days
  Differential Revision: https://reviews.freebsd.org/D8683

Modified:
  head/Makefile.inc1

Modified: head/Makefile.inc1
==
--- head/Makefile.inc1  Wed Nov 30 18:34:40 2016(r309331)
+++ head/Makefile.inc1  Wed Nov 30 19:06:47 2016(r309332)
@@ -2404,6 +2404,11 @@ delete-old-dirs: .PHONY
elif [ -L "${DESTDIR}/$${dir}" ]; then \
echo "${DESTDIR}/$${dir} is a link, please remove 
everything manually."; \
fi; \
+   if [ -d "${DESTDIR}${DEBUGDIR}/$${dir}" ]; then \
+   rmdir -v "${DESTDIR}${DEBUGDIR}/$${dir}" || true; \
+   elif [ -L "${DESTDIR}${DEBUGDIR}/$${dir}" ]; then \
+   echo "${DESTDIR}${DEBUGDIR}/$${dir} is a link, please 
remove everything manually."; \
+   fi; \
done
@echo ">>> Old directories removed"
 
@@ -2418,6 +2423,11 @@ check-old-dirs: .PHONY
elif [ -L "${DESTDIR}/$${dir}" ]; then \
echo "${DESTDIR}/$${dir} is a link, please remove 
everything manually."; \
fi; \
+   if [ -d "${DESTDIR}${DEBUGDIR}/$${dir}" ]; then \
+   echo "${DESTDIR}${DEBUGDIR}/$${dir}"; \
+   elif [ -L "${DESTDIR}${DEBUGDIR}/$${dir}" ]; then \
+   echo "${DESTDIR}${DEBUGDIR}/$${dir} is a link, please 
remove everything manually."; \
+   fi; \
done
 
 delete-old: delete-old-files delete-old-dirs .PHONY
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r309331 - head/usr.bin/locale

2016-11-30 Thread Eric van Gyzen
Author: vangyzen
Date: Wed Nov 30 18:34:40 2016
New Revision: 309331
URL: https://svnweb.freebsd.org/changeset/base/309331

Log:
  Include limits.h for CHAR_MAX
  
  This was needed on stable/10.  Apparently, sys/param.h supplies CHAR_MAX
  on head.  Include limits.h anyway, for consistency, and because C says so.
  
  Sponsored by: Dell EMC

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

Modified: head/usr.bin/locale/locale.c
==
--- head/usr.bin/locale/locale.cWed Nov 30 18:26:22 2016
(r309330)
+++ head/usr.bin/locale/locale.cWed Nov 30 18:34:40 2016
(r309331)
@@ -40,6 +40,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r309328 - head/sys/dev/pci

2016-11-30 Thread Andrew Turner
Author: andrew
Date: Wed Nov 30 14:18:52 2016
New Revision: 309328
URL: https://svnweb.freebsd.org/changeset/base/309328

Log:
  Fix the PCI host generic FDT driver to call into the common code and not
  recurse into itself.
  
  Obtained from:ABT Systems Ltd
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/dev/pci/pci_host_generic_fdt.c

Modified: head/sys/dev/pci/pci_host_generic_fdt.c
==
--- head/sys/dev/pci/pci_host_generic_fdt.c Wed Nov 30 14:17:06 2016
(r309327)
+++ head/sys/dev/pci/pci_host_generic_fdt.c Wed Nov 30 14:18:52 2016
(r309328)
@@ -152,7 +152,7 @@ pci_host_generic_attach(device_t dev)
device_printf(dev, "Bus is%s cache-coherent\n",
sc->base.coherent ? "" : " not");
 
-   error = pci_host_generic_attach(dev);
+   error = pci_host_generic_core_attach(dev);
if (error != 0)
return (error);
 
@@ -327,15 +327,15 @@ pci_host_generic_alloc_resource(device_t
 
 #if defined(NEW_PCIB) && defined(PCI_RES_BUS)
if (type == PCI_RES_BUS) {
-   return (pci_host_generic_alloc_resource(dev, child, type, rid,
+   return (pci_host_generic_core_alloc_resource(dev, child, type, 
rid,
start, end, count, flags));
}
 #endif
 
/* For PCIe devices that do not have FDT nodes, use PCIB method */
if ((int)ofw_bus_get_node(child) <= 0)
-   return (pci_host_generic_alloc_resource(dev, child, type, rid,
-   start, end, count, flags));
+   return (pci_host_generic_core_alloc_resource(dev, child, type,
+   rid, start, end, count, flags));
 
/* For other devices use OFW method */
sc = device_get_softc(dev);
@@ -377,8 +377,8 @@ pci_host_generic_alloc_resource(device_t
}
}
 
-   return (bus_generic_alloc_resource(dev, child, type, rid, start, end,
-   count, flags));
+   return (bus_generic_alloc_resource(dev, child, type, rid, start,
+   end, count, flags));
 }
 
 static int
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r309327 - head/sys/arm64/cavium

2016-11-30 Thread Andrew Turner
Author: andrew
Date: Wed Nov 30 14:17:06 2016
New Revision: 309327
URL: https://svnweb.freebsd.org/changeset/base/309327

Log:
  Fix the alloc function the ThunderX PCIe driver calls, the previous
  function may not exist when FDT is removed from the kernel.
  
  Obtained from:ABT Systems Ltd
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/arm64/cavium/thunder_pcie_common.c

Modified: head/sys/arm64/cavium/thunder_pcie_common.c
==
--- head/sys/arm64/cavium/thunder_pcie_common.c Wed Nov 30 14:02:36 2016
(r309326)
+++ head/sys/arm64/cavium/thunder_pcie_common.c Wed Nov 30 14:17:06 2016
(r309327)
@@ -204,7 +204,7 @@ thunder_pcie_alloc_resource(device_t dev
end = start + count - 1;
}
 
-   return (pci_host_generic_alloc_resource(dev, child, type, rid, start,
-   end, count, flags));
+   return (pci_host_generic_core_alloc_resource(dev, child, type, rid,
+   start, end, count, flags));
 }
 #endif
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r309326 - head/usr.bin/login

2016-11-30 Thread Robert Watson
Author: rwatson
Date: Wed Nov 30 14:02:36 2016
New Revision: 309326
URL: https://svnweb.freebsd.org/changeset/base/309326

Log:
  Clarify warning message when failing to configure audit on user login:
  when au_user_mask() fails, it's not a failure to set the audit mask,
  but to calculate the audit mask -- and hence a condfiguration-file
  issue (of some sort).
  
  MFC after:3 days
  Sponsored by: DARPA, AFRL

Modified:
  head/usr.bin/login/login_audit.c

Modified: head/usr.bin/login/login_audit.c
==
--- head/usr.bin/login/login_audit.cWed Nov 30 12:06:03 2016
(r309325)
+++ head/usr.bin/login/login_audit.cWed Nov 30 14:02:36 2016
(r309326)
@@ -80,7 +80,7 @@ au_login_success(void)
 
/* Compute and set the user's preselection mask. */
if (au_user_mask(pwd->pw_name, ) == -1)
-   errx(1, "could not set audit mask");
+   errx(1, "could not calculate audit mask");
 
/* Set the audit info for the user. */
auinfo.ai_auid = uid;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r309324 - head/sys/conf

2016-11-30 Thread Andrew Turner
Author: andrew
Date: Wed Nov 30 10:17:03 2016
New Revision: 309324
URL: https://svnweb.freebsd.org/changeset/base/309324

Log:
  Mark the Alpine ethernet driver as FDT only. It calls
  alpine_serdes_resource_get which is defined in an FDT only file.
  
  Obtained from:ABT Systems Ltd
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/conf/files

Modified: head/sys/conf/files
==
--- head/sys/conf/files Wed Nov 30 09:47:29 2016(r309323)
+++ head/sys/conf/files Wed Nov 30 10:17:03 2016(r309324)
@@ -719,13 +719,13 @@ dev/aic7xxx/aic7xxx_93cx6.c   optional ahc
 dev/aic7xxx/aic7xxx_osm.c  optional ahc
 dev/aic7xxx/aic7xxx_pci.c  optional ahc pci
 dev/aic7xxx/aic7xxx_reg_print.coptional ahc ahc_reg_pretty_print
-dev/al_eth/al_eth.coptional al_eth \
+dev/al_eth/al_eth.coptional al_eth fdt \
no-depend   \
compile-with "${CC} -c -o ${.TARGET} ${CFLAGS} -I$S/contrib/alpine-hal 
-I$S/contrib/alpine-hal/eth ${PROF} ${.IMPSRC}"
-dev/al_eth/al_init_eth_lm.coptional al_eth \
+dev/al_eth/al_init_eth_lm.coptional al_eth fdt \
no-depend   \
compile-with "${CC} -c -o ${.TARGET} ${CFLAGS} -I$S/contrib/alpine-hal 
-I$S/contrib/alpine-hal/eth ${PROF} ${.IMPSRC}"
-dev/al_eth/al_init_eth_kr.coptional al_eth \
+dev/al_eth/al_init_eth_kr.coptional al_eth fdt \
no-depend   \
compile-with "${CC} -c -o ${.TARGET} ${CFLAGS} -I$S/contrib/alpine-hal 
-I$S/contrib/alpine-hal/eth ${PROF} ${.IMPSRC}"
 contrib/alpine-hal/al_hal_iofic.c  optional al_iofic   \
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r309323 - head/sys/arm/arm

2016-11-30 Thread Andrew Turner
Author: andrew
Date: Wed Nov 30 09:47:29 2016
New Revision: 309323
URL: https://svnweb.freebsd.org/changeset/base/309323

Log:
  Move the FDT specific parts of the GIC diver softc to the FDT attachment.
  This allows the driver to be built in a kernel with no FDT support, e.g.
  on arm64 with just ACPI.
  
  Obtained from:ABT Systems Ltd
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/arm/arm/gic.h
  head/sys/arm/arm/gic_fdt.c

Modified: head/sys/arm/arm/gic.h
==
--- head/sys/arm/arm/gic.h  Wed Nov 30 09:45:18 2016(r309322)
+++ head/sys/arm/arm/gic.h  Wed Nov 30 09:47:29 2016(r309323)
@@ -75,9 +75,6 @@ struct arm_gic_softc {
 #endif
 
 #ifdef INTRNG
-   /* FDT child data */
-   pcell_t addr_cells;
-   pcell_t size_cells;
int nranges;
struct arm_gic_range *  ranges;
 #endif

Modified: head/sys/arm/arm/gic_fdt.c
==
--- head/sys/arm/arm/gic_fdt.c  Wed Nov 30 09:45:18 2016(r309322)
+++ head/sys/arm/arm/gic_fdt.c  Wed Nov 30 09:47:29 2016(r309323)
@@ -60,6 +60,12 @@ struct arm_gic_devinfo {
 };
 #endif
 
+struct arm_gic_fdt_softc {
+   struct arm_gic_softcbase;
+   pcell_t addr_cells;
+   pcell_t size_cells;
+};
+
 static device_probe_t gic_fdt_probe;
 static device_attach_t gic_fdt_attach;
 static ofw_bus_get_devinfo_t gic_ofw_get_devinfo;
@@ -102,7 +108,7 @@ static device_method_t gic_fdt_methods[]
 };
 
 DEFINE_CLASS_1(gic, gic_fdt_driver, gic_fdt_methods,
-sizeof(struct arm_gic_softc), arm_gic_driver);
+sizeof(struct arm_gic_fdt_softc), arm_gic_driver);
 
 static devclass_t gic_fdt_devclass;
 
@@ -128,7 +134,7 @@ static int
 gic_fdt_attach(device_t dev)
 {
 #ifdef INTRNG
-   struct arm_gic_softc *sc = device_get_softc(dev);
+   struct arm_gic_fdt_softc *sc = device_get_softc(dev);
phandle_t pxref;
intptr_t xref;
 #endif
@@ -164,14 +170,14 @@ gic_fdt_attach(device_t dev)
goto cleanup;
}
} else {
-   if (sc->gic_res[2] == NULL) {
+   if (sc->base.gic_res[2] == NULL) {
device_printf(dev,
"not root PIC must have defined interrupt\n");
intr_pic_deregister(dev, xref);
goto cleanup;
}
-   if (bus_setup_intr(dev, sc->gic_res[2], INTR_TYPE_CLK,
-   arm_gic_intr, NULL, sc, >gic_intrhand)) {
+   if (bus_setup_intr(dev, sc->base.gic_res[2], INTR_TYPE_CLK,
+   arm_gic_intr, NULL, sc, >base.gic_intrhand)) {
device_printf(dev, "could not setup irq handler\n");
intr_pic_deregister(dev, xref);
goto cleanup;
@@ -209,7 +215,7 @@ gic_fdt_get_resource_list(device_t bus, 
 }
 
 static int
-arm_gic_fill_ranges(phandle_t node, struct arm_gic_softc *sc)
+arm_gic_fill_ranges(phandle_t node, struct arm_gic_fdt_softc *sc)
 {
pcell_t host_cells;
cell_t *base_ranges;
@@ -229,42 +235,42 @@ arm_gic_fill_ranges(phandle_t node, stru
nbase_ranges = OF_getproplen(node, "ranges");
if (nbase_ranges < 0)
return (-1);
-   sc->nranges = nbase_ranges / sizeof(cell_t) /
+   sc->base.nranges = nbase_ranges / sizeof(cell_t) /
(sc->addr_cells + host_cells + sc->size_cells);
-   if (sc->nranges == 0)
+   if (sc->base.nranges == 0)
return (0);
 
-   sc->ranges = malloc(sc->nranges * sizeof(sc->ranges[0]),
+   sc->base.ranges = malloc(sc->base.nranges * sizeof(sc->base.ranges[0]),
M_DEVBUF, M_WAITOK);
base_ranges = malloc(nbase_ranges, M_DEVBUF, M_WAITOK);
OF_getencprop(node, "ranges", base_ranges, nbase_ranges);
 
-   for (i = 0, j = 0; i < sc->nranges; i++) {
-   sc->ranges[i].bus = 0;
+   for (i = 0, j = 0; i < sc->base.nranges; i++) {
+   sc->base.ranges[i].bus = 0;
for (k = 0; k < sc->addr_cells; k++) {
-   sc->ranges[i].bus <<= 32;
-   sc->ranges[i].bus |= base_ranges[j++];
+   sc->base.ranges[i].bus <<= 32;
+   sc->base.ranges[i].bus |= base_ranges[j++];
}
-   sc->ranges[i].host = 0;
+   sc->base.ranges[i].host = 0;
for (k = 0; k < host_cells; k++) {
-   sc->ranges[i].host <<= 32;
-   sc->ranges[i].host |= base_ranges[j++];
+   sc->base.ranges[i].host <<= 32;
+   sc->base.ranges[i].host |= base_ranges[j++];
}
-   sc->ranges[i].size = 0;
+   

svn commit: r309322 - head/sys/arm/arm

2016-11-30 Thread Andrew Turner
Author: andrew
Date: Wed Nov 30 09:45:18 2016
New Revision: 309322
URL: https://svnweb.freebsd.org/changeset/base/309322

Log:
  Only include FDT headders when building for FDT.
  
  Obtained from:ABT Systems Ltd
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/arm/arm/gic.c

Modified: head/sys/arm/arm/gic.c
==
--- head/sys/arm/arm/gic.c  Wed Nov 30 09:27:08 2016(r309321)
+++ head/sys/arm/arm/gic.c  Wed Nov 30 09:45:18 2016(r309322)
@@ -61,8 +61,10 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#ifdef FDT
 #include 
 #include 
+#endif
 
 #include 
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r309321 - in head: sbin/geom/class/mirror sys/geom/mirror

2016-11-30 Thread Alexander Motin
Author: mav
Date: Wed Nov 30 09:27:08 2016
New Revision: 309321
URL: https://svnweb.freebsd.org/changeset/base/309321

Log:
  Add `gmirror create` subcommand, alike to gstripe, gconcat, etc.
  
  It is quite specific mode of operation without storing on-disk metadata.
  It can be useful in some cases in combination with some external control
  tools handling mirror creation and disks hot-plug.
  
  MFC after:2 weeks
  Sponsored by: iXsystems, Inc.

Modified:
  head/sbin/geom/class/mirror/geom_mirror.c
  head/sbin/geom/class/mirror/gmirror.8
  head/sys/geom/mirror/g_mirror.c
  head/sys/geom/mirror/g_mirror.h
  head/sys/geom/mirror/g_mirror_ctl.c

Modified: head/sbin/geom/class/mirror/geom_mirror.c
==
--- head/sbin/geom/class/mirror/geom_mirror.c   Wed Nov 30 08:21:15 2016
(r309320)
+++ head/sbin/geom/class/mirror/geom_mirror.c   Wed Nov 30 09:27:08 2016
(r309321)
@@ -79,6 +79,16 @@ struct g_command class_commands[] = {
"[-adfFhnv] [-b balance] [-s slice] name\n"
"[-v] -p priority name prov"
},
+   { "create", G_FLAG_VERBOSE, NULL,
+   {
+   { 'b', "balance", GMIRROR_BALANCE, G_TYPE_STRING },
+   { 'F', "nofailsync", NULL, G_TYPE_BOOL },
+   { 'n', "noautosync", NULL, G_TYPE_BOOL },
+   { 's', "slice", GMIRROR_SLICE, G_TYPE_NUMBER },
+   G_OPT_SENTINEL
+   },
+   "[-Fnv] [-b balance] [-s slice] name prov ..."
+   },
{ "deactivate", G_FLAG_VERBOSE, NULL, G_NULL_OPTS,
"[-v] name prov ..."
},

Modified: head/sbin/geom/class/mirror/gmirror.8
==
--- head/sbin/geom/class/mirror/gmirror.8   Wed Nov 30 08:21:15 2016
(r309320)
+++ head/sbin/geom/class/mirror/gmirror.8   Wed Nov 30 09:27:08 2016
(r309321)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd December 27, 2013
+.Dd November 27, 2016
 .Dt GMIRROR 8
 .Os
 .Sh NAME
@@ -43,6 +43,13 @@
 .Op Fl v
 .Ar prov ...
 .Nm
+.Cm create
+.Op Fl Fnv
+.Op Fl b Ar balance
+.Op Fl s Ar slice
+.Ar name
+.Ar prov ...
+.Nm
 .Cm configure
 .Op Fl adfFhnv
 .Op Fl b Ar balance
@@ -170,6 +177,12 @@ Defaults to 4096 bytes.
 .El
 .It Cm clear
 Clear metadata on the given providers.
+.It Cm create
+Similar to
+.Cm label,
+but creates mirror without storing on-disk metadata in last sector.
+This special "manual" operation mode assumes some external control to manage
+mirror detection after reboot, device hot-plug and other external events.
 .It Cm configure
 Configure the given device.
 .Pp

Modified: head/sys/geom/mirror/g_mirror.c
==
--- head/sys/geom/mirror/g_mirror.c Wed Nov 30 08:21:15 2016
(r309320)
+++ head/sys/geom/mirror/g_mirror.c Wed Nov 30 09:27:08 2016
(r309321)
@@ -700,6 +700,8 @@ g_mirror_clear_metadata(struct g_mirror_
g_topology_assert_not();
sx_assert(>d_softc->sc_lock, SX_LOCKED);
 
+   if (disk->d_softc->sc_type != G_MIRROR_TYPE_AUTOMATIC)
+   return (0);
error = g_mirror_write_metadata(disk, NULL);
if (error == 0) {
G_MIRROR_DEBUG(2, "Metadata on %s cleared.",
@@ -765,6 +767,8 @@ g_mirror_update_metadata(struct g_mirror
sc = disk->d_softc;
sx_assert(>sc_lock, SX_LOCKED);
 
+   if (sc->sc_type != G_MIRROR_TYPE_AUTOMATIC)
+   return;
if ((sc->sc_flags & G_MIRROR_DEVICE_FLAG_WIPE) == 0)
g_mirror_fill_metadata(sc, disk, );
error = g_mirror_write_metadata(disk, );
@@ -2942,8 +2946,9 @@ end:
return (error);
 }
 
-static struct g_geom *
-g_mirror_create(struct g_class *mp, const struct g_mirror_metadata *md)
+struct g_geom *
+g_mirror_create(struct g_class *mp, const struct g_mirror_metadata *md,
+u_int type)
 {
struct g_mirror_softc *sc;
struct g_geom *gp;
@@ -2966,6 +2971,7 @@ g_mirror_create(struct g_class *mp, cons
gp->access = g_mirror_access;
gp->dumpconf = g_mirror_dumpconf;
 
+   sc->sc_type = type;
sc->sc_id = md->md_mid;
sc->sc_slice = md->md_slice;
sc->sc_balance = md->md_balance;
@@ -3142,6 +3148,8 @@ g_mirror_taste(struct g_class *mp, struc
sc = gp->softc;
if (sc == NULL)
continue;
+   if (sc->sc_type != G_MIRROR_TYPE_AUTOMATIC)
+   continue;
if (sc->sc_sync.ds_geom == gp)
continue;
if (strcmp(md.md_name, sc->sc_name) != 0)
@@ -3154,7 +3162,7 @@ g_mirror_taste(struct g_class *mp, struc
break;
}
if (gp == NULL) {
-   gp = g_mirror_create(mp, );
+   gp = g_mirror_create(mp, , G_MIRROR_TYPE_AUTOMATIC);
if (gp == 

svn commit: r309320 - head/sys/dev/hyperv/storvsc

2016-11-30 Thread Sepherosa Ziehau
Author: sephe
Date: Wed Nov 30 08:21:15 2016
New Revision: 309320
URL: https://svnweb.freebsd.org/changeset/base/309320

Log:
  hyperv/storvsc: Don't use timedwait.
  
  The timeout is unnecessary.
  
  Reviewed by:  jhb
  MFC after:1 week
  Sponsored by: Microsoft
  Differential Revision:https://reviews.freebsd.org/D8656

Modified:
  head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c

Modified: head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c
==
--- head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.cWed Nov 30 
08:10:49 2016(r309319)
+++ head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.cWed Nov 30 
08:21:15 2016(r309320)
@@ -413,13 +413,7 @@ storvsc_send_multichannel_request(struct
VMBUS_CHANPKT_TYPE_INBAND, VMBUS_CHANPKT_FLAG_RC,
vstor_packet, VSTOR_PKT_SIZE, (uint64_t)(uintptr_t)request);
 
-   /* wait for 5 seconds */
-   ret = sema_timedwait(>synch_sema, 5 * hz);
-   if (ret != 0) { 
-   printf("Storvsc_error: create multi-channel timeout, %d\n",
-   ret);
-   return;
-   }
+   sema_wait(>synch_sema);
 
if (vstor_packet->operation != VSTOR_OPERATION_COMPLETEIO ||
vstor_packet->status != 0) {
@@ -486,10 +480,7 @@ hv_storvsc_channel_init(struct storvsc_s
if (ret != 0)
goto cleanup;
 
-   /* wait 5 seconds */
-   ret = sema_timedwait(>synch_sema, 5 * hz);
-   if (ret != 0)
-   goto cleanup;
+   sema_wait(>synch_sema);
 
if (vstor_packet->operation != VSTOR_OPERATION_COMPLETEIO ||
vstor_packet->status != 0) {
@@ -516,11 +507,7 @@ hv_storvsc_channel_init(struct storvsc_s
if (ret != 0)
goto cleanup;
 
-   /* wait 5 seconds */
-   ret = sema_timedwait(>synch_sema, 5 * hz);
-
-   if (ret)
-   goto cleanup;
+   sema_wait(>synch_sema);
 
if (vstor_packet->operation != VSTOR_OPERATION_COMPLETEIO) {
ret = EINVAL;
@@ -555,11 +542,7 @@ hv_storvsc_channel_init(struct storvsc_s
if ( ret != 0)
goto cleanup;
 
-   /* wait 5 seconds */
-   ret = sema_timedwait(>synch_sema, 5 * hz);
-
-   if (ret != 0)
-   goto cleanup;
+   sema_wait(>synch_sema);
 
/* TODO: Check returned version */
if (vstor_packet->operation != VSTOR_OPERATION_COMPLETEIO ||
@@ -588,11 +571,7 @@ hv_storvsc_channel_init(struct storvsc_s
goto cleanup;
}
 
-   /* wait 5 seconds */
-   ret = sema_timedwait(>synch_sema, 5 * hz);
-
-   if (ret != 0)
-   goto cleanup;
+   sema_wait(>synch_sema);
 
if (vstor_packet->operation != VSTOR_OPERATION_COMPLETEIO ||
vstor_packet->status != 0)
@@ -672,12 +651,7 @@ hv_storvsc_host_reset(struct storvsc_sof
goto cleanup;
}
 
-   ret = sema_timedwait(>synch_sema, 5 * hz); /* KYS 5 seconds */
-
-   if (ret) {
-   goto cleanup;
-   }
-
+   sema_wait(>synch_sema);
 
/*
 * At this point, all outstanding requests in the adapter
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r309319 - head/sys/dev/hyperv/vmbus

2016-11-30 Thread Sepherosa Ziehau
Author: sephe
Date: Wed Nov 30 08:10:49 2016
New Revision: 309319
URL: https://svnweb.freebsd.org/changeset/base/309319

Log:
  hypver/vmbus: Remove extra assertion.
  
  It is asserted by vmbus_chan_gpadl_connect() now.
  
  MFC after:1 week
  Sponsored by: Microsoft
  Differential Revision:https://reviews.freebsd.org/D8660

Modified:
  head/sys/dev/hyperv/vmbus/vmbus_chan.c

Modified: head/sys/dev/hyperv/vmbus/vmbus_chan.c
==
--- head/sys/dev/hyperv/vmbus/vmbus_chan.c  Wed Nov 30 07:54:28 2016
(r309318)
+++ head/sys/dev/hyperv/vmbus/vmbus_chan.c  Wed Nov 30 08:10:49 2016
(r309319)
@@ -405,8 +405,6 @@ vmbus_chan_open_br(struct vmbus_channel 
/*
 * Connect the bufrings, both RX and TX, to this channel.
 */
-   KASSERT(chan->ch_bufring_gpadl == 0,
-   ("bufring GPADL is still connected"));
error = vmbus_chan_gpadl_connect(chan, cbr->cbr_paddr,
txbr_size + rxbr_size, >ch_bufring_gpadl);
if (error) {
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"