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

2016-07-12 Thread Sepherosa Ziehau
Author: sephe
Date: Wed Jul 13 05:58:46 2016
New Revision: 302704
URL: https://svnweb.freebsd.org/changeset/base/302704

Log:
  hyperv/hn: Avoid the hv_device
  
  This paves way to nuke the hv_device, which is actually an unncessary
  indirection.
  
  MFC after:1 week
  Sponsored by: Microsoft OSTC
  Differential Revision:https://reviews.freebsd.org/D7033

Modified:
  head/sys/dev/hyperv/netvsc/hv_net_vsc.c
  head/sys/dev/hyperv/netvsc/hv_net_vsc.h
  head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
  head/sys/dev/hyperv/netvsc/hv_rndis_filter.c
  head/sys/dev/hyperv/netvsc/hv_rndis_filter.h

Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.c
==
--- head/sys/dev/hyperv/netvsc/hv_net_vsc.c Wed Jul 13 05:47:09 2016
(r302703)
+++ head/sys/dev/hyperv/netvsc/hv_net_vsc.c Wed Jul 13 05:58:46 2016
(r302704)
@@ -58,31 +58,30 @@ MALLOC_DEFINE(M_NETVSC, "netvsc", "Hyper
  * Forward declarations
  */
 static void hv_nv_on_channel_callback(void *xchan);
-static int  hv_nv_init_send_buffer_with_net_vsp(struct hv_device *device);
-static int  hv_nv_init_rx_buffer_with_net_vsp(struct hv_device *device);
+static int  hv_nv_init_send_buffer_with_net_vsp(struct hn_softc *sc);
+static int  hv_nv_init_rx_buffer_with_net_vsp(struct hn_softc *);
 static int  hv_nv_destroy_send_buffer(netvsc_dev *net_dev);
 static int  hv_nv_destroy_rx_buffer(netvsc_dev *net_dev);
-static int  hv_nv_connect_to_vsp(struct hv_device *device);
+static int  hv_nv_connect_to_vsp(struct hn_softc *sc);
 static void hv_nv_on_send_completion(netvsc_dev *net_dev,
-struct hv_device *device, struct hv_vmbus_channel *, 
hv_vm_packet_descriptor *pkt);
+struct hv_vmbus_channel *, hv_vm_packet_descriptor *pkt);
 static void hv_nv_on_receive_completion(struct hv_vmbus_channel *chan,
 uint64_t tid, uint32_t status);
 static void hv_nv_on_receive(netvsc_dev *net_dev,
-struct hv_device *device, struct hv_vmbus_channel *chan,
+struct hn_softc *sc, struct hv_vmbus_channel *chan,
 hv_vm_packet_descriptor *pkt);
 
 /*
  *
  */
 static inline netvsc_dev *
-hv_nv_alloc_net_device(struct hv_device *device)
+hv_nv_alloc_net_device(struct hn_softc *sc)
 {
netvsc_dev *net_dev;
-   hn_softc_t *sc = device_get_softc(device->device);
 
net_dev = malloc(sizeof(netvsc_dev), M_NETVSC, M_WAITOK | M_ZERO);
 
-   net_dev->dev = device;
+   net_dev->sc = sc;
net_dev->destroy = FALSE;
sc->net_dev = net_dev;
 
@@ -90,43 +89,21 @@ hv_nv_alloc_net_device(struct hv_device 
 }
 
 /*
- *
+ * XXX unnecessary; nuke it.
  */
 static inline netvsc_dev *
-hv_nv_get_outbound_net_device(struct hv_device *device)
+hv_nv_get_outbound_net_device(struct hn_softc *sc)
 {
-   hn_softc_t *sc = device_get_softc(device->device);
-   netvsc_dev *net_dev = sc->net_dev;;
-
-   if ((net_dev != NULL) && net_dev->destroy) {
-   return (NULL);
-   }
-
-   return (net_dev);
+   return sc->net_dev;
 }
 
 /*
- *
+ * XXX unnecessary; nuke it.
  */
 static inline netvsc_dev *
-hv_nv_get_inbound_net_device(struct hv_device *device)
+hv_nv_get_inbound_net_device(struct hn_softc *sc)
 {
-   hn_softc_t *sc = device_get_softc(device->device);
-   netvsc_dev *net_dev = sc->net_dev;;
-
-   if (net_dev == NULL) {
-   return (net_dev);
-   }
-   /*
-* When the device is being destroyed; we only
-* permit incoming packets if and only if there
-* are outstanding sends.
-*/
-   if (net_dev->destroy) {
-   return (NULL);
-   }
-
-   return (net_dev);
+   return sc->net_dev;
 }
 
 int
@@ -164,13 +141,13 @@ hv_nv_get_next_send_section(netvsc_dev *
  * Hyper-V extensible switch and the synthetic data path.
  */
 static int 
-hv_nv_init_rx_buffer_with_net_vsp(struct hv_device *device)
+hv_nv_init_rx_buffer_with_net_vsp(struct hn_softc *sc)
 {
netvsc_dev *net_dev;
nvsp_msg *init_pkt;
int ret = 0;
 
-   net_dev = hv_nv_get_outbound_net_device(device);
+   net_dev = hv_nv_get_outbound_net_device(sc);
if (!net_dev) {
return (ENODEV);
}
@@ -185,7 +162,7 @@ hv_nv_init_rx_buffer_with_net_vsp(struct
 * GPADL:  Guest physical address descriptor list.
 */
ret = hv_vmbus_channel_establish_gpadl(
-   device->channel, net_dev->rx_buf,
+   sc->hn_prichan, net_dev->rx_buf,
net_dev->rx_buf_size, _dev->rx_buf_gpadl_handle);
if (ret != 0) {
goto cleanup;
@@ -206,7 +183,7 @@ hv_nv_init_rx_buffer_with_net_vsp(struct
 
/* Send the gpadl notification request */
 
-   ret = hv_vmbus_channel_send_packet(device->channel, init_pkt,
+   ret = hv_vmbus_channel_send_packet(sc->hn_prichan, init_pkt,
sizeof(nvsp_msg), (uint64_t)(uintptr_t)init_pkt,

svn commit: r302703 - in head/sys/dev/hyperv: include vmbus

2016-07-12 Thread Sepherosa Ziehau
Author: sephe
Date: Wed Jul 13 05:47:09 2016
New Revision: 302703
URL: https://svnweb.freebsd.org/changeset/base/302703

Log:
  hyperv/vmbus: Deprecate the usage of hv_device.
  
  This paves way to nuke the hv_device, which is actually an unncessary
  indirection.
  
  MFC after:1 week
  Sponsored by: Microsoft OSTC
  Differential Revision:https://reviews.freebsd.org/D7032

Modified:
  head/sys/dev/hyperv/include/hyperv.h
  head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c
  head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h
  head/sys/dev/hyperv/vmbus/vmbus.c

Modified: head/sys/dev/hyperv/include/hyperv.h
==
--- head/sys/dev/hyperv/include/hyperv.hWed Jul 13 05:35:28 2016
(r302702)
+++ head/sys/dev/hyperv/include/hyperv.hWed Jul 13 05:47:09 2016
(r302703)
@@ -539,6 +539,7 @@ typedef union {
 
 typedef struct hv_vmbus_channel {
struct hv_device*   device;
+   device_tch_dev;
struct vmbus_softc  *vmbus_sc;
hv_vmbus_channel_state  state;
uint32_tch_flags;   /* VMBUS_CHAN_FLAG_ */

Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c
==
--- head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Wed Jul 13 05:35:28 2016
(r302702)
+++ head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Wed Jul 13 05:47:09 2016
(r302703)
@@ -163,6 +163,7 @@ vmbus_channel_process_offer(hv_vmbus_cha
 */
new_channel->primary_channel = channel;
new_channel->device = channel->device;
+   new_channel->ch_dev = channel->ch_dev;
mtx_lock(>sc_lock);
TAILQ_INSERT_TAIL(>sc_list_anchor,
new_channel, sc_list_entry);
@@ -216,9 +217,12 @@ vmbus_channel_process_offer(hv_vmbus_cha
 * Add the new device to the bus. This will kick off device-driver
 * binding which eventually invokes the device driver's AddDevice()
 * method.
+*
+* NOTE:
+* Error is ignored here; don't have much to do if error really
+* happens.
 */
-   hv_vmbus_child_device_register(new_channel->vmbus_sc,
-   new_channel->device);
+   hv_vmbus_child_device_register(new_channel);
 }
 
 void
@@ -365,8 +369,8 @@ vmbus_chan_detach_task(void *xchan, int 
struct hv_vmbus_channel *chan = xchan;
 
if (HV_VMBUS_CHAN_ISPRIMARY(chan)) {
-   /* Only primary channel owns the hv_device */
-   hv_vmbus_child_device_unregister(chan->device);
+   /* Only primary channel owns the device */
+   hv_vmbus_child_device_unregister(chan);
/* NOTE: DO NOT free primary channel for now */
} else {
struct vmbus_softc *sc = chan->vmbus_sc;
@@ -446,8 +450,8 @@ hv_vmbus_release_unattached_channels(str
TAILQ_REMOVE(>vmbus_chlist, channel, ch_link);
 
if (HV_VMBUS_CHAN_ISPRIMARY(channel)) {
-   /* Only primary channel owns the hv_device */
-   hv_vmbus_child_device_unregister(channel->device);
+   /* Only primary channel owns the device */
+   hv_vmbus_child_device_unregister(channel);
}
hv_vmbus_free_vmbus_channel(channel);
}

Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h
==
--- head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h   Wed Jul 13 05:35:28 2016
(r302702)
+++ head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h   Wed Jul 13 05:47:09 2016
(r302703)
@@ -215,9 +215,9 @@ void
hv_vmbus_release_unattached_chann
 struct hv_device*  hv_vmbus_child_device_create(
struct hv_vmbus_channel *channel);
 
-void   hv_vmbus_child_device_register(struct vmbus_softc *,
-   struct hv_device *child_dev);
+inthv_vmbus_child_device_register(
+   struct hv_vmbus_channel *chan);
 inthv_vmbus_child_device_unregister(
-   struct hv_device *child_dev);
+   struct hv_vmbus_channel *chan);
 
 #endif  /* __HYPERV_PRIV_H__ */

Modified: head/sys/dev/hyperv/vmbus/vmbus.c
==
--- head/sys/dev/hyperv/vmbus/vmbus.c   Wed Jul 13 05:35:28 2016
(r302702)
+++ head/sys/dev/hyperv/vmbus/vmbus.c   Wed Jul 13 05:47:09 2016
(r302703)
@@ -989,18 +989,21 @@ vmbus_read_ivar(device_t dev, device_t c
 static int
 vmbus_child_pnpinfo_str(device_t dev, device_t child, char *buf, size_t 

svn commit: r302702 - head/sys/dev/hyperv/utilities

2016-07-12 Thread Sepherosa Ziehau
Author: sephe
Date: Wed Jul 13 05:35:28 2016
New Revision: 302702
URL: https://svnweb.freebsd.org/changeset/base/302702

Log:
  hyperv/util: Avoid the hv_device
  
  This paves way to nuke the hv_device, which is actually an unncessary
  indirection.
  
  MFC after:1 week
  Sponsored by: Microsoft OSTC
  Differential Revision:https://reviews.freebsd.org/D7028

Modified:
  head/sys/dev/hyperv/utilities/hv_heartbeat.c
  head/sys/dev/hyperv/utilities/hv_kvp.c
  head/sys/dev/hyperv/utilities/hv_shutdown.c
  head/sys/dev/hyperv/utilities/hv_timesync.c
  head/sys/dev/hyperv/utilities/hv_util.c
  head/sys/dev/hyperv/utilities/hv_util.h

Modified: head/sys/dev/hyperv/utilities/hv_heartbeat.c
==
--- head/sys/dev/hyperv/utilities/hv_heartbeat.cWed Jul 13 05:28:07 
2016(r302701)
+++ head/sys/dev/hyperv/utilities/hv_heartbeat.cWed Jul 13 05:35:28 
2016(r302702)
@@ -61,7 +61,7 @@ hv_heartbeat_cb(void *context)
 
softc = (hv_util_sc*)context;
buf = softc->receive_buffer;
-   channel = softc->hv_dev->channel;
+   channel = softc->channel;
 
ret = hv_vmbus_channel_recv_packet(channel, buf, PAGE_SIZE, ,
);

Modified: head/sys/dev/hyperv/utilities/hv_kvp.c
==
--- head/sys/dev/hyperv/utilities/hv_kvp.c  Wed Jul 13 05:28:07 2016
(r302701)
+++ head/sys/dev/hyperv/utilities/hv_kvp.c  Wed Jul 13 05:35:28 2016
(r302702)
@@ -308,10 +308,6 @@ hv_kvp_convert_utf16_ipinfo_to_utf8(stru
 {
int err_ip, err_subnet, err_gway, err_dns, err_adap;
int UNUSED_FLAG = 1;
-   struct hv_device *hv_dev;   /* GUID Data Structure */
-   hn_softc_t *sc; /* hn softc structure  */
-   char buf[HYPERV_GUID_STRLEN];
-
device_t *devs;
int devcnt;
 
@@ -333,12 +329,18 @@ hv_kvp_convert_utf16_ipinfo_to_utf8(stru
 
if (devclass_get_devices(devclass_find("hn"), , ) == 0) {
for (devcnt = devcnt - 1; devcnt >= 0; devcnt--) {
-   sc = device_get_softc(devs[devcnt]);
-
-   /* Trying to find GUID of Network Device */
-   hv_dev = sc->hn_dev_obj;
+   /* XXX access other driver's softc?  are you kidding? */
+   device_t dev = devs[devcnt];
+   struct hn_softc *sc = device_get_softc(dev);
+   struct hv_vmbus_channel *chan;
+   char buf[HYPERV_GUID_STRLEN];
 
-   hyperv_guid2str(_dev->device_id, buf, sizeof(buf));
+   /*
+* Trying to find GUID of Network Device
+* TODO: need vmbus interface.
+*/
+   chan = vmbus_get_channel(dev);
+   hyperv_guid2str(>ch_guid_inst, buf, sizeof(buf));
 
if (strncmp(buf, (char 
*)umsg->body.kvp_ip_val.adapter_id,
HYPERV_GUID_STRLEN - 1) == 0) {
@@ -573,7 +575,7 @@ hv_kvp_respond_host(hv_kvp_sc *sc, int e
hv_icmsg_hdrp->status = error;
hv_icmsg_hdrp->icflags = HV_ICMSGHDRFLAG_TRANSACTION | 
HV_ICMSGHDRFLAG_RESPONSE;
 
-   error = hv_vmbus_channel_send_packet(sc->util_sc.hv_dev->channel,
+   error = hv_vmbus_channel_send_packet(sc->util_sc.channel,
sc->rcv_buf,
sc->host_msg_len, sc->host_msg_id,
HV_VMBUS_PACKET_TYPE_DATA_IN_BAND, 0);
@@ -624,7 +626,7 @@ hv_kvp_process_request(void *context, in
 
sc = (hv_kvp_sc*)context;
kvp_buf = sc->util_sc.receive_buffer;
-   channel = sc->util_sc.hv_dev->channel;
+   channel = sc->util_sc.channel;
 
ret = hv_vmbus_channel_recv_packet(channel, kvp_buf, 2 * PAGE_SIZE,
, );

Modified: head/sys/dev/hyperv/utilities/hv_shutdown.c
==
--- head/sys/dev/hyperv/utilities/hv_shutdown.c Wed Jul 13 05:28:07 2016
(r302701)
+++ head/sys/dev/hyperv/utilities/hv_shutdown.c Wed Jul 13 05:35:28 2016
(r302702)
@@ -65,7 +65,7 @@ hv_shutdown_cb(void *context)
 
softc = (hv_util_sc*)context;
buf = softc->receive_buffer;
-   channel = softc->hv_dev->channel;
+   channel = softc->channel;
ret = hv_vmbus_channel_recv_packet(channel, buf, PAGE_SIZE,
_len, _id);
 

Modified: head/sys/dev/hyperv/utilities/hv_timesync.c
==
--- head/sys/dev/hyperv/utilities/hv_timesync.c Wed Jul 13 05:28:07 2016
(r302701)
+++ head/sys/dev/hyperv/utilities/hv_timesync.c Wed Jul 13 05:35:28 2016
(r302702)
@@ -140,7 

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

2016-07-12 Thread Sepherosa Ziehau
Author: sephe
Date: Wed Jul 13 05:28:07 2016
New Revision: 302701
URL: https://svnweb.freebsd.org/changeset/base/302701

Log:
  hyperv/stor: Avoid the hv_device and nuke the broken get_stor_device
  
  This paves way to nuke the hv_device, which is actually an unncessary
  indirection.
  
  MFC after:1 week
  Sponsored by: Microsoft OSTC
  Differential Revision:https://reviews.freebsd.org/D7027

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 Jul 13 
05:19:45 2016(r302700)
+++ head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.cWed Jul 13 
05:28:07 2016(r302701)
@@ -125,7 +125,7 @@ struct hv_storvsc_request {
 };
 
 struct storvsc_softc {
-   struct hv_device*hs_dev;
+   struct hv_vmbus_channel *hs_chan;
LIST_HEAD(, hv_storvsc_request) hs_free_list;
struct mtx  hs_lock;
struct storvsc_driver_props *hs_drv_props;
@@ -139,6 +139,7 @@ struct storvsc_softc {
struct sema hs_drain_sema;  
struct hv_storvsc_request   hs_init_req;
struct hv_storvsc_request   hs_reset_req;
+   device_ths_dev;
 };
 
 
@@ -264,11 +265,11 @@ static int create_storvsc_request(union 
 static void storvsc_free_request(struct storvsc_softc *sc, struct 
hv_storvsc_request *reqp);
 static enum hv_storage_type storvsc_get_storage_type(device_t dev);
 static void hv_storvsc_rescan_target(struct storvsc_softc *sc);
-static void hv_storvsc_on_channel_callback(void *context);
+static void hv_storvsc_on_channel_callback(void *xchan);
 static void hv_storvsc_on_iocompletion( struct storvsc_softc *sc,
struct vstor_packet *vstor_packet,
struct hv_storvsc_request *request);
-static int hv_storvsc_connect_vsp(struct hv_device *device);
+static int hv_storvsc_connect_vsp(struct storvsc_softc *);
 static void storvsc_io_done(struct hv_storvsc_request *reqp);
 static void storvsc_copy_sgl_to_bounce_buf(struct sglist *bounce_sgl,
bus_dma_segment_t *orig_sgl,
@@ -297,72 +298,16 @@ DRIVER_MODULE(storvsc, vmbus, storvsc_dr
 MODULE_VERSION(storvsc, 1);
 MODULE_DEPEND(storvsc, vmbus, 1, 1, 1);
 
-
-/**
- * The host is capable of sending messages to us that are
- * completely unsolicited. So, we need to address the race
- * condition where we may be in the process of unloading the
- * driver when the host may send us an unsolicited message.
- * We address this issue by implementing a sequentially
- * consistent protocol:
- *
- * 1. Channel callback is invoked while holding the channel lock
- *and an unloading driver will reset the channel callback under
- *the protection of this channel lock.
- *
- * 2. To ensure bounded wait time for unloading a driver, we don't
- *permit outgoing traffic once the device is marked as being
- *destroyed.
- *
- * 3. Once the device is marked as being destroyed, we only
- *permit incoming traffic to properly account for
- *packets already sent out.
- */
-static inline struct storvsc_softc *
-get_stor_device(struct hv_device *device,
-   boolean_t outbound)
-{
-   struct storvsc_softc *sc;
-
-   sc = device_get_softc(device->device);
-
-   if (outbound) {
-   /*
-* Here we permit outgoing I/O only
-* if the device is not being destroyed.
-*/
-
-   if (sc->hs_destroy) {
-   sc = NULL;
-   }
-   } else {
-   /*
-* inbound case; if being destroyed
-* only permit to account for
-* messages already sent out.
-*/
-   if (sc->hs_destroy && (sc->hs_num_out_reqs == 0)) {
-   sc = NULL;
-   }
-   }
-   return sc;
-}
-
 static void
-storvsc_subchan_attach(struct hv_vmbus_channel *new_channel)
+storvsc_subchan_attach(struct storvsc_softc *sc,
+struct hv_vmbus_channel *new_channel)
 {
-   struct hv_device *device;
-   struct storvsc_softc *sc;
struct vmstor_chan_props props;
int ret = 0;
 
-   device = new_channel->device;
-   sc = get_stor_device(device, TRUE);
-   if (sc == NULL)
-   return;
-
memset(, 0, sizeof(props));
 
+   new_channel->hv_chan_priv1 = sc;
vmbus_channel_cpu_rr(new_channel);
ret = hv_vmbus_channel_open(new_channel,
sc->hs_drv_props->drv_ringbuffer_size,
@@ -371,8 +316,6 @@ storvsc_subchan_attach(struct hv_vmbus_c
sizeof(struct vmstor_chan_props),
hv_storvsc_on_channel_callback,
   

svn commit: r302700 - in head/sys/dev/hyperv: include vmbus

2016-07-12 Thread Sepherosa Ziehau
Author: sephe
Date: Wed Jul 13 05:19:45 2016
New Revision: 302700
URL: https://svnweb.freebsd.org/changeset/base/302700

Log:
  hyperv/vmbus: Add channel ivar accessor.
  
  This makes life easier during the transition period to nuke the hv_device.
  
  MFC after:1 week
  Sponsored by: Microsoft OSTC
  Differential Revision:https://reviews.freebsd.org/D7026

Modified:
  head/sys/dev/hyperv/include/hyperv.h
  head/sys/dev/hyperv/vmbus/vmbus.c

Modified: head/sys/dev/hyperv/include/hyperv.h
==
--- head/sys/dev/hyperv/include/hyperv.hWed Jul 13 05:11:45 2016
(r302699)
+++ head/sys/dev/hyperv/include/hyperv.hWed Jul 13 05:19:45 2016
(r302700)
@@ -403,14 +403,18 @@ enum {
HV_VMBUS_IVAR_TYPE,
HV_VMBUS_IVAR_INSTANCE,
HV_VMBUS_IVAR_NODE,
-   HV_VMBUS_IVAR_DEVCTX
+   HV_VMBUS_IVAR_DEVCTX,
+   HV_VMBUS_IVAR_CHAN,
 };
 
 #define HV_VMBUS_ACCESSOR(var, ivar, type) \
__BUS_ACCESSOR(vmbus, var, HV_VMBUS, ivar, type)
 
+struct hv_vmbus_channel;
+
 HV_VMBUS_ACCESSOR(type, TYPE,  const char *)
 HV_VMBUS_ACCESSOR(devctx, DEVCTX,  struct hv_device *)
+HV_VMBUS_ACCESSOR(channel, CHAN, struct hv_vmbus_channel *)
 
 
 /*

Modified: head/sys/dev/hyperv/vmbus/vmbus.c
==
--- head/sys/dev/hyperv/vmbus/vmbus.c   Wed Jul 13 05:11:45 2016
(r302699)
+++ head/sys/dev/hyperv/vmbus/vmbus.c   Wed Jul 13 05:19:45 2016
(r302700)
@@ -978,6 +978,10 @@ vmbus_read_ivar(device_t dev, device_t c
case HV_VMBUS_IVAR_NODE:
*result = (uintptr_t)child_dev_ctx->device;
return (0);
+
+   case HV_VMBUS_IVAR_CHAN:
+   *result = (uintptr_t)child_dev_ctx->channel;
+   return (0);
}
return (ENOENT);
 }
___
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: r302699 - head/sys/dev/hyperv/vmbus

2016-07-12 Thread Sepherosa Ziehau
Author: sephe
Date: Wed Jul 13 05:11:45 2016
New Revision: 302699
URL: https://svnweb.freebsd.org/changeset/base/302699

Log:
  hyperv/vmbus: All ivars are read-only; nuke unnecessary write_ivar
  
  MFC after:1 week
  Sponsored by: Microsoft OSTC
  Differential Revision:https://reviews.freebsd.org/D7025

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

Modified: head/sys/dev/hyperv/vmbus/vmbus.c
==
--- head/sys/dev/hyperv/vmbus/vmbus.c   Wed Jul 13 05:01:12 2016
(r302698)
+++ head/sys/dev/hyperv/vmbus/vmbus.c   Wed Jul 13 05:11:45 2016
(r302699)
@@ -983,20 +983,6 @@ vmbus_read_ivar(device_t dev, device_t c
 }
 
 static int
-vmbus_write_ivar(device_t dev, device_t child, int index, uintptr_t value)
-{
-   switch (index) {
-   case HV_VMBUS_IVAR_TYPE:
-   case HV_VMBUS_IVAR_INSTANCE:
-   case HV_VMBUS_IVAR_DEVCTX:
-   case HV_VMBUS_IVAR_NODE:
-   /* read-only */
-   return (EINVAL);
-   }
-   return (ENOENT);
-}
-
-static int
 vmbus_child_pnpinfo_str(device_t dev, device_t child, char *buf, size_t buflen)
 {
struct hv_device *dev_ctx = device_get_ivars(child);
@@ -1311,7 +1297,6 @@ static device_method_t vmbus_methods[] =
DEVMETHOD(bus_add_child,bus_generic_add_child),
DEVMETHOD(bus_print_child,  bus_generic_print_child),
DEVMETHOD(bus_read_ivar,vmbus_read_ivar),
-   DEVMETHOD(bus_write_ivar,   vmbus_write_ivar),
DEVMETHOD(bus_child_pnpinfo_str,vmbus_child_pnpinfo_str),
 
/* Vmbus interface */
___
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: r302698 - in head/sys: dev/hyperv/netvsc dev/hyperv/storvsc dev/hyperv/utilities dev/hyperv/vmbus modules/hyperv/utilities

2016-07-12 Thread Sepherosa Ziehau
Author: sephe
Date: Wed Jul 13 05:01:12 2016
New Revision: 302698
URL: https://svnweb.freebsd.org/changeset/base/302698

Log:
  hyperv/vmbus: Add vmbus method for GUID base device probing.
  
  Reduce the exposure of hv_device.
  
  MFC after:1 week
  Sponsored by: Microsoft OSTC
  Differential Revision:https://reviews.freebsd.org/D7024

Modified:
  head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
  head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c
  head/sys/dev/hyperv/utilities/hv_heartbeat.c
  head/sys/dev/hyperv/utilities/hv_kvp.c
  head/sys/dev/hyperv/utilities/hv_shutdown.c
  head/sys/dev/hyperv/utilities/hv_timesync.c
  head/sys/dev/hyperv/vmbus/vmbus.c
  head/sys/dev/hyperv/vmbus/vmbus_if.m
  head/sys/modules/hyperv/utilities/Makefile

Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
==
--- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Wed Jul 13 04:51:37 
2016(r302697)
+++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Wed Jul 13 05:01:12 
2016(r302698)
@@ -411,18 +411,12 @@ static const hv_guid g_net_vsc_device_ty
 static int
 netvsc_probe(device_t dev)
 {
-   const char *p;
-
-   p = vmbus_get_type(dev);
-   if (!memcmp(p, _net_vsc_device_type.data, sizeof(hv_guid))) {
+   if (VMBUS_PROBE_GUID(device_get_parent(dev), dev,
+   _net_vsc_device_type) == 0) {
device_set_desc(dev, "Hyper-V Network Interface");
-   if (bootverbose)
-   printf("Netvsc probe... DONE \n");
-
-   return (BUS_PROBE_DEFAULT);
+   return BUS_PROBE_DEFAULT;
}
-
-   return (ENXIO);
+   return ENXIO;
 }
 
 /*

Modified: head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c
==
--- head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.cWed Jul 13 
04:51:37 2016(r302697)
+++ head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.cWed Jul 13 
05:01:12 2016(r302698)
@@ -2167,13 +2167,11 @@ storvsc_free_request(struct storvsc_soft
 static enum hv_storage_type
 storvsc_get_storage_type(device_t dev)
 {
-   const char *p = vmbus_get_type(dev);
+   device_t parent = device_get_parent(dev);
 
-   if (!memcmp(p, , sizeof(hv_guid))) {
+   if (VMBUS_PROBE_GUID(parent, dev, ) == 0)
return DRIVER_BLKVSC;
-   } else if (!memcmp(p, , sizeof(hv_guid))) {
+   if (VMBUS_PROBE_GUID(parent, dev, ) == 0)
return DRIVER_STORVSC;
-   }
-   return (DRIVER_UNKNOWN);
+   return DRIVER_UNKNOWN;
 }
-

Modified: head/sys/dev/hyperv/utilities/hv_heartbeat.c
==
--- head/sys/dev/hyperv/utilities/hv_heartbeat.cWed Jul 13 04:51:37 
2016(r302697)
+++ head/sys/dev/hyperv/utilities/hv_heartbeat.cWed Jul 13 05:01:12 
2016(r302698)
@@ -36,9 +36,10 @@
 
 #include 
 #include "hv_util.h"
+#include "vmbus_if.h"
 
 /* Heartbeat Service */
-static hv_guid service_guid = { .data =
+static const hv_guid service_guid = { .data =
{0x39, 0x4f, 0x16, 0x57, 0x15, 0x91, 0x78, 0x4e,
0xab, 0x55, 0x38, 0x2f, 0x3b, 0xd5, 0x42, 0x2d} };
 
@@ -93,16 +94,13 @@ hv_heartbeat_cb(void *context)
 static int
 hv_heartbeat_probe(device_t dev)
 {
-   const char *p = vmbus_get_type(dev);
-
if (resource_disabled("hvheartbeat", 0))
return ENXIO;
 
-   if (!memcmp(p, _guid, sizeof(hv_guid))) {
+   if (VMBUS_PROBE_GUID(device_get_parent(dev), dev, _guid) == 0) {
device_set_desc(dev, "Hyper-V Heartbeat Service");
return BUS_PROBE_DEFAULT;
}
-
return ENXIO;
 }
 

Modified: head/sys/dev/hyperv/utilities/hv_kvp.c
==
--- head/sys/dev/hyperv/utilities/hv_kvp.c  Wed Jul 13 04:51:37 2016
(r302697)
+++ head/sys/dev/hyperv/utilities/hv_kvp.c  Wed Jul 13 05:01:12 2016
(r302698)
@@ -69,6 +69,7 @@ __FBSDID("$FreeBSD$");
 #include "hv_util.h"
 #include "unicode.h"
 #include "hv_kvp.h"
+#include "vmbus_if.h"
 
 /* hv_kvp defines */
 #define BUFFERSIZE sizeof(struct hv_kvp_msg)
@@ -89,7 +90,7 @@ static int hv_kvp_log = 0;
log(LOG_INFO, "hv_kvp: " __VA_ARGS__);  \
 } while (0)
 
-static hv_guid service_guid = { .data =
+static const hv_guid service_guid = { .data =
{0xe7, 0xf4, 0xa0, 0xa9, 0x45, 0x5a, 0x96, 0x4d,
0xb8, 0x27, 0x8a, 0x84, 0x1e, 0x8c, 0x3,  0xe6} };
 
@@ -865,16 +866,13 @@ hv_kvp_dev_daemon_poll(struct cdev *dev,
 static int
 hv_kvp_probe(device_t dev)
 {
-   const char *p = vmbus_get_type(dev);
-
if (resource_disabled("hvkvp", 0))
return ENXIO;
 
-   if (!memcmp(p, _guid, sizeof(hv_guid))) {
+   if 

svn commit: r302697 - in head/sys/dev/hyperv: include vmbus

2016-07-12 Thread Sepherosa Ziehau
Author: sephe
Date: Wed Jul 13 04:51:37 2016
New Revision: 302697
URL: https://svnweb.freebsd.org/changeset/base/302697

Log:
  hyperv/vmbus: Remove the embedded offer message from hv_vmbus_channel
  
  MFC after:1 week
  Sponsored by: Microsoft OSTC
  Differential Revision:https://reviews.freebsd.org/D7021

Modified:
  head/sys/dev/hyperv/include/hyperv.h
  head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c

Modified: head/sys/dev/hyperv/include/hyperv.h
==
--- head/sys/dev/hyperv/include/hyperv.hWed Jul 13 04:39:16 2016
(r302696)
+++ head/sys/dev/hyperv/include/hyperv.hWed Jul 13 04:51:37 2016
(r302697)
@@ -537,7 +537,6 @@ typedef struct hv_vmbus_channel {
struct hv_device*   device;
struct vmbus_softc  *vmbus_sc;
hv_vmbus_channel_state  state;
-   hv_vmbus_channel_offer_channel  offer_msg;
uint32_tch_flags;   /* VMBUS_CHAN_FLAG_ */
uint32_tch_id;  /* channel id */
/*

Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c
==
--- head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Wed Jul 13 04:39:16 2016
(r302696)
+++ head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Wed Jul 13 04:51:37 2016
(r302697)
@@ -321,8 +321,6 @@ vmbus_channel_on_offer_internal(struct v
new_channel->ch_sigevt->hc_connid = offer->connection_id;
}
 
-   memcpy(_channel->offer_msg, offer,
-   sizeof(hv_vmbus_channel_offer_channel));
new_channel->monitor_group = (uint8_t) offer->monitor_id / 32;
new_channel->monitor_bit = (uint8_t) offer->monitor_id % 32;
 
___
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: r302696 - in head/sys/dev/hyperv: include vmbus

2016-07-12 Thread Sepherosa Ziehau
Author: sephe
Date: Wed Jul 13 04:39:16 2016
New Revision: 302696
URL: https://svnweb.freebsd.org/changeset/base/302696

Log:
  hyperv/vmbus: Add type/instance guid fields into hv_vmbus_channel
  
  This prepares to remove the unnecessary offer message embedding in
  hv_vmbus_channel.
  
  MFC after:1 week
  Sponsored by: Microsoft OSTC
  Differential Revision:https://reviews.freebsd.org/D7020

Modified:
  head/sys/dev/hyperv/include/hyperv.h
  head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c
  head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h
  head/sys/dev/hyperv/vmbus/vmbus.c

Modified: head/sys/dev/hyperv/include/hyperv.h
==
--- head/sys/dev/hyperv/include/hyperv.hWed Jul 13 04:31:08 2016
(r302695)
+++ head/sys/dev/hyperv/include/hyperv.hWed Jul 13 04:39:16 2016
(r302696)
@@ -632,6 +632,9 @@ typedef struct hv_vmbus_channel {
TAILQ_ENTRY(hv_vmbus_channel)   ch_link;
uint32_tch_subidx;  /* subchan index */
 
+   struct hv_guid  ch_guid_type;
+   struct hv_guid  ch_guid_inst;
+
struct sysctl_ctx_list  ch_sysctl_ctx;
 } hv_vmbus_channel;
 

Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c
==
--- head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Wed Jul 13 04:31:08 2016
(r302695)
+++ head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Wed Jul 13 04:39:16 2016
(r302696)
@@ -127,11 +127,9 @@ vmbus_channel_process_offer(hv_vmbus_cha
}
 
TAILQ_FOREACH(channel, >vmbus_chlist, ch_link) {
-   if (memcmp(>offer_msg.offer.interface_type,
-   _channel->offer_msg.offer.interface_type,
+   if (memcmp(>ch_guid_type, _channel->ch_guid_type,
sizeof(hv_guid)) == 0 &&
-   memcmp(>offer_msg.offer.interface_instance,
-   _channel->offer_msg.offer.interface_instance,
+   memcmp(>ch_guid_inst, _channel->ch_guid_inst,
sizeof(hv_guid)) == 0)
break;
}
@@ -212,9 +210,7 @@ vmbus_channel_process_offer(hv_vmbus_cha
 * (We need to set the device field before calling
 * hv_vmbus_child_device_add())
 */
-   new_channel->device = hv_vmbus_child_device_create(
-   new_channel->offer_msg.offer.interface_type,
-   new_channel->offer_msg.offer.interface_instance, new_channel);
+   new_channel->device = hv_vmbus_child_device_create(new_channel);
 
/*
 * Add the new device to the bus. This will kick off device-driver
@@ -296,6 +292,8 @@ vmbus_channel_on_offer_internal(struct v
new_channel->ch_subidx = offer->offer.sub_channel_index;
if (offer->monitor_allocated)
new_channel->ch_flags |= VMBUS_CHAN_FLAG_HASMNF;
+   new_channel->ch_guid_type = offer->offer.interface_type;
+   new_channel->ch_guid_inst = offer->offer.interface_instance;
 
/*
 * By default we setup state to enable batched

Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h
==
--- head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h   Wed Jul 13 04:31:08 2016
(r302695)
+++ head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h   Wed Jul 13 04:39:16 2016
(r302696)
@@ -213,9 +213,7 @@ void
hv_vmbus_release_unattached_chann
struct vmbus_softc *);
 
 struct hv_device*  hv_vmbus_child_device_create(
-   hv_guid device_type,
-   hv_guid device_instance,
-   hv_vmbus_channel*channel);
+   struct hv_vmbus_channel *channel);
 
 void   hv_vmbus_child_device_register(struct vmbus_softc *,
struct hv_device *child_dev);

Modified: head/sys/dev/hyperv/vmbus/vmbus.c
==
--- head/sys/dev/hyperv/vmbus/vmbus.c   Wed Jul 13 04:31:08 2016
(r302695)
+++ head/sys/dev/hyperv/vmbus/vmbus.c   Wed Jul 13 04:39:16 2016
(r302696)
@@ -1017,8 +1017,7 @@ vmbus_child_pnpinfo_str(device_t dev, de
 }
 
 struct hv_device *
-hv_vmbus_child_device_create(hv_guid type, hv_guid instance,
-hv_vmbus_channel *channel)
+hv_vmbus_child_device_create(struct hv_vmbus_channel *channel)
 {
hv_device *child_dev;
 
@@ -1028,8 +1027,8 @@ hv_vmbus_child_device_create(hv_guid typ
child_dev = malloc(sizeof(hv_device), M_DEVBUF, M_WAITOK | M_ZERO);
 
child_dev->channel = channel;
-   memcpy(_dev->class_id, , sizeof(hv_guid));
-   memcpy(_dev->device_id, , sizeof(hv_guid));
+   child_dev->class_id = 

svn commit: r302695 - in head/sys/dev/hyperv: include vmbus

2016-07-12 Thread Sepherosa Ziehau
Author: sephe
Date: Wed Jul 13 04:31:08 2016
New Revision: 302695
URL: https://svnweb.freebsd.org/changeset/base/302695

Log:
  hyperv/vmbus: Add flags field into hv_vmbus_channel for MNF indication
  
  This prepares to remove the unnecessary offer message embedding in
  hv_vmbus_channel.
  
  MFC after:1 week
  Sponsored by: Microsoft OSTC
  Differential Revision:https://reviews.freebsd.org/D7019

Modified:
  head/sys/dev/hyperv/include/hyperv.h
  head/sys/dev/hyperv/vmbus/hv_channel.c
  head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c

Modified: head/sys/dev/hyperv/include/hyperv.h
==
--- head/sys/dev/hyperv/include/hyperv.hWed Jul 13 03:35:22 2016
(r302694)
+++ head/sys/dev/hyperv/include/hyperv.hWed Jul 13 04:31:08 2016
(r302695)
@@ -538,6 +538,7 @@ typedef struct hv_vmbus_channel {
struct vmbus_softc  *vmbus_sc;
hv_vmbus_channel_state  state;
hv_vmbus_channel_offer_channel  offer_msg;
+   uint32_tch_flags;   /* VMBUS_CHAN_FLAG_ */
uint32_tch_id;  /* channel id */
/*
 * These are based on the offer_msg.monitor_id.
@@ -636,6 +637,8 @@ typedef struct hv_vmbus_channel {
 
 #define HV_VMBUS_CHAN_ISPRIMARY(chan)  ((chan)->primary_channel == NULL)
 
+#define VMBUS_CHAN_FLAG_HASMNF 0x0001
+
 static inline void
 hv_set_channel_read_state(hv_vmbus_channel* channel, boolean_t state)
 {

Modified: head/sys/dev/hyperv/vmbus/hv_channel.c
==
--- head/sys/dev/hyperv/vmbus/hv_channel.c  Wed Jul 13 03:35:22 2016
(r302694)
+++ head/sys/dev/hyperv/vmbus/hv_channel.c  Wed Jul 13 04:31:08 2016
(r302695)
@@ -67,7 +67,7 @@ vmbus_channel_set_event(hv_vmbus_channel
atomic_set_long(>vmbus_tx_evtflags[chanid >> VMBUS_EVTFLAG_SHIFT],
1UL << (chanid & VMBUS_EVTFLAG_MASK));
 
-   if (channel->offer_msg.monitor_allocated) {
+   if (channel->ch_flags & VMBUS_CHAN_FLAG_HASMNF) {
hv_vmbus_monitor_page *monitor_page;
 
monitor_page = sc->vmbus_mnf2;
@@ -86,7 +86,7 @@ vmbus_channel_sysctl_monalloc(SYSCTL_HAN
struct hv_vmbus_channel *chan = arg1;
int alloc = 0;
 
-   if (chan->offer_msg.monitor_allocated)
+   if (chan->ch_flags & VMBUS_CHAN_FLAG_HASMNF)
alloc = 1;
return sysctl_handle_int(oidp, , 0, req);
 }

Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c
==
--- head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Wed Jul 13 03:35:22 2016
(r302694)
+++ head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Wed Jul 13 04:31:08 2016
(r302695)
@@ -294,6 +294,8 @@ vmbus_channel_on_offer_internal(struct v
new_channel = hv_vmbus_allocate_channel(sc);
new_channel->ch_id = offer->child_rel_id;
new_channel->ch_subidx = offer->offer.sub_channel_index;
+   if (offer->monitor_allocated)
+   new_channel->ch_flags |= VMBUS_CHAN_FLAG_HASMNF;
 
/*
 * By default we setup state to enable batched
___
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: r302694 - in head/sys/dev/hyperv: include netvsc vmbus

2016-07-12 Thread Sepherosa Ziehau
Author: sephe
Date: Wed Jul 13 03:35:22 2016
New Revision: 302694
URL: https://svnweb.freebsd.org/changeset/base/302694

Log:
  hyperv/vmbus: Make subchan index a field of hv_vmbus_channel.
  
  This prepares to remove the unnecessary offer message embedding in
  hv_vmbus_channel.
  
  MFC after:1 week
  Sponsored by: Microsoft OSTC
  Differential Revision:https://reviews.freebsd.org/D7015

Modified:
  head/sys/dev/hyperv/include/hyperv.h
  head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
  head/sys/dev/hyperv/vmbus/hv_channel.c
  head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c

Modified: head/sys/dev/hyperv/include/hyperv.h
==
--- head/sys/dev/hyperv/include/hyperv.hWed Jul 13 03:24:29 2016
(r302693)
+++ head/sys/dev/hyperv/include/hyperv.hWed Jul 13 03:35:22 2016
(r302694)
@@ -629,6 +629,7 @@ typedef struct hv_vmbus_channel {
 
struct task ch_detach_task;
TAILQ_ENTRY(hv_vmbus_channel)   ch_link;
+   uint32_tch_subidx;  /* subchan index */
 
struct sysctl_ctx_list  ch_sysctl_ctx;
 } hv_vmbus_channel;

Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
==
--- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Wed Jul 13 03:24:29 
2016(r302693)
+++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Wed Jul 13 03:35:22 
2016(r302694)
@@ -518,9 +518,9 @@ netvsc_attach(device_t dev)
 */
pri_chan = device_ctx->channel;
KASSERT(HV_VMBUS_CHAN_ISPRIMARY(pri_chan), ("not primary channel"));
-   KASSERT(pri_chan->offer_msg.offer.sub_channel_index == 0,
+   KASSERT(pri_chan->ch_subidx == 0,
("primary channel subidx %u",
-pri_chan->offer_msg.offer.sub_channel_index));
+pri_chan->ch_subidx));
hn_channel_attach(sc, pri_chan);
 
ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
@@ -809,8 +809,8 @@ hn_tx_done(struct hv_vmbus_channel *chan
txr = txd->txr;
KASSERT(txr->hn_chan == chan,
("channel mismatch, on channel%u, should be channel%u",
-chan->offer_msg.offer.sub_channel_index,
-txr->hn_chan->offer_msg.offer.sub_channel_index));
+chan->ch_subidx,
+txr->hn_chan->ch_subidx));
 
txr->hn_has_txeof = 1;
hn_txdesc_put(txr, txd);
@@ -2940,7 +2940,7 @@ hn_channel_attach(struct hn_softc *sc, s
struct hn_rx_ring *rxr;
int idx;
 
-   idx = chan->offer_msg.offer.sub_channel_index;
+   idx = chan->ch_subidx;
 
KASSERT(idx >= 0 && idx < sc->hn_rx_ring_inuse,
("invalid channel index %d, should > 0 && < %d",
@@ -2981,9 +2981,9 @@ hn_subchan_attach(struct hn_softc *sc, s
 
KASSERT(!HV_VMBUS_CHAN_ISPRIMARY(chan),
("subchannel callback on primary channel"));
-   KASSERT(chan->offer_msg.offer.sub_channel_index > 0,
+   KASSERT(chan->ch_subidx > 0,
("invalid channel subidx %u",
-chan->offer_msg.offer.sub_channel_index));
+chan->ch_subidx));
hn_channel_attach(sc, chan);
 }
 

Modified: head/sys/dev/hyperv/vmbus/hv_channel.c
==
--- head/sys/dev/hyperv/vmbus/hv_channel.c  Wed Jul 13 03:24:29 2016
(r302693)
+++ head/sys/dev/hyperv/vmbus/hv_channel.c  Wed Jul 13 03:35:22 2016
(r302694)
@@ -111,7 +111,7 @@ vmbus_channel_sysctl_create(hv_vmbus_cha
} else {
dev = primary_ch->device->device;
ch_id = primary_ch->ch_id;
-   sub_ch_id = channel->offer_msg.offer.sub_channel_index;
+   sub_ch_id = channel->ch_subidx;
}
ctx = >ch_sysctl_ctx;
sysctl_ctx_init(ctx);

Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c
==
--- head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Wed Jul 13 03:24:29 2016
(r302693)
+++ head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Wed Jul 13 03:35:22 2016
(r302694)
@@ -152,14 +152,14 @@ vmbus_channel_process_offer(hv_vmbus_cha
}
device_printf(sc->vmbus_dev, "chan%u subchanid%u offer%s\n",
new_channel->ch_id,
-   new_channel->offer_msg.offer.sub_channel_index, logstr);
+   new_channel->ch_subidx, logstr);
}
 
if (channel != NULL) {
/*
 * Check if this is a sub channel.
 */
-   if (new_channel->offer_msg.offer.sub_channel_index != 0) {
+   if (new_channel->ch_subidx != 0) {
/*
 * It is a sub channel offer, process it.
 */
@@ 

svn commit: r302693 - in head/sys/dev/hyperv: include netvsc vmbus

2016-07-12 Thread Sepherosa Ziehau
Author: sephe
Date: Wed Jul 13 03:24:29 2016
New Revision: 302693
URL: https://svnweb.freebsd.org/changeset/base/302693

Log:
  hyperv/vmbus: Make channel id a field of hv_vmbus_channel.
  
  This prepares to remove the unnecessary offer message embedding in
  hv_vmbus_channel.
  
  MFC after:1 week
  Sponsored by: Microsoft OSTC
  Differential Revision:https://reviews.freebsd.org/D7014

Modified:
  head/sys/dev/hyperv/include/hyperv.h
  head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
  head/sys/dev/hyperv/vmbus/hv_channel.c
  head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c

Modified: head/sys/dev/hyperv/include/hyperv.h
==
--- head/sys/dev/hyperv/include/hyperv.hWed Jul 13 03:14:29 2016
(r302692)
+++ head/sys/dev/hyperv/include/hyperv.hWed Jul 13 03:24:29 2016
(r302693)
@@ -538,6 +538,7 @@ typedef struct hv_vmbus_channel {
struct vmbus_softc  *vmbus_sc;
hv_vmbus_channel_state  state;
hv_vmbus_channel_offer_channel  offer_msg;
+   uint32_tch_id;  /* channel id */
/*
 * These are based on the offer_msg.monitor_id.
 * Save it here for easy access.

Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
==
--- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Wed Jul 13 03:14:29 
2016(r302692)
+++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Wed Jul 13 03:24:29 
2016(r302693)
@@ -2953,7 +2953,7 @@ hn_channel_attach(struct hn_softc *sc, s
chan->hv_chan_rxr = rxr;
if (bootverbose) {
if_printf(sc->hn_ifp, "link RX ring %d to channel%u\n",
-   idx, chan->offer_msg.child_rel_id);
+   idx, chan->ch_id);
}
 
if (idx < sc->hn_tx_ring_inuse) {
@@ -2967,7 +2967,7 @@ hn_channel_attach(struct hn_softc *sc, s
txr->hn_chan = chan;
if (bootverbose) {
if_printf(sc->hn_ifp, "link TX ring %d to channel%u\n",
-   idx, chan->offer_msg.child_rel_id);
+   idx, chan->ch_id);
}
}
 

Modified: head/sys/dev/hyperv/vmbus/hv_channel.c
==
--- head/sys/dev/hyperv/vmbus/hv_channel.c  Wed Jul 13 03:14:29 2016
(r302692)
+++ head/sys/dev/hyperv/vmbus/hv_channel.c  Wed Jul 13 03:24:29 2016
(r302693)
@@ -62,7 +62,7 @@ static void
 vmbus_channel_set_event(hv_vmbus_channel *channel)
 {
struct vmbus_softc *sc = channel->vmbus_sc;
-   uint32_t chanid = channel->offer_msg.child_rel_id;
+   uint32_t chanid = channel->ch_id;
 
atomic_set_long(>vmbus_tx_evtflags[chanid >> VMBUS_EVTFLAG_SHIFT],
1UL << (chanid & VMBUS_EVTFLAG_MASK));
@@ -107,10 +107,10 @@ vmbus_channel_sysctl_create(hv_vmbus_cha
 
if (primary_ch == NULL) {
dev = channel->device->device;
-   ch_id = channel->offer_msg.child_rel_id;
+   ch_id = channel->ch_id;
} else {
dev = primary_ch->device->device;
-   ch_id = primary_ch->offer_msg.child_rel_id;
+   ch_id = primary_ch->ch_id;
sub_ch_id = channel->offer_msg.offer.sub_channel_index;
}
ctx = >ch_sysctl_ctx;
@@ -136,7 +136,7 @@ vmbus_channel_sysctl_create(hv_vmbus_cha
 
SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(devch_id_sysctl),
OID_AUTO, "chanid", CTLFLAG_RD,
-   >offer_msg.child_rel_id, 0, "channel id");
+   >ch_id, 0, "channel id");
}
SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(devch_id_sysctl), OID_AUTO,
"cpu", CTLFLAG_RD, >target_cpu, 0, "owner CPU id");
@@ -190,7 +190,7 @@ hv_vmbus_channel_open(
if (user_data_len > VMBUS_CHANMSG_CHOPEN_UDATA_SIZE) {
device_printf(sc->vmbus_dev,
"invalid udata len %u for chan%u\n",
-   user_data_len, new_channel->offer_msg.child_rel_id);
+   user_data_len, new_channel->ch_id);
return EINVAL;
}
 
@@ -261,14 +261,14 @@ hv_vmbus_channel_open(
if (mh == NULL) {
device_printf(sc->vmbus_dev,
"can not get msg hypercall for chopen(chan%u)\n",
-   new_channel->offer_msg.child_rel_id);
+   new_channel->ch_id);
return ENXIO;
}
 
req = vmbus_msghc_dataptr(mh);
req->chm_hdr.chm_type = VMBUS_CHANMSG_TYPE_CHOPEN;
-   req->chm_chanid = new_channel->offer_msg.child_rel_id;
-   req->chm_openid = new_channel->offer_msg.child_rel_id;
+   req->chm_chanid = new_channel->ch_id;
+   req->chm_openid = new_channel->ch_id;

svn commit: r302692 - in head/sys: conf dev/hyperv/vmbus modules/hyperv/vmbus

2016-07-12 Thread Sepherosa Ziehau
Author: sephe
Date: Wed Jul 13 03:14:29 2016
New Revision: 302692
URL: https://svnweb.freebsd.org/changeset/base/302692

Log:
  hyperv/vmbus: Merge hv_connection.c into hv_channel.c
  
  MFC after:1 week
  Sponsored by: Microsoft OSTC
  Differential Revision:https://reviews.freebsd.org/D7004

Deleted:
  head/sys/dev/hyperv/vmbus/hv_connection.c
Modified:
  head/sys/conf/files.amd64
  head/sys/conf/files.i386
  head/sys/dev/hyperv/vmbus/hv_channel.c
  head/sys/dev/hyperv/vmbus/vmbus_var.h
  head/sys/modules/hyperv/vmbus/Makefile

Modified: head/sys/conf/files.amd64
==
--- head/sys/conf/files.amd64   Wed Jul 13 02:07:36 2016(r302691)
+++ head/sys/conf/files.amd64   Wed Jul 13 03:14:29 2016(r302692)
@@ -272,7 +272,6 @@ dev/hyperv/utilities/hv_timesync.c  opt
 dev/hyperv/utilities/hv_util.c optionalhyperv
 dev/hyperv/vmbus/hv_channel.c  optionalhyperv
 dev/hyperv/vmbus/hv_channel_mgmt.c optionalhyperv
-dev/hyperv/vmbus/hv_connection.c   optionalhyperv
 dev/hyperv/vmbus/hv_ring_buffer.c  optionalhyperv
 dev/hyperv/vmbus/hyperv.c  optionalhyperv
 dev/hyperv/vmbus/hyperv_busdma.c   optionalhyperv

Modified: head/sys/conf/files.i386
==
--- head/sys/conf/files.i386Wed Jul 13 02:07:36 2016(r302691)
+++ head/sys/conf/files.i386Wed Jul 13 03:14:29 2016(r302692)
@@ -248,7 +248,6 @@ dev/hyperv/utilities/hv_timesync.c  opt
 dev/hyperv/utilities/hv_util.c optionalhyperv
 dev/hyperv/vmbus/hv_channel.c  optionalhyperv
 dev/hyperv/vmbus/hv_channel_mgmt.c optionalhyperv
-dev/hyperv/vmbus/hv_connection.c   optionalhyperv
 dev/hyperv/vmbus/hv_ring_buffer.c  optionalhyperv
 dev/hyperv/vmbus/hyperv.c  optionalhyperv
 dev/hyperv/vmbus/hyperv_busdma.c   optionalhyperv

Modified: head/sys/dev/hyperv/vmbus/hv_channel.c
==
--- head/sys/dev/hyperv/vmbus/hv_channel.c  Wed Jul 13 02:07:36 2016
(r302691)
+++ head/sys/dev/hyperv/vmbus/hv_channel.c  Wed Jul 13 03:14:29 2016
(r302692)
@@ -52,6 +52,8 @@ __FBSDID("$FreeBSD$");
 
 static voidvmbus_channel_set_event(hv_vmbus_channel* channel);
 static voidVmbusProcessChannelEvent(void* channel, int pending);
+static voidvmbus_chan_update_evtflagcnt(struct vmbus_softc *,
+   const struct hv_vmbus_channel *);
 
 /**
  *  @brief Trigger an event notification on the specified channel
@@ -207,7 +209,7 @@ hv_vmbus_channel_open(
new_channel->on_channel_callback = pfn_on_channel_callback;
new_channel->channel_callback_context = context;
 
-   vmbus_on_channel_open(new_channel);
+   vmbus_chan_update_evtflagcnt(sc, new_channel);
 
new_channel->rxq = VMBUS_PCPU_GET(new_channel->vmbus_sc, event_tq,
new_channel->target_cpu);
@@ -883,3 +885,95 @@ VmbusProcessChannelEvent(void* context, 
} while (is_batched_reading && (bytes_to_read != 0));
}
 }
+
+static __inline void
+vmbus_event_flags_proc(struct vmbus_softc *sc, volatile u_long *event_flags,
+int flag_cnt)
+{
+   int f;
+
+   for (f = 0; f < flag_cnt; ++f) {
+   uint32_t rel_id_base;
+   u_long flags;
+   int bit;
+
+   if (event_flags[f] == 0)
+   continue;
+
+   flags = atomic_swap_long(_flags[f], 0);
+   rel_id_base = f << VMBUS_EVTFLAG_SHIFT;
+
+   while ((bit = ffsl(flags)) != 0) {
+   struct hv_vmbus_channel *channel;
+   uint32_t rel_id;
+
+   --bit;  /* NOTE: ffsl is 1-based */
+   flags &= ~(1UL << bit);
+
+   rel_id = rel_id_base + bit;
+   channel = sc->vmbus_chmap[rel_id];
+
+   /* if channel is closed or closing */
+   if (channel == NULL || channel->rxq == NULL)
+   continue;
+
+   if (channel->batched_reading)
+   hv_ring_buffer_read_begin(>inbound);
+   taskqueue_enqueue(channel->rxq, >channel_task);
+   }
+   }
+}
+
+void
+vmbus_event_proc(struct vmbus_softc *sc, int cpu)
+{
+   struct vmbus_evtflags *eventf;
+
+   /*
+* On Host with Win8 or above, the event page can be checked directly
+* to 

Re: svn commit: r302691 - head/release

2016-07-12 Thread Ngie Cooper (yaneurabeya)

> On Jul 12, 2016, at 19:07, Nathan Whitehorn  wrote:
> 
> Author: nwhitehorn
> Date: Wed Jul 13 02:07:36 2016
> New Revision: 302691
> URL: https://svnweb.freebsd.org/changeset/base/302691
> 
> Log:
>  Reduce the set of things on the disc1 image to those on the bootonly image.
>  Notably, this removes the toolchain from the CD-ROM image (it remains on DVD
>  images) and pushes the CD-ROM image well below the 700 MB mark.
> 
>  MFC after:   10 days
> 
> Modified:
>  head/release/Makefile

There’s a lot more that could be done to be honest.

Here are some other knobs that might help, depending on how people configure 
their custom installers.

Cheers,
-Ngie

WITHOUT_ACCT=
WITHOUT_AMD=
WITHOUT_APM=
WITHOUT_AT=
WITHOUT_ATM=
WITHOUT_AUTOFS=
WITHOUT_BHYVE=
WITHOUT_BOOTPARAMD=
WITHOUT_BOOTPD=
WITHOUT_BSNMP=
WITHOUT_CVS=
WITHOUT_FINGER=
WITHOUT_GAMES=
WITHOUT_GDB=
WITHOUT_GPIB=
WITHOUT_HAST=
WITHOUT_HESOID=
WITHOUT_HTML=
WITHOUT_HYPERV=
WITHOUT_I4B=
WITHOUT_INETD=
WITHOUT_IPFILTER=
WITHOUT_IPFW=
WITHOUT_IPX=
WITHOUT_ISCSI=
WITHOUT_LIB32=
WITHOUT_LPR=
WITHOUT_NS_CACHING=
WITHOUT_PC_SYSINSTALL=
WITHOUT_PF=
WITHOUT_QUOTAS=
WITHOUT_RADIUS_SUPPORT=
WITHOUT_RBOOTD=
WITHOUT_RCMDS=
WITHOUT_ROUTED=
WITHOUT_SVN=
WITHOUT_SVNLITE=
WITHOUT_TALK=
WITHOUT_TCP_WRAPPERS=
WITHOUT_TFTP=
WITHOUT_TIMED=
WITHOUT_UNBOUND=


signature.asc
Description: Message signed with OpenPGP using GPGMail


svn commit: r302691 - head/release

2016-07-12 Thread Nathan Whitehorn
Author: nwhitehorn
Date: Wed Jul 13 02:07:36 2016
New Revision: 302691
URL: https://svnweb.freebsd.org/changeset/base/302691

Log:
  Reduce the set of things on the disc1 image to those on the bootonly image.
  Notably, this removes the toolchain from the CD-ROM image (it remains on DVD
  images) and pushes the CD-ROM image well below the 700 MB mark.
  
  MFC after:10 days

Modified:
  head/release/Makefile

Modified: head/release/Makefile
==
--- head/release/Makefile   Wed Jul 13 01:35:53 2016(r302690)
+++ head/release/Makefile   Wed Jul 13 02:07:36 2016(r302691)
@@ -171,9 +171,11 @@ disc1: packagesystem
 # Install system
mkdir -p ${.TARGET}
cd ${WORLDDIR} && ${IMAKE} installkernel installworld distribution \
-   DESTDIR=${.OBJDIR}/${.TARGET} MK_RESCUE=no MK_KERNEL_SYMBOLS=no 
\
-   MK_PROFILE=no MK_SENDMAIL=no MK_TESTS=no MK_LIB32=no \
-   MK_DEBUG_FILES=no
+   DESTDIR=${.OBJDIR}/${.TARGET} MK_AMD=no MK_AT=no \
+   MK_INSTALLLIB=no MK_LIB32=no MK_MAIL=no \
+   MK_NCP=no MK_TOOLCHAIN=no MK_PROFILE=no \
+   MK_RESCUE=no MK_DICT=no \
+   MK_KERNEL_SYMBOLS=no MK_TESTS=no MK_DEBUG_FILES=no
 # Copy distfiles
mkdir -p ${.TARGET}/usr/freebsd-dist
for dist in MANIFEST $$(ls *.txz | grep -vE -- '(base|lib32)-dbg'); \
___
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: r302690 - in head: . gnu/usr.bin/binutils gnu/usr.bin/cc gnu/usr.bin/gdb gnu/usr.bin/gdb/libgdb share/mk

2016-07-12 Thread Bryan Drewery
Author: bdrewery
Date: Wed Jul 13 01:35:53 2016
New Revision: 302690
URL: https://svnweb.freebsd.org/changeset/base/302690

Log:
  Revert r302670 and r302671 for now.
  
  MACHINE_CPUARCH smells like MACHINE except for arm64/aarch64 which
  has it backwards.

Modified:
  head/Makefile
  head/Makefile.inc1
  head/gnu/usr.bin/binutils/Makefile.inc0
  head/gnu/usr.bin/cc/Makefile.tgt
  head/gnu/usr.bin/gdb/Makefile.inc
  head/gnu/usr.bin/gdb/libgdb/Makefile
  head/share/mk/sys.mk

Modified: head/Makefile
==
--- head/Makefile   Tue Jul 12 22:53:11 2016(r302689)
+++ head/Makefile   Wed Jul 13 01:35:53 2016(r302690)
@@ -235,7 +235,7 @@ _MAKE+= MK_META_MODE=no
 _TARGET_ARCH=  ${TARGET:S/pc98/i386/:S/arm64/aarch64/}
 .elif !defined(TARGET) && defined(TARGET_ARCH) && \
 ${TARGET_ARCH} != ${MACHINE_ARCH}
-_TARGET=   ${TARGET_ARCH:${MACHINE_CPUARCH_SUB:ts:}}
+_TARGET=   
${TARGET_ARCH:C/mips(n32|64)?(el)?/mips/:C/arm(v6)?(eb)?/arm/:C/aarch64/arm64/:C/powerpc64/powerpc/:C/riscv64/riscv/}
 .endif
 .if defined(TARGET) && !defined(_TARGET)
 _TARGET=${TARGET}

Modified: head/Makefile.inc1
==
--- head/Makefile.inc1  Tue Jul 12 22:53:11 2016(r302689)
+++ head/Makefile.inc1  Wed Jul 13 01:35:53 2016(r302690)
@@ -384,8 +384,6 @@ XPATH=  ${WORLDTMP}/usr/sbin:${WORLDTMP}
 STRICTTMPPATH= ${BPATH}:${XPATH}
 TMPPATH=   ${STRICTTMPPATH}:${PATH}
 
-TARGET_CPUARCH?= ${TARGET_ARCH:${MACHINE_CPUARCH_SUB:ts:}}
-
 #
 # Avoid running mktemp(1) unless actually needed.
 # It may not be functional, e.g., due to new ABI

Modified: head/gnu/usr.bin/binutils/Makefile.inc0
==
--- head/gnu/usr.bin/binutils/Makefile.inc0 Tue Jul 12 22:53:11 2016
(r302689)
+++ head/gnu/usr.bin/binutils/Makefile.inc0 Wed Jul 13 01:35:53 2016
(r302690)
@@ -7,7 +7,7 @@
 VERSION=   "2.17.50 [FreeBSD] 2007-07-03"
 
 .if defined(TARGET_ARCH)
-TARGET_CPUARCH=${TARGET_ARCH:${MACHINE_CPUARCH_SUB:ts:}}
+TARGET_CPUARCH=${TARGET_ARCH:C/mips(n32|64)?(el)?/mips/:C/arm(v6)?(eb)?/arm/:C/powerpc64/powerpc/}
 .else
 TARGET_CPUARCH=${MACHINE_CPUARCH}
 .endif

Modified: head/gnu/usr.bin/cc/Makefile.tgt
==
--- head/gnu/usr.bin/cc/Makefile.tgtTue Jul 12 22:53:11 2016
(r302689)
+++ head/gnu/usr.bin/cc/Makefile.tgtWed Jul 13 01:35:53 2016
(r302690)
@@ -4,7 +4,7 @@
 # MACHINE_CPUARCH, but there's no easy way to export make functions...
 
 .if defined(TARGET_ARCH)
-TARGET_CPUARCH=${TARGET_ARCH:${MACHINE_CPUARCH_SUB:ts:}}
+TARGET_CPUARCH=${TARGET_ARCH:C/mips(n32|64)?(el)?/mips/:C/arm(v6)?(eb)?/arm/:C/powerpc64/powerpc/}
 .else
 TARGET_CPUARCH=${MACHINE_CPUARCH}
 .endif

Modified: head/gnu/usr.bin/gdb/Makefile.inc
==
--- head/gnu/usr.bin/gdb/Makefile.inc   Tue Jul 12 22:53:11 2016
(r302689)
+++ head/gnu/usr.bin/gdb/Makefile.inc   Wed Jul 13 01:35:53 2016
(r302690)
@@ -23,7 +23,7 @@ OBJ_RL= ${OBJ_ROOT}/../lib/libreadline/r
 # MACHINE_CPUARCH, but there's no easy way to export make functions...
 
 .if defined(TARGET_ARCH)
-TARGET_CPUARCH=${TARGET_ARCH:${MACHINE_CPUARCH_SUB:ts:}}
+TARGET_CPUARCH=${TARGET_ARCH:C/mips(n32|64)?(el)?/mips/:C/arm(v6)?(eb)?/arm/:C/powerpc64/powerpc/}
 .else
 TARGET_CPUARCH=${MACHINE_CPUARCH}
 .endif

Modified: head/gnu/usr.bin/gdb/libgdb/Makefile
==
--- head/gnu/usr.bin/gdb/libgdb/MakefileTue Jul 12 22:53:11 2016
(r302689)
+++ head/gnu/usr.bin/gdb/libgdb/MakefileWed Jul 13 01:35:53 2016
(r302690)
@@ -4,7 +4,7 @@
 # MACHINE_CPUARCH, but there's no easy way to export make functions...
 
 .if defined(TARGET_ARCH)
-TARGET_CPUARCH=${TARGET_ARCH:${MACHINE_CPUARCH_SUB:ts:}}
+TARGET_CPUARCH=${TARGET_ARCH:C/mips(n32|64)?(el)?/mips/:C/arm(v6)?(eb)?/arm/:C/powerpc64/powerpc/}
 .else
 TARGET_CPUARCH=${MACHINE_CPUARCH}
 .endif

Modified: head/share/mk/sys.mk
==
--- head/share/mk/sys.mkTue Jul 12 22:53:11 2016(r302689)
+++ head/share/mk/sys.mkWed Jul 13 01:35:53 2016(r302690)
@@ -13,13 +13,7 @@ unix ?=  We run FreeBSD, not UNIX.
 # and/or endian.  This is called MACHINE_CPU in NetBSD, but that's used
 # for something different in FreeBSD.
 #
-MACHINE_CPUARCH_SUB= \
-   C/mips(n32|64)?(el)?/mips/ \
-   C/arm(v6)?(eb|hf)?/arm/ \
-   C/aarch64/arm64/ \
-   C/powerpc64/powerpc/ \
-   C/riscv64/riscv/
-MACHINE_CPUARCH=${MACHINE_ARCH:${MACHINE_CPUARCH_SUB:ts:}}

Re: svn commit: r302670 - in head: . gnu/usr.bin/binutils gnu/usr.bin/cc gnu/usr.bin/gdb gnu/usr.bin/gdb/libgdb share/mk

2016-07-12 Thread Bryan Drewery
On 7/12/2016 6:32 PM, Bryan Drewery wrote:
> On 7/12/2016 11:57 AM, Bryan Drewery wrote:
>> Author: bdrewery
>> Date: Tue Jul 12 18:57:25 2016
>> New Revision: 302670
>> URL: https://svnweb.freebsd.org/changeset/base/302670
>>
>> Log:
>>   Create one list of replacements for MACHINE_CPUARCH as MACHINE_CPUARCH_SUB.
>>   
>>   This also adds missing s/aarch64/arm64 to the sys.mk version and also
> 
> This breaks the arm64 build, but I think it's correct.
> 
> Let's first start with what even is MACHINE_CPUARCH? It's unclear.
> Looking at r209024 we get:
> 
>> Introduce MACHINE_CPUARCH.  Many different MACHINE_ARCHs will be built
>> from one MACHINE_CPUARCH.  This will allow us to move to a more
>> standard MACHINE_ARCH for mips and arm which exist in many different
>> endian variants, and for powerpc where both 32 and 64 bit binaries are
>> generated from the same sources.
> 
> If we look at the current targets list we have:
> 
>> # make targets
>> Supported TARGET/TARGET_ARCH pairs for world and kernel targets
>> amd64/amd64
>> arm/arm
>> arm/armeb
>> arm/armv6
>> arm64/aarch64
>> i386/i386
>> mips/mipsel
>> mips/mips
>> mips/mips64el
>> mips/mips64
>> mips/mipsn32
>> pc98/i386
>> powerpc/powerpc
>> powerpc/powerpc64
>> sparc64/sparc64
> 
> So one TARGET can have multiple TARGET_ARCH.  So MACHINE_CPUARCH sounds
> like TARGET.
> 
> In all but the arm64 cases it seems that MACHINE_CPUARCH == MACHINE
> (meaning TARGET_CPUARCH == TARGET).
> 
> So 1. I think MACHINE_CPUARCH is really just MACHINE.
> and 2. I think the proper MACHINE_CPUARCH for AArch64 is arm64 since
> that is what the TARGET is.  There's a lot of code using MACHINE_CPUARCH
> == aarc64 instead of MACHINE_CPUARCH == arm64 (and directories named
> "aarch64" rather than "arm64",

And I think this is only the case because we had these replacements
spread everywhere and C/aarch64/arm64/ was missed in share/mk/sys.mk
until I added it here.

> so I am willing to revert or modify this
> but it seems to be inconsistent.
> 
> For now I am just reverting this, but I think the commit is worth having
> in here if we are going to keep MACHINE_CPUARCH as it keeps the
> replacement list in 1 place.
> 
>>   adds back armv6hf for universe since it was added to the sys.mk version
>>   in r300438.
>>   
>>   MFC after: 3 days
>>   Sponsored by:  EMC / Isilon Storage Division
>>   Differential Revision: https://reviews.freebsd.org/D7159
>>
>> Modified:
>>   head/Makefile
>>   head/gnu/usr.bin/binutils/Makefile.inc0
>>   head/gnu/usr.bin/cc/Makefile.tgt
>>   head/gnu/usr.bin/gdb/Makefile.inc
>>   head/gnu/usr.bin/gdb/libgdb/Makefile
>>   head/share/mk/sys.mk
>>
>> Modified: head/Makefile
>> ==
>> --- head/MakefileTue Jul 12 17:58:58 2016(r302669)
>> +++ head/MakefileTue Jul 12 18:57:25 2016(r302670)
>> @@ -235,7 +235,7 @@ _MAKE+=  MK_META_MODE=no
>>  _TARGET_ARCH=   ${TARGET:S/pc98/i386/:S/arm64/aarch64/}
>>  .elif !defined(TARGET) && defined(TARGET_ARCH) && \
>>  ${TARGET_ARCH} != ${MACHINE_ARCH}
>> -_TARGET=
>> ${TARGET_ARCH:C/mips(n32|64)?(el)?/mips/:C/arm(v6)?(eb)?/arm/:C/aarch64/arm64/:C/powerpc64/powerpc/:C/riscv64/riscv/}
>> +_TARGET=${TARGET_ARCH:${MACHINE_CPUARCH_SUB:ts:}}
>>  .endif
>>  .if defined(TARGET) && !defined(_TARGET)
>>  _TARGET=${TARGET}
>>
>> Modified: head/gnu/usr.bin/binutils/Makefile.inc0
>> ==
>> --- head/gnu/usr.bin/binutils/Makefile.inc0  Tue Jul 12 17:58:58 2016
>> (r302669)
>> +++ head/gnu/usr.bin/binutils/Makefile.inc0  Tue Jul 12 18:57:25 2016
>> (r302670)
>> @@ -7,7 +7,7 @@
>>  VERSION="2.17.50 [FreeBSD] 2007-07-03"
>>  
>>  .if defined(TARGET_ARCH)
>> -TARGET_CPUARCH=${TARGET_ARCH:C/mips(n32|64)?(el)?/mips/:C/arm(v6)?(eb)?/arm/:C/powerpc64/powerpc/}
>> +TARGET_CPUARCH=${TARGET_ARCH:${MACHINE_CPUARCH_SUB:ts:}}
>>  .else
>>  TARGET_CPUARCH=${MACHINE_CPUARCH}
>>  .endif
>>
>> Modified: head/gnu/usr.bin/cc/Makefile.tgt
>> ==
>> --- head/gnu/usr.bin/cc/Makefile.tgt Tue Jul 12 17:58:58 2016
>> (r302669)
>> +++ head/gnu/usr.bin/cc/Makefile.tgt Tue Jul 12 18:57:25 2016
>> (r302670)
>> @@ -4,7 +4,7 @@
>>  # MACHINE_CPUARCH, but there's no easy way to export make functions...
>>  
>>  .if defined(TARGET_ARCH)
>> -TARGET_CPUARCH=${TARGET_ARCH:C/mips(n32|64)?(el)?/mips/:C/arm(v6)?(eb)?/arm/:C/powerpc64/powerpc/}
>> +TARGET_CPUARCH=${TARGET_ARCH:${MACHINE_CPUARCH_SUB:ts:}}
>>  .else
>>  TARGET_CPUARCH=${MACHINE_CPUARCH}
>>  .endif
>>
>> Modified: head/gnu/usr.bin/gdb/Makefile.inc
>> ==
>> --- head/gnu/usr.bin/gdb/Makefile.incTue Jul 12 17:58:58 2016
>> 

Re: svn commit: r302670 - in head: . gnu/usr.bin/binutils gnu/usr.bin/cc gnu/usr.bin/gdb gnu/usr.bin/gdb/libgdb share/mk

2016-07-12 Thread Bryan Drewery
On 7/12/2016 11:57 AM, Bryan Drewery wrote:
> Author: bdrewery
> Date: Tue Jul 12 18:57:25 2016
> New Revision: 302670
> URL: https://svnweb.freebsd.org/changeset/base/302670
> 
> Log:
>   Create one list of replacements for MACHINE_CPUARCH as MACHINE_CPUARCH_SUB.
>   
>   This also adds missing s/aarch64/arm64 to the sys.mk version and also

This breaks the arm64 build, but I think it's correct.

Let's first start with what even is MACHINE_CPUARCH? It's unclear.
Looking at r209024 we get:

> Introduce MACHINE_CPUARCH.  Many different MACHINE_ARCHs will be built
> from one MACHINE_CPUARCH.  This will allow us to move to a more
> standard MACHINE_ARCH for mips and arm which exist in many different
> endian variants, and for powerpc where both 32 and 64 bit binaries are
> generated from the same sources.

If we look at the current targets list we have:

> # make targets
> Supported TARGET/TARGET_ARCH pairs for world and kernel targets
> amd64/amd64
> arm/arm
> arm/armeb
> arm/armv6
> arm64/aarch64
> i386/i386
> mips/mipsel
> mips/mips
> mips/mips64el
> mips/mips64
> mips/mipsn32
> pc98/i386
> powerpc/powerpc
> powerpc/powerpc64
> sparc64/sparc64

So one TARGET can have multiple TARGET_ARCH.  So MACHINE_CPUARCH sounds
like TARGET.

In all but the arm64 cases it seems that MACHINE_CPUARCH == MACHINE
(meaning TARGET_CPUARCH == TARGET).

So 1. I think MACHINE_CPUARCH is really just MACHINE.
and 2. I think the proper MACHINE_CPUARCH for AArch64 is arm64 since
that is what the TARGET is.  There's a lot of code using MACHINE_CPUARCH
== aarc64 instead of MACHINE_CPUARCH == arm64 (and directories named
"aarch64" rather than "arm64", so I am willing to revert or modify this
but it seems to be inconsistent.

For now I am just reverting this, but I think the commit is worth having
in here if we are going to keep MACHINE_CPUARCH as it keeps the
replacement list in 1 place.

>   adds back armv6hf for universe since it was added to the sys.mk version
>   in r300438.
>   
>   MFC after:  3 days
>   Sponsored by:   EMC / Isilon Storage Division
>   Differential Revision:  https://reviews.freebsd.org/D7159
> 
> Modified:
>   head/Makefile
>   head/gnu/usr.bin/binutils/Makefile.inc0
>   head/gnu/usr.bin/cc/Makefile.tgt
>   head/gnu/usr.bin/gdb/Makefile.inc
>   head/gnu/usr.bin/gdb/libgdb/Makefile
>   head/share/mk/sys.mk
> 
> Modified: head/Makefile
> ==
> --- head/Makefile Tue Jul 12 17:58:58 2016(r302669)
> +++ head/Makefile Tue Jul 12 18:57:25 2016(r302670)
> @@ -235,7 +235,7 @@ _MAKE+=   MK_META_MODE=no
>  _TARGET_ARCH=${TARGET:S/pc98/i386/:S/arm64/aarch64/}
>  .elif !defined(TARGET) && defined(TARGET_ARCH) && \
>  ${TARGET_ARCH} != ${MACHINE_ARCH}
> -_TARGET= 
> ${TARGET_ARCH:C/mips(n32|64)?(el)?/mips/:C/arm(v6)?(eb)?/arm/:C/aarch64/arm64/:C/powerpc64/powerpc/:C/riscv64/riscv/}
> +_TARGET= ${TARGET_ARCH:${MACHINE_CPUARCH_SUB:ts:}}
>  .endif
>  .if defined(TARGET) && !defined(_TARGET)
>  _TARGET=${TARGET}
> 
> Modified: head/gnu/usr.bin/binutils/Makefile.inc0
> ==
> --- head/gnu/usr.bin/binutils/Makefile.inc0   Tue Jul 12 17:58:58 2016
> (r302669)
> +++ head/gnu/usr.bin/binutils/Makefile.inc0   Tue Jul 12 18:57:25 2016
> (r302670)
> @@ -7,7 +7,7 @@
>  VERSION= "2.17.50 [FreeBSD] 2007-07-03"
>  
>  .if defined(TARGET_ARCH)
> -TARGET_CPUARCH=${TARGET_ARCH:C/mips(n32|64)?(el)?/mips/:C/arm(v6)?(eb)?/arm/:C/powerpc64/powerpc/}
> +TARGET_CPUARCH=${TARGET_ARCH:${MACHINE_CPUARCH_SUB:ts:}}
>  .else
>  TARGET_CPUARCH=${MACHINE_CPUARCH}
>  .endif
> 
> Modified: head/gnu/usr.bin/cc/Makefile.tgt
> ==
> --- head/gnu/usr.bin/cc/Makefile.tgt  Tue Jul 12 17:58:58 2016
> (r302669)
> +++ head/gnu/usr.bin/cc/Makefile.tgt  Tue Jul 12 18:57:25 2016
> (r302670)
> @@ -4,7 +4,7 @@
>  # MACHINE_CPUARCH, but there's no easy way to export make functions...
>  
>  .if defined(TARGET_ARCH)
> -TARGET_CPUARCH=${TARGET_ARCH:C/mips(n32|64)?(el)?/mips/:C/arm(v6)?(eb)?/arm/:C/powerpc64/powerpc/}
> +TARGET_CPUARCH=${TARGET_ARCH:${MACHINE_CPUARCH_SUB:ts:}}
>  .else
>  TARGET_CPUARCH=${MACHINE_CPUARCH}
>  .endif
> 
> Modified: head/gnu/usr.bin/gdb/Makefile.inc
> ==
> --- head/gnu/usr.bin/gdb/Makefile.inc Tue Jul 12 17:58:58 2016
> (r302669)
> +++ head/gnu/usr.bin/gdb/Makefile.inc Tue Jul 12 18:57:25 2016
> (r302670)
> @@ -23,7 +23,7 @@ OBJ_RL= ${OBJ_ROOT}/../lib/libreadline/r
>  # MACHINE_CPUARCH, but there's no easy way to export make functions...
>  
>  .if defined(TARGET_ARCH)
> 

svn commit: r302689 - in stable/10: usr.bin/lastcomm/tests usr.sbin/sa/tests

2016-07-12 Thread Alan Somers
Author: asomers
Date: Tue Jul 12 22:53:11 2016
New Revision: 302689
URL: https://svnweb.freebsd.org/changeset/base/302689

Log:
  MFC r302206
  
  Skip lastcomm and sa tests on unsupported architectures
  
  usr.bin/lastcom/tests/Makefile
  usr.sbin/sa/tests/Makefile
Set allow_architectures appropriately.  These tests depend on
golden files that must be generated for each architecture, and
haven't yet been generated for all of them.
  
  PR:   204154

Modified:
  stable/10/usr.bin/lastcomm/tests/Makefile
  stable/10/usr.sbin/sa/tests/Makefile
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/usr.bin/lastcomm/tests/Makefile
==
--- stable/10/usr.bin/lastcomm/tests/Makefile   Tue Jul 12 22:19:25 2016
(r302688)
+++ stable/10/usr.bin/lastcomm/tests/Makefile   Tue Jul 12 22:53:11 2016
(r302689)
@@ -3,6 +3,7 @@
 TESTSDIR=  ${TESTSBASE}/usr.bin/lastcomm
 
 TAP_TESTS_SH=  legacy_test
+TEST_METADATA.legacy_test+=allowed_architectures="amd64 i386 sparc64"
 
 FILESDIR=  ${TESTSDIR}
 FILES= v1-amd64-acct.in

Modified: stable/10/usr.sbin/sa/tests/Makefile
==
--- stable/10/usr.sbin/sa/tests/MakefileTue Jul 12 22:19:25 2016
(r302688)
+++ stable/10/usr.sbin/sa/tests/MakefileTue Jul 12 22:53:11 2016
(r302689)
@@ -3,6 +3,7 @@
 TESTSDIR=  ${TESTSBASE}/usr.sbin/sa
 
 TAP_TESTS_SH=  legacy_test
+TEST_METADATA.legacy_test+=allowed_architectures="amd64 i386 sparc64"
 
 FILESDIR=  ${TESTSDIR}
 FILES= v1-amd64-sav.in
___
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: r302688 - stable/10/sbin/sysctl

2016-07-12 Thread Alan Somers
Author: asomers
Date: Tue Jul 12 22:19:25 2016
New Revision: 302688
URL: https://svnweb.freebsd.org/changeset/base/302688

Log:
  MFC r302174
  
  Fix "sysctl vm.vmtotal" output on machines with > 2TB virtual memory
  
  sbin/sysctl/sysctl.c
  Fix integer overflows in printf format strings
  
  PR:   199673

Modified:
  stable/10/sbin/sysctl/sysctl.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sbin/sysctl/sysctl.c
==
--- stable/10/sbin/sysctl/sysctl.c  Tue Jul 12 22:09:05 2016
(r302687)
+++ stable/10/sbin/sysctl/sysctl.c  Tue Jul 12 22:19:25 2016
(r302688)
@@ -547,15 +547,15 @@ S_vmtotal(size_t l2, void *p)
"%hd Sleep: %hd)\n",
v->t_rq, v->t_dw, v->t_pw, v->t_sl);
printf(
-   "Virtual Memory:\t\t(Total: %dK Active: %dK)\n",
-   v->t_vm * pageKilo, v->t_avm * pageKilo);
-   printf("Real Memory:\t\t(Total: %dK Active: %dK)\n",
-   v->t_rm * pageKilo, v->t_arm * pageKilo);
-   printf("Shared Virtual Memory:\t(Total: %dK Active: %dK)\n",
-   v->t_vmshr * pageKilo, v->t_avmshr * pageKilo);
-   printf("Shared Real Memory:\t(Total: %dK Active: %dK)\n",
-   v->t_rmshr * pageKilo, v->t_armshr * pageKilo);
-   printf("Free Memory:\t%dK", v->t_free * pageKilo);
+   "Virtual Memory:\t\t(Total: %jdK Active: %jdK)\n",
+   (intmax_t)v->t_vm * pageKilo, (intmax_t)v->t_avm * pageKilo);
+   printf("Real Memory:\t\t(Total: %jdK Active: %jdK)\n",
+   (intmax_t)v->t_rm * pageKilo, (intmax_t)v->t_arm * pageKilo);
+   printf("Shared Virtual Memory:\t(Total: %jdK Active: %jdK)\n",
+   (intmax_t)v->t_vmshr * pageKilo, (intmax_t)v->t_avmshr * pageKilo);
+   printf("Shared Real Memory:\t(Total: %jdK Active: %jdK)\n",
+   (intmax_t)v->t_rmshr * pageKilo, (intmax_t)v->t_armshr * pageKilo);
+   printf("Free Memory:\t%jdK", (intmax_t)v->t_free * pageKilo);
 
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: r302687 - stable/10/tests/sys/acl

2016-07-12 Thread Alan Somers
Author: asomers
Date: Tue Jul 12 22:09:05 2016
New Revision: 302687
URL: https://svnweb.freebsd.org/changeset/base/302687

Log:
  MFC r302036
  
  Skip sys/acl tests on systems lacking perl
  
  tests/sys/acl/Makefile
  add perl to the required_programs for all tests in this directory

Modified:
  stable/10/tests/sys/acl/Makefile
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/tests/sys/acl/Makefile
==
--- stable/10/tests/sys/acl/MakefileTue Jul 12 21:57:05 2016
(r302686)
+++ stable/10/tests/sys/acl/MakefileTue Jul 12 22:09:05 2016
(r302687)
@@ -25,11 +25,11 @@ TEST_METADATA.$t+=  required_user="root"
 _ACL_PROGS=getfacl setfacl
 
 .for t in 01 03 04
-TEST_METADATA.$t+= required_programs="zpool ${_ACL_PROGS}"
+TEST_METADATA.$t+= required_programs="perl zpool ${_ACL_PROGS}"
 .endfor
 
 .for t in 00 02
-TEST_METADATA.$t+= required_programs="${_ACL_PROGS}"
+TEST_METADATA.$t+= required_programs="perl ${_ACL_PROGS}"
 .endfor
 
 .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: r302682 - head/sys/dev/ioat

2016-07-12 Thread Conrad E. Meyer
Author: cem
Date: Tue Jul 12 21:56:55 2016
New Revision: 302682
URL: https://svnweb.freebsd.org/changeset/base/302682

Log:
  ioat_reserve_space: Recheck quiescing flag after dropping submit lock
  
  Fix a minor bound check error while here (ring can only hold 1 <<
  MAX_ORDER - 1 entries).

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

Modified: head/sys/dev/ioat/ioat.c
==
--- head/sys/dev/ioat/ioat.cTue Jul 12 21:56:52 2016(r302681)
+++ head/sys/dev/ioat/ioat.cTue Jul 12 21:56:55 2016(r302682)
@@ -1382,16 +1382,17 @@ ioat_reserve_space(struct ioat_softc *io
error = 0;
dug = FALSE;
 
-   if (num_descs < 1 || num_descs > (1 << IOAT_MAX_ORDER)) {
+   if (num_descs < 1 || num_descs >= (1 << IOAT_MAX_ORDER)) {
error = EINVAL;
goto out;
}
-   if (ioat->quiescing) {
-   error = ENXIO;
-   goto out;
-   }
 
for (;;) {
+   if (ioat->quiescing) {
+   error = ENXIO;
+   goto out;
+   }
+
if (ioat_get_ring_space(ioat) >= num_descs)
goto out;
 
@@ -1453,6 +1454,8 @@ ioat_reserve_space(struct ioat_softc *io
 
 out:
mtx_assert(>submit_lock, MA_OWNED);
+   KASSERT(!ioat->quiescing || error == ENXIO,
+   ("reserved during quiesce"));
return (error);
 }
 
___
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: r302685 - head/sys/dev/ioat

2016-07-12 Thread Conrad E. Meyer
Author: cem
Date: Tue Jul 12 21:57:02 2016
New Revision: 302685
URL: https://svnweb.freebsd.org/changeset/base/302685

Log:
  ioat(4): Add KTR trace for ioat_reset_hw

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

Modified: head/sys/dev/ioat/ioat.c
==
--- head/sys/dev/ioat/ioat.cTue Jul 12 21:57:00 2016(r302684)
+++ head/sys/dev/ioat/ioat.cTue Jul 12 21:57:02 2016(r302685)
@@ -1778,6 +1778,8 @@ ioat_reset_hw(struct ioat_softc *ioat)
unsigned timeout;
int error;
 
+   CTR0(KTR_IOAT, __func__);
+
mtx_lock(IOAT_REFLK);
while (ioat->resetting && !ioat->destroying)
msleep(>resetting, IOAT_REFLK, 0, "IRH_drain", 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: r302683 - head/sys/dev/ioat

2016-07-12 Thread Conrad E. Meyer
Author: cem
Date: Tue Jul 12 21:56:57 2016
New Revision: 302683
URL: https://svnweb.freebsd.org/changeset/base/302683

Log:
  ioat(4): Assert against ring underflow

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

Modified: head/sys/dev/ioat/ioat.c
==
--- head/sys/dev/ioat/ioat.cTue Jul 12 21:56:55 2016(r302682)
+++ head/sys/dev/ioat/ioat.cTue Jul 12 21:56:57 2016(r302683)
@@ -702,6 +702,11 @@ ioat_process_events(struct ioat_softc *i
ioat->tail++;
if (desc->hw_desc_bus_addr == status)
break;
+
+   KASSERT(ioat_get_active(ioat) > 0, ("overrunning ring t:%u "
+   "h:%u st:0x%016lx last_seen:%016lx completed:%u\n",
+   ioat->tail, ioat->head, comp_update, ioat->last_seen,
+   completed));
}
 
ioat->last_seen = desc->hw_desc_bus_addr;
___
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: r302680 - head/sys/dev/ioat

2016-07-12 Thread Conrad E. Meyer
Author: cem
Date: Tue Jul 12 21:56:49 2016
New Revision: 302680
URL: https://svnweb.freebsd.org/changeset/base/302680

Log:
  ioat(4): Export HW capabilities to consumers

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

Modified: head/sys/dev/ioat/ioat.c
==
--- head/sys/dev/ioat/ioat.cTue Jul 12 21:56:46 2016(r302679)
+++ head/sys/dev/ioat/ioat.cTue Jul 12 21:56:49 2016(r302680)
@@ -870,6 +870,15 @@ ioat_get_max_io_size(bus_dmaengine_t dma
return (ioat->max_xfer_size);
 }
 
+uint32_t
+ioat_get_capabilities(bus_dmaengine_t dmaengine)
+{
+   struct ioat_softc *ioat;
+
+   ioat = to_ioat_softc(dmaengine);
+   return (ioat->capabilities);
+}
+
 int
 ioat_set_interrupt_coalesce(bus_dmaengine_t dmaengine, uint16_t delay)
 {

Modified: head/sys/dev/ioat/ioat.h
==
--- head/sys/dev/ioat/ioat.hTue Jul 12 21:56:46 2016(r302679)
+++ head/sys/dev/ioat/ioat.hTue Jul 12 21:56:49 2016(r302680)
@@ -81,6 +81,36 @@ __FBSDID("$FreeBSD$");
 #defineIOAT_VER_3_20x32
 #defineIOAT_VER_3_30x33
 
+/*
+ * Hardware capabilities.  Different hardware revisions support different
+ * features.  It is often useful to detect specific features than try to infer
+ * them from hardware version.
+ *
+ * Different channels may support different features too; for example, 'PQ' may
+ * only be supported on the first two channels of some hardware.
+ */
+#defineIOAT_DMACAP_PB  (1 << 0)
+#defineIOAT_DMACAP_CRC (1 << 1)
+#defineIOAT_DMACAP_MARKER_SKIP (1 << 2)
+#defineIOAT_DMACAP_OLD_XOR (1 << 3)
+#defineIOAT_DMACAP_DCA (1 << 4)
+#defineIOAT_DMACAP_MOVECRC (1 << 5)
+#defineIOAT_DMACAP_BFILL   (1 << 6)
+#defineIOAT_DMACAP_EXT_APIC(1 << 7)
+#defineIOAT_DMACAP_XOR (1 << 8)
+#defineIOAT_DMACAP_PQ  (1 << 9)
+#defineIOAT_DMACAP_DMA_DIF (1 << 10)
+#defineIOAT_DMACAP_DWBES   (1 << 13)
+#defineIOAT_DMACAP_RAID16SS(1 << 17)
+#defineIOAT_DMACAP_DMAMC   (1 << 18)
+#defineIOAT_DMACAP_CTOS(1 << 19)
+
+#defineIOAT_DMACAP_STR \
+"\20\24Completion_Timeout_Support\23DMA_with_Multicasting_Support" \
+"\22RAID_Super_descriptors\16Descriptor_Write_Back_Error_Support" \
+"\13DMA_with_DIF\12PQ\11XOR\10Extended_APIC_ID\07Block_Fill\06Move_CRC" \
+"\05DCA\04Old_XOR\03Marker_Skipping\02CRC\01Page_Break"
+
 typedef void *bus_dmaengine_t;
 struct bus_dmadesc;
 typedef void (*bus_dmaengine_callback_t)(void *arg, int error);
@@ -100,6 +130,7 @@ void ioat_put_dmaengine(bus_dmaengine_t 
 /* Check the DMA engine's HW version */
 int ioat_get_hwversion(bus_dmaengine_t dmaengine);
 size_t ioat_get_max_io_size(bus_dmaengine_t dmaengine);
+uint32_t ioat_get_capabilities(bus_dmaengine_t dmaengine);
 
 /*
  * Set interrupt coalescing on a DMA channel.

Modified: head/sys/dev/ioat/ioat_hw.h
==
--- head/sys/dev/ioat/ioat_hw.h Tue Jul 12 21:56:46 2016(r302679)
+++ head/sys/dev/ioat/ioat_hw.h Tue Jul 12 21:56:49 2016(r302680)
@@ -55,27 +55,6 @@ __FBSDID("$FreeBSD$");
 #defineIOAT_CS_STATUS_OFFSET   0x0E
 
 #defineIOAT_DMACAPABILITY_OFFSET   0x10
-#defineIOAT_DMACAP_PB  (1 << 0)
-#defineIOAT_DMACAP_CRC (1 << 1)
-#defineIOAT_DMACAP_MARKER_SKIP (1 << 2)
-#defineIOAT_DMACAP_OLD_XOR (1 << 3)
-#defineIOAT_DMACAP_DCA (1 << 4)
-#defineIOAT_DMACAP_MOVECRC (1 << 5)
-#defineIOAT_DMACAP_BFILL   (1 << 6)
-#defineIOAT_DMACAP_EXT_APIC(1 << 7)
-#defineIOAT_DMACAP_XOR (1 << 8)
-#defineIOAT_DMACAP_PQ  (1 << 9)
-#defineIOAT_DMACAP_DMA_DIF (1 << 10)
-#defineIOAT_DMACAP_DWBES   (1 << 13)
-#defineIOAT_DMACAP_RAID16SS(1 << 17)
-#defineIOAT_DMACAP_DMAMC   (1 << 18)
-#defineIOAT_DMACAP_CTOS(1 << 19)
-
-#defineIOAT_DMACAP_STR \
-"\20\24Completion_Timeout_Support\23DMA_with_Multicasting_Support" \
-"\22RAID_Super_descriptors\16Descriptor_Write_Back_Error_Support" \
-"\13DMA_with_DIF\12PQ\11XOR\10Extended_APIC_ID\07Block_Fill\06Move_CRC" \
-"\05DCA\04Old_XOR\03Marker_Skipping\02CRC\01Page_Break"
 
 /* DMA Channel Registers */
 #defineIOAT_CHANCTRL_OFFSET0x80

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

2016-07-12 Thread Conrad E. Meyer
Author: cem
Date: Tue Jul 12 21:57:00 2016
New Revision: 302684
URL: https://svnweb.freebsd.org/changeset/base/302684

Log:
  ioat(4): Enhance KTR logging for descriptor completions

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

Modified: head/sys/dev/ioat/ioat.c
==
--- head/sys/dev/ioat/ioat.cTue Jul 12 21:56:57 2016(r302683)
+++ head/sys/dev/ioat/ioat.cTue Jul 12 21:57:00 2016(r302684)
@@ -693,7 +693,8 @@ ioat_process_events(struct ioat_softc *i
while (1) {
desc = ioat_get_ring_entry(ioat, ioat->tail);
dmadesc = >bus_dmadesc;
-   CTR1(KTR_IOAT, "completing desc %d", ioat->tail);
+   CTR3(KTR_IOAT, "completing desc %u ok  cb %p(%p)", ioat->tail,
+   dmadesc->callback_fn, dmadesc->callback_arg);
 
if (dmadesc->callback_fn != NULL)
dmadesc->callback_fn(dmadesc->callback_arg, 0);
@@ -763,7 +764,8 @@ out:
while (ioat_get_active(ioat) > 0) {
desc = ioat_get_ring_entry(ioat, ioat->tail);
dmadesc = >bus_dmadesc;
-   CTR1(KTR_IOAT, "completing err desc %d", ioat->tail);
+   CTR3(KTR_IOAT, "completing desc %u err cb %p(%p)", ioat->tail,
+   dmadesc->callback_fn, dmadesc->callback_arg);
 
if (dmadesc->callback_fn != NULL)
dmadesc->callback_fn(dmadesc->callback_arg,
___
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: r302681 - head/sys/dev/ioat

2016-07-12 Thread Conrad E. Meyer
Author: cem
Date: Tue Jul 12 21:56:52 2016
New Revision: 302681
URL: https://svnweb.freebsd.org/changeset/base/302681

Log:
  ioat(4): Remove force_hw_error sysctl; it does not work reliably

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

Modified: head/sys/dev/ioat/ioat.c
==
--- head/sys/dev/ioat/ioat.cTue Jul 12 21:56:49 2016(r302680)
+++ head/sys/dev/ioat/ioat.cTue Jul 12 21:56:52 2016(r302681)
@@ -1975,38 +1975,6 @@ out:
 }
 
 static int
-sysctl_handle_error(SYSCTL_HANDLER_ARGS)
-{
-   struct ioat_descriptor *desc;
-   struct ioat_softc *ioat;
-   int error, arg;
-
-   ioat = arg1;
-
-   arg = 0;
-   error = SYSCTL_OUT(req, , sizeof(arg));
-   if (error != 0 || req->newptr == NULL)
-   return (error);
-
-   error = SYSCTL_IN(req, , sizeof(arg));
-   if (error != 0)
-   return (error);
-
-   if (arg != 0) {
-   ioat_acquire(>dmaengine);
-   desc = ioat_op_generic(ioat, IOAT_OP_COPY, 1,
-   0xull, 0xull, NULL, NULL,
-   0);
-   if (desc == NULL)
-   error = ENOMEM;
-   else
-   ioat_submit_single(ioat);
-   ioat_release(>dmaengine);
-   }
-   return (error);
-}
-
-static int
 sysctl_handle_reset(SYSCTL_HANDLER_ARGS)
 {
struct ioat_softc *ioat;
@@ -2107,9 +2075,6 @@ ioat_setup_sysctl(device_t device)
SYSCTL_ADD_PROC(ctx, hammer, OID_AUTO, "force_hw_reset",
CTLTYPE_INT | CTLFLAG_RW, ioat, 0, sysctl_handle_reset, "I",
"Set to non-zero to reset the hardware");
-   SYSCTL_ADD_PROC(ctx, hammer, OID_AUTO, "force_hw_error",
-   CTLTYPE_INT | CTLFLAG_RW, ioat, 0, sysctl_handle_error, "I",
-   "Set to non-zero to inject a recoverable hardware error");
 
tmp = SYSCTL_ADD_NODE(ctx, par, OID_AUTO, "stats", CTLFLAG_RD, NULL,
"IOAT channel statistics");
___
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: r302686 - head/sys/dev/ioat

2016-07-12 Thread Conrad E. Meyer
Author: cem
Date: Tue Jul 12 21:57:05 2016
New Revision: 302686
URL: https://svnweb.freebsd.org/changeset/base/302686

Log:
  ioat(4): Check ring links at grow/shrink in INVARIANTS

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

Modified: head/sys/dev/ioat/ioat.c
==
--- head/sys/dev/ioat/ioat.cTue Jul 12 21:57:02 2016(r302685)
+++ head/sys/dev/ioat/ioat.cTue Jul 12 21:57:05 2016(r302686)
@@ -1591,6 +1591,18 @@ ring_grow(struct ioat_softc *ioat, uint3
hw->next = next->hw_desc_bus_addr;
}
 
+#ifdef INVARIANTS
+   for (i = 0; i < newsize; i++) {
+   next = newring[(i + 1) & (newsize - 1)];
+   hw = newring[i & (newsize - 1)]->u.dma;
+
+   KASSERT(hw->next == next->hw_desc_bus_addr,
+   ("mismatch at i:%u (oldsize:%u); next=%p nextaddr=0x%lx"
+" (tail:%u)", i, oldsize, next, next->hw_desc_bus_addr,
+tail));
+   }
+#endif
+
free(ioat->ring, M_IOAT);
ioat->ring = newring;
ioat->ring_size_order = oldorder + 1;
@@ -1657,6 +1669,18 @@ ring_shrink(struct ioat_softc *ioat, uin
next = newring[(ioat->tail + newsize) & (newsize - 1)];
hw->next = next->hw_desc_bus_addr;
 
+#ifdef INVARIANTS
+   for (i = 0; i < newsize; i++) {
+   next = newring[(i + 1) & (newsize - 1)];
+   hw = newring[i & (newsize - 1)]->u.dma;
+
+   KASSERT(hw->next == next->hw_desc_bus_addr,
+   ("mismatch at i:%u (newsize:%u); next=%p nextaddr=0x%lx "
+"(tail:%u)", i, newsize, next, next->hw_desc_bus_addr,
+ioat->tail));
+   }
+#endif
+
free(ioat->ring, M_IOAT);
ioat->ring = newring;
ioat->ring_size_order = oldorder - 1;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2016-07-12 Thread Conrad E. Meyer
Author: cem
Date: Tue Jul 12 21:56:46 2016
New Revision: 302679
URL: https://svnweb.freebsd.org/changeset/base/302679

Log:
  ioat(4): Submitters pick up a shovel if queue is too full
  
  Before attempting to grow the ring.

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.cTue Jul 12 21:56:34 2016(r302678)
+++ head/sys/dev/ioat/ioat.cTue Jul 12 21:56:46 2016(r302679)
@@ -462,6 +462,7 @@ ioat3_attach(device_t device)
mtx_unlock(>submit_lock);
 
ioat->is_resize_pending = FALSE;
+   ioat->is_submitter_processing = FALSE;
ioat->is_completion_pending = FALSE;
ioat->is_reset_pending = FALSE;
ioat->is_channel_running = FALSE;
@@ -1365,10 +1366,12 @@ ioat_reserve_space(struct ioat_softc *io
 {
struct ioat_descriptor **new_ring;
uint32_t order;
+   boolean_t dug;
int error;
 
mtx_assert(>submit_lock, MA_OWNED);
error = 0;
+   dug = FALSE;
 
if (num_descs < 1 || num_descs > (1 << IOAT_MAX_ORDER)) {
error = EINVAL;
@@ -1383,6 +1386,22 @@ ioat_reserve_space(struct ioat_softc *io
if (ioat_get_ring_space(ioat) >= num_descs)
goto out;
 
+   if (!dug && !ioat->is_submitter_processing &&
+   (1 << ioat->ring_size_order) > num_descs) {
+   ioat->is_submitter_processing = TRUE;
+   mtx_unlock(>submit_lock);
+
+   ioat_process_events(ioat);
+
+   mtx_lock(>submit_lock);
+   dug = TRUE;
+   KASSERT(ioat->is_submitter_processing == TRUE,
+   ("is_submitter_processing"));
+   ioat->is_submitter_processing = FALSE;
+   wakeup(>tail);
+   continue;
+   }
+
order = ioat->ring_size_order;
if (ioat->is_resize_pending || order == IOAT_MAX_ORDER) {
if ((mflags & M_WAITOK) != 0) {
@@ -2054,6 +2073,9 @@ ioat_setup_sysctl(device_t device)
 
SYSCTL_ADD_INT(ctx, state, OID_AUTO, "is_resize_pending", CTLFLAG_RD,
>is_resize_pending, 0, "resize pending");
+   SYSCTL_ADD_INT(ctx, state, OID_AUTO, "is_submitter_processing",
+   CTLFLAG_RD, >is_submitter_processing, 0,
+   "submitter processing");
SYSCTL_ADD_INT(ctx, state, OID_AUTO, "is_completion_pending",
CTLFLAG_RD, >is_completion_pending, 0, "completion pending");
SYSCTL_ADD_INT(ctx, state, OID_AUTO, "is_reset_pending", CTLFLAG_RD,
@@ -2241,6 +2263,8 @@ DB_SHOW_COMMAND(ioat, db_show_ioat)
db_printf(" quiescing: %d\n", (int)sc->quiescing);
db_printf(" destroying: %d\n", (int)sc->destroying);
db_printf(" is_resize_pending: %d\n", (int)sc->is_resize_pending);
+   db_printf(" is_submitter_processing: %d\n",
+   (int)sc->is_submitter_processing);
db_printf(" is_completion_pending: %d\n", 
(int)sc->is_completion_pending);
db_printf(" is_reset_pending: %d\n", (int)sc->is_reset_pending);
db_printf(" is_channel_running: %d\n", (int)sc->is_channel_running);

Modified: head/sys/dev/ioat/ioat_internal.h
==
--- head/sys/dev/ioat/ioat_internal.h   Tue Jul 12 21:56:34 2016
(r302678)
+++ head/sys/dev/ioat/ioat_internal.h   Tue Jul 12 21:56:46 2016
(r302679)
@@ -486,6 +486,7 @@ struct ioat_softc {
 
boolean_t   quiescing;
boolean_t   destroying;
+   boolean_t   is_submitter_processing;
boolean_t   is_resize_pending;
boolean_t   is_completion_pending;  /* submit_lock */
boolean_t   is_reset_pending;
___
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: r302678 - head/sys/dev/ioat

2016-07-12 Thread Conrad E. Meyer
Author: cem
Date: Tue Jul 12 21:56:34 2016
New Revision: 302678
URL: https://svnweb.freebsd.org/changeset/base/302678

Log:
  ioat(4): Don't shrink ring if active

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

Modified: head/sys/dev/ioat/ioat.c
==
--- head/sys/dev/ioat/ioat.cTue Jul 12 21:52:26 2016(r302677)
+++ head/sys/dev/ioat/ioat.cTue Jul 12 21:56:34 2016(r302678)
@@ -1682,7 +1682,8 @@ ioat_shrink_timer_callback(void *arg)
}
 
order = ioat->ring_size_order;
-   if (ioat->is_resize_pending || order == IOAT_MIN_ORDER) {
+   if (ioat->is_completion_pending || ioat->is_resize_pending ||
+   order == IOAT_MIN_ORDER) {
mtx_unlock(>submit_lock);
goto out;
}
@@ -1696,8 +1697,10 @@ ioat_shrink_timer_callback(void *arg)
KASSERT(ioat->ring_size_order == order,
("resize_pending protects order"));
 
-   if (newring != NULL)
+   if (newring != NULL && !ioat->is_completion_pending)
ring_shrink(ioat, order, newring);
+   else if (newring != NULL)
+   ioat_free_ring(ioat, (1 << (order - 1)), newring);
 
ioat->is_resize_pending = FALSE;
mtx_unlock(>submit_lock);
___
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: r302677 - head/sys/dev/ioat

2016-07-12 Thread Conrad E. Meyer
Author: cem
Date: Tue Jul 12 21:52:26 2016
New Revision: 302677
URL: https://svnweb.freebsd.org/changeset/base/302677

Log:
  ioat(4): Print some more useful information about the ring from ddb "show 
ioat"

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

Modified: head/sys/dev/ioat/ioat.c
==
--- head/sys/dev/ioat/ioat.cTue Jul 12 21:49:08 2016(r302676)
+++ head/sys/dev/ioat/ioat.cTue Jul 12 21:52:26 2016(r302677)
@@ -2203,7 +2203,7 @@ DB_SHOW_COMMAND(ioat, db_show_ioat)
if (!have_addr)
goto usage;
idx = (unsigned)addr;
-   if (addr >= ioat_channel_index)
+   if (idx >= ioat_channel_index)
goto usage;
 
sc = ioat_channel[idx];
@@ -2251,6 +2251,35 @@ DB_SHOW_COMMAND(ioat, db_show_ioat)
db_printf(" last_seen: 0x%lx\n", sc->last_seen);
db_printf(" ring: %p\n", sc->ring);
 
+   db_printf("  ring[%u] (tail):\n", sc->tail %
+   (1 << sc->ring_size_order));
+   db_printf("   id: %u\n", ioat_get_ring_entry(sc, sc->tail)->id);
+   db_printf("   addr: 0x%lx\n",
+   ioat_get_ring_entry(sc, sc->tail)->hw_desc_bus_addr);
+   db_printf("   next: 0x%lx\n",
+   ioat_get_ring_entry(sc, sc->tail)->u.generic->next);
+
+   db_printf("  ring[%u] (head - 1):\n", (sc->head - 1) %
+   (1 << sc->ring_size_order));
+   db_printf("   id: %u\n", ioat_get_ring_entry(sc, sc->head - 1)->id);
+   db_printf("   addr: 0x%lx\n",
+   ioat_get_ring_entry(sc, sc->head - 1)->hw_desc_bus_addr);
+   db_printf("   next: 0x%lx\n",
+   ioat_get_ring_entry(sc, sc->head - 1)->u.generic->next);
+
+   db_printf("  ring[%u] (head):\n", (sc->head) %
+   (1 << sc->ring_size_order));
+   db_printf("   id: %u\n", ioat_get_ring_entry(sc, sc->head)->id);
+   db_printf("   addr: 0x%lx\n",
+   ioat_get_ring_entry(sc, sc->head)->hw_desc_bus_addr);
+   db_printf("   next: 0x%lx\n",
+   ioat_get_ring_entry(sc, sc->head)->u.generic->next);
+
+   for (idx = 0; idx < (1 << sc->ring_size_order); idx++)
+   if ((*sc->comp_update & IOAT_CHANSTS_COMPLETED_DESCRIPTOR_MASK)
+   == ioat_get_ring_entry(sc, idx)->hw_desc_bus_addr)
+   db_printf("  ring[%u] == hardware tail\n", idx);
+
db_printf(" cleanup_lock: ");
db_show_lock(>cleanup_lock);
 
___
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: r302676 - stable/10/usr.sbin/rpcbind/tests

2016-07-12 Thread Alan Somers
Author: asomers
Date: Tue Jul 12 21:49:08 2016
New Revision: 302676
URL: https://svnweb.freebsd.org/changeset/base/302676

Log:
  MFC r301967
  
  Fix usr.sbin/rpcbind ATF tests on 32-bit platforms
  
  usr.sbin/rpcbind/tests/addrmerge_test.c
Fix some sizeof calculations that work only by luck on 64-bit
platforms.

Modified:
  stable/10/usr.sbin/rpcbind/tests/addrmerge_test.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/usr.sbin/rpcbind/tests/addrmerge_test.c
==
--- stable/10/usr.sbin/rpcbind/tests/addrmerge_test.c   Tue Jul 12 21:41:27 
2016(r302675)
+++ stable/10/usr.sbin/rpcbind/tests/addrmerge_test.c   Tue Jul 12 21:49:08 
2016(r302676)
@@ -92,15 +92,15 @@ mock_ifaddr4(const char* name, const cha
 
in->sin_family = AF_INET;
in->sin_port = 0;
-   in->sin_len = sizeof(in);
+   in->sin_len = sizeof(*in);
in->sin_addr.s_addr = inet_addr(addr);
mask_in->sin_family = AF_INET;
mask_in->sin_port = 0;
-   mask_in->sin_len = sizeof(mask_in);
+   mask_in->sin_len = sizeof(*mask_in);
mask_in->sin_addr.s_addr = inet_addr(mask);
bcast_in->sin_family = AF_INET;
bcast_in->sin_port = 0;
-   bcast_in->sin_len = sizeof(bcast_in);
+   bcast_in->sin_len = sizeof(*bcast_in);
bcast_in->sin_addr.s_addr = inet_addr(bcast);
*ifaddr = (struct ifaddrs) {
.ifa_next = 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: r302675 - stable/10/usr.sbin/extattr/tests

2016-07-12 Thread Alan Somers
Author: asomers
Date: Tue Jul 12 21:41:27 2016
New Revision: 302675
URL: https://svnweb.freebsd.org/changeset/base/302675

Log:
  MFC r301874
  
  Fix usr.sbin/extattr testcases on tmpfs
  
  Skip the usr.sbin/extattr testscases if $TMPDIR is tmpfs, which doesn't
  support extended attributes

Modified:
  stable/10/usr.sbin/extattr/tests/extattr_test.sh
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/usr.sbin/extattr/tests/extattr_test.sh
==
--- stable/10/usr.sbin/extattr/tests/extattr_test.shTue Jul 12 19:47:01 
2016(r302674)
+++ stable/10/usr.sbin/extattr/tests/extattr_test.shTue Jul 12 21:41:27 
2016(r302675)
@@ -30,6 +30,7 @@ bad_namespace_head() {
atf_set "descr" "Can't set attributes for nonexistent namespaces"
 }
 bad_namespace_body() {
+   check_fs
touch foo
atf_check -s not-exit:0 -e match:"Invalid argument" \
setextattr badnamespace myattr X foo
@@ -42,6 +43,7 @@ hex_head() {
atf_set "descr" "Set and get attribute values in hexadecimal"
 }
 hex_body() {
+   check_fs
touch foo
atf_check -s exit:0 -o empty setextattr user myattr XYZ foo
atf_check -s exit:0 -o inline:"58 59 5a\n" \
@@ -53,6 +55,7 @@ hex_nonascii_head() {
atf_set "descr" "Get binary attribute values in hexadecimal"
 }
 hex_nonascii_body() {
+   check_fs
touch foo
BINSTUFF=`echo $'\x20\x30\x40\x55\x66\x70\x81\xa2\xb3\xee\xff'`
atf_check -s exit:0 -o empty setextattr user myattr "$BINSTUFF" foo
@@ -66,6 +69,7 @@ long_name_head() {
atf_set "descr" "A maximum length attribute name"
 }
 long_name_body() {
+   check_fs
# https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=208965
atf_expect_fail "BUG 208965 extattr(2) doesn't allow maxlen attr names"
 
@@ -84,6 +88,7 @@ loud_head() {
atf_set "descr" "Loud (non -q) output for each command"
 }
 loud_body() {
+   check_fs
touch foo
# setextattr(8) and friends print hard tabs.  Use printf to convert
# them to spaces before checking the output.
@@ -101,6 +106,7 @@ noattrs_head() {
atf_set "descr" "A file with no extended attributes"
 }
 noattrs_body() {
+   check_fs
touch foo
atf_check -s exit:0 -o empty lsextattr -q user foo
 }  
@@ -110,6 +116,7 @@ nonexistent_file_head() {
atf_set "descr" "A file that does not exist"
 }
 nonexistent_file_body() {
+   check_fs
atf_check -s exit:1 -e match:"No such file or directory" \
lsextattr user foo
atf_check -s exit:1 -e match:"No such file or directory" \
@@ -125,6 +132,7 @@ null_head() {
atf_set "descr" "NUL-terminate an attribute value"
 }
 null_body() {
+   check_fs
touch foo
atf_check -s exit:0 -o empty setextattr -n user myattr myvalue foo
atf_check -s exit:0 -o inline:"myvalue\0\n" getextattr -q user myattr 
foo
@@ -135,6 +143,7 @@ one_user_attr_head() {
atf_set "descr" "A file with one extended attribute"
 }
 one_user_attr_body() {
+   check_fs
touch foo
atf_check -s exit:0 -o empty setextattr user myattr myvalue foo
atf_check -s exit:0 -o inline:"myattr\n" lsextattr -q user foo
@@ -149,6 +158,7 @@ one_system_attr_head() {
atf_set "require.user" "root"
 }
 one_system_attr_body() {
+   check_fs
touch foo
atf_check -s exit:0 -o empty setextattr system myattr myvalue foo
atf_check -s exit:0 -o inline:"myattr\n" lsextattr -q system foo
@@ -162,6 +172,7 @@ stdin_head() {
atf_set "descr" "Set attribute value from stdin"
 }
 stdin_body() {
+   check_fs
dd if=/dev/random of=infile bs=1k count=8
touch foo
setextattr -i user myattr foo < infile || atf_fail "setextattr failed"
@@ -175,6 +186,7 @@ stringify_head() {
atf_set "descr" "Stringify the output of getextattr"
 }
 stringify_body() {
+   check_fs
touch foo
atf_check -s exit:0 -o empty setextattr user myattr "my value" foo
atf_check -s exit:0 -o inline:"\"my\\\040value\"\n" \
@@ -186,6 +198,7 @@ symlink_head() {
atf_set "descr" "A symlink to an ordinary file"
 }
 symlink_body() {
+   check_fs
touch foo
ln -s foo foolink
atf_check -s exit:0 -o empty setextattr user myattr myvalue foolink
@@ -199,6 +212,7 @@ symlink_nofollow_head() {
atf_set "descr" "Operating directly on a symlink"
 }
 symlink_nofollow_body() {
+   check_fs
touch foo
ln -s foo foolink
# Check that with -h we can operate directly on the link
@@ -221,6 +235,7 @@ system_and_user_attrs_head() {
atf_set "require.user" "root"
 }
 system_and_user_attrs_body() {
+   check_fs
touch foo
atf_check -s exit:0 -o empty setextattr user userattr userval foo
atf_check -s exit:0 -o empty setextattr 

svn commit: r302674 - in head/usr.sbin: etcupdate mergemaster

2016-07-12 Thread Bryan Drewery
Author: bdrewery
Date: Tue Jul 12 19:47:01 2016
New Revision: 302674
URL: https://svnweb.freebsd.org/changeset/base/302674

Log:
  META_MODE: Don't require filemon(4) for mergemaster(8)/etcupdate(8)
  
  New .meta files will be created without filemon data, but any future build
  that wants filemon data will force a rebuild due to the missing data
  due to use of bmake's .MAKE.MODE=missing-filemon=yes feature.
  
  Reported by:  np
  Sponsored by: EMC / Isilon Storage Division
  MFC after:3 days

Modified:
  head/usr.sbin/etcupdate/etcupdate.sh
  head/usr.sbin/mergemaster/mergemaster.sh

Modified: head/usr.sbin/etcupdate/etcupdate.sh
==
--- head/usr.sbin/etcupdate/etcupdate.shTue Jul 12 19:34:10 2016
(r302673)
+++ head/usr.sbin/etcupdate/etcupdate.shTue Jul 12 19:47:01 2016
(r302674)
@@ -184,7 +184,7 @@ build_tree()
 {
local destdir dir file make
 
-   make="make $MAKE_OPTIONS"
+   make="make $MAKE_OPTIONS -DNO_FILEMON"
 
log "Building tree at $1 with $make"
mkdir -p $1/usr/obj >&3 2>&1

Modified: head/usr.sbin/mergemaster/mergemaster.sh
==
--- head/usr.sbin/mergemaster/mergemaster.shTue Jul 12 19:34:10 2016
(r302673)
+++ head/usr.sbin/mergemaster/mergemaster.shTue Jul 12 19:47:01 2016
(r302674)
@@ -486,7 +486,7 @@ fi
 SOURCEDIR=$(realpath "$SOURCEDIR")
 
 # Setup make to use system files from SOURCEDIR
-MM_MAKE="make ${ARCHSTRING} -m ${SOURCEDIR}/share/mk"
+MM_MAKE="make ${ARCHSTRING} -m ${SOURCEDIR}/share/mk -DNO_FILEMON"
 
 # Check DESTDIR against the mergemaster mtree database to see what
 # files the user changed from the reference files.
___
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: r302673 - in head: share/man/man4 sys/dev/mpr sys/dev/mps

2016-07-12 Thread Stephen McConnell
Author: slm
Date: Tue Jul 12 19:34:10 2016
New Revision: 302673
URL: https://svnweb.freebsd.org/changeset/base/302673

Log:
  Use real values to calculate Max I/O size instead of guessing.
  
  Reviewed by:  ken, scottl
  Approved by:  ken, scottl, ambrisko (mentors)
  MFC after:3 days
  Differential Revision:https://reviews.freebsd.org/D7043

Modified:
  head/share/man/man4/mpr.4
  head/share/man/man4/mps.4
  head/sys/dev/mpr/mpr.c
  head/sys/dev/mpr/mpr_sas.c
  head/sys/dev/mpr/mprvar.h
  head/sys/dev/mps/mps.c
  head/sys/dev/mps/mps_sas.c
  head/sys/dev/mps/mpsvar.h

Modified: head/share/man/man4/mpr.4
==
--- head/share/man/man4/mpr.4   Tue Jul 12 19:27:05 2016(r302672)
+++ head/share/man/man4/mpr.4   Tue Jul 12 19:34:10 2016(r302673)
@@ -38,7 +38,7 @@
 .\" $Id$
 .\" $FreeBSD$
 .\"
-.Dd April 29, 2016
+.Dd July 6, 2016
 .Dt MPR 4
 .Os
 .Sh NAME
@@ -156,6 +156,29 @@ The current number of active I/O command
 dev.mpr.X.io_cmds_active
 .Xr sysctl 8
 variable.
+.Ed
+.Pp
+To set the maximum number of pages that will be used per I/O for all adapters,
+set this tunable in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+hw.mpr.max_io_pages=
+.Ed
+.Pp
+To set the maximum number of pages that will be used per I/O for a specific
+adapter, set this tunable in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+dev.mpr.X.max_io_pages=
+.Ed
+.Pp
+The default max_io_pages value is -1, meaning that the maximum I/O size that
+will be used per I/O will be calculated using the IOCFacts values stored in
+the controller.
+The lowest value that the driver will use for max_io_pages is 1, otherwise
+IOCFacts will be used to calculate the maximum I/O size.
+The smaller I/O size calculated from either max_io_pages or IOCFacts will be 
the
+maximum I/O size used by the driver.
 .Pp
 The highest number of active I/O commands seen since boot is stored in the
 dev.mpr.X.io_cmds_highwater
@@ -220,7 +243,7 @@ SATA disks that take several seconds to 
 command might not be discovered by the driver.
 This problem can sometimes be overcome by increasing the value of the spinup
 wait time in
-.Xr loader.conf 5 :
+.Xr loader.conf 5
 with the
 .Bd -literal -offset indent
 hw.mpr.spinup_wait_time=

Modified: head/share/man/man4/mps.4
==
--- head/share/man/man4/mps.4   Tue Jul 12 19:27:05 2016(r302672)
+++ head/share/man/man4/mps.4   Tue Jul 12 19:34:10 2016(r302673)
@@ -1,5 +1,8 @@
 .\"
 .\" Copyright (c) 2010 Spectra Logic Corporation
+.\" Copyright (c) 2014 LSI Corp
+.\" Copyright (c) 2016 Avago Technologies
+.\" Copyright (c) 2016 Broadcom Ltd.
 .\" All rights reserved.
 .\"
 .\" Redistribution and use in source and binary forms, with or without
@@ -30,25 +33,27 @@
 .\" mps driver man page.
 .\"
 .\" Author: Ken Merry 
+.\" Author: Stephen McConnell 
 .\"
 .\" $Id: //depot/SpectraBSD/head/share/man/man4/mps.4#6 $
 .\" $FreeBSD$
 .\"
-.Dd December 9, 2015
+.Dd July 5, 2016
 .Dt MPS 4
 .Os
 .Sh NAME
 .Nm mps
-.Nd LSI Fusion-MPT 2 Serial Attached SCSI driver
+.Nd "LSI Fusion-MPT 2 IT/IR 6Gb/s Serial Attached SCSI/SATA driver"
 .Sh SYNOPSIS
-To compile this driver into your kernel,
-place the following lines in your kernel configuration file:
+To compile this driver into the kernel, place these lines in the kernel
+configuration file:
 .Bd -ragged -offset indent
+.Cd "device pci"
 .Cd "device scbus"
 .Cd "device mps"
 .Ed
 .Pp
-Or, to load the driver as a module at boot, place the following line in
+The driver can be loaded as a module at boot time by placing this line in
 .Xr loader.conf 5 :
 .Bd -literal -offset indent
 mps_load="YES"
@@ -56,35 +61,30 @@ mps_load="YES"
 .Sh DESCRIPTION
 The
 .Nm
-driver provides support for LSI Logic Fusion-MPT 2
+driver provides support for Broadcom Ltd./Avago Tech (LSI)
+Fusion-MPT 2 IT/IR
 .Tn SAS
 controllers and WarpDrive solid state storage cards.
 .Sh HARDWARE
-The
+These controllers are supported by the
 .Nm
-driver supports the following hardware:
+driver:
 .Pp
 .Bl -bullet -compact
 .It
-LSI Logic SAS2004 (4 Port
-.Tn SAS )
+Broadcom Ltd./Avago Tech (LSI) SAS 2004 (4 Port SAS)
 .It
-LSI Logic SAS2008 (8 Port
-.Tn SAS )
+Broadcom Ltd./Avago Tech (LSI) SAS 2008 (8 Port SAS)
 .It
-LSI Logic SAS2108 (8 Port
-.Tn SAS )
+Broadcom Ltd./Avago Tech (LSI) SAS 2108 (8 Port SAS)
 .It
-LSI Logic SAS2116 (16 Port
-.Tn SAS )
+Broadcom Ltd./Avago Tech (LSI) SAS 2116 (16 Port SAS)
 .It
-LSI Logic SAS2208 (8 Port
-.Tn SAS )
+Broadcom Ltd./Avago Tech (LSI) SAS 2208 (8 Port SAS)
 .It
-LSI Logic SAS2308 (8 Port
-.Tn SAS )
+Broadcom Ltd./Avago Tech (LSI) SAS 2308 (8 Port SAS)
 .It
-LSI Logic SSS6200 Solid State Storage
+Broadcom Ltd./Avago Tech (LSI) SSS6200 Solid State Storage
 .It
 Intel Integrated RAID Module RMS25JB040
 .It
@@ -95,9 +95,12 @@ Intel Integrated RAID Module 

Unable to deliver your item, #0000345402

2016-07-12 Thread FedEx International Economy
Dear Customer,

This is to confirm that one or more of your parcels has been shipped.
Please, open email attachment to print shipment label.

Kind regards,
Salvador Kuhn,
FedEx Operation Agent.

___
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: r302671 - head

2016-07-12 Thread Bryan Drewery
Author: bdrewery
Date: Tue Jul 12 18:57:28 2016
New Revision: 302671
URL: https://svnweb.freebsd.org/changeset/base/302671

Log:
  Create a TARGET_CPUARCH thing to go with MACHINE_CPUARCH.
  
  MFC after:3 days
  Sponsored by: EMC / Isilon Storage Division
  Differential Revision:https://reviews.freebsd.org/D7160

Modified:
  head/Makefile.inc1

Modified: head/Makefile.inc1
==
--- head/Makefile.inc1  Tue Jul 12 18:57:25 2016(r302670)
+++ head/Makefile.inc1  Tue Jul 12 18:57:28 2016(r302671)
@@ -384,6 +384,8 @@ XPATH=  ${WORLDTMP}/usr/sbin:${WORLDTMP}
 STRICTTMPPATH= ${BPATH}:${XPATH}
 TMPPATH=   ${STRICTTMPPATH}:${PATH}
 
+TARGET_CPUARCH?= ${TARGET_ARCH:${MACHINE_CPUARCH_SUB:ts:}}
+
 #
 # Avoid running mktemp(1) unless actually needed.
 # It may not be functional, e.g., due to new ABI
___
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: r302670 - in head: . gnu/usr.bin/binutils gnu/usr.bin/cc gnu/usr.bin/gdb gnu/usr.bin/gdb/libgdb share/mk

2016-07-12 Thread Bryan Drewery
Author: bdrewery
Date: Tue Jul 12 18:57:25 2016
New Revision: 302670
URL: https://svnweb.freebsd.org/changeset/base/302670

Log:
  Create one list of replacements for MACHINE_CPUARCH as MACHINE_CPUARCH_SUB.
  
  This also adds missing s/aarch64/arm64 to the sys.mk version and also
  adds back armv6hf for universe since it was added to the sys.mk version
  in r300438.
  
  MFC after:3 days
  Sponsored by: EMC / Isilon Storage Division
  Differential Revision:https://reviews.freebsd.org/D7159

Modified:
  head/Makefile
  head/gnu/usr.bin/binutils/Makefile.inc0
  head/gnu/usr.bin/cc/Makefile.tgt
  head/gnu/usr.bin/gdb/Makefile.inc
  head/gnu/usr.bin/gdb/libgdb/Makefile
  head/share/mk/sys.mk

Modified: head/Makefile
==
--- head/Makefile   Tue Jul 12 17:58:58 2016(r302669)
+++ head/Makefile   Tue Jul 12 18:57:25 2016(r302670)
@@ -235,7 +235,7 @@ _MAKE+= MK_META_MODE=no
 _TARGET_ARCH=  ${TARGET:S/pc98/i386/:S/arm64/aarch64/}
 .elif !defined(TARGET) && defined(TARGET_ARCH) && \
 ${TARGET_ARCH} != ${MACHINE_ARCH}
-_TARGET=   
${TARGET_ARCH:C/mips(n32|64)?(el)?/mips/:C/arm(v6)?(eb)?/arm/:C/aarch64/arm64/:C/powerpc64/powerpc/:C/riscv64/riscv/}
+_TARGET=   ${TARGET_ARCH:${MACHINE_CPUARCH_SUB:ts:}}
 .endif
 .if defined(TARGET) && !defined(_TARGET)
 _TARGET=${TARGET}

Modified: head/gnu/usr.bin/binutils/Makefile.inc0
==
--- head/gnu/usr.bin/binutils/Makefile.inc0 Tue Jul 12 17:58:58 2016
(r302669)
+++ head/gnu/usr.bin/binutils/Makefile.inc0 Tue Jul 12 18:57:25 2016
(r302670)
@@ -7,7 +7,7 @@
 VERSION=   "2.17.50 [FreeBSD] 2007-07-03"
 
 .if defined(TARGET_ARCH)
-TARGET_CPUARCH=${TARGET_ARCH:C/mips(n32|64)?(el)?/mips/:C/arm(v6)?(eb)?/arm/:C/powerpc64/powerpc/}
+TARGET_CPUARCH=${TARGET_ARCH:${MACHINE_CPUARCH_SUB:ts:}}
 .else
 TARGET_CPUARCH=${MACHINE_CPUARCH}
 .endif

Modified: head/gnu/usr.bin/cc/Makefile.tgt
==
--- head/gnu/usr.bin/cc/Makefile.tgtTue Jul 12 17:58:58 2016
(r302669)
+++ head/gnu/usr.bin/cc/Makefile.tgtTue Jul 12 18:57:25 2016
(r302670)
@@ -4,7 +4,7 @@
 # MACHINE_CPUARCH, but there's no easy way to export make functions...
 
 .if defined(TARGET_ARCH)
-TARGET_CPUARCH=${TARGET_ARCH:C/mips(n32|64)?(el)?/mips/:C/arm(v6)?(eb)?/arm/:C/powerpc64/powerpc/}
+TARGET_CPUARCH=${TARGET_ARCH:${MACHINE_CPUARCH_SUB:ts:}}
 .else
 TARGET_CPUARCH=${MACHINE_CPUARCH}
 .endif

Modified: head/gnu/usr.bin/gdb/Makefile.inc
==
--- head/gnu/usr.bin/gdb/Makefile.inc   Tue Jul 12 17:58:58 2016
(r302669)
+++ head/gnu/usr.bin/gdb/Makefile.inc   Tue Jul 12 18:57:25 2016
(r302670)
@@ -23,7 +23,7 @@ OBJ_RL= ${OBJ_ROOT}/../lib/libreadline/r
 # MACHINE_CPUARCH, but there's no easy way to export make functions...
 
 .if defined(TARGET_ARCH)
-TARGET_CPUARCH=${TARGET_ARCH:C/mips(n32|64)?(el)?/mips/:C/arm(v6)?(eb)?/arm/:C/powerpc64/powerpc/}
+TARGET_CPUARCH=${TARGET_ARCH:${MACHINE_CPUARCH_SUB:ts:}}
 .else
 TARGET_CPUARCH=${MACHINE_CPUARCH}
 .endif

Modified: head/gnu/usr.bin/gdb/libgdb/Makefile
==
--- head/gnu/usr.bin/gdb/libgdb/MakefileTue Jul 12 17:58:58 2016
(r302669)
+++ head/gnu/usr.bin/gdb/libgdb/MakefileTue Jul 12 18:57:25 2016
(r302670)
@@ -4,7 +4,7 @@
 # MACHINE_CPUARCH, but there's no easy way to export make functions...
 
 .if defined(TARGET_ARCH)
-TARGET_CPUARCH=${TARGET_ARCH:C/mips(n32|64)?(el)?/mips/:C/arm(v6)?(eb)?/arm/:C/powerpc64/powerpc/}
+TARGET_CPUARCH=${TARGET_ARCH:${MACHINE_CPUARCH_SUB:ts:}}
 .else
 TARGET_CPUARCH=${MACHINE_CPUARCH}
 .endif

Modified: head/share/mk/sys.mk
==
--- head/share/mk/sys.mkTue Jul 12 17:58:58 2016(r302669)
+++ head/share/mk/sys.mkTue Jul 12 18:57:25 2016(r302670)
@@ -13,7 +13,13 @@ unix ?=  We run FreeBSD, not UNIX.
 # and/or endian.  This is called MACHINE_CPU in NetBSD, but that's used
 # for something different in FreeBSD.
 #
-MACHINE_CPUARCH=${MACHINE_ARCH:C/mips(n32|64)?(el)?/mips/:C/arm(v6)?(eb|hf)?/arm/:C/powerpc64/powerpc/:C/riscv64/riscv/}
+MACHINE_CPUARCH_SUB= \
+   C/mips(n32|64)?(el)?/mips/ \
+   C/arm(v6)?(eb|hf)?/arm/ \
+   C/aarch64/arm64/ \
+   C/powerpc64/powerpc/ \
+   C/riscv64/riscv/
+MACHINE_CPUARCH=${MACHINE_ARCH:${MACHINE_CPUARCH_SUB:ts:}}
 .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: r302669 - head/sys/dev/ioat

2016-07-12 Thread Conrad E. Meyer
Author: cem
Date: Tue Jul 12 17:58:58 2016
New Revision: 302669
URL: https://svnweb.freebsd.org/changeset/base/302669

Log:
  ioat(4): Shrink using the correct timer
  
  Fix a typo introduced in r302352.
  
  Sponsored by: EMC / Isilon Storage Division

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

Modified: head/sys/dev/ioat/ioat.c
==
--- head/sys/dev/ioat/ioat.cTue Jul 12 17:38:18 2016(r302668)
+++ head/sys/dev/ioat/ioat.cTue Jul 12 17:58:58 2016(r302669)
@@ -1704,7 +1704,7 @@ ioat_shrink_timer_callback(void *arg)
 
 out:
if (ioat->ring_size_order > IOAT_MIN_ORDER)
-   callout_reset(>poll_timer, IOAT_SHRINK_PERIOD,
+   callout_reset(>shrink_timer, IOAT_SHRINK_PERIOD,
ioat_shrink_timer_callback, ioat);
 }
 
___
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: r302667 - head/sys/netpfil/ipfw

2016-07-12 Thread Don Lewis
Author: truckman
Date: Tue Jul 12 17:32:40 2016
New Revision: 302667
URL: https://svnweb.freebsd.org/changeset/base/302667

Log:
  Fix problems in the FQ-PIE AQM cleanup code that could leak memory or
  cause a crash.
  
  Because dummynet calls pie_cleanup() while holding a mutex, pie_cleanup()
  is not able to use callout_drain() to make sure that all callouts are
  finished before it returns, and callout_stop() is not sufficient to make
  that guarantee.  After pie_cleanup() returns, dummynet will free a
  structure that any remaining callouts will want to access.
  
  Fix these problems by allocating a separate structure to contain the
  data used by the callouts.  In pie_cleanup(), call callout_reset_sbt()
  to replace the normal callout with a cleanup callout that does the cleanup
  work for each sub-queue.  The instance of the cleanup callout that
  destroys the last flow will also free the extra allocated block of memory.
  Protect the reference count manipulation in the cleanup callout with
  DN_BH_WLOCK() to be consistent with all of the other usage of the reference
  count where this lock is held by the dummynet code.
  
  Submitted by: Rasool Al-Saadi 
  MFC after:3 days
  Differential Revision:https://reviews.freebsd.org/D7174

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

Modified: head/sys/netpfil/ipfw/dn_sched_fq_pie.c
==
--- head/sys/netpfil/ipfw/dn_sched_fq_pie.c Tue Jul 12 17:30:37 2016
(r302666)
+++ head/sys/netpfil/ipfw/dn_sched_fq_pie.c Tue Jul 12 17:32:40 2016
(r302667)
@@ -111,7 +111,7 @@ struct fq_pie_flow {
int deficit;
int active; /* 1: flow is active (in a list) */
struct pie_status pst;  /* pie status variables */
-   struct fq_pie_si *psi;  /* parent scheduler instance */
+   struct fq_pie_si_extra *psi_extra;
STAILQ_ENTRY(fq_pie_flow) flowchain;
 };
 
@@ -120,23 +120,30 @@ struct fq_pie_schk {
struct dn_sch_fq_pie_parms cfg;
 };
 
+
+/* fq_pie scheduler instance extra state vars.
+ * The purpose of separation this structure is to preserve number of active
+ * sub-queues and the flows array pointer even after the scheduler instance
+ * is destroyed.
+ * Preserving these varaiables allows freeing the allocated memory by
+ * fqpie_callout_cleanup() independently from fq_pie_free_sched().
+ */
+struct fq_pie_si_extra {
+   uint32_t nr_active_q;   /* number of active queues */
+   struct fq_pie_flow *flows;  /* array of flows (queues) */
+   };
+
 /* fq_pie scheduler instance */
 struct fq_pie_si {
-   struct dn_sch_inst _si; /* standard scheduler instance */
+   struct dn_sch_inst _si; /* standard scheduler instance. SHOULD BE FIRST 
*/ 
struct dn_queue main_q; /* main queue is after si directly */
-   uint32_t nr_active_q;
-   struct fq_pie_flow *flows;  /* array of flows (queues) */
uint32_t perturbation;  /* random value */
struct fq_pie_list newflows;/* list of new queues */
struct fq_pie_list oldflows;/* list of old queues */
+   struct fq_pie_si_extra *si_extra; /* extra state vars*/
 };
 
 
-struct mem_to_free {
-   void *mem_flows;
-   void *mem_callout;
-};
-static struct mtx freemem_mtx;
 static struct dn_alg fq_pie_desc;
 
 /*  Default FQ-PIE parameters including PIE */
@@ -371,22 +378,6 @@ fq_calculate_drop_prob(void *x)
int64_t p, prob, oldprob;
aqm_time_t now;
 
-   /* dealing with race condition */
-   if (callout_pending(>aqm_pie_callout)) {
-   /* callout was reset */
-   mtx_unlock(>lock_mtx);
-   return;
-   }
-
-   if (!callout_active(>aqm_pie_callout)) {
-   /* callout was stopped */
-   mtx_unlock(>lock_mtx);
-   mtx_destroy(>lock_mtx);
-   q->psi->nr_active_q--;
-   return;
-   }
-   callout_deactivate(>aqm_pie_callout);
-
now = AQM_UNOW;
pprms = pst->parms;
prob = pst->drop_prob;
@@ -524,20 +515,17 @@ fq_deactivate_pie(struct pie_status *pst
   * Initialize PIE for sub-queue 'q'
   */
 static int
-pie_init(struct fq_pie_flow *q)
+pie_init(struct fq_pie_flow *q, struct fq_pie_schk *fqpie_schk)
 {
struct pie_status *pst=>pst;
struct dn_aqm_pie_parms *pprms = pst->parms;
-   struct fq_pie_schk *fqpie_schk;
-   
-   fqpie_schk = (struct fq_pie_schk *)(q->psi->_si.sched+1);
-   int err = 0;
 
+   int err = 0;
if (!pprms){
D("AQM_PIE is not configured");
err = EINVAL;
} else {
-   q->psi->nr_active_q++;
+   q->psi_extra->nr_active_q++;
 
/* For speed optimization, we caculate 1/3 queue size once here 
*/
// XXX limit divided by number of queues divided by 3 ??? 
@@ -553,8 +541,36 @@ 

svn commit: r302668 - head/usr.sbin/bhyve

2016-07-12 Thread Alexander Motin
Author: mav
Date: Tue Jul 12 17:38:18 2016
New Revision: 302668
URL: https://svnweb.freebsd.org/changeset/base/302668

Log:
  Make unknown register reads predictable.
  
  Reported by:  Coverity
  CID:  1357525

Modified:
  head/usr.sbin/bhyve/pci_e82545.c

Modified: head/usr.sbin/bhyve/pci_e82545.c
==
--- head/usr.sbin/bhyve/pci_e82545.cTue Jul 12 17:32:40 2016
(r302667)
+++ head/usr.sbin/bhyve/pci_e82545.cTue Jul 12 17:38:18 2016
(r302668)
@@ -2000,6 +2000,7 @@ e82545_read_register(struct e82545_softc
break;
default:
DPRINTF("Unknown read register: 0x%x\r\n", offset);
+   retval = 0;
break;
}
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r302666 - head/usr.sbin/bhyve

2016-07-12 Thread Alexander Motin
Author: mav
Date: Tue Jul 12 17:30:37 2016
New Revision: 302666
URL: https://svnweb.freebsd.org/changeset/base/302666

Log:
  Add missing breaks in I/O BAR read/write.
  
  This could be important if any guest actually used those registers.
  
  Reported by:  Coverity
  CID:  1357519, 1357520

Modified:
  head/usr.sbin/bhyve/pci_e82545.c

Modified: head/usr.sbin/bhyve/pci_e82545.c
==
--- head/usr.sbin/bhyve/pci_e82545.cTue Jul 12 17:22:13 2016
(r302665)
+++ head/usr.sbin/bhyve/pci_e82545.cTue Jul 12 17:30:37 2016
(r302666)
@@ -2040,6 +2040,7 @@ e82545_write(struct vmctx *ctx, int vcpu
DPRINTF("Unknown io bar write offset:0x%lx value:0x%lx 
size:%d\r\n", offset, value, size);
break;
}
+   break;
case E82545_BAR_REGISTER:
if (size != 4) {
DPRINTF("Wrong register write size:%d offset:0x%lx 
value:0x%lx\r\n", size, offset, value);
@@ -2092,6 +2093,7 @@ e82545_read(struct vmctx *ctx, int vcpu,
offset, size);
break;
}
+   break;
case E82545_BAR_REGISTER:
if (size != 4) {
DPRINTF("Wrong register read size:%d offset:0x%lx\r\n",
___
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: r302665 - stable/11/sys/net

2016-07-12 Thread Bryan Drewery
Author: bdrewery
Date: Tue Jul 12 17:22:13 2016
New Revision: 302665
URL: https://svnweb.freebsd.org/changeset/base/302665

Log:
  MFC r302439:
  
iflib: Fix typo in 'iflib_rx_miss_bufs' sysctl name
  
  Approved by:  re (gjb)

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

Modified: stable/11/sys/net/iflib.c
==
--- stable/11/sys/net/iflib.c   Tue Jul 12 15:46:53 2016(r302664)
+++ stable/11/sys/net/iflib.c   Tue Jul 12 17:22:13 2016(r302665)
@@ -626,12 +626,12 @@ MODULE_DEPEND(iflib, netmap, 1, 1, 1);
 /*
  * device-specific sysctl variables:
  *
- * ixl_crcstrip: 0: keep CRC in rx frames (default), 1: strip it.
+ * iflib_crcstrip: 0: keep CRC in rx frames (default), 1: strip it.
  * During regular operations the CRC is stripped, but on some
  * hardware reception of frames not multiple of 64 is slower,
  * so using crcstrip=0 helps in benchmarks.
  *
- * ixl_rx_miss, ixl_rx_miss_bufs:
+ * iflib_rx_miss, iflib_rx_miss_bufs:
  * count packets that might be missed due to lost interrupts.
  */
 SYSCTL_DECL(_dev_netmap);
@@ -646,7 +646,7 @@ SYSCTL_INT(_dev_netmap, OID_AUTO, iflib_
 int iflib_rx_miss, iflib_rx_miss_bufs;
 SYSCTL_INT(_dev_netmap, OID_AUTO, iflib_rx_miss,
 CTLFLAG_RW, _rx_miss, 0, "potentially missed rx intr");
-SYSCTL_INT(_dev_netmap, OID_AUTO, ixl_rx_miss_bufs,
+SYSCTL_INT(_dev_netmap, OID_AUTO, iflib_rx_miss_bufs,
 CTLFLAG_RW, _rx_miss_bufs, 0, "potentially missed rx intr bufs");
 
 /*
___
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: r302664 - head/usr.bin/mkimg

2016-07-12 Thread Pedro F. Giffuni
Author: pfg
Date: Tue Jul 12 15:46:53 2016
New Revision: 302664
URL: https://svnweb.freebsd.org/changeset/base/302664

Log:
  mkimg(1): minor cleanups with argument order in calloc(3).
  
  Generally the first argument in calloc is supposed to stand for a count
  and the second for a size. Try to make that consistent. While here,
  attempt to make some use of the overflow detection capability in
  calloc(3).

Modified:
  head/usr.bin/mkimg/vmdk.c

Modified: head/usr.bin/mkimg/vmdk.c
==
--- head/usr.bin/mkimg/vmdk.c   Tue Jul 12 13:12:01 2016(r302663)
+++ head/usr.bin/mkimg/vmdk.c   Tue Jul 12 15:46:53 2016(r302664)
@@ -149,7 +149,7 @@ vmdk_write(int fd)
gdsz = (ngts * sizeof(uint32_t) + VMDK_SECTOR_SIZE - 1) &
~(VMDK_SECTOR_SIZE - 1);
 
-   gd = calloc(gdsz, 1);
+   gd = calloc(1, gdsz);
if (gd == NULL) {
free(desc);
return (ENOMEM);
@@ -161,7 +161,7 @@ vmdk_write(int fd)
sec += VMDK_NGTES * sizeof(uint32_t) / VMDK_SECTOR_SIZE;
}
 
-   rgd = calloc(gdsz, 1);
+   rgd = calloc(1, gdsz);
if (rgd == NULL) {
free(gd);
free(desc);
@@ -183,14 +183,14 @@ vmdk_write(int fd)
le64enc(, sec);
be32enc(_test, VMDK_NL_TEST);
 
-   gtsz = ngts * VMDK_NGTES * sizeof(uint32_t);
-   gt = calloc(gtsz, 1);
+   gt = calloc(ngts, VMDK_NGTES * sizeof(uint32_t));
if (gt == NULL) {
free(rgd);
free(gd);
free(desc);
return (ENOMEM);
}
+   gtsz = ngts * VMDK_NGTES * sizeof(uint32_t);
 
cursec = sec;
blkcnt = (grainsz * VMDK_SECTOR_SIZE) / secsz;
@@ -225,7 +225,7 @@ vmdk_write(int fd)
cur = VMDK_SECTOR_SIZE + desc_len + (gdsz + gtsz) * 2;
lim = sec * VMDK_SECTOR_SIZE;
if (cur < lim) {
-   buf = calloc(VMDK_SECTOR_SIZE, 1);
+   buf = calloc(1, VMDK_SECTOR_SIZE);
if (buf == NULL)
error = ENOMEM;
while (!error && cur < lim) {
___
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: r302601 - in head/sys: arm/include arm64/include

2016-07-12 Thread Ian Lepore
On Tue, 2016-07-12 at 00:37 +, Andrey A. Chernov wrote:
> Author: ache
> Date: Tue Jul 12 00:37:48 2016
> New Revision: 302601
> URL: https://svnweb.freebsd.org/changeset/base/302601
> 
> Log:
>   I don't know why unsigned int is choosed for wchar_t here, but


The ARM ABI requires wchar_t to be unsigned (plain char is unsigned by
default in the ARM ABI too).

-- Ian

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


svn commit: r302663 - stable/11/usr.sbin/ctld

2016-07-12 Thread Edward Tomasz Napierala
Author: trasz
Date: Tue Jul 12 13:12:01 2016
New Revision: 302663
URL: https://svnweb.freebsd.org/changeset/base/302663

Log:
  MFC r302503:
  
  Fix ctld(8) to not exit when reloading configuration with invalid
  initiator-portal clause.
  
  Approved by:  re (gjb)

Modified:
  stable/11/usr.sbin/ctld/ctld.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/usr.sbin/ctld/ctld.c
==
--- stable/11/usr.sbin/ctld/ctld.c  Tue Jul 12 12:05:58 2016
(r302662)
+++ stable/11/usr.sbin/ctld/ctld.c  Tue Jul 12 13:12:01 2016
(r302663)
@@ -402,7 +402,7 @@ auth_portal_new(struct auth_group *ag, c
 
 error:
free(ap);
-   log_errx(1, "Incorrect initiator portal '%s'", portal);
+   log_warnx("incorrect initiator portal \"%s\"", portal);
return (NULL);
 }
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r302662 - vendor-sys/illumos/dist/common/nvpair vendor/illumos/dist/lib/libnvpair

2016-07-12 Thread Andriy Gapon
Author: avg
Date: Tue Jul 12 12:05:58 2016
New Revision: 302662
URL: https://svnweb.freebsd.org/changeset/base/302662

Log:
  6447 handful of nvpair cleanups
  
  illumos/illumos-gate@759e89be359f2af635e4122d147df56bce948773
  
https://github.com/illumos/illumos-gate/commit/759e89be359f2af635e4122d147df56bce948773
  
  https://www.illumos.org/issues/6447
I got a patch from someone who uses nvpair code outside of illumos. It 
fixes a
couple of gcc warnings/bugs for him.
   1. silence uninitialized use warnings
   2. add parentheses around assignment used as truth value
   3. fix printf format specifier (ll is for integers only)
   4. strstr, strspn, strcspn, and strcmp are declared in string.h, not
  strings.h.
   5. avoid scanning integer into boolean variable
  
  Reviewed by: Josef 'Jeff' Sipek 
  Reviewed by: Andy Stormont 
  Reviewed by: Garrett D'Amore 
  Approved by: Robert Mustacchi 
  Author: Steve Dougherty 

Modified:
  vendor/illumos/dist/lib/libnvpair/libnvpair.c

Changes in other areas also in this revision:
Modified:
  vendor-sys/illumos/dist/common/nvpair/nvpair.c

Modified: vendor/illumos/dist/lib/libnvpair/libnvpair.c
==
--- vendor/illumos/dist/lib/libnvpair/libnvpair.c   Tue Jul 12 12:03:00 
2016(r302661)
+++ vendor/illumos/dist/lib/libnvpair/libnvpair.c   Tue Jul 12 12:05:58 
2016(r302662)
@@ -24,7 +24,7 @@
  */
 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -211,7 +211,7 @@ NVLIST_PRTFUNC(int32, int32_t, int32_t, 
 NVLIST_PRTFUNC(uint32, uint32_t, uint32_t, "0x%x")
 NVLIST_PRTFUNC(int64, int64_t, longlong_t, "%lld")
 NVLIST_PRTFUNC(uint64, uint64_t, u_longlong_t, "0x%llx")
-NVLIST_PRTFUNC(double, double, double, "0x%llf")
+NVLIST_PRTFUNC(double, double, double, "0x%f")
 NVLIST_PRTFUNC(string, char *, char *, "%s")
 NVLIST_PRTFUNC(hrtime, hrtime_t, hrtime_t, "0x%llx")
 
@@ -1218,7 +1218,8 @@ nvpair_value_match_regex(nvpair_t *nvp, 
break;
}
case DATA_TYPE_BOOLEAN_VALUE: {
-   boolean_t val, val_arg;
+   int32_t val_arg;
+   boolean_t val;
 
/* scanf boolean_t from value and check for match */
sr = sscanf(value, "%"SCNi32, _arg);
@@ -1229,7 +1230,8 @@ nvpair_value_match_regex(nvpair_t *nvp, 
break;
}
case DATA_TYPE_BOOLEAN_ARRAY: {
-   boolean_t *val_array, val_arg;
+   boolean_t *val_array;
+   int32_t val_arg;
 
/* check indexed value of array for match */
sr = sscanf(value, "%"SCNi32, _arg);
___
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: r302662 - vendor-sys/illumos/dist/common/nvpair vendor/illumos/dist/lib/libnvpair

2016-07-12 Thread Andriy Gapon
Author: avg
Date: Tue Jul 12 12:05:58 2016
New Revision: 302662
URL: https://svnweb.freebsd.org/changeset/base/302662

Log:
  6447 handful of nvpair cleanups
  
  illumos/illumos-gate@759e89be359f2af635e4122d147df56bce948773
  
https://github.com/illumos/illumos-gate/commit/759e89be359f2af635e4122d147df56bce948773
  
  https://www.illumos.org/issues/6447
I got a patch from someone who uses nvpair code outside of illumos. It 
fixes a
couple of gcc warnings/bugs for him.
   1. silence uninitialized use warnings
   2. add parentheses around assignment used as truth value
   3. fix printf format specifier (ll is for integers only)
   4. strstr, strspn, strcspn, and strcmp are declared in string.h, not
  strings.h.
   5. avoid scanning integer into boolean variable
  
  Reviewed by: Josef 'Jeff' Sipek 
  Reviewed by: Andy Stormont 
  Reviewed by: Garrett D'Amore 
  Approved by: Robert Mustacchi 
  Author: Steve Dougherty 

Modified:
  vendor-sys/illumos/dist/common/nvpair/nvpair.c

Changes in other areas also in this revision:
Modified:
  vendor/illumos/dist/lib/libnvpair/libnvpair.c

Modified: vendor-sys/illumos/dist/common/nvpair/nvpair.c
==
--- vendor-sys/illumos/dist/common/nvpair/nvpair.c  Tue Jul 12 12:03:00 
2016(r302661)
+++ vendor-sys/illumos/dist/common/nvpair/nvpair.c  Tue Jul 12 12:05:58 
2016(r302662)
@@ -1624,6 +1624,8 @@ nvlist_lookup_nvpair_ei_sep(nvlist_t *nv
if ((nvl == NULL) || (name == NULL))
return (EINVAL);
 
+   sepp = NULL;
+   idx = 0;
/* step through components of name */
for (np = name; np && *np; np = sepp) {
/* ensure unique names */
@@ -2381,7 +2383,7 @@ nvlist_xpack(nvlist_t *nvl, char **bufp,
 */
nv_priv_init(, nva, 0);
 
-   if (err = nvlist_size(nvl, _size, encoding))
+   if ((err = nvlist_size(nvl, _size, encoding)))
return (err);
 
if ((buf = nv_mem_zalloc(, alloc_size)) == 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: r302661 - vendor-sys/illumos/dist/uts/common/fs/zfs

2016-07-12 Thread Andriy Gapon
Author: avg
Date: Tue Jul 12 12:03:00 2016
New Revision: 302661
URL: https://svnweb.freebsd.org/changeset/base/302661

Log:
  7082 bptree_iterate() passes wrong args to zfs_dbgmsg()
  
  illumos/illumos-gate@10e67aa0db0823d5464aafdd681f3c966155c68e
  
https://github.com/illumos/illumos-gate/commit/10e67aa0db0823d5464aafdd681f3c966155c68e
  
  https://www.illumos.org/issues/7082
upstream
DLPX-40542 bptree_iterate() passes wrong args to zfs_dbgmsg()
  
  Reviewed by: Dan Kimmel 
  Reviewed by: George Wilson 
  Reviewed by: Igor Kozhukhov 
  Approved by: Dan McDonald 
  Author: Matthew Ahrens 

Modified:
  vendor-sys/illumos/dist/uts/common/fs/zfs/bptree.c

Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/bptree.c
==
--- vendor-sys/illumos/dist/uts/common/fs/zfs/bptree.c  Tue Jul 12 12:01:54 
2016(r302660)
+++ vendor-sys/illumos/dist/uts/common/fs/zfs/bptree.c  Tue Jul 12 12:03:00 
2016(r302661)
@@ -20,7 +20,7 @@
  */
 
 /*
- * Copyright (c) 2011, 2014 by Delphix. All rights reserved.
+ * Copyright (c) 2011, 2015 by Delphix. All rights reserved.
  * Copyright (c) 2014 Integros [integros.com]
  */
 
@@ -220,9 +220,10 @@ bptree_iterate(objset_t *os, uint64_t ob
 
if (zfs_free_leak_on_eio)
flags |= TRAVERSE_HARD;
-   zfs_dbgmsg("bptree index %d: traversing from min_txg=%lld "
+   zfs_dbgmsg("bptree index %lld: traversing from min_txg=%lld "
"bookmark %lld/%lld/%lld/%lld",
-   i, (longlong_t)bte.be_birth_txg,
+   (longlong_t)i,
+   (longlong_t)bte.be_birth_txg,
(longlong_t)bte.be_zb.zb_objset,
(longlong_t)bte.be_zb.zb_object,
(longlong_t)bte.be_zb.zb_level,
___
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: r302660 - vendor-sys/illumos/dist/common/zfs vendor-sys/illumos/dist/uts/common/fs/zfs vendor-sys/illumos/dist/uts/common/fs/zfs/sys vendor-sys/illumos/dist/uts/common/sys/fs vendor/ill...

2016-07-12 Thread Andriy Gapon
Author: avg
Date: Tue Jul 12 12:01:54 2016
New Revision: 302660
URL: https://svnweb.freebsd.org/changeset/base/302660

Log:
  6314 buffer overflow in dsl_dataset_name
  
  illumos/illumos-gate@9adfa60d484ce2435f5af77cc99dcd4e692b6660
  
https://github.com/illumos/illumos-gate/commit/9adfa60d484ce2435f5af77cc99dcd4e692b6660
  
  https://www.illumos.org/issues/6314
Callers of dsl_dataset_name pass a buffer of size ZFS_MAXNAMELEN, but
dsl_dataset_name copies the datasets' name PLUS the snapshot name to it,
resulting in a max of 2 * ZFS_MAXNAMELEN + '@'.
  
  Reviewed by: George Wilson 
  Reviewed by: Prakash Surya 
  Reviewed by: Igor Kozhukhov 
  Approved by: Dan McDonald 
  Author: Matthew Ahrens 

Modified:
  vendor/illumos/dist/cmd/zdb/zdb.c
  vendor/illumos/dist/cmd/zfs/zfs_main.c
  vendor/illumos/dist/cmd/zhack/zhack.c
  vendor/illumos/dist/cmd/ztest/ztest.c
  vendor/illumos/dist/lib/libzfs/common/libzfs.h
  vendor/illumos/dist/lib/libzfs/common/libzfs_changelist.c
  vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c
  vendor/illumos/dist/lib/libzfs/common/libzfs_diff.c
  vendor/illumos/dist/lib/libzfs/common/libzfs_impl.h
  vendor/illumos/dist/lib/libzfs/common/libzfs_iter.c
  vendor/illumos/dist/lib/libzfs/common/libzfs_mount.c
  vendor/illumos/dist/lib/libzfs/common/libzfs_pool.c
  vendor/illumos/dist/lib/libzfs/common/libzfs_sendrecv.c
  vendor/illumos/dist/lib/libzfs_core/common/libzfs_core.c

Changes in other areas also in this revision:
Modified:
  vendor-sys/illumos/dist/common/zfs/zfs_namecheck.c
  vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_objset.c
  vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_send.c
  vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_bookmark.c
  vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_dataset.c
  vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_deleg.c
  vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_dir.c
  vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_prop.c
  vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_scan.c
  vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_userhold.c
  vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c
  vendor-sys/illumos/dist/uts/common/fs/zfs/spa_history.c
  vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dmu.h
  vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dsl_dataset.h
  vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dsl_dir.h
  vendor-sys/illumos/dist/uts/common/fs/zfs/sys/spa_impl.h
  vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zap.h
  vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zfs_znode.h
  vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_ctldir.c
  vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_ioctl.c
  vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_vfsops.c
  vendor-sys/illumos/dist/uts/common/fs/zfs/zil.c
  vendor-sys/illumos/dist/uts/common/sys/fs/zfs.h

Modified: vendor/illumos/dist/cmd/zdb/zdb.c
==
--- vendor/illumos/dist/cmd/zdb/zdb.c   Tue Jul 12 12:00:31 2016
(r302659)
+++ vendor/illumos/dist/cmd/zdb/zdb.c   Tue Jul 12 12:01:54 2016
(r302660)
@@ -60,7 +60,6 @@
 #include 
 #include 
 #include 
-#undef ZFS_MAXNAMELEN
 #undef verify
 #include 
 
@@ -1920,7 +1919,7 @@ dump_dir(objset_t *os)
uint64_t refdbytes, usedobjs, scratch;
char numbuf[32];
char blkbuf[BP_SPRINTF_LEN + 20];
-   char osname[MAXNAMELEN];
+   char osname[ZFS_MAX_DATASET_NAME_LEN];
char *type = "UNKNOWN";
int verbosity = dump_opt['d'];
int print_header = 1;
@@ -3454,7 +3453,7 @@ find_zpool(char **target, nvlist_t **con
nvlist_t *match = NULL;
char *name = NULL;
char *sepp = NULL;
-   char sep;
+   char sep = '\0';
int count = 0;
importargs_t args = { 0 };
 

Modified: vendor/illumos/dist/cmd/zfs/zfs_main.c
==
--- vendor/illumos/dist/cmd/zfs/zfs_main.c  Tue Jul 12 12:00:31 2016
(r302659)
+++ vendor/illumos/dist/cmd/zfs/zfs_main.c  Tue Jul 12 12:01:54 2016
(r302660)
@@ -1482,7 +1482,7 @@ get_callback(zfs_handle_t *zhp, void *da
char buf[ZFS_MAXPROPLEN];
char rbuf[ZFS_MAXPROPLEN];
zprop_source_t sourcetype;
-   char source[ZFS_MAXNAMELEN];
+   char source[ZFS_MAX_DATASET_NAME_LEN];
zprop_get_cbdata_t *cbp = data;
nvlist_t *user_props = zfs_get_user_props(zhp);
zprop_list_t *pl = cbp->cb_proplist;
@@ -1962,7 +1962,7 @@ typedef struct upgrade_cbdata {
uint64_t cb_version;
boolean_t cb_newer;
boolean_t cb_foundone;
-   char cb_lastfs[ZFS_MAXNAMELEN];
+   char cb_lastfs[ZFS_MAX_DATASET_NAME_LEN];
 } upgrade_cbdata_t;
 
 static int
@@ -2408,7 +2408,7 @@ userspace_cb(void *arg, const char *doma
 
if (domain != NULL && domain[0] != '\0') {
/* SMB */
-   

svn commit: r302660 - vendor-sys/illumos/dist/common/zfs vendor-sys/illumos/dist/uts/common/fs/zfs vendor-sys/illumos/dist/uts/common/fs/zfs/sys vendor-sys/illumos/dist/uts/common/sys/fs vendor/ill...

2016-07-12 Thread Andriy Gapon
Author: avg
Date: Tue Jul 12 12:01:54 2016
New Revision: 302660
URL: https://svnweb.freebsd.org/changeset/base/302660

Log:
  6314 buffer overflow in dsl_dataset_name
  
  illumos/illumos-gate@9adfa60d484ce2435f5af77cc99dcd4e692b6660
  
https://github.com/illumos/illumos-gate/commit/9adfa60d484ce2435f5af77cc99dcd4e692b6660
  
  https://www.illumos.org/issues/6314
Callers of dsl_dataset_name pass a buffer of size ZFS_MAXNAMELEN, but
dsl_dataset_name copies the datasets' name PLUS the snapshot name to it,
resulting in a max of 2 * ZFS_MAXNAMELEN + '@'.
  
  Reviewed by: George Wilson 
  Reviewed by: Prakash Surya 
  Reviewed by: Igor Kozhukhov 
  Approved by: Dan McDonald 
  Author: Matthew Ahrens 

Modified:
  vendor-sys/illumos/dist/common/zfs/zfs_namecheck.c
  vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_objset.c
  vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_send.c
  vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_bookmark.c
  vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_dataset.c
  vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_deleg.c
  vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_dir.c
  vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_prop.c
  vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_scan.c
  vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_userhold.c
  vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c
  vendor-sys/illumos/dist/uts/common/fs/zfs/spa_history.c
  vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dmu.h
  vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dsl_dataset.h
  vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dsl_dir.h
  vendor-sys/illumos/dist/uts/common/fs/zfs/sys/spa_impl.h
  vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zap.h
  vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zfs_znode.h
  vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_ctldir.c
  vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_ioctl.c
  vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_vfsops.c
  vendor-sys/illumos/dist/uts/common/fs/zfs/zil.c
  vendor-sys/illumos/dist/uts/common/sys/fs/zfs.h

Changes in other areas also in this revision:
Modified:
  vendor/illumos/dist/cmd/zdb/zdb.c
  vendor/illumos/dist/cmd/zfs/zfs_main.c
  vendor/illumos/dist/cmd/zhack/zhack.c
  vendor/illumos/dist/cmd/ztest/ztest.c
  vendor/illumos/dist/lib/libzfs/common/libzfs.h
  vendor/illumos/dist/lib/libzfs/common/libzfs_changelist.c
  vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c
  vendor/illumos/dist/lib/libzfs/common/libzfs_diff.c
  vendor/illumos/dist/lib/libzfs/common/libzfs_impl.h
  vendor/illumos/dist/lib/libzfs/common/libzfs_iter.c
  vendor/illumos/dist/lib/libzfs/common/libzfs_mount.c
  vendor/illumos/dist/lib/libzfs/common/libzfs_pool.c
  vendor/illumos/dist/lib/libzfs/common/libzfs_sendrecv.c
  vendor/illumos/dist/lib/libzfs_core/common/libzfs_core.c

Modified: vendor-sys/illumos/dist/common/zfs/zfs_namecheck.c
==
--- vendor-sys/illumos/dist/common/zfs/zfs_namecheck.c  Tue Jul 12 12:00:31 
2016(r302659)
+++ vendor-sys/illumos/dist/common/zfs/zfs_namecheck.c  Tue Jul 12 12:01:54 
2016(r302660)
@@ -69,7 +69,7 @@ zfs_component_namecheck(const char *path
 {
const char *loc;
 
-   if (strlen(path) >= MAXNAMELEN) {
+   if (strlen(path) >= ZFS_MAX_DATASET_NAME_LEN) {
if (why)
*why = NAME_ERR_TOOLONG;
return (-1);
@@ -140,14 +140,9 @@ dataset_namecheck(const char *path, name
 
/*
 * Make sure the name is not too long.
-*
-* ZFS_MAXNAMELEN is the maximum dataset length used in the userland
-* which is the same as MAXNAMELEN used in the kernel.
-* If ZFS_MAXNAMELEN value is changed, make sure to cleanup all
-* places using MAXNAMELEN.
 */
 
-   if (strlen(path) >= MAXNAMELEN) {
+   if (strlen(path) >= ZFS_MAX_DATASET_NAME_LEN) {
if (why)
*why = NAME_ERR_TOOLONG;
return (-1);
@@ -276,7 +271,7 @@ mountpoint_namecheck(const char *path, n
while (*end != '/' && *end != '\0')
end++;
 
-   if (end - start >= MAXNAMELEN) {
+   if (end - start >= ZFS_MAX_DATASET_NAME_LEN) {
if (why)
*why = NAME_ERR_TOOLONG;
return (-1);
@@ -301,13 +296,8 @@ pool_namecheck(const char *pool, nameche
 
/*
 * Make sure the name is not too long.
-*
-* ZPOOL_MAXNAMELEN is the maximum pool length used in the userland
-* which is the same as MAXNAMELEN used in the kernel.
-* If ZPOOL_MAXNAMELEN value is changed, make sure to cleanup all
-* places using MAXNAMELEN.
 */
-   if (strlen(pool) >= MAXNAMELEN) {
+   if (strlen(pool) >= ZFS_MAX_DATASET_NAME_LEN) 

svn commit: r302659 - vendor-sys/illumos/dist/common/zfs vendor/illumos/dist/lib/libzfs/common

2016-07-12 Thread Andriy Gapon
Author: avg
Date: Tue Jul 12 12:00:31 2016
New Revision: 302659
URL: https://svnweb.freebsd.org/changeset/base/302659

Log:
  6931 lib/libzfs: cleanup gcc warnings
  
  illumos/illumos-gate@88f61dee20b358671b1b643e9d1dbf220a1d69be
  
https://github.com/illumos/illumos-gate/commit/88f61dee20b358671b1b643e9d1dbf220a1d69be
  
  https://www.illumos.org/issues/6931
need cleanup:
CERRWARN += -_gcc=-Wno-switch
CERRWARN += -_gcc=-Wno-parentheses
CERRWARN += -_gcc=-Wno-unused-function
  
  Reviewed by: Matthew Ahrens 
  Approved by: Robert Mustacchi 
  Author: Igor Kozhukhov 

Modified:
  vendor/illumos/dist/lib/libzfs/common/libzfs_changelist.c
  vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c
  vendor/illumos/dist/lib/libzfs/common/libzfs_diff.c
  vendor/illumos/dist/lib/libzfs/common/libzfs_mount.c
  vendor/illumos/dist/lib/libzfs/common/libzfs_pool.c
  vendor/illumos/dist/lib/libzfs/common/libzfs_sendrecv.c
  vendor/illumos/dist/lib/libzfs/common/libzfs_util.c

Changes in other areas also in this revision:
Modified:
  vendor-sys/illumos/dist/common/zfs/zfs_deleg.c

Modified: vendor/illumos/dist/lib/libzfs/common/libzfs_changelist.c
==
--- vendor/illumos/dist/lib/libzfs/common/libzfs_changelist.c   Tue Jul 12 
11:59:25 2016(r302658)
+++ vendor/illumos/dist/lib/libzfs/common/libzfs_changelist.c   Tue Jul 12 
12:00:31 2016(r302659)
@@ -24,6 +24,7 @@
  * Use is subject to license terms.
  *
  * Portions Copyright 2007 Ramprakash Jelari
+ * Copyright 2016 Igor Kozhukhov 
  */
 
 #include 
@@ -131,6 +132,9 @@ changelist_prefix(prop_changelist_t *clp
case ZFS_PROP_SHARESMB:
(void) zfs_unshare_smb(cn->cn_handle, NULL);
break;
+
+   default:
+   break;
}
}
}

Modified: vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c
==
--- vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c  Tue Jul 12 
11:59:25 2016(r302658)
+++ vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c  Tue Jul 12 
12:00:31 2016(r302659)
@@ -29,6 +29,7 @@
  * Copyright (c) 2013 Steven Hartland. All rights reserved.
  * Copyright (c) 2014 Integros [integros.com]
  * Copyright 2016 Nexenta Systems, Inc.
+ * Copyright 2016 Igor Kozhukhov 
  */
 
 #include 
@@ -80,55 +81,18 @@ zfs_type_to_name(zfs_type_t type)
return (dgettext(TEXT_DOMAIN, "snapshot"));
case ZFS_TYPE_VOLUME:
return (dgettext(TEXT_DOMAIN, "volume"));
+   case ZFS_TYPE_POOL:
+   return (dgettext(TEXT_DOMAIN, "pool"));
+   case ZFS_TYPE_BOOKMARK:
+   return (dgettext(TEXT_DOMAIN, "bookmark"));
+   default:
+   assert(!"unhandled zfs_type_t");
}
 
return (NULL);
 }
 
 /*
- * Given a path and mask of ZFS types, return a string describing this dataset.
- * This is used when we fail to open a dataset and we cannot get an exact type.
- * We guess what the type would have been based on the path and the mask of
- * acceptable types.
- */
-static const char *
-path_to_str(const char *path, int types)
-{
-   /*
-* When given a single type, always report the exact type.
-*/
-   if (types == ZFS_TYPE_SNAPSHOT)
-   return (dgettext(TEXT_DOMAIN, "snapshot"));
-   if (types == ZFS_TYPE_FILESYSTEM)
-   return (dgettext(TEXT_DOMAIN, "filesystem"));
-   if (types == ZFS_TYPE_VOLUME)
-   return (dgettext(TEXT_DOMAIN, "volume"));
-
-   /*
-* The user is requesting more than one type of dataset.  If this is the
-* case, consult the path itself.  If we're looking for a snapshot, and
-* a '@' is found, then report it as "snapshot".  Otherwise, remove the
-* snapshot attribute and try again.
-*/
-   if (types & ZFS_TYPE_SNAPSHOT) {
-   if (strchr(path, '@') != NULL)
-   return (dgettext(TEXT_DOMAIN, "snapshot"));
-   return (path_to_str(path, types & ~ZFS_TYPE_SNAPSHOT));
-   }
-
-   /*
-* The user has requested either filesystems or volumes.
-* We have no way of knowing a priori what type this would be, so always
-* report it as "filesystem" or "volume", our two primitive types.
-*/
-   if (types & ZFS_TYPE_FILESYSTEM)
-   return (dgettext(TEXT_DOMAIN, "filesystem"));
-
-   assert(types & ZFS_TYPE_VOLUME);
-   return (dgettext(TEXT_DOMAIN, "volume"));
-}
-
-/*
  * Validate a ZFS path.  This is used even before trying to open the dataset, 
to
  * provide a more meaningful error message.  We 

svn commit: r302659 - vendor-sys/illumos/dist/common/zfs vendor/illumos/dist/lib/libzfs/common

2016-07-12 Thread Andriy Gapon
Author: avg
Date: Tue Jul 12 12:00:31 2016
New Revision: 302659
URL: https://svnweb.freebsd.org/changeset/base/302659

Log:
  6931 lib/libzfs: cleanup gcc warnings
  
  illumos/illumos-gate@88f61dee20b358671b1b643e9d1dbf220a1d69be
  
https://github.com/illumos/illumos-gate/commit/88f61dee20b358671b1b643e9d1dbf220a1d69be
  
  https://www.illumos.org/issues/6931
need cleanup:
CERRWARN += -_gcc=-Wno-switch
CERRWARN += -_gcc=-Wno-parentheses
CERRWARN += -_gcc=-Wno-unused-function
  
  Reviewed by: Matthew Ahrens 
  Approved by: Robert Mustacchi 
  Author: Igor Kozhukhov 

Modified:
  vendor-sys/illumos/dist/common/zfs/zfs_deleg.c

Changes in other areas also in this revision:
Modified:
  vendor/illumos/dist/lib/libzfs/common/libzfs_changelist.c
  vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c
  vendor/illumos/dist/lib/libzfs/common/libzfs_diff.c
  vendor/illumos/dist/lib/libzfs/common/libzfs_mount.c
  vendor/illumos/dist/lib/libzfs/common/libzfs_pool.c
  vendor/illumos/dist/lib/libzfs/common/libzfs_sendrecv.c
  vendor/illumos/dist/lib/libzfs/common/libzfs_util.c

Modified: vendor-sys/illumos/dist/common/zfs/zfs_deleg.c
==
--- vendor-sys/illumos/dist/common/zfs/zfs_deleg.c  Tue Jul 12 11:59:25 
2016(r302658)
+++ vendor-sys/illumos/dist/common/zfs/zfs_deleg.c  Tue Jul 12 12:00:31 
2016(r302659)
@@ -22,6 +22,7 @@
  * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
  * Copyright 2010 Nexenta Systems, Inc. All rights reserved.
  * Copyright (c) 2013 by Delphix. All rights reserved.
+ * Copyright 2016 Igor Kozhukhov 
  */
 
 #include 
@@ -177,8 +178,9 @@ zfs_deleg_verify_nvlist(nvlist_t *nvp)
nvpair_name(perm_name));
if (error)
return (-1);
-   } while (perm_name = nvlist_next_nvpair(perms, perm_name));
-   } while (who = nvlist_next_nvpair(nvp, who));
+   } while ((perm_name = nvlist_next_nvpair(perms, perm_name))
+   != NULL);
+   } while ((who = nvlist_next_nvpair(nvp, who)) != NULL);
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: r302658 - in vendor/illumos/dist: cmd/zpool lib/libzfs/common

2016-07-12 Thread Andriy Gapon
Author: avg
Date: Tue Jul 12 11:59:25 2016
New Revision: 302658
URL: https://svnweb.freebsd.org/changeset/base/302658

Log:
  6872 zfs libraries should not allow uninitialized variables
  
  illumos/illumos-gate@f83b46baf98d276f5f84fa84c8b461f412ac1f5e
  
https://github.com/illumos/illumos-gate/commit/f83b46baf98d276f5f84fa84c8b461f412ac1f5e
  
  https://www.illumos.org/issues/6872
We compile the zfs libraries with -Wno-uninitialized. We should remove
this. Change makefiles, fix new warnings, fix pbchk errors.
  
  Reviewed by: Dan Kimmel 
  Reviewed by: George Wilson 
  Reviewed by: Prakash Surya 
  Reviewed by: Yuri Pankov 
  Approved by: Robert Mustacchi 
  Author: Paul Dagnelie 

Modified:
  vendor/illumos/dist/cmd/zpool/zpool_vdev.c
  vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c
  vendor/illumos/dist/lib/libzfs/common/libzfs_import.c
  vendor/illumos/dist/lib/libzfs/common/libzfs_util.c

Modified: vendor/illumos/dist/cmd/zpool/zpool_vdev.c
==
--- vendor/illumos/dist/cmd/zpool/zpool_vdev.c  Tue Jul 12 11:58:04 2016
(r302657)
+++ vendor/illumos/dist/cmd/zpool/zpool_vdev.c  Tue Jul 12 11:59:25 2016
(r302658)
@@ -21,7 +21,7 @@
 
 /*
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2013 by Delphix. All rights reserved.
+ * Copyright (c) 2013, 2015 by Delphix. All rights reserved.
  * Copyright 2016 Igor Kozhukhov .
  */
 
@@ -558,7 +558,6 @@ get_replication(nvlist_t *nvroot, boolea
verify(nvlist_lookup_nvlist_array(nvroot, ZPOOL_CONFIG_CHILDREN,
, ) == 0);
 
-   lastrep.zprl_type = NULL;
for (t = 0; t < toplevels; t++) {
uint64_t is_log = B_FALSE;
 

Modified: vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c
==
--- vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c  Tue Jul 12 
11:58:04 2016(r302657)
+++ vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c  Tue Jul 12 
11:59:25 2016(r302658)
@@ -1563,7 +1563,7 @@ zfs_prop_set_list(zfs_handle_t *zhp, nvl
libzfs_handle_t *hdl = zhp->zfs_hdl;
nvlist_t *nvl;
int nvl_len;
-   int added_resv;
+   int added_resv = 0;
 
(void) snprintf(errbuf, sizeof (errbuf),
dgettext(TEXT_DOMAIN, "cannot set property for '%s'"),
@@ -3157,7 +3157,7 @@ zfs_create_ancestors(libzfs_handle_t *hd
 {
int prefix;
char *path_copy;
-   int rc;
+   int rc = 0;
 
if (check_parents(hdl, path, NULL, B_TRUE, ) != 0)
return (-1);
@@ -3799,7 +3799,7 @@ zfs_rollback(zfs_handle_t *zhp, zfs_hand
rollback_data_t cb = { 0 };
int err;
boolean_t restore_resv = 0;
-   uint64_t old_volsize, new_volsize;
+   uint64_t old_volsize = 0, new_volsize;
zfs_prop_t resv_prop;
 
assert(zhp->zfs_type == ZFS_TYPE_FILESYSTEM ||
@@ -3988,6 +3988,7 @@ zfs_rename(zfs_handle_t *zhp, const char
"child dataset with inherited mountpoint is used "
"in a non-global zone"));
(void) zfs_error(hdl, EZFS_ZONED, errbuf);
+   ret = -1;
goto error;
}
 

Modified: vendor/illumos/dist/lib/libzfs/common/libzfs_import.c
==
--- vendor/illumos/dist/lib/libzfs/common/libzfs_import.c   Tue Jul 12 
11:58:04 2016(r302657)
+++ vendor/illumos/dist/lib/libzfs/common/libzfs_import.c   Tue Jul 12 
11:59:25 2016(r302658)
@@ -21,7 +21,7 @@
 
 /*
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2013 by Delphix. All rights reserved.
+ * Copyright (c) 2012, 2015 by Delphix. All rights reserved.
  * Copyright 2015 RackTop Systems.
  * Copyright 2016 Nexenta Systems, Inc.
  */
@@ -438,12 +438,12 @@ get_configs(libzfs_handle_t *hdl, pool_l
pool_entry_t *pe;
vdev_entry_t *ve;
config_entry_t *ce;
-   nvlist_t *ret = NULL, *config = NULL, *tmp, *nvtop, *nvroot;
+   nvlist_t *ret = NULL, *config = NULL, *tmp = NULL, *nvtop, *nvroot;
nvlist_t **spares, **l2cache;
uint_t i, nspares, nl2cache;
boolean_t config_seen;
uint64_t best_txg;
-   char *name, *hostname;
+   char *name, *hostname = NULL;
uint64_t guid;
uint_t children = 0;
nvlist_t **child = NULL;

Modified: vendor/illumos/dist/lib/libzfs/common/libzfs_util.c
==
--- vendor/illumos/dist/lib/libzfs/common/libzfs_util.c Tue Jul 12 

svn commit: r302657 - in vendor/illumos/dist: cmd/zfs lib/libzfs/common

2016-07-12 Thread Andriy Gapon
Author: avg
Date: Tue Jul 12 11:58:04 2016
New Revision: 302657
URL: https://svnweb.freebsd.org/changeset/base/302657

Log:
  4521 zfstest is trying to execute evil "zfs unmount -a"
  
  illumos/illumos-gate@8808ac5dae118369991f158b6ab736cb2691ecde
  
https://github.com/illumos/illumos-gate/commit/8808ac5dae118369991f158b6ab736cb2691ecde
  
  https://www.illumos.org/issues/4521
zfstest is trying to execute evil "zfs unmount -a", which fails 
(fortunately,
as it would otherwise leave me with my ~ missing):
03:44:11.86 cannot unmount '/export/home/yuri': Device busy cannot unmount 
'/
export/home': Device busy
03:44:11.86 ERROR: /usr/sbin/zfs unmount -a exited 1
This affects, at least, zfs_mount_009_neg and zfs_mount_all_001_pos, both
failing on that step. The pool containing the /export/home hierarchy is
included in KEEP variable, but it doesn't seem to affect anything here.
  
  Reviewed by: Andriy Gapon 
  Reviewed by: Dan McDonald 
  Reviewed by: Matthew Ahrens 
  Reviewed by: John Kennedy 
  Approved by: Robert Mustacchi 
  Author: Yuri Pankov 

Modified:
  vendor/illumos/dist/cmd/zfs/zfs_main.c
  vendor/illumos/dist/lib/libzfs/common/libzfs.h
  vendor/illumos/dist/lib/libzfs/common/libzfs_config.c
  vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c

Modified: vendor/illumos/dist/cmd/zfs/zfs_main.c
==
--- vendor/illumos/dist/cmd/zfs/zfs_main.c  Tue Jul 12 11:56:45 2016
(r302656)
+++ vendor/illumos/dist/cmd/zfs/zfs_main.c  Tue Jul 12 11:58:04 2016
(r302657)
@@ -26,9 +26,9 @@
  * Copyright (c) 2012, Joyent, Inc. All rights reserved.
  * Copyright (c) 2011-2012 Pawel Jakub Dawidek. All rights reserved.
  * Copyright (c) 2013 Steven Hartland.  All rights reserved.
- * Copyright 2013 Nexenta Systems, Inc.  All rights reserved.
  * Copyright (c) 2014 Integros [integros.com]
  * Copyright 2016 Igor Kozhukhov .
+ * Copyright 2016 Nexenta Systems, Inc.
  */
 
 #include 
@@ -6388,6 +6388,15 @@ unshare_unmount(int op, int argc, char *
continue;
}
 
+   /*
+* Ignore datasets that are excluded/restricted by
+* parent pool name.
+*/
+   if (zpool_skip_pool(zfs_get_pool_name(zhp))) {
+   zfs_close(zhp);
+   continue;
+   }
+
switch (op) {
case OP_SHARE:
verify(zfs_prop_get(zhp, ZFS_PROP_SHARENFS,

Modified: vendor/illumos/dist/lib/libzfs/common/libzfs.h
==
--- vendor/illumos/dist/lib/libzfs/common/libzfs.h  Tue Jul 12 11:56:45 
2016(r302656)
+++ vendor/illumos/dist/lib/libzfs/common/libzfs.h  Tue Jul 12 11:58:04 
2016(r302657)
@@ -25,8 +25,8 @@
  * Copyright (c) 2011, 2015 by Delphix. All rights reserved.
  * Copyright (c) 2012, Joyent, Inc. All rights reserved.
  * Copyright (c) 2013 Steven Hartland. All rights reserved.
- * Copyright 2013 Nexenta Systems, Inc.  All rights reserved.
  * Copyright (c) 2014 Integros [integros.com]
+ * Copyright 2016 Nexenta Systems, Inc.
  */
 
 #ifndef_LIBZFS_H
@@ -220,6 +220,7 @@ extern void zpool_free_handles(libzfs_ha
  */
 typedef int (*zpool_iter_f)(zpool_handle_t *, void *);
 extern int zpool_iter(libzfs_handle_t *, zpool_iter_f, void *);
+extern boolean_t zpool_skip_pool(const char *);
 
 /*
  * Functions to create and destroy pools
@@ -409,6 +410,7 @@ extern void zfs_close(zfs_handle_t *);
 extern zfs_type_t zfs_get_type(const zfs_handle_t *);
 extern const char *zfs_get_name(const zfs_handle_t *);
 extern zpool_handle_t *zfs_get_pool_handle(const zfs_handle_t *);
+extern const char *zfs_get_pool_name(const zfs_handle_t *);
 
 /*
  * Property management functions.  Some functions are shared with the kernel,

Modified: vendor/illumos/dist/lib/libzfs/common/libzfs_config.c
==
--- vendor/illumos/dist/lib/libzfs/common/libzfs_config.c   Tue Jul 12 
11:56:45 2016(r302656)
+++ vendor/illumos/dist/lib/libzfs/common/libzfs_config.c   Tue Jul 12 
11:58:04 2016(r302657)
@@ -27,6 +27,7 @@
 /*
  * Copyright (c) 2012 by Delphix. All rights reserved.
  * Copyright (c) 2015 by Syneto S.R.L. All rights reserved.
+ * Copyright 2016 Nexenta Systems, Inc.
  */
 
 /*
@@ -338,33 +339,47 @@ zpool_refresh_stats(zpool_handle_t *zhp,
 }
 
 /*
- * If the __ZFS_POOL_RESTRICT environment variable is set we only iterate over
- * pools it lists.
+ * The following environment variables are undocumented
+ 

svn commit: r302656 - vendor/illumos/dist/lib/libzfs/common

2016-07-12 Thread Andriy Gapon
Author: avg
Date: Tue Jul 12 11:56:45 2016
New Revision: 302656
URL: https://svnweb.freebsd.org/changeset/base/302656

Log:
  5813 zfs_setprop_error(): Handle errno value E2BIG.
  
  illumos/illumos-gate@6fdcb3d1c2baae812d9cbce37b41469b924efd90
  
https://github.com/illumos/illumos-gate/commit/6fdcb3d1c2baae812d9cbce37b41469b924efd90
  
  https://www.illumos.org/issues/5813
Lets pull in this patch from freebsd:
http://svnweb.freebsd.org/base?view=revision=271764
zfs_setprop_error(): Handle errno value E2BIG.
This errno value is emitted by dsl_props_set_check() in
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_prop.c, and
is used to mean that the property value is too long. For the record,
the maximum length is ZAP_MAXVALUELEN, which is 8*1024 bytes.
Instead of claiming an unknown error (and abort()ing), provide
something more specific to the scenario involved. As far as I
can tell, E2BIG is not emitted for any other scenario.
MFC after: 1 week
Sponsored by: Spectra Logic
Affects: All ZFS versions starting 27 Feb 2009 (illumos ccba0801)
This change modified the value returned by
dsl_props_set_check(), so that it can distinguish between
a name that's too long and a value that's too long, but
libzfs was not updated accordingly.
MFSpectraBSD: r1051499 on 2014/03/28 11:07:59
  
  Reviewed by: Paul Dagnelie 
  Reviewed by: Matthew Ahrens 
  Reviewed by: Prakash Surya 
  Reviewed by: Richard Elling 
  Approved by: Garrett D'Amore 
  Author: Will Andrews 

Modified:
  vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c

Modified: vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c
==
--- vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c  Tue Jul 12 
11:54:25 2016(r302655)
+++ vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c  Tue Jul 12 
11:56:45 2016(r302656)
@@ -1463,6 +1463,12 @@ zfs_setprop_error(libzfs_handle_t *hdl, 
(void) zfs_error(hdl, EZFS_DSREADONLY, errbuf);
break;
 
+   case E2BIG:
+   zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
+   "property value too long"));
+   (void) zfs_error(hdl, EZFS_BADPROP, errbuf);
+   break;
+
case ENOTSUP:
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
"pool and or dataset must be upgraded to set 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: r302655 - vendor/illumos/dist/lib/libzfs/common

2016-07-12 Thread Andriy Gapon
Author: avg
Date: Tue Jul 12 11:54:25 2016
New Revision: 302655
URL: https://svnweb.freebsd.org/changeset/base/302655

Log:
  6873 zfs_destroy_snaps_nvl leaks errlist
  
  illumos/illumos-gate@4cde22c2ffb907ca39d2ebd512812f7e5168
  
https://github.com/illumos/illumos-gate/commit/4cde22c2ffb907ca39d2ebd512812f7e5168
  
  https://www.illumos.org/issues/6873
lzc_destroy_snaps() returns an nvlist in errlist.
zfs_destroy_snaps_nvl() should nvlist_free() it before returning.
  
  Reviewed by: Matthew Ahrens 
  Reviewed by: Paul Dagnelie 
  Approved by: Dan McDonald 
  Author: Chris Williamson 

Modified:
  vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c

Modified: vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c
==
--- vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c  Tue Jul 12 
11:52:33 2016(r302654)
+++ vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c  Tue Jul 12 
11:54:25 2016(r302655)
@@ -3405,12 +3405,14 @@ int
 zfs_destroy_snaps_nvl(libzfs_handle_t *hdl, nvlist_t *snaps, boolean_t defer)
 {
int ret;
-   nvlist_t *errlist;
+   nvlist_t *errlist = NULL;
 
ret = lzc_destroy_snaps(snaps, defer, );
 
-   if (ret == 0)
+   if (ret == 0) {
+   nvlist_free(errlist);
return (0);
+   }
 
if (nvlist_empty(errlist)) {
char errbuf[1024];
@@ -3438,6 +3440,7 @@ zfs_destroy_snaps_nvl(libzfs_handle_t *h
}
}
 
+   nvlist_free(errlist);
return (ret);
 }
 
___
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: r302654 - vendor/illumos/dist/lib/libzfs/common

2016-07-12 Thread Andriy Gapon
Author: avg
Date: Tue Jul 12 11:52:33 2016
New Revision: 302654
URL: https://svnweb.freebsd.org/changeset/base/302654

Log:
  6879 incorrect endianness swap for drr_spill.drr_length in libzfs_sendrecv.c
  
  illumos/illumos-gate@20fea7a47472aceb64d3ed48cc2a3ea268bc4795
  
https://github.com/illumos/illumos-gate/commit/20fea7a47472aceb64d3ed48cc2a3ea268bc4795
  
  https://www.illumos.org/issues/6879
In libzfs_sendrecv, there's a typo:
case DRR_SPILL:
if (byteswap) {
drr->drr_u.drr_write.drr_length =
BSWAP_64(drr->drr_u.drr_spill.drr_length);
}
Instead of drr_write.drr_length, we should be assigning the result of the
byteswap to drr_spill.drr_length.
  
  Reviewed by: Matthew Ahrens 
  Reviewed by: Paul Dagnelie 
  Approved by: Robert Mustacchi 
  Author: Dan Kimmel 

Modified:
  vendor/illumos/dist/lib/libzfs/common/libzfs_sendrecv.c

Modified: vendor/illumos/dist/lib/libzfs/common/libzfs_sendrecv.c
==
--- vendor/illumos/dist/lib/libzfs/common/libzfs_sendrecv.c Tue Jul 12 
11:48:59 2016(r302653)
+++ vendor/illumos/dist/lib/libzfs/common/libzfs_sendrecv.c Tue Jul 12 
11:52:33 2016(r302654)
@@ -2928,7 +2928,7 @@ recv_skip(libzfs_handle_t *hdl, int fd, 
break;
case DRR_SPILL:
if (byteswap) {
-   drr->drr_u.drr_write.drr_length =
+   drr->drr_u.drr_spill.drr_length =
BSWAP_64(drr->drr_u.drr_spill.drr_length);
}
(void) recv_read(hdl, fd, 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: r302653 - vendor/illumos/dist/lib/libzfs/common

2016-07-12 Thread Andriy Gapon
Author: avg
Date: Tue Jul 12 11:48:59 2016
New Revision: 302653
URL: https://svnweb.freebsd.org/changeset/base/302653

Log:
  6111 zfs send should ignore datasets created after the ending snapshot
  
  illumos/illumos-gate@4a20c933b148de8a1c1d3538391c64284e636653
  
https://github.com/illumos/illumos-gate/commit/4a20c933b148de8a1c1d3538391c64284e636653
  
  https://www.illumos.org/issues/6111
If you create a zfs child folder, zfs send returns an error when a recursive
incremental send is done between two snapshots made prior to the folder
creation.
The problem can be reproduced with the following steps.
root@zfs:/# zfs create pool/test
root@zfs:/# zfs snapshot pool/test@snap1
root@zfs:/# zfs snapshot pool/test@snap2
root@zfs:/# zfs create pool/test/child
root@zfs:/# zfs send -R -I pool/test@snap1 pool/test@snap2 > /dev/null
WARNING: could not send pool/test/child@snap2: does not exist
WARNING: could not send pool/test/child@snap2: does not exist
root@zfs:/# echo $?
1
root@zfs:/# zfs snapshot -r pool/test@snap3
root@zfs:/# zfs send -R -I pool/test@snap1 pool/test@snap3 > /dev/null
root@zfs:/# echo $?
0
root@zfs:/# zfs send -R -I pool/test@snap2 pool/test@snap3 > /dev/null
root@zfs:/# echo $?
0
Since pool/test/child was created after snap2, zfs send should not expect 
snap2
to be in pool/test/child when doing a recursive send. It should examine the
compare the creation time of the snapshot and each child folder to decide if
the folder will be sent. The next incremental send between snap2 and snap3
would properly create the child folder and snap3 which first appears in the
child folder.
The problem is identical if '-i' is used instead of '-I'.
  
  Reviewed by: Alex Aizman alex.aiz...@nexenta.com
  Reviewed by: Alek Pinchuk alek.pinc...@nexenta.com
  Reviewed by: Roman Strashkin roman.strash...@nexenta.com
  Reviewed by: Matthew Ahrens 
  Reviewed by: Paul Dagnelie 
  Approved by: Garrett D'Amore 
  Author: Alex Deiter 

Modified:
  vendor/illumos/dist/lib/libzfs/common/libzfs_sendrecv.c

Modified: vendor/illumos/dist/lib/libzfs/common/libzfs_sendrecv.c
==
--- vendor/illumos/dist/lib/libzfs/common/libzfs_sendrecv.c Tue Jul 12 
11:46:13 2016(r302652)
+++ vendor/illumos/dist/lib/libzfs/common/libzfs_sendrecv.c Tue Jul 12 
11:48:59 2016(r302653)
@@ -572,13 +572,30 @@ fsavl_create(nvlist_t *fss)
  * Routines for dealing with the giant nvlist of fs-nvlists, etc.
  */
 typedef struct send_data {
+   /*
+* assigned inside every recursive call,
+* restored from *_save on return:
+*
+* guid of fromsnap snapshot in parent dataset
+* txg of fromsnap snapshot in current dataset
+* txg of tosnap snapshot in current dataset
+*/
+
uint64_t parent_fromsnap_guid;
+   uint64_t fromsnap_txg;
+   uint64_t tosnap_txg;
+
+   /* the nvlists get accumulated during depth-first traversal */
nvlist_t *parent_snaps;
nvlist_t *fss;
nvlist_t *snapprops;
+
+   /* send-receive configuration, does not change during traversal */
+   const char *fsname;
const char *fromsnap;
const char *tosnap;
boolean_t recursive;
+   boolean_t verbose;
 
/*
 * The header nvlist is of the following format:
@@ -611,11 +628,23 @@ send_iterate_snap(zfs_handle_t *zhp, voi
 {
send_data_t *sd = arg;
uint64_t guid = zhp->zfs_dmustats.dds_guid;
+   uint64_t txg = zhp->zfs_dmustats.dds_creation_txg;
char *snapname;
nvlist_t *nv;
 
snapname = strrchr(zhp->zfs_name, '@')+1;
 
+   if (sd->tosnap_txg != 0 && txg > sd->tosnap_txg) {
+   if (sd->verbose) {
+   (void) fprintf(stderr, dgettext(TEXT_DOMAIN,
+   "skipping snapshot %s because it was created "
+   "after the destination snapshot (%s)\n"),
+   zhp->zfs_name, sd->tosnap);
+   }
+   zfs_close(zhp);
+   return (0);
+   }
+
VERIFY(0 == nvlist_add_uint64(sd->parent_snaps, snapname, guid));
/*
 * NB: if there is no fromsnap here (it's a newly created fs in
@@ -709,6 +738,31 @@ send_iterate_prop(zfs_handle_t *zhp, nvl
 }
 
 /*
+ * returns snapshot creation txg
+ * and returns 0 if the snapshot does not exist
+ */
+static uint64_t
+get_snap_txg(libzfs_handle_t *hdl, const char *fs, const char *snap)
+{
+   char name[ZFS_MAXNAMELEN];
+   uint64_t txg = 0;
+
+   if (fs == NULL || fs[0] == '\0' || snap == NULL || snap[0] == '\0')
+   return (txg);
+
+   (void) snprintf(name, sizeof (name), "%s@%s", fs, snap);
+   if (zfs_dataset_exists(hdl, 

svn commit: r302652 - vendor-sys/illumos/dist/uts/common/fs/zfs

2016-07-12 Thread Andriy Gapon
Author: avg
Date: Tue Jul 12 11:46:13 2016
New Revision: 302652
URL: https://svnweb.freebsd.org/changeset/base/302652

Log:
  5768 zfsctl_snapshot_inactive() can leak a vnode hold
  
  illumos/illumos-gate@20a95fb2c4af266e063e0cf86037f910a303c710
  
https://github.com/illumos/illumos-gate/commit/20a95fb2c4af266e063e0cf86037f910a303c710
  
  https://www.illumos.org/issues/5768
zfsctl_snapshot_inactive() leaks a hold on the dvp (directory vnode) if 
v_count > 1.
reproduce by:
create a fs with 100 snapshots.
have a thread do:
while true; do ls -l /test/snaps/.zfs/snapshot >/dev/null; done
have another thread do:
while true; do zfs promote test/clone; zfs promote test/snaps; done
use dtrace to delay & observe:
dtrace -w -xd \\
-n 'vn_rele:entry/args0 == (void*)0xff01dd42ce80ULL/{[stack()]=count();
chill(10);}' \\
-n 'zfsctl_snapshot_inactive:entry{ if (args[0]->v_count > 1) trace(args[0]-
>v_count); self->vp=args[0];}' \\
-n 
'gfs_vop_inactive:entry/callers["zfsctl_snapshot_inactive"]/{self->good=1;
[stack()]=count()}' \\
-n 'zfsctl_snapshot_inactive:return{if (self->good) self->good=0; else 
printf
("bad return");}' \\
-n 'gfs_dir_lookup:return/callers["zfsctl_snapshot_inactive"] && self->vp-
>v_count > 1/{trace(self->vp->v_count)}'
the address is found by selecting one of the output of this at random:
dtrace -n 'zfsctl_snapshot_inactive:entry{print(args[0]);'
when you see "bad return", we have hit the bug. Then doing "zfs umount test/
snaps" will fail with EBUSY.
When we hit this case, we also leak the hold on the target vnode (vn). When 
the
inactive callback is called on a vnode with v_count > 1, it needs to be
decremented.
  
  Reviewed by: George Wilson 
  Reviewed by: Prakash Surya 
  Reviewed by: Adam Leventhal 
  Reviewed by: Bayard Bell 
  Approved by: Rich Lowe 
  Author: Matthew Ahrens 

Modified:
  vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_ctldir.c

Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_ctldir.c
==
--- vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_ctldir.c  Tue Jul 12 
11:37:19 2016(r302651)
+++ vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_ctldir.c  Tue Jul 12 
11:46:13 2016(r302652)
@@ -20,7 +20,7 @@
  */
 /*
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2013 by Delphix. All rights reserved.
+ * Copyright (c) 2012, 2014 by Delphix. All rights reserved.
  * Copyright 2015, OmniTI Computer Consulting, Inc. All rights reserved.
  */
 
@@ -1214,10 +1214,15 @@ zfsctl_snapshot_inactive(vnode_t *vp, cr
 
mutex_enter(>sd_lock);
 
+   mutex_enter(>v_lock);
if (vp->v_count > 1) {
+   vp->v_count--;
+   mutex_exit(>v_lock);
mutex_exit(>sd_lock);
+   VN_RELE(dvp);
return;
}
+   mutex_exit(>v_lock);
ASSERT(!vn_ismntpt(vp));
 
sep = avl_first(>sd_snaps);
___
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: r302651 - in vendor-sys/illumos/dist/uts/common/fs/zfs: . sys

2016-07-12 Thread Andriy Gapon
Author: avg
Date: Tue Jul 12 11:37:19 2016
New Revision: 302651
URL: https://svnweb.freebsd.org/changeset/base/302651

Log:
  7054 dmu_tx_hold_t should use refcount_t to track space
  
  illumos/illumos-gate@0c779ad424a92a84d1e07d47cab7f8009189202b
  
https://github.com/illumos/illumos-gate/commit/0c779ad424a92a84d1e07d47cab7f8009189202b
  
  https://www.illumos.org/issues/7054
upstream:
ee0003de7d3e598499be7ac3fe6b61efcc47cb7f
DLPX-40399 dmu_tx_hold_t should use refcount_t to track space
  
  Reviewed by: George Wilson 
  Reviewed by: Paul Dagnelie 
  Reviewed by: Igor Kozhukhov 
  Approved by: Dan McDonald 
  Author: Matthew Ahrens 

Modified:
  vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_tx.c
  vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dmu_tx.h
  vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zap.h
  vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zap_impl.h
  vendor-sys/illumos/dist/uts/common/fs/zfs/zap.c
  vendor-sys/illumos/dist/uts/common/fs/zfs/zap_micro.c

Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_tx.c
==
--- vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_tx.c  Tue Jul 12 11:36:22 
2016(r302650)
+++ vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_tx.c  Tue Jul 12 11:37:19 
2016(r302651)
@@ -129,6 +129,12 @@ dmu_tx_hold_object_impl(dmu_tx_t *tx, ob
txh = kmem_zalloc(sizeof (dmu_tx_hold_t), KM_SLEEP);
txh->txh_tx = tx;
txh->txh_dnode = dn;
+   refcount_create(>txh_space_towrite);
+   refcount_create(>txh_space_tofree);
+   refcount_create(>txh_space_tooverwrite);
+   refcount_create(>txh_space_tounref);
+   refcount_create(>txh_memory_tohold);
+   refcount_create(>txh_fudge);
 #ifdef ZFS_DEBUG
txh->txh_type = type;
txh->txh_arg1 = arg1;
@@ -201,12 +207,18 @@ dmu_tx_count_twig(dmu_tx_hold_t *txh, dn
freeable = (bp && (freeable ||
dsl_dataset_block_freeable(ds, bp, bp->blk_birth)));
 
-   if (freeable)
-   txh->txh_space_tooverwrite += space;
-   else
-   txh->txh_space_towrite += space;
-   if (bp)
-   txh->txh_space_tounref += bp_get_dsize(os->os_spa, bp);
+   if (freeable) {
+   (void) refcount_add_many(>txh_space_tooverwrite,
+   space, FTAG);
+   } else {
+   (void) refcount_add_many(>txh_space_towrite,
+   space, FTAG);
+   }
+
+   if (bp) {
+   (void) refcount_add_many(>txh_space_tounref,
+   bp_get_dsize(os->os_spa, bp), FTAG);
+   }
 
dmu_tx_count_twig(txh, dn, parent, level + 1,
blkid >> epbs, freeable, history);
@@ -336,8 +348,11 @@ dmu_tx_count_write(dmu_tx_hold_t *txh, u
bits = 64 - min_bs;
epbs = min_ibs - SPA_BLKPTRSHIFT;
for (bits -= epbs * (nlvls - 1);
-   bits >= 0; bits -= epbs)
-   txh->txh_fudge += 1ULL << max_ibs;
+   bits >= 0; bits -= epbs) {
+   (void) refcount_add_many(
+   >txh_fudge,
+   1ULL << max_ibs, FTAG);
+   }
goto out;
}
off += delta;
@@ -353,7 +368,8 @@ dmu_tx_count_write(dmu_tx_hold_t *txh, u
 */
start = P2ALIGN(off, 1ULL << max_bs);
end = P2ROUNDUP(off + len, 1ULL << max_bs) - 1;
-   txh->txh_space_towrite += end - start + 1;
+   (void) refcount_add_many(>txh_space_towrite,
+   end - start + 1, FTAG);
 
start >>= min_bs;
end >>= min_bs;
@@ -368,18 +384,21 @@ dmu_tx_count_write(dmu_tx_hold_t *txh, u
start >>= epbs;
end >>= epbs;
ASSERT3U(end, >=, start);
-   txh->txh_space_towrite += (end - start + 1) << max_ibs;
+   (void) refcount_add_many(>txh_space_towrite,
+   (end - start + 1) << max_ibs, FTAG);
if (start != 0) {
/*
 * We also need a new blkid=0 indirect block
 * to reference any existing file data.
 */
-   txh->txh_space_towrite += 1ULL << max_ibs;
+   (void) refcount_add_many(>txh_space_towrite,
+   1ULL << max_ibs, FTAG);
}
}
 
 out:
-   if (txh->txh_space_towrite + txh->txh_space_tooverwrite >
+   if (refcount_count(>txh_space_towrite) +
+   refcount_count(>txh_space_tooverwrite) >
2 * DMU_MAX_ACCESS)
   

svn commit: r302650 - vendor-sys/illumos/dist/uts/common/fs/zfs

2016-07-12 Thread Andriy Gapon
Author: avg
Date: Tue Jul 12 11:36:22 2016
New Revision: 302650
URL: https://svnweb.freebsd.org/changeset/base/302650

Log:
  6940 Cannot unlink directories when over quota
  
  illumos/illumos-gate@99189164df06057fb968ca7be701bb1a0d5da8c9
  
https://github.com/illumos/illumos-gate/commit/99189164df06057fb968ca7be701bb1a0d5da8c9
  
  https://www.illumos.org/issues/6940
Similar to #6334, but this time with empty directories:
$ zfs create tank/quota
$ zfs set quota=10M tank/quota
$ zfs snapshot tank/quota@snap1
$ zfs set mountpoint=/mnt/tank/quota tank/quota
$ mkdir /mnt/tank/quota/dir # create an empty directory
$ mkfile 11M /mnt/tank/quota/11M
/mnt/tank/quota/11M: initialized 9830400 of 11534336 bytes: Disc quota 
exceeded
$ rmdir /mnt/tank/quota/dir # now unlink the empty directory
rmdir: directory "/mnt/tank/quota/dir": Disc quota exceeded
From user perspective, I would expect that ZFS is always able to remove 
files
and directories even when the quota is exceeded.
  
  Reviewed by: Dan McDonald 
  Reviewed by: Matthew Ahrens 
  Approved by: Robert Mustacchi 
  Author: Simon Klinkert 

Modified:
  vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_vnops.c

Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_vnops.c
==
--- vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_vnops.c   Tue Jul 12 
11:35:07 2016(r302649)
+++ vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_vnops.c   Tue Jul 12 
11:36:22 2016(r302650)
@@ -2112,6 +2112,7 @@ top:
dmu_tx_hold_zap(tx, zfsvfs->z_unlinkedobj, FALSE, NULL);
zfs_sa_upgrade_txholds(tx, zp);
zfs_sa_upgrade_txholds(tx, dzp);
+   dmu_tx_mark_netfree(tx);
error = dmu_tx_assign(tx, waited ? TXG_WAITED : TXG_NOWAIT);
if (error) {
rw_exit(>z_parent_lock);
___
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: r302649 - vendor-sys/illumos/dist/uts/common/fs/zfs

2016-07-12 Thread Andriy Gapon
Author: avg
Date: Tue Jul 12 11:35:07 2016
New Revision: 302649
URL: https://svnweb.freebsd.org/changeset/base/302649

Log:
  7016 arc_available_memory is not 32-bit safe
  
  illumos/illumos-gate@0dd053d7d890618ea1fc697b07de364e69eb4190
  
https://github.com/illumos/illumos-gate/commit/0dd053d7d890618ea1fc697b07de364e69eb4190
  
  https://www.illumos.org/issues/7016
upstream DLPX-39446 arc_available_memory is not 32-bit safe
https://github.com/delphix/delphix-os/commit/
6b353ea3b8a1610be22e71e657d051743c64190b
related to this upstream:
DLPX-38547 delphix engine hang
https://github.com/delphix/delphix-os/commit/
3183a567b3e8c62a74a65885ca60c86f3d693783
DLPX-38547 delphix engine hang (fix static global)
https://github.com/delphix/delphix-os/commit/
22ac551d8ef085ad66cc8f65e51ac372b12993b9
DLPX-38882 system hung waiting on free segment
https://github.com/delphix/delphix-os/commit/
cdd6beef7548cd3b12f0fc0328eeb3af540079c2
  
  Reviewed by: Igor Kozhukhov 
  Reviewed by: Matthew Ahrens 
  Reviewed by: Paul Dagnelie 
  Reviewed by: George Wilson 
  Approved by: Gordon Ross 
  Author: Prakash Surya 

Modified:
  vendor-sys/illumos/dist/uts/common/fs/zfs/arc.c

Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/arc.c
==
--- vendor-sys/illumos/dist/uts/common/fs/zfs/arc.c Tue Jul 12 11:34:05 
2016(r302648)
+++ vendor-sys/illumos/dist/uts/common/fs/zfs/arc.c Tue Jul 12 11:35:07 
2016(r302649)
@@ -216,6 +216,11 @@ static int arc_dead;
 static boolean_t arc_warm;
 
 /*
+ * log2 fraction of the zio arena to keep free.
+ */
+int arc_zio_arena_free_shift = 2;
+
+/*
  * These tunables are for performance analysis.
  */
 uint64_t zfs_arc_max;
@@ -3235,7 +3240,7 @@ arc_available_memory(void)
 * heap is allocated.  (Or, in the calculation, if less than 1/4th is
 * free)
 */
-   n = vmem_size(heap_arena, VMEM_FREE) -
+   n = (int64_t)vmem_size(heap_arena, VMEM_FREE) -
(vmem_size(heap_arena, VMEM_FREE | VMEM_ALLOC) >> 2);
if (n < lowest) {
lowest = n;
@@ -3246,15 +3251,16 @@ arc_available_memory(void)
/*
 * If zio data pages are being allocated out of a separate heap segment,
 * then enforce that the size of available vmem for this arena remains
-* above about 1/16th free.
+* above about 1/4th (1/(2^arc_zio_arena_free_shift)) free.
 *
-* Note: The 1/16th arena free requirement was put in place
-* to aggressively evict memory from the arc in order to avoid
-* memory fragmentation issues.
+* Note that reducing the arc_zio_arena_free_shift keeps more virtual
+* memory (in the zio_arena) free, which can avoid memory
+* fragmentation issues.
 */
if (zio_arena != NULL) {
-   n = vmem_size(zio_arena, VMEM_FREE) -
-   (vmem_size(zio_arena, VMEM_ALLOC) >> 4);
+   n = (int64_t)vmem_size(zio_arena, VMEM_FREE) -
+   (vmem_size(zio_arena, VMEM_ALLOC) >>
+   arc_zio_arena_free_shift);
if (n < lowest) {
lowest = n;
r = FMR_ZIO_ARENA;
___
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: r302648 - vendor-sys/illumos/dist/uts/common/fs/zfs

2016-07-12 Thread Andriy Gapon
Author: avg
Date: Tue Jul 12 11:34:05 2016
New Revision: 302648
URL: https://svnweb.freebsd.org/changeset/base/302648

Log:
  7019 zfsdev_ioctl skips secpolicy when FKIOCTL is set
  
  7020 sdev_cleandir can loop forever
  
  Note that the bulk of the upstream change is not applicable to FreeBSD
  and the affected files are not even in the vendor area.
  
  illumos/illumos-gate@45b1747515a17db45e8971501ee84a26bdff37b2
  
https://github.com/illumos/illumos-gate/commit/45b1747515a17db45e8971501ee84a26bdff37b2
  
  https://www.illumos.org/issues/7019
Currently zfsdev_ioctl, when confronted by a request with the FKIOCTL flag 
set,
skips all processing of secpolicy functions. This means that ZFS is not 
doing
any kind of verification of the credentials or access rights of the caller 
and
assuming that (as it is an in-kernel client) all such checks have already 
been
done.
This turns out to be quite a dangerous assumption, especially with respect 
to
sdev. In general I don't think it's particularly reasonable to offload this
enforcement of access rights onto other kernel subsystems when ZFS has some
particular local semantics in this area (delegated datasets etc) and does 
not
provide any kind of API to allow other subsystems to avoid code duplication
when doing it. ZFS should apply its normal access policy to requests from
within the kernel, and callers should take care to give it the correct
credentials and call it from the correct context in order to get the results
they need.
You can observe the currently unfortunate consequences of this bug in any 
non-
global zone that has access to /dev/zvol or any subset of it via sdev 
profiles.
In particular, a zone used to contain a KVM or similar which has a single 
zvol
passed through to it using a https://www.illumos.org/issues/7020
sdev_cleandir can currently hang forever when it encounters a child node 
that
is busy, or when it is given a matching expr and the first entry on the list
does not match.
The previous code (circa 2013) iterated over the children of the node using 
a
for loop with SDEV_NEXT_ENTRY, which was then changed to a while ((dv =
SDEV_FIRST_ENTRY(ddv)) { loop. Unfortunately the continue statements that
previously made it skip over an entry were left as they were, which now 
result
in an infinite busy-loop in the kernel.
You can trigger this pretty easily by setting up an sdev exclude rule in
zonecfg.
Diagnosis: look for a runaway process consuming 100% CPU in kernel -- they 
have
a distinctive stack:
# mdb -k
> 0t1234::pid2proc | ::walk thread | ::findstack -v
[ d001efcd3310 _resume_from_idle+0x112() ]
  d001efcd3360 apix_hilevel_intr_epilog+0xc1(d001efcd33d0, 0)
  d001efcd33c0 apix_do_interrupt+0x34a(d001efcd33d0, 0)
  d001efcd33d0 _sys_rtt_ints_disabled+8()
  d001efcd3550 rw_enter+0x58()
  d001efcd35e0 sdev_cleandir+0x60(d0631b6d75d8, 0, 0)
  d001efcd3630 devzvol_prunedir+0xec(d0631b6d76e8)
  d001efcd36d0 devzvol_readdir+0x150(d06333250e00, d001efcd3790,
d062dc990e18, d001efcd37dc, 0, 0)
  d001efcd3760 fop_readdir+0x6b(d06333250e00, d001efcd3790,
d062dc990e18, d001efcd37dc, 0, 0)
  d001efcd3830 walk_dir+0xee(d06333250e00, d0669e4483c8,
fbbdf410)
  d001efcd3850 prof_make_names_walk+0x2e(d0669e4483c8,
fbbdf410)
  d001efcd38b0 prof_make_names+0xfc(d0669e4483c8)
  
  Reviewed by: Robert Mustacchi 
  Reviewed by: Richard Lowe 
  Reviewed by: Matthew Ahrens 
  Approved by: Dan McDonald 
  Author: Alex Wilson 

Modified:
  vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_ioctl.c

Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_ioctl.c
==
--- vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_ioctl.c   Tue Jul 12 
11:29:19 2016(r302647)
+++ vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_ioctl.c   Tue Jul 12 
11:34:05 2016(r302648)
@@ -25,7 +25,7 @@
  * Portions Copyright 2011 Martin Matuska
  * Copyright 2015, OmniTI Computer Consulting, Inc. All rights reserved.
  * Copyright 2015 Nexenta Systems, Inc.  All rights reserved.
- * Copyright (c) 2014, Joyent, Inc. All rights reserved.
+ * Copyright (c) 2014, 2016 Joyent, Inc. All rights reserved.
  * Copyright (c) 2011, 2015 by Delphix. All rights reserved.
  * Copyright (c) 2013 by Saso Kiselkov. All rights reserved.
  * Copyright (c) 2013 Steven Hartland. All rights reserved.
@@ -6022,7 +6022,7 @@ zfsdev_ioctl(dev_t dev, int cmd, intptr_
}
 
 
-   if (error == 0 && !(flag & FKIOCTL))
+   if (error == 0)
error = vec->zvec_secpolicy(zc, innvl, cr);
 

svn commit: r302647 - in vendor-sys/illumos/dist/uts/common: fs/zfs sys/sysevent

2016-07-12 Thread Andriy Gapon
Author: avg
Date: Tue Jul 12 11:29:19 2016
New Revision: 302647
URL: https://svnweb.freebsd.org/changeset/base/302647

Log:
  6922 Emit ESC_ZFS_VDEV_REMOVE_AUX after removing an aux device
  
  illumos/illumos-gate@63364b0ee2604783e7a55f842567768eafa4
  
https://github.com/illumos/illumos-gate/commit/63364b0ee2604783e7a55f842567768eafa4
  
  https://www.illumos.org/issues/6922
ZFS does not do a config_sync after removing an aux (spare, log, or cache)
device. AFAICT this isn't being done because it is slow and was deemed
unnecessary. However, it should be such a rare operation that speed doesn't
matter, and not doing it results in two problems:
1) It is theoretically possible to remove an aux device from one pool and
attach it to another, then lose power. When power is restored, both pools 
would
think that they own the aux device.
2) Removal of the aux device doesn't send any useful sysevents to userland.
  
  Reviewed by: George Wilson 
  Reviewed by: Matthew Ahrens 
  Approved by: Dan McDonald 
  Author: Alan Somers 

Modified:
  vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c
  vendor-sys/illumos/dist/uts/common/sys/sysevent/eventdefs.h

Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c
==
--- vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c Tue Jul 12 11:27:17 
2016(r302646)
+++ vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c Tue Jul 12 11:29:19 
2016(r302647)
@@ -5481,6 +5481,7 @@ spa_vdev_remove(spa_t *spa, uint64_t gui
} else {
error = SET_ERROR(EBUSY);
}
+   spa_event_notify(spa, vd, ESC_ZFS_VDEV_REMOVE_AUX);
} else if (spa->spa_l2cache.sav_vdevs != NULL &&
nvlist_lookup_nvlist_array(spa->spa_l2cache.sav_config,
ZPOOL_CONFIG_L2CACHE, , ) == 0 &&
@@ -5492,6 +5493,7 @@ spa_vdev_remove(spa_t *spa, uint64_t gui
ZPOOL_CONFIG_L2CACHE, l2cache, nl2cache, nv);
spa_load_l2cache(spa);
spa->spa_l2cache.sav_sync = B_TRUE;
+   spa_event_notify(spa, vd, ESC_ZFS_VDEV_REMOVE_AUX);
} else if (vd != NULL && vd->vdev_islog) {
ASSERT(!locked);
ASSERT(vd == vd->vdev_top);
@@ -5530,6 +5532,7 @@ spa_vdev_remove(spa_t *spa, uint64_t gui
 */
spa_vdev_remove_from_namespace(spa, vd);
 
+   spa_event_notify(spa, vd, ESC_ZFS_VDEV_REMOVE_DEV);
} else if (vd != NULL) {
/*
 * Normal vdevs cannot be removed (yet).
@@ -5543,7 +5546,7 @@ spa_vdev_remove(spa_t *spa, uint64_t gui
}
 
if (!locked)
-   return (spa_vdev_exit(spa, NULL, txg, error));
+   error = spa_vdev_exit(spa, NULL, txg, error);
 
return (error);
 }

Modified: vendor-sys/illumos/dist/uts/common/sys/sysevent/eventdefs.h
==
--- vendor-sys/illumos/dist/uts/common/sys/sysevent/eventdefs.h Tue Jul 12 
11:27:17 2016(r302646)
+++ vendor-sys/illumos/dist/uts/common/sys/sysevent/eventdefs.h Tue Jul 12 
11:29:19 2016(r302647)
@@ -249,6 +249,8 @@ extern "C" {
 #defineESC_ZFS_RESILVER_START  "ESC_ZFS_resilver_start"
 #defineESC_ZFS_RESILVER_FINISH "ESC_ZFS_resilver_finish"
 #defineESC_ZFS_VDEV_REMOVE "ESC_ZFS_vdev_remove"
+#defineESC_ZFS_VDEV_REMOVE_AUX "ESC_ZFS_vdev_remove_aux"
+#defineESC_ZFS_VDEV_REMOVE_DEV "ESC_ZFS_vdev_remove_dev"
 #defineESC_ZFS_POOL_CREATE "ESC_ZFS_pool_create"
 #defineESC_ZFS_POOL_DESTROY"ESC_ZFS_pool_destroy"
 #defineESC_ZFS_POOL_IMPORT "ESC_ZFS_pool_import"
___
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: r302646 - vendor-sys/illumos/dist/uts/common/fs/zfs/sys

2016-07-12 Thread Andriy Gapon
Author: avg
Date: Tue Jul 12 11:27:17 2016
New Revision: 302646
URL: https://svnweb.freebsd.org/changeset/base/302646

Log:
  6980 6902 causes zfs send to break due to 32-bit/64-bit struct mismatch
  
  illumos/illumos-gate@ea4a67f462de0a39a9adea8197bcdef849de5371
  
https://github.com/illumos/illumos-gate/commit/ea4a67f462de0a39a9adea8197bcdef849de5371
  
  https://www.illumos.org/issues/6980
doing zfs send -i snap1 snap2 >testfile results in
internal error: Invalid argument
Abort (core dumped)
  
  Reviewed by: Paul Dagnelie 
  Reviewed by: George Wilson 
  Approved by: Robert Mustacchi 
  Author: Matthew Ahrens 

Modified:
  vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zfs_ioctl.h

Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zfs_ioctl.h
==
--- vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zfs_ioctl.h   Tue Jul 12 
11:25:55 2016(r302645)
+++ vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zfs_ioctl.h   Tue Jul 12 
11:27:17 2016(r302646)
@@ -337,6 +337,12 @@ typedef enum zfs_case {
ZFS_CASE_MIXED
 } zfs_case_t;
 
+/*
+ * Note: this struct must have the same layout in 32-bit and 64-bit, so
+ * that 32-bit processes (like /sbin/zfs) can pass it to the 64-bit
+ * kernel.  Therefore, we add padding to it so that no "hidden" padding
+ * is automatically added on 64-bit (but not on 32-bit).
+ */
 typedef struct zfs_cmd {
charzc_name[MAXPATHLEN];/* name of pool or dataset */
uint64_tzc_nvlist_src;  /* really (char *) */
@@ -372,7 +378,9 @@ typedef struct zfs_cmd {
uint64_tzc_action_handle;
int zc_cleanup_fd;
uint8_t zc_simple;
+   uint8_t zc_pad3[3];
boolean_t   zc_resumable;
+   uint32_tzc_pad4;
uint64_tzc_sendobj;
uint64_tzc_fromobj;
uint64_tzc_createtxg;
___
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: r302645 - vendor-sys/illumos/dist/uts/common/fs/zfs

2016-07-12 Thread Andriy Gapon
Author: avg
Date: Tue Jul 12 11:25:55 2016
New Revision: 302645
URL: https://svnweb.freebsd.org/changeset/base/302645

Log:
  6878 Add scrub completion info to "zpool history"
  
  illumos/illumos-gate@1825bc56e5a1f7ef6f0dc3137f3b35f5850c1100
  
https://github.com/illumos/illumos-gate/commit/1825bc56e5a1f7ef6f0dc3137f3b35f5850c1100
  
  https://www.illumos.org/issues/6878
Summary of changes:
* Replace generic "scan done" message with "scan aborted, restarting",
  "scan cancelled", or "scan done"
* Log number of errors using spa_get_errlog_size
* Refactor scan restarting check into static function
  
  Reviewed by: Matthew Ahrens 
  Reviewed by: Dan Kimmel 
  Approved by: Dan McDonald 
  Author: Nav Ravindranath 

Modified:
  vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_scan.c

Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_scan.c
==
--- vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_scan.cTue Jul 12 
11:24:55 2016(r302644)
+++ vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_scan.cTue Jul 12 
11:25:55 2016(r302645)
@@ -56,7 +56,8 @@ typedef int (scan_cb_t)(dsl_pool_t *, co
 
 static scan_cb_t dsl_scan_scrub_cb;
 static void dsl_scan_cancel_sync(void *, dmu_tx_t *);
-static void dsl_scan_sync_state(dsl_scan_t *, dmu_tx_t *tx);
+static void dsl_scan_sync_state(dsl_scan_t *, dmu_tx_t *);
+static boolean_t dsl_scan_restarting(dsl_scan_t *, dmu_tx_t *);
 
 int zfs_top_maxinflight = 32;  /* maximum I/Os per top-level */
 int zfs_resilver_delay = 2;/* number of ticks to delay resilver */
@@ -293,8 +294,15 @@ dsl_scan_done(dsl_scan_t *scn, boolean_t
else
scn->scn_phys.scn_state = DSS_CANCELED;
 
-   spa_history_log_internal(spa, "scan done", tx,
-   "complete=%u", complete);
+   if (dsl_scan_restarting(scn, tx))
+   spa_history_log_internal(spa, "scan aborted, restarting", tx,
+   "errors=%llu", spa_get_errlog_size(spa));
+   else if (!complete)
+   spa_history_log_internal(spa, "scan cancelled", tx,
+   "errors=%llu", spa_get_errlog_size(spa));
+   else
+   spa_history_log_internal(spa, "scan done", tx,
+   "errors=%llu", spa_get_errlog_size(spa));
 
if (DSL_SCAN_IS_SCRUB_RESILVER(scn)) {
mutex_enter(>spa_scrub_lock);
@@ -1448,8 +1456,7 @@ dsl_scan_sync(dsl_pool_t *dp, dmu_tx_t *
 * that we can restart an old-style scan while the pool is being
 * imported (see dsl_scan_init).
 */
-   if (scn->scn_restart_txg != 0 &&
-   scn->scn_restart_txg <= tx->tx_txg) {
+   if (dsl_scan_restarting(scn, tx)) {
pool_scan_func_t func = POOL_SCAN_SCRUB;
dsl_scan_done(scn, B_FALSE, tx);
if (vdev_resilver_needed(spa->spa_root_vdev, NULL, NULL))
@@ -1875,3 +1882,10 @@ dsl_scan(dsl_pool_t *dp, pool_scan_func_
return (dsl_sync_task(spa_name(spa), dsl_scan_setup_check,
dsl_scan_setup_sync, , 0, ZFS_SPACE_CHECK_NONE));
 }
+
+static boolean_t
+dsl_scan_restarting(dsl_scan_t *scn, dmu_tx_t *tx)
+{
+   return (scn->scn_restart_txg != 0 &&
+   scn->scn_restart_txg <= tx->tx_txg);
+}
___
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: r302644 - in vendor-sys/illumos/dist/uts/common/fs/zfs: . sys

2016-07-12 Thread Andriy Gapon
Author: avg
Date: Tue Jul 12 11:24:55 2016
New Revision: 302644
URL: https://svnweb.freebsd.org/changeset/base/302644

Log:
  6513 partially filled holes lose birth time
  
  illumos/illumos-gate@8df0bcf0df7622a075cc6e52f659d2fcfdd08cdc
  
https://github.com/illumos/illumos-gate/commit/8df0bcf0df7622a075cc6e52f659d2fcfdd08cdc
  
  https://www.illumos.org/issues/6513
If a ZFS object contains a hole at level one, and then a data block is 
created
at level 0 underneath that l1 block, l0 holes will be created. However, 
these
l0 holes do not have the birth time property set; as a result, incremental
sends will not send those holes.
Fix is to modify the dbuf_read code to fill in birth time data.
  
  Reviewed by: Matthew Ahrens 
  Reviewed by: George Wilson 
  Reviewed by: Boris Protopopov 
  Approved by: Richard Lowe 
  Author: Paul Dagnelie 

Modified:
  vendor-sys/illumos/dist/uts/common/fs/zfs/arc.c
  vendor-sys/illumos/dist/uts/common/fs/zfs/dbuf.c
  vendor-sys/illumos/dist/uts/common/fs/zfs/dmu.c
  vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_objset.c
  vendor-sys/illumos/dist/uts/common/fs/zfs/dnode_sync.c
  vendor-sys/illumos/dist/uts/common/fs/zfs/sys/arc.h
  vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zio.h
  vendor-sys/illumos/dist/uts/common/fs/zfs/zio.c

Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/arc.c
==
--- vendor-sys/illumos/dist/uts/common/fs/zfs/arc.c Tue Jul 12 11:21:41 
2016(r302643)
+++ vendor-sys/illumos/dist/uts/common/fs/zfs/arc.c Tue Jul 12 11:24:55 
2016(r302644)
@@ -21,7 +21,7 @@
 /*
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
  * Copyright (c) 2012, Joyent, Inc. All rights reserved.
- * Copyright (c) 2011, 2015 by Delphix. All rights reserved.
+ * Copyright (c) 2011, 2016 by Delphix. All rights reserved.
  * Copyright (c) 2014 by Saso Kiselkov. All rights reserved.
  * Copyright 2015 Nexenta Systems, Inc.  All rights reserved.
  */
@@ -673,6 +673,7 @@ typedef struct arc_write_callback arc_wr
 struct arc_write_callback {
void*awcb_private;
arc_done_func_t *awcb_ready;
+   arc_done_func_t *awcb_children_ready;
arc_done_func_t *awcb_physdone;
arc_done_func_t *awcb_done;
arc_buf_t   *awcb_buf;
@@ -4674,6 +4675,15 @@ arc_write_ready(zio_t *zio)
hdr->b_flags |= ARC_FLAG_IO_IN_PROGRESS;
 }
 
+static void
+arc_write_children_ready(zio_t *zio)
+{
+   arc_write_callback_t *callback = zio->io_private;
+   arc_buf_t *buf = callback->awcb_buf;
+
+   callback->awcb_children_ready(zio, buf, callback->awcb_private);
+}
+
 /*
  * The SPA calls this callback for each physical write that happens on behalf
  * of a logical write.  See the comment in dbuf_write_physdone() for details.
@@ -4770,7 +4780,8 @@ arc_write_done(zio_t *zio)
 zio_t *
 arc_write(zio_t *pio, spa_t *spa, uint64_t txg,
 blkptr_t *bp, arc_buf_t *buf, boolean_t l2arc, boolean_t l2arc_compress,
-const zio_prop_t *zp, arc_done_func_t *ready, arc_done_func_t *physdone,
+const zio_prop_t *zp, arc_done_func_t *ready,
+arc_done_func_t *children_ready, arc_done_func_t *physdone,
 arc_done_func_t *done, void *private, zio_priority_t priority,
 int zio_flags, const zbookmark_phys_t *zb)
 {
@@ -4790,13 +4801,16 @@ arc_write(zio_t *pio, spa_t *spa, uint64
hdr->b_flags |= ARC_FLAG_L2COMPRESS;
callback = kmem_zalloc(sizeof (arc_write_callback_t), KM_SLEEP);
callback->awcb_ready = ready;
+   callback->awcb_children_ready = children_ready;
callback->awcb_physdone = physdone;
callback->awcb_done = done;
callback->awcb_private = private;
callback->awcb_buf = buf;
 
zio = zio_write(pio, spa, txg, bp, buf->b_data, hdr->b_size, zp,
-   arc_write_ready, arc_write_physdone, arc_write_done, callback,
+   arc_write_ready,
+   (children_ready != NULL) ? arc_write_children_ready : NULL,
+   arc_write_physdone, arc_write_done, callback,
priority, zio_flags, zb);
 
return (zio);

Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dbuf.c
==
--- vendor-sys/illumos/dist/uts/common/fs/zfs/dbuf.cTue Jul 12 11:21:41 
2016(r302643)
+++ vendor-sys/illumos/dist/uts/common/fs/zfs/dbuf.cTue Jul 12 11:24:55 
2016(r302644)
@@ -486,13 +486,49 @@ dbuf_verify(dmu_buf_impl_t *db)
 * If the blkptr isn't set but they have nonzero data,
 * it had better be dirty, otherwise we'll lose that
 * data when we evict this buffer.
+*
+* There is an exception to this rule for indirect blocks; in
+

svn commit: r302643 - vendor-sys/illumos/dist/uts/common/fs/zfs vendor-sys/illumos/dist/uts/common/fs/zfs/sys vendor/illumos/dist/cmd/zfs vendor/illumos/dist/lib/libzfs/common

2016-07-12 Thread Andriy Gapon
Author: avg
Date: Tue Jul 12 11:21:41 2016
New Revision: 302643
URL: https://svnweb.freebsd.org/changeset/base/302643

Log:
  6902 speed up listing of snapshots if requesting name only and sorting by name
  
  illumos/illumos-gate@0d8fa8f8eba3ea46bc79d73445009505d1dd5d7d
  
https://github.com/illumos/illumos-gate/commit/0d8fa8f8eba3ea46bc79d73445009505d1dd5d7d
  
  https://www.illumos.org/issues/6902
pjd has authored and commited a patch in Jan 21, 2012 that substanially 
speeds
up zfs snapshot listing if requesting only the name property and sorting by
name.
In this special case, the snapshot properties do not need to be loaded. This
code has been adopted by zfsonlinux on May 29, 2012.
Commit message from pjd:
 Dramatically optimize listing snapshots when user requests only
 snapshot
 names and wants to sort them by name, ie. when executes:
1. zfs list -t snapshot -o name -s name
 Because only name is needed we don't have to read all snapshot
 properties.
 Below you can find how long does it take to list 34509 snapshots from
 a single
 disk pool before and after this change with cold and warm cache:
 before:
1. time zfs list -t snapshot -o name -s name > /dev/null
   cold cache: 525s
   warm cache: 218s
 after:
1. time zfs list -t snapshot -o name -s name > /dev/null
   cold cache: 1.7s
   warm cache: 1.1s
References:
http://svnweb.freebsd.org/base?view=revision=230438
https://github.com/freebsd/freebsd/commit/8e3e9863
https://github.com/zfsonlinux/zfs/commit/0cee2406
  
  Reviewed by: Matthew Ahrens 
  Reviewed by: Pawel Dawidek 
  Reviewed by: Brian Behlendorf 
  Approved by: Garrett D'Amore 
  Author: Martin Matuska 

Modified:
  vendor/illumos/dist/cmd/zfs/zfs_iter.c
  vendor/illumos/dist/cmd/zfs/zfs_iter.h
  vendor/illumos/dist/cmd/zfs/zfs_main.c
  vendor/illumos/dist/lib/libzfs/common/libzfs.h
  vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c
  vendor/illumos/dist/lib/libzfs/common/libzfs_impl.h
  vendor/illumos/dist/lib/libzfs/common/libzfs_iter.c
  vendor/illumos/dist/lib/libzfs/common/libzfs_sendrecv.c

Changes in other areas also in this revision:
Modified:
  vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zfs_ioctl.h
  vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_ioctl.c

Modified: vendor/illumos/dist/cmd/zfs/zfs_iter.c
==
--- vendor/illumos/dist/cmd/zfs/zfs_iter.c  Tue Jul 12 11:20:00 2016
(r302642)
+++ vendor/illumos/dist/cmd/zfs/zfs_iter.c  Tue Jul 12 11:21:41 2016
(r302643)
@@ -21,6 +21,7 @@
 
 /*
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012 Pawel Jakub Dawidek. All rights reserved.
  * Copyright 2013 Nexenta Systems, Inc.  All rights reserved.
  * Copyright (c) 2013 by Delphix. All rights reserved.
  */
@@ -136,7 +137,9 @@ zfs_callback(zfs_handle_t *zhp, void *da
(void) zfs_iter_filesystems(zhp, zfs_callback, data);
if (((zfs_get_type(zhp) & (ZFS_TYPE_SNAPSHOT |
ZFS_TYPE_BOOKMARK)) == 0) && include_snaps)
-   (void) zfs_iter_snapshots(zhp, zfs_callback, data);
+   (void) zfs_iter_snapshots(zhp,
+   (cb->cb_flags & ZFS_ITER_SIMPLE) != 0, zfs_callback,
+   data);
if (((zfs_get_type(zhp) & (ZFS_TYPE_SNAPSHOT |
ZFS_TYPE_BOOKMARK)) == 0) && include_bmarks)
(void) zfs_iter_bookmarks(zhp, zfs_callback, data);
@@ -193,6 +196,14 @@ zfs_free_sort_columns(zfs_sort_column_t 
}
 }
 
+boolean_t
+zfs_sort_only_by_name(const zfs_sort_column_t *sc)
+{
+
+   return (sc != NULL && sc->sc_next == NULL &&
+   sc->sc_prop == ZFS_PROP_NAME);
+}
+
 /* ARGSUSED */
 static int
 zfs_compare(const void *larg, const void *rarg, void *unused)
@@ -233,7 +244,13 @@ zfs_compare(const void *larg, const void
lcreate = zfs_prop_get_int(l, ZFS_PROP_CREATETXG);
rcreate = zfs_prop_get_int(r, ZFS_PROP_CREATETXG);
 
-   if (lcreate < rcreate)
+   /*
+* Both lcreate and rcreate being 0 means we don't have
+* properties and we should compare full name.
+*/
+   if (lcreate == 0 && rcreate == 0)
+   ret = strcmp(lat + 1, rat + 1);
+   else if (lcreate < rcreate)
ret = -1;
else if (lcreate > rcreate)
ret = 1;
@@ -299,7 +316,14 @@ 

svn commit: r302643 - vendor-sys/illumos/dist/uts/common/fs/zfs vendor-sys/illumos/dist/uts/common/fs/zfs/sys vendor/illumos/dist/cmd/zfs vendor/illumos/dist/lib/libzfs/common

2016-07-12 Thread Andriy Gapon
Author: avg
Date: Tue Jul 12 11:21:41 2016
New Revision: 302643
URL: https://svnweb.freebsd.org/changeset/base/302643

Log:
  6902 speed up listing of snapshots if requesting name only and sorting by name
  
  illumos/illumos-gate@0d8fa8f8eba3ea46bc79d73445009505d1dd5d7d
  
https://github.com/illumos/illumos-gate/commit/0d8fa8f8eba3ea46bc79d73445009505d1dd5d7d
  
  https://www.illumos.org/issues/6902
pjd has authored and commited a patch in Jan 21, 2012 that substanially 
speeds
up zfs snapshot listing if requesting only the name property and sorting by
name.
In this special case, the snapshot properties do not need to be loaded. This
code has been adopted by zfsonlinux on May 29, 2012.
Commit message from pjd:
 Dramatically optimize listing snapshots when user requests only
 snapshot
 names and wants to sort them by name, ie. when executes:
1. zfs list -t snapshot -o name -s name
 Because only name is needed we don't have to read all snapshot
 properties.
 Below you can find how long does it take to list 34509 snapshots from
 a single
 disk pool before and after this change with cold and warm cache:
 before:
1. time zfs list -t snapshot -o name -s name > /dev/null
   cold cache: 525s
   warm cache: 218s
 after:
1. time zfs list -t snapshot -o name -s name > /dev/null
   cold cache: 1.7s
   warm cache: 1.1s
References:
http://svnweb.freebsd.org/base?view=revision=230438
https://github.com/freebsd/freebsd/commit/8e3e9863
https://github.com/zfsonlinux/zfs/commit/0cee2406
  
  Reviewed by: Matthew Ahrens 
  Reviewed by: Pawel Dawidek 
  Reviewed by: Brian Behlendorf 
  Approved by: Garrett D'Amore 
  Author: Martin Matuska 

Modified:
  vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zfs_ioctl.h
  vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_ioctl.c

Changes in other areas also in this revision:
Modified:
  vendor/illumos/dist/cmd/zfs/zfs_iter.c
  vendor/illumos/dist/cmd/zfs/zfs_iter.h
  vendor/illumos/dist/cmd/zfs/zfs_main.c
  vendor/illumos/dist/lib/libzfs/common/libzfs.h
  vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c
  vendor/illumos/dist/lib/libzfs/common/libzfs_impl.h
  vendor/illumos/dist/lib/libzfs/common/libzfs_iter.c
  vendor/illumos/dist/lib/libzfs/common/libzfs_sendrecv.c

Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zfs_ioctl.h
==
--- vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zfs_ioctl.h   Tue Jul 12 
11:20:00 2016(r302642)
+++ vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zfs_ioctl.h   Tue Jul 12 
11:21:41 2016(r302643)
@@ -20,6 +20,7 @@
  */
 /*
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011-2012 Pawel Jakub Dawidek. All rights reserved.
  * Copyright (c) 2012, 2015 by Delphix. All rights reserved.
  * Copyright 2016 RackTop Systems.
  * Copyright (c) 2014 Integros [integros.com]
@@ -370,6 +371,7 @@ typedef struct zfs_cmd {
uint32_tzc_flags;
uint64_tzc_action_handle;
int zc_cleanup_fd;
+   uint8_t zc_simple;
boolean_t   zc_resumable;
uint64_tzc_sendobj;
uint64_tzc_fromobj;

Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_ioctl.c
==
--- vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_ioctl.c   Tue Jul 12 
11:20:00 2016(r302642)
+++ vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_ioctl.c   Tue Jul 12 
11:21:41 2016(r302643)
@@ -21,6 +21,7 @@
 
 /*
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011-2012 Pawel Jakub Dawidek. All rights reserved.
  * Portions Copyright 2011 Martin Matuska
  * Copyright 2015, OmniTI Computer Consulting, Inc. All rights reserved.
  * Copyright 2015 Nexenta Systems, Inc.  All rights reserved.
@@ -2268,6 +2269,7 @@ top:
  * zc_name name of filesystem
  * zc_cookie   zap cursor
  * zc_nvlist_dst_size  size of buffer for property nvlist
+ * zc_simple   when set, only name is requested
  *
  * outputs:
  * zc_name name of next snapshot
@@ -2300,7 +2302,7 @@ zfs_ioc_snapshot_list_next(zfs_cmd_t *zc
zc->zc_name + strlen(zc->zc_name), >zc_obj, >zc_cookie,
NULL);
 
-   if (error == 0) {
+   if (error == 0 && !zc->zc_simple) {
dsl_dataset_t *ds;
dsl_pool_t *dp = os->os_dsl_dataset->ds_dir->dd_pool;
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To 

svn commit: r302642 - vendor-sys/illumos/dist/uts/common/fs/zfs vendor/illumos/dist/lib/libzfs/common

2016-07-12 Thread Andriy Gapon
Author: avg
Date: Tue Jul 12 11:20:00 2016
New Revision: 302642
URL: https://svnweb.freebsd.org/changeset/base/302642

Log:
  6876 Stack corruption after importing a pool with a too-long name
  
  illumos/illumos-gate@c971037baa5d64dfecf6d87ed602fc3116ebec41
  
https://github.com/illumos/illumos-gate/commit/c971037baa5d64dfecf6d87ed602fc3116ebec41
  
  https://www.illumos.org/issues/6876
Calling dsl_dataset_name on a dataset with a 256 byte buffer is asking for
trouble. We should check every dataset on import, using a 1024 byte buffer 
and
checking each time to see if the dataset's new name is longer than 256 
bytes.
  
  Reviewed by: Prakash Surya 
  Reviewed by: Dan Kimmel 
  Reviewed by: George Wilson 
  Reviewed by: Yuri Pankov 
  Approved by: Richard Lowe 
  Author: Paul Dagnelie 

Modified:
  vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c

Changes in other areas also in this revision:
Modified:
  vendor/illumos/dist/lib/libzfs/common/libzfs_pool.c

Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c
==
--- vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c Tue Jul 12 11:18:25 
2016(r302641)
+++ vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c Tue Jul 12 11:20:00 
2016(r302642)
@@ -1926,6 +1926,19 @@ spa_load_verify_cb(spa_t *spa, zilog_t *
return (0);
 }
 
+/* ARGSUSED */
+int
+verify_dataset_name_len(dsl_pool_t *dp, dsl_dataset_t *ds, void *arg)
+{
+   char namebuf[MAXPATHLEN];
+   dsl_dataset_name(ds, namebuf);
+   if (strlen(namebuf) > MAXNAMELEN) {
+   return (SET_ERROR(ENAMETOOLONG));
+   }
+
+   return (0);
+}
+
 static int
 spa_load_verify(spa_t *spa)
 {
@@ -1940,6 +1953,14 @@ spa_load_verify(spa_t *spa)
if (policy.zrp_request & ZPOOL_NEVER_REWIND)
return (0);
 
+   dsl_pool_config_enter(spa->spa_dsl_pool, FTAG);
+   error = dmu_objset_find_dp(spa->spa_dsl_pool,
+   spa->spa_dsl_pool->dp_root_dir_obj, verify_dataset_name_len, NULL,
+   DS_FIND_CHILDREN);
+   dsl_pool_config_exit(spa->spa_dsl_pool, FTAG);
+   if (error != 0)
+   return (error);
+
rio = zio_root(spa, NULL, ,
ZIO_FLAG_CANFAIL | ZIO_FLAG_SPECULATIVE);
 
___
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: r302642 - vendor-sys/illumos/dist/uts/common/fs/zfs vendor/illumos/dist/lib/libzfs/common

2016-07-12 Thread Andriy Gapon
Author: avg
Date: Tue Jul 12 11:20:00 2016
New Revision: 302642
URL: https://svnweb.freebsd.org/changeset/base/302642

Log:
  6876 Stack corruption after importing a pool with a too-long name
  
  illumos/illumos-gate@c971037baa5d64dfecf6d87ed602fc3116ebec41
  
https://github.com/illumos/illumos-gate/commit/c971037baa5d64dfecf6d87ed602fc3116ebec41
  
  https://www.illumos.org/issues/6876
Calling dsl_dataset_name on a dataset with a 256 byte buffer is asking for
trouble. We should check every dataset on import, using a 1024 byte buffer 
and
checking each time to see if the dataset's new name is longer than 256 
bytes.
  
  Reviewed by: Prakash Surya 
  Reviewed by: Dan Kimmel 
  Reviewed by: George Wilson 
  Reviewed by: Yuri Pankov 
  Approved by: Richard Lowe 
  Author: Paul Dagnelie 

Modified:
  vendor/illumos/dist/lib/libzfs/common/libzfs_pool.c

Changes in other areas also in this revision:
Modified:
  vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c

Modified: vendor/illumos/dist/lib/libzfs/common/libzfs_pool.c
==
--- vendor/illumos/dist/lib/libzfs/common/libzfs_pool.c Tue Jul 12 11:18:25 
2016(r302641)
+++ vendor/illumos/dist/lib/libzfs/common/libzfs_pool.c Tue Jul 12 11:20:00 
2016(r302642)
@@ -1785,7 +1785,12 @@ zpool_import_props(libzfs_handle_t *hdl,
case EEXIST:
(void) zpool_standard_error(hdl, error, desc);
break;
-
+   case ENAMETOOLONG:
+   zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
+   "new name of at least one dataset is longer than "
+   "the maximum allowable length"));
+   (void) zfs_error(hdl, EZFS_NAMETOOLONG, desc);
+   break;
default:
(void) zpool_standard_error(hdl, error, desc);
zpool_explain_recover(hdl,
___
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: r302641 - in vendor-sys/illumos/dist/uts/common/fs/zfs: . sys

2016-07-12 Thread Andriy Gapon
Author: avg
Date: Tue Jul 12 11:18:25 2016
New Revision: 302641
URL: https://svnweb.freebsd.org/changeset/base/302641

Log:
  6844 dnode_next_offset can detect fictional holes
  
  illumos/illumos-gate@11ceac77ea8034bf2fe9bdd6d314f5d1e5ceeba3
  
https://github.com/illumos/illumos-gate/commit/11ceac77ea8034bf2fe9bdd6d314f5d1e5ceeba3
  
  https://www.illumos.org/issues/6844
dnode_next_offset is used in a variety of places to iterate over the holes 
or
allocated blocks in a dnode. It operates under the premise that it can 
iterate
over the blockpointers of a dnode in open context while holding only the
dn_struct_rwlock as reader. Unfortunately, this premise does not hold.
When we create the zio for a dbuf, we pass in the actual block pointer in 
the
indirect block above that dbuf. When we later zero the bp in
zio_write_compress, we are directly modifying the bp. The state of the bp is
now inconsistent from the perspective of dnode_next_offset: the bp will 
appear
to be a hole until zio_dva_allocate finally finishes filling it in. In the
meantime, dnode_next_offset can detect a hole in the dnode when none exists.
I was able to experimentally demonstrate this behavior with the following
setup:
1. Create a file with 1 million dbufs.
2. Create a thread that randomly dirties L2 blocks by writing to the first 
L0
block under them.
3. Observe dnode_next_offset, waiting for it to skip over a hole in the 
middle
of a file.
4. Do dnode_next_offset in a loop until we skip over such a non-existent 
hole.
The fix is to ensure that it is valid to iterate over the indirect blocks 
in a
dnode while holding the dn_struct_rwlock by passing the zio a copy of the BP
and updating the actual BP in dbuf_write_ready while holding the lock.
  
  Reviewed by: Matthew Ahrens 
  Reviewed by: George Wilson 
  Reviewed by: Boris Protopopov 
  Approved by: Dan McDonald 
  Author: Alex Reece 

Modified:
  vendor-sys/illumos/dist/uts/common/fs/zfs/dbuf.c
  vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dbuf.h

Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dbuf.c
==
--- vendor-sys/illumos/dist/uts/common/fs/zfs/dbuf.cTue Jul 12 11:16:43 
2016(r302640)
+++ vendor-sys/illumos/dist/uts/common/fs/zfs/dbuf.cTue Jul 12 11:18:25 
2016(r302641)
@@ -2879,7 +2879,8 @@ dbuf_write_ready(zio_t *zio, arc_buf_t *
uint64_t fill = 0;
int i;
 
-   ASSERT3P(db->db_blkptr, ==, bp);
+   ASSERT3P(db->db_blkptr, !=, NULL);
+   ASSERT3P(>db_data_pending->dr_bp_copy, ==, bp);
 
DB_DNODE_ENTER(db);
dn = DB_DNODE(db);
@@ -2901,7 +2902,7 @@ dbuf_write_ready(zio_t *zio, arc_buf_t *
 #ifdef ZFS_DEBUG
if (db->db_blkid == DMU_SPILL_BLKID) {
ASSERT(dn->dn_phys->dn_flags & DNODE_FLAG_SPILL_BLKPTR);
-   ASSERT(!(BP_IS_HOLE(db->db_blkptr)) &&
+   ASSERT(!(BP_IS_HOLE(bp)) &&
db->db_blkptr == >dn_phys->dn_spill);
}
 #endif
@@ -2942,6 +2943,10 @@ dbuf_write_ready(zio_t *zio, arc_buf_t *
bp->blk_fill = fill;
 
mutex_exit(>db_mtx);
+
+   rw_enter(>dn_struct_rwlock, RW_WRITER);
+   *db->db_blkptr = *bp;
+   rw_exit(>dn_struct_rwlock);
 }
 
 /*
@@ -3120,6 +3125,8 @@ dbuf_write(dbuf_dirty_record_t *dr, arc_
zio_t *zio;
int wp_flag = 0;
 
+   ASSERT(dmu_tx_is_syncing(tx));
+
DB_DNODE_ENTER(db);
dn = DB_DNODE(db);
os = dn->dn_objset;
@@ -3178,6 +3185,14 @@ dbuf_write(dbuf_dirty_record_t *dr, arc_
dmu_write_policy(os, dn, db->db_level, wp_flag, );
DB_DNODE_EXIT(db);
 
+   /*
+* We copy the blkptr now (rather than when we instantiate the dirty
+* record), because its value can change between open context and
+* syncing context. We do not need to hold dn_struct_rwlock to read
+* db_blkptr because we are in syncing context.
+*/
+   dr->dr_bp_copy = *db->db_blkptr;
+
if (db->db_level == 0 &&
dr->dt.dl.dr_override_state == DR_OVERRIDDEN) {
/*
@@ -3187,7 +3202,7 @@ dbuf_write(dbuf_dirty_record_t *dr, arc_
void *contents = (data != NULL) ? data->b_data : NULL;
 
dr->dr_zio = zio_write(zio, os->os_spa, txg,
-   db->db_blkptr, contents, db->db.db_size, ,
+   >dr_bp_copy, contents, db->db.db_size, ,
dbuf_write_override_ready, NULL, dbuf_write_override_done,
dr, ZIO_PRIORITY_ASYNC_WRITE, ZIO_FLAG_MUSTSUCCEED, );
mutex_enter(>db_mtx);
@@ -3199,14 +3214,14 @@ dbuf_write(dbuf_dirty_record_t *dr, arc_
ASSERT(zp.zp_checksum == ZIO_CHECKSUM_OFF ||
zp.zp_checksum 

svn commit: r302640 - vendor-sys/illumos/dist/uts/common/fs/zfs

2016-07-12 Thread Andriy Gapon
Author: avg
Date: Tue Jul 12 11:16:43 2016
New Revision: 302640
URL: https://svnweb.freebsd.org/changeset/base/302640

Log:
  6874 rollback and receive need to reset ZPL state to what's on disk
  
  illumos/illumos-gate@1fdcbd00c9cbac286b5f92e08877e8cb3c448420
  
https://github.com/illumos/illumos-gate/commit/1fdcbd00c9cbac286b5f92e08877e8cb3c448420
  
  https://www.illumos.org/issues/6874
When we do a clone swap (caused by "zfs rollback" or "zfs receive"), the ZPL
doesn't completely reload the state from the DMU; some values remain cached 
in
the zfsvfs_t.
steps to reproduce:
```
#!/bin/bash -x
zfs destroy -R test/fs
zfs destroy -R test/recvd
zfs create test/fs
zfs snapshot test/fs@a
zfs set userquota@$USER=1m test/fs
zfs snapshot test/fs@b
zfs send test/fs@a | zfs recv test/recvd
zfs send -i @a test/fs@b | zfs recv test/recvd
zfs userspace test/recvd
   1. should show 1m quota
  dd if=/dev/urandom of=/test/recvd/file bs=1k count=1024
  sync
  dd if=/dev/urandom of=/test/recvd/file2 bs=1k count=1024
   2. should fail with ENOSPC
  sync
  zfs unmount test/recvd
  zfs mount test/recvd
  zfs userspace test/recvd
   3. if bug above, now shows 1m quota
  dd if=/dev/urandom of=/test/recvd/file3 bs=1k count=1024
   4. if bug above, now fails with ENOSPC
```
  
  Reviewed by: George Wilson 
  Reviewed by: Paul Dagnelie 
  Approved by: Garrett D'Amore 
  Author: Matthew Ahrens 

Modified:
  vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_vfsops.c

Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_vfsops.c
==
--- vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_vfsops.c  Tue Jul 12 
09:32:53 2016(r302639)
+++ vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_vfsops.c  Tue Jul 12 
11:16:43 2016(r302640)
@@ -20,7 +20,7 @@
  */
 /*
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2012, 2014 by Delphix. All rights reserved.
+ * Copyright (c) 2012, 2015 by Delphix. All rights reserved.
  * Copyright (c) 2014 Integros [integros.com]
  */
 
@@ -852,61 +852,46 @@ zfs_owner_overquota(zfsvfs_t *zfsvfs, zn
return (zfs_fuid_overquota(zfsvfs, isgroup, fuid));
 }
 
-int
-zfsvfs_create(const char *osname, zfsvfs_t **zfvp)
+/*
+ * Associate this zfsvfs with the given objset, which must be owned.
+ * This will cache a bunch of on-disk state from the objset in the
+ * zfsvfs.
+ */
+static int
+zfsvfs_init(zfsvfs_t *zfsvfs, objset_t *os)
 {
-   objset_t *os;
-   zfsvfs_t *zfsvfs;
-   uint64_t zval;
-   int i, error;
-   uint64_t sa_obj;
-
-   zfsvfs = kmem_zalloc(sizeof (zfsvfs_t), KM_SLEEP);
-
-   /*
-* We claim to always be readonly so we can open snapshots;
-* other ZPL code will prevent us from writing to snapshots.
-*/
-   error = dmu_objset_own(osname, DMU_OST_ZFS, B_TRUE, zfsvfs, );
-   if (error) {
-   kmem_free(zfsvfs, sizeof (zfsvfs_t));
-   return (error);
-   }
+   int error;
+   uint64_t val;
 
-   /*
-* Initialize the zfs-specific filesystem structure.
-* Should probably make this a kmem cache, shuffle fields,
-* and just bzero up to z_hold_mtx[].
-*/
-   zfsvfs->z_vfs = NULL;
-   zfsvfs->z_parent = zfsvfs;
zfsvfs->z_max_blksz = SPA_OLD_MAXBLOCKSIZE;
zfsvfs->z_show_ctldir = ZFS_SNAPDIR_VISIBLE;
zfsvfs->z_os = os;
 
error = zfs_get_zplprop(os, ZFS_PROP_VERSION, >z_version);
-   if (error) {
-   goto out;
-   } else if (zfsvfs->z_version >
+   if (error != 0)
+   return (error);
+   if (zfsvfs->z_version >
zfs_zpl_version_map(spa_version(dmu_objset_spa(os {
(void) printf("Can't mount a version %lld file system "
"on a version %lld pool\n. Pool must be upgraded to mount "
"this file system.", (u_longlong_t)zfsvfs->z_version,
(u_longlong_t)spa_version(dmu_objset_spa(os)));
-   error = SET_ERROR(ENOTSUP);
-   goto out;
+   return (SET_ERROR(ENOTSUP));
}
-   if ((error = zfs_get_zplprop(os, ZFS_PROP_NORMALIZE, )) != 0)
-   goto out;
-   zfsvfs->z_norm = (int)zval;
+   error = zfs_get_zplprop(os, ZFS_PROP_NORMALIZE, );
+   if (error != 0)
+   return (error);
+   zfsvfs->z_norm = (int)val;
 
-   if ((error = zfs_get_zplprop(os, ZFS_PROP_UTF8ONLY, )) != 0)
-   goto out;
-   zfsvfs->z_utf8 = (zval != 0);
+   error = zfs_get_zplprop(os, ZFS_PROP_UTF8ONLY, );
+   if (error != 0)
+   return (error);
+   zfsvfs->z_utf8 = (val 

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

2016-07-12 Thread Sepherosa Ziehau
Author: sephe
Date: Tue Jul 12 09:06:25 2016
New Revision: 302638
URL: https://svnweb.freebsd.org/changeset/base/302638

Log:
  hyperv/vmbus: Destroy channel list lock upon attach failure and detach.
  
  MFC after:1 week
  Sponsored by: Microsoft OSTC
  Differential Revision:https://reviews.freebsd.org/D7003

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

Modified: head/sys/dev/hyperv/vmbus/vmbus.c
==
--- head/sys/dev/hyperv/vmbus/vmbus.c   Tue Jul 12 08:55:08 2016
(r302637)
+++ head/sys/dev/hyperv/vmbus/vmbus.c   Tue Jul 12 09:06:25 2016
(r302638)
@@ -1202,6 +1202,7 @@ cleanup:
}
free(sc->vmbus_chmap, M_DEVBUF);
mtx_destroy(>vmbus_scan_lock);
+   mtx_destroy(>vmbus_chlist_lock);
 
return (ret);
 }
@@ -1283,6 +1284,8 @@ vmbus_detach(device_t dev)
 
free(sc->vmbus_chmap, M_DEVBUF);
mtx_destroy(>vmbus_scan_lock);
+   mtx_destroy(>vmbus_chlist_lock);
+
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: r302637 - head/sys/dev/hyperv/vmbus

2016-07-12 Thread Sepherosa Ziehau
Author: sephe
Date: Tue Jul 12 08:55:08 2016
New Revision: 302637
URL: https://svnweb.freebsd.org/changeset/base/302637

Log:
  hyperv/vmbus: Remove needed bits
  
  MFC after:1 week
  Sponsored by: Microsoft OSTC
  Differential Revision:https://reviews.freebsd.org/D7002

Modified:
  head/sys/dev/hyperv/vmbus/hv_connection.c
  head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h
  head/sys/dev/hyperv/vmbus/vmbus.c

Modified: head/sys/dev/hyperv/vmbus/hv_connection.c
==
--- head/sys/dev/hyperv/vmbus/hv_connection.c   Tue Jul 12 08:47:04 2016
(r302636)
+++ head/sys/dev/hyperv/vmbus/hv_connection.c   Tue Jul 12 08:55:08 2016
(r302637)
@@ -43,47 +43,6 @@
 #include 
 #include 
 
-/*
- * Globals
- */
-hv_vmbus_connection hv_vmbus_g_connection =
-   { .connect_state = HV_DISCONNECTED };
-
-/**
- * Send a connect request on the partition service connection
- */
-int
-hv_vmbus_connect(struct vmbus_softc *sc)
-{
-   /**
-* Make sure we are not connecting or connected
-*/
-   if (hv_vmbus_g_connection.connect_state != HV_DISCONNECTED) {
-   return (-1);
-   }
-
-   /**
-* Initialize the vmbus connection
-*/
-   hv_vmbus_g_connection.connect_state = HV_CONNECTING;
-
-   hv_vmbus_g_connection.connect_state = HV_CONNECTED;
-
-   return (0);
-}
-
-/**
- * Send a disconnect request on the partition service connection
- */
-int
-hv_vmbus_disconnect(void)
-{
-
-   hv_vmbus_g_connection.connect_state = HV_DISCONNECTED;
-
-   return (0);
-}
-
 static __inline void
 vmbus_event_flags_proc(struct vmbus_softc *sc, volatile u_long *event_flags,
 int flag_cnt)

Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h
==
--- head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h   Tue Jul 12 08:47:04 2016
(r302636)
+++ head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h   Tue Jul 12 08:55:08 2016
(r302637)
@@ -97,20 +97,6 @@ typedef struct hv_vmbus_channel_packet_m
hv_vmbus_multipage_buffer   range;
 } __packed hv_vmbus_channel_packet_multipage_buffer;
 
-/*
- * VM Bus connection states
- */
-typedef enum {
-   HV_DISCONNECTED,
-   HV_CONNECTING,
-   HV_CONNECTED,
-   HV_DISCONNECTING
-} hv_vmbus_connect_state;
-
-typedef struct {
-   hv_vmbus_connect_state  connect_state;
-} hv_vmbus_connection;
-
 typedef union {
uint32_t as_uint32_t;
struct {
@@ -172,12 +158,6 @@ typedef struct {
uint8_t rsvd_z4[1984];
 } hv_vmbus_monitor_page;
 
-/**
- * Global variables
- */
-
-extern hv_vmbus_connection hv_vmbus_g_connection;
-
 /*
  * Private, VM Bus functions
  */
@@ -242,10 +222,4 @@ void   
hv_vmbus_child_device_register(st
 inthv_vmbus_child_device_unregister(
struct hv_device *child_dev);
 
-/**
- * Connection interfaces
- */
-inthv_vmbus_connect(struct vmbus_softc *);
-inthv_vmbus_disconnect(void);
-
 #endif  /* __HYPERV_PRIV_H__ */

Modified: head/sys/dev/hyperv/vmbus/vmbus.c
==
--- head/sys/dev/hyperv/vmbus/vmbus.c   Tue Jul 12 08:47:04 2016
(r302636)
+++ head/sys/dev/hyperv/vmbus/vmbus.c   Tue Jul 12 08:55:08 2016
(r302637)
@@ -1169,12 +1169,8 @@ vmbus_doattach(struct vmbus_softc *sc)
sc->vmbus_flags |= VMBUS_FLAG_SYNIC;
 
/*
-* Connect to VMBus in the root partition
+* Initialize vmbus, e.g. connect to Hypervisor.
 */
-   ret = hv_vmbus_connect(sc);
-   if (ret != 0)
-   goto cleanup;
-
ret = vmbus_init(sc);
if (ret != 0)
goto cleanup;
@@ -1271,7 +1267,6 @@ vmbus_detach(device_t dev)
hv_vmbus_release_unattached_channels(sc);
 
vmbus_disconnect(sc);
-   hv_vmbus_disconnect();
 
if (sc->vmbus_flags & VMBUS_FLAG_SYNIC) {
sc->vmbus_flags &= ~VMBUS_FLAG_SYNIC;
___
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: r302636 - head/sys/dev/hyperv/vmbus

2016-07-12 Thread Sepherosa Ziehau
Author: sephe
Date: Tue Jul 12 08:47:04 2016
New Revision: 302636
URL: https://svnweb.freebsd.org/changeset/base/302636

Log:
  hyperv/vmbus: Move channel map to vmbus_softc
  
  MFC after:1 week
  Sponsored by: Microsoft OSTC
  Differential Revision:https://reviews.freebsd.org/D6982

Modified:
  head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c
  head/sys/dev/hyperv/vmbus/hv_connection.c
  head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h
  head/sys/dev/hyperv/vmbus/vmbus.c
  head/sys/dev/hyperv/vmbus/vmbus_var.h

Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c
==
--- head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Tue Jul 12 08:43:09 2016
(r302635)
+++ head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Tue Jul 12 08:47:04 2016
(r302636)
@@ -123,7 +123,7 @@ vmbus_channel_process_offer(hv_vmbus_cha
 */
printf("VMBUS: got channel0 offer\n");
} else {
-   hv_vmbus_g_connection.channels[relid] = new_channel;
+   sc->vmbus_chmap[relid] = new_channel;
}
 
TAILQ_FOREACH(channel, >vmbus_chlist, ch_link) {
@@ -351,10 +351,10 @@ vmbus_channel_on_offer_rescind(struct vm
rescind->child_rel_id);
}
 
-   channel = hv_vmbus_g_connection.channels[rescind->child_rel_id];
+   channel = sc->vmbus_chmap[rescind->child_rel_id];
if (channel == NULL)
return;
-   hv_vmbus_g_connection.channels[rescind->child_rel_id] = NULL;
+   sc->vmbus_chmap[rescind->child_rel_id] = NULL;
 
taskqueue_enqueue(taskqueue_thread, >ch_detach_task);
 }
@@ -451,8 +451,8 @@ hv_vmbus_release_unattached_channels(str
}
hv_vmbus_free_vmbus_channel(channel);
}
-   bzero(hv_vmbus_g_connection.channels,
-   sizeof(hv_vmbus_channel*) * VMBUS_CHAN_MAX);
+   bzero(sc->vmbus_chmap,
+   sizeof(struct hv_vmbus_channel *) * VMBUS_CHAN_MAX);
 
mtx_unlock(>vmbus_chlist_lock);
 }

Modified: head/sys/dev/hyperv/vmbus/hv_connection.c
==
--- head/sys/dev/hyperv/vmbus/hv_connection.c   Tue Jul 12 08:43:09 2016
(r302635)
+++ head/sys/dev/hyperv/vmbus/hv_connection.c   Tue Jul 12 08:47:04 2016
(r302636)
@@ -67,9 +67,6 @@ hv_vmbus_connect(struct vmbus_softc *sc)
 */
hv_vmbus_g_connection.connect_state = HV_CONNECTING;
 
-   hv_vmbus_g_connection.channels = malloc(sizeof(hv_vmbus_channel*) *
-   VMBUS_CHAN_MAX, M_DEVBUF, M_WAITOK | M_ZERO);
-
hv_vmbus_g_connection.connect_state = HV_CONNECTED;
 
return (0);
@@ -82,14 +79,14 @@ int
 hv_vmbus_disconnect(void)
 {
 
-   free(hv_vmbus_g_connection.channels, M_DEVBUF);
hv_vmbus_g_connection.connect_state = HV_DISCONNECTED;
 
return (0);
 }
 
 static __inline void
-vmbus_event_flags_proc(volatile u_long *event_flags, int flag_cnt)
+vmbus_event_flags_proc(struct vmbus_softc *sc, volatile u_long *event_flags,
+int flag_cnt)
 {
int f;
 
@@ -112,7 +109,7 @@ vmbus_event_flags_proc(volatile u_long *
flags &= ~(1UL << bit);
 
rel_id = rel_id_base + bit;
-   channel = hv_vmbus_g_connection.channels[rel_id];
+   channel = sc->vmbus_chmap[rel_id];
 
/* if channel is closed or closing */
if (channel == NULL || channel->rxq == NULL)
@@ -135,7 +132,7 @@ vmbus_event_proc(struct vmbus_softc *sc,
 * to get the id of the channel that has the pending interrupt.
 */
eventf = VMBUS_PCPU_GET(sc, event_flags, cpu) + VMBUS_SINT_MESSAGE;
-   vmbus_event_flags_proc(eventf->evt_flags,
+   vmbus_event_flags_proc(sc, eventf->evt_flags,
VMBUS_PCPU_GET(sc, event_flags_cnt, cpu));
 }
 
@@ -146,7 +143,7 @@ vmbus_event_proc_compat(struct vmbus_sof
 
eventf = VMBUS_PCPU_GET(sc, event_flags, cpu) + VMBUS_SINT_MESSAGE;
if (atomic_testandclear_long(>evt_flags[0], 0)) {
-   vmbus_event_flags_proc(sc->vmbus_rx_evtflags,
+   vmbus_event_flags_proc(sc, sc->vmbus_rx_evtflags,
VMBUS_CHAN_MAX_COMPAT >> VMBUS_EVTFLAG_SHIFT);
}
 }

Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h
==
--- head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h   Tue Jul 12 08:43:09 2016
(r302635)
+++ head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h   Tue Jul 12 08:47:04 2016
(r302636)
@@ -109,11 +109,6 @@ typedef enum {
 
 typedef struct {
hv_vmbus_connect_state  connect_state;
-
-   /**
-* channel table for fast lookup through id.
-   */
-   hv_vmbus_channel**channels;
 } hv_vmbus_connection;
 
 typedef union {

Modified: 

Re: svn commit: r302601 - in head/sys: arm/include arm64/include

2016-07-12 Thread Andrey Chernov
On 12.07.2016 11:35, Andrew Turner wrote:
> On Tue, 12 Jul 2016 00:37:48 + (UTC)
> "Andrey A. Chernov"  wrote:
> 
>> Author: ache
>> Date: Tue Jul 12 00:37:48 2016
>> New Revision: 302601
>> URL: https://svnweb.freebsd.org/changeset/base/302601
>>
>> Log:
>>   I don't know why unsigned int is choosed for wchar_t here, but
>> WCHAR_MAX should be <= WINT_MAX. It is bigger, __UINT_MAX > INT32_MAX
> 
> Because the ABI either requires us to use an unsigned int [1], or the
> preferred type is unsigned int [2]. In the latter case the other choice
> is unsigned short, it would seem this is for Windows.

Thanx for explanation. Perhaps we need to use 32bit unsigned int for
other architectures too (instead of 32bit signed int), because no
L'' literals produce negative value and locale enumerates positive
values only.

BTW, this commit is already backed out.

> 
> Andrew
> 
> [1]
> http://infocenter.arm.com/help/topic/com.arm.doc.ihi0055c/IHI0055C_beta_aapcs64.pdf
> [2]
> http://infocenter.arm.com/help/topic/com.arm.doc.ihi0042f/IHI0042F_aapcs.pdf
> 

___
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: r302635 - in head/sys: amd64/include i386/include x86/x86 x86/xen

2016-07-12 Thread Roger Pau Monné
Author: royger
Date: Tue Jul 12 08:43:09 2016
New Revision: 302635
URL: https://svnweb.freebsd.org/changeset/base/302635

Log:
  xen: automatically disable MSI-X interrupt migration
  
  If the hypervisor version is smaller than 4.6.0. Xen commits 74fd00 and
  70a3cb are required on the hypervisor side for this to be fixed, and those
  are only included in 4.6.0, so stay on the safe side and disable MSI-X
  interrupt migration on anything older than 4.6.0.
  
  It should not cause major performance degradation unless a lot of MSI-X
  interrupts are allocated.
  
  Sponsored by: Citrix Systems R
  MFC after:3 days
  Reviewed by:  jhb
  Differential revision:https://reviews.freebsd.org/D7148

Modified:
  head/sys/amd64/include/intr_machdep.h
  head/sys/i386/include/intr_machdep.h
  head/sys/x86/x86/msi.c
  head/sys/x86/xen/hvm.c

Modified: head/sys/amd64/include/intr_machdep.h
==
--- head/sys/amd64/include/intr_machdep.h   Tue Jul 12 08:38:03 2016
(r302634)
+++ head/sys/amd64/include/intr_machdep.h   Tue Jul 12 08:43:09 2016
(r302635)
@@ -149,6 +149,8 @@ extern cpuset_t intr_cpus;
 extern struct mtx icu_lock;
 extern int elcr_found;
 
+extern int msix_disable_migration;
+
 #ifndef DEV_ATPIC
 void   atpic_reset(void);
 #endif

Modified: head/sys/i386/include/intr_machdep.h
==
--- head/sys/i386/include/intr_machdep.hTue Jul 12 08:38:03 2016
(r302634)
+++ head/sys/i386/include/intr_machdep.hTue Jul 12 08:43:09 2016
(r302635)
@@ -140,6 +140,8 @@ extern cpuset_t intr_cpus;
 extern struct mtx icu_lock;
 extern int elcr_found;
 
+extern int msix_disable_migration;
+
 #ifndef DEV_ATPIC
 void   atpic_reset(void);
 #endif

Modified: head/sys/x86/x86/msi.c
==
--- head/sys/x86/x86/msi.c  Tue Jul 12 08:38:03 2016(r302634)
+++ head/sys/x86/x86/msi.c  Tue Jul 12 08:43:09 2016(r302635)
@@ -149,12 +149,16 @@ struct pic msi_pic = {
.pic_reprogram_pin = NULL,
 };
 
-/*
+/**
  * Xen hypervisors prior to 4.6.0 do not properly handle updates to
  * enabled MSI-X table entries.  Allow migration of MSI-X interrupts
- * to be disabled via a tunable.
+ * to be disabled via a tunable. Values have the following meaning:
+ *
+ * -1: automatic detection by FreeBSD
+ *  0: enable migration
+ *  1: disable migration
  */
-static int msix_disable_migration = 0;
+int msix_disable_migration = -1;
 SYSCTL_INT(_machdep, OID_AUTO, disable_msix_migration, CTLFLAG_RDTUN,
 _disable_migration, 0,
 "Disable migration of MSI-X interrupts between CPUs");
@@ -312,6 +316,11 @@ msi_init(void)
return;
}
 
+   if (msix_disable_migration == -1) {
+   /* The default is to allow migration of MSI-X interrupts. */
+   msix_disable_migration = 0;
+   }
+
msi_enabled = 1;
intr_register_pic(_pic);
mtx_init(_lock, "msi", NULL, MTX_DEF);

Modified: head/sys/x86/xen/hvm.c
==
--- head/sys/x86/xen/hvm.c  Tue Jul 12 08:38:03 2016(r302634)
+++ head/sys/x86/xen/hvm.c  Tue Jul 12 08:43:09 2016(r302635)
@@ -134,9 +134,29 @@ xen_hvm_init_hypercall_stubs(enum xen_hv
return (ENXIO);
 
if (init_type == XEN_HVM_INIT_COLD) {
+   int major, minor;
+
do_cpuid(base + 1, regs);
-   printf("XEN: Hypervisor version %d.%d detected.\n",
-   regs[0] >> 16, regs[0] & 0x);
+
+   major = regs[0] >> 16;
+   minor = regs[0] & 0x;
+   printf("XEN: Hypervisor version %d.%d detected.\n", major,
+   minor);
+
+   if (((major < 4) || (major == 4 && minor <= 5)) &&
+   msix_disable_migration == -1) {
+   /*
+* Xen hypervisors prior to 4.6.0 do not properly
+* handle updates to enabled MSI-X table entries,
+* so disable MSI-X interrupt migration in that
+* case.
+*/
+   if (bootverbose)
+   printf(
+"Disabling MSI-X interrupt migration due to Xen hypervisor bug.\n"
+"Set machdep.msix_disable_migration=0 to forcefully enable it.\n");
+   msix_disable_migration = 1;
+   }
}
 
/*
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r302634 - in head/sys/dev/hyperv: include netvsc vmbus

2016-07-12 Thread Sepherosa Ziehau
Author: sephe
Date: Tue Jul 12 08:38:03 2016
New Revision: 302634
URL: https://svnweb.freebsd.org/changeset/base/302634

Log:
  hyperv/vmbus: Fix sub-channel re-open support.
  
  For multi-channel devices, once the primary channel is closed,
  a set of 'rescind' messages for sub-channels will be delivered
  by Hypervisor.  Sub-channel MUST be freed according to these
  'rescind' messages; directly re-openning sub-channels in the
  same fashion as the primary channel's re-opening does NOT work
  at all.
  
  After the primary channel is re-opened, requested # of sub-
  channels will be delivered though 'channel offer' messages, and
  this set of newly offered channels can be opened along side with
  the primary channel.
  
  This unbreaks the MTU setting for hn(4), which requires re-
  openning all existsing channels upon MTU change.
  
  MFC after:1 week
  Sponsored by: Microsoft OSTC
  Differential Revision:https://reviews.freebsd.org/D6978

Modified:
  head/sys/dev/hyperv/include/hyperv.h
  head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
  head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c
  head/sys/dev/hyperv/vmbus/vmbus_reg.h

Modified: head/sys/dev/hyperv/include/hyperv.h
==
--- head/sys/dev/hyperv/include/hyperv.hTue Jul 12 08:28:51 2016
(r302633)
+++ head/sys/dev/hyperv/include/hyperv.hTue Jul 12 08:38:03 2016
(r302634)
@@ -717,6 +717,7 @@ voidvmbus_channel_cpu_rr(struct hv_vmb
 struct hv_vmbus_channel **
vmbus_get_subchan(struct hv_vmbus_channel *pri_chan, int 
subchan_cnt);
 void   vmbus_rel_subchan(struct hv_vmbus_channel **subchan, int 
subchan_cnt);
+void   vmbus_drain_subchan(struct hv_vmbus_channel *pri_chan);
 
 /**
  * @brief Get physical address from virtual

Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
==
--- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Tue Jul 12 08:28:51 
2016(r302633)
+++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Tue Jul 12 08:38:03 
2016(r302634)
@@ -345,6 +345,7 @@ static void hn_destroy_rx_data(struct hn
 static void hn_set_tx_chimney_size(struct hn_softc *, int);
 static void hn_channel_attach(struct hn_softc *, struct hv_vmbus_channel *);
 static void hn_subchan_attach(struct hn_softc *, struct hv_vmbus_channel *);
+static void hn_subchan_setup(struct hn_softc *);
 
 static int hn_transmit(struct ifnet *, struct mbuf *);
 static void hn_xmit_qflush(struct ifnet *);
@@ -575,25 +576,8 @@ netvsc_attach(device_t dev)
device_printf(dev, "%d TX ring, %d RX ring\n",
sc->hn_tx_ring_inuse, sc->hn_rx_ring_inuse);
 
-   if (sc->net_dev->num_channel > 1) {
-   struct hv_vmbus_channel **subchan;
-   int subchan_cnt = sc->net_dev->num_channel - 1;
-   int i;
-
-   /* Wait for sub-channels setup to complete. */
-   subchan = vmbus_get_subchan(pri_chan, subchan_cnt);
-
-   /* Attach the sub-channels. */
-   for (i = 0; i < subchan_cnt; ++i) {
-   /* NOTE: Calling order is critical. */
-   hn_subchan_attach(sc, subchan[i]);
-   hv_nv_subchan_attach(subchan[i]);
-   }
-
-   /* Release the sub-channels */
-   vmbus_rel_subchan(subchan, subchan_cnt);
-   device_printf(dev, "%d sub-channels setup done\n", subchan_cnt);
-   }
+   if (sc->net_dev->num_channel > 1)
+   hn_subchan_setup(sc);
 
 #if __FreeBSD_version >= 1100099
if (sc->hn_rx_ring_inuse > 1) {
@@ -1620,6 +1604,10 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, 
NV_UNLOCK(sc);
break;
}
+
+   /* Wait for subchannels to be destroyed */
+   vmbus_drain_subchan(hn_dev->channel);
+
error = hv_rf_on_device_add(hn_dev, _info,
sc->hn_rx_ring_inuse);
if (error) {
@@ -1628,6 +1616,26 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, 
NV_UNLOCK(sc);
break;
}
+   KASSERT(sc->hn_rx_ring_cnt == sc->net_dev->num_channel,
+   ("RX ring count %d and channel count %u mismatch",
+sc->hn_rx_ring_cnt, sc->net_dev->num_channel));
+   if (sc->net_dev->num_channel > 1) {
+   int r;
+
+   /*
+* Skip the rings on primary channel; they are
+* handled by the hv_rf_on_device_add() above.
+*/
+   for (r = 1; r < sc->hn_rx_ring_cnt; ++r) {
+   sc->hn_rx_ring[r].hn_rx_flags &=
+   

Re: svn commit: r302601 - in head/sys: arm/include arm64/include

2016-07-12 Thread Andrew Turner
On Tue, 12 Jul 2016 00:37:48 + (UTC)
"Andrey A. Chernov"  wrote:

> Author: ache
> Date: Tue Jul 12 00:37:48 2016
> New Revision: 302601
> URL: https://svnweb.freebsd.org/changeset/base/302601
> 
> Log:
>   I don't know why unsigned int is choosed for wchar_t here, but
> WCHAR_MAX should be <= WINT_MAX. It is bigger, __UINT_MAX > INT32_MAX

Because the ABI either requires us to use an unsigned int [1], or the
preferred type is unsigned int [2]. In the latter case the other choice
is unsigned short, it would seem this is for Windows.

Andrew

[1]
http://infocenter.arm.com/help/topic/com.arm.doc.ihi0055c/IHI0055C_beta_aapcs64.pdf
[2]
http://infocenter.arm.com/help/topic/com.arm.doc.ihi0042f/IHI0042F_aapcs.pdf
___
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: r302633 - in head/sys/dev/hyperv: include vmbus

2016-07-12 Thread Sepherosa Ziehau
Author: sephe
Date: Tue Jul 12 08:28:51 2016
New Revision: 302633
URL: https://svnweb.freebsd.org/changeset/base/302633

Log:
  hyperv/vmbus: Free sysctl properly upon channel close.
  
  Prepare for sub-channel re-open.
  
  MFC after:1 week
  Sponsored by: Microsoft OSTC
  Differential Revision:https://reviews.freebsd.org/D6977

Modified:
  head/sys/dev/hyperv/include/hyperv.h
  head/sys/dev/hyperv/vmbus/hv_channel.c

Modified: head/sys/dev/hyperv/include/hyperv.h
==
--- head/sys/dev/hyperv/include/hyperv.hTue Jul 12 08:21:28 2016
(r302632)
+++ head/sys/dev/hyperv/include/hyperv.hTue Jul 12 08:28:51 2016
(r302633)
@@ -49,6 +49,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -627,6 +628,8 @@ typedef struct hv_vmbus_channel {
 
struct task ch_detach_task;
TAILQ_ENTRY(hv_vmbus_channel)   ch_link;
+
+   struct sysctl_ctx_list  ch_sysctl_ctx;
 } hv_vmbus_channel;
 
 #define HV_VMBUS_CHAN_ISPRIMARY(chan)  ((chan)->primary_channel == NULL)

Modified: head/sys/dev/hyperv/vmbus/hv_channel.c
==
--- head/sys/dev/hyperv/vmbus/hv_channel.c  Tue Jul 12 08:21:28 2016
(r302632)
+++ head/sys/dev/hyperv/vmbus/hv_channel.c  Tue Jul 12 08:28:51 2016
(r302633)
@@ -111,7 +111,8 @@ vmbus_channel_sysctl_create(hv_vmbus_cha
ch_id = primary_ch->offer_msg.child_rel_id;
sub_ch_id = channel->offer_msg.offer.sub_channel_index;
}
-   ctx = device_get_sysctl_ctx(dev);
+   ctx = >ch_sysctl_ctx;
+   sysctl_ctx_init(ctx);
/* This creates dev.DEVNAME.DEVUNIT.channel tree */
devch_sysctl = SYSCTL_ADD_NODE(ctx,
SYSCTL_CHILDREN(device_get_sysctl_tree(dev)),
@@ -482,6 +483,7 @@ hv_vmbus_channel_close_internal(hv_vmbus
int error;
 
channel->state = HV_CHANNEL_OPEN_STATE;
+   sysctl_ctx_free(>ch_sysctl_ctx);
 
/*
 * set rxq to NULL to avoid more requests be scheduled
___
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: r302632 - head/sys/dev/hyperv/vmbus

2016-07-12 Thread Sepherosa Ziehau
Author: sephe
Date: Tue Jul 12 08:21:28 2016
New Revision: 302632
URL: https://svnweb.freebsd.org/changeset/base/302632

Log:
  hyperv/vmbus: More verbose for GPADL_connect/chan_{rescind,offer}
  
  Reviewed by:  Dexuan Cui , Hongjiang Zhang 
  MFC after:1 week
  Sponsored by: Microsoft OSTC
  Differential Revision:https://reviews.freebsd.org/D6976

Modified:
  head/sys/dev/hyperv/vmbus/hv_channel.c
  head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c

Modified: head/sys/dev/hyperv/vmbus/hv_channel.c
==
--- head/sys/dev/hyperv/vmbus/hv_channel.c  Tue Jul 12 08:11:16 2016
(r302631)
+++ head/sys/dev/hyperv/vmbus/hv_channel.c  Tue Jul 12 08:21:28 2016
(r302632)
@@ -423,6 +423,11 @@ hv_vmbus_channel_establish_gpadl(struct 
device_printf(sc->vmbus_dev, "gpadl->chan%u failed: "
"status %u\n", channel->offer_msg.child_rel_id, status);
return EIO;
+   } else {
+   if (bootverbose) {
+   device_printf(sc->vmbus_dev, "gpadl->chan%u "
+   "succeeded\n", channel->offer_msg.child_rel_id);
+   }
}
return 0;
 }

Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c
==
--- head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Tue Jul 12 08:11:16 2016
(r302631)
+++ head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Tue Jul 12 08:21:28 2016
(r302632)
@@ -142,6 +142,19 @@ vmbus_channel_process_offer(hv_vmbus_cha
}
mtx_unlock(>vmbus_chlist_lock);
 
+   if (bootverbose) {
+   char logstr[64];
+
+   logstr[0] = '\0';
+   if (channel != NULL) {
+   snprintf(logstr, sizeof(logstr), ", primary chan%u",
+   channel->offer_msg.child_rel_id);
+   }
+   device_printf(sc->vmbus_dev, "chan%u subchanid%u offer%s\n",
+   new_channel->offer_msg.child_rel_id,
+   new_channel->offer_msg.offer.sub_channel_index, logstr);
+   }
+
if (channel != NULL) {
/*
 * Check if this is a sub channel.
@@ -157,13 +170,6 @@ vmbus_channel_process_offer(hv_vmbus_cha
new_channel, sc_list_entry);
mtx_unlock(>sc_lock);
 
-   if (bootverbose) {
-   printf("VMBUS get multi-channel offer, "
-   "rel=%u, sub=%u\n",
-   new_channel->offer_msg.child_rel_id,
-   
new_channel->offer_msg.offer.sub_channel_index);
-   }
-
/*
 * Insert the new channel to the end of the global
 * channel list.
@@ -178,11 +184,6 @@ vmbus_channel_process_offer(hv_vmbus_cha
ch_link);
mtx_unlock(>vmbus_chlist_lock);
 
-   if(bootverbose)
-   printf("VMBUS: new multi-channel offer <%p>, "
-   "its primary channel is <%p>.\n",
-   new_channel, new_channel->primary_channel);
-
new_channel->state = HV_CHANNEL_OPEN_STATE;
 
/*
@@ -345,6 +346,10 @@ vmbus_channel_on_offer_rescind(struct vm
hv_vmbus_channel*   channel;
 
rescind = (const hv_vmbus_channel_rescind_offer *)msg->msg_data;
+   if (bootverbose) {
+   device_printf(sc->vmbus_dev, "chan%u rescind\n",
+   rescind->child_rel_id);
+   }
 
channel = hv_vmbus_g_connection.channels[rescind->child_rel_id];
if (channel == 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: r302631 - in head/sys/dev/hyperv: include vmbus

2016-07-12 Thread Sepherosa Ziehau
Author: sephe
Date: Tue Jul 12 08:11:16 2016
New Revision: 302631
URL: https://svnweb.freebsd.org/changeset/base/302631

Log:
  hyperv/vmbus: Move channel list to vmbus_softc
  
  MFC after:1 week
  Sponsored by: Microsoft OSTC
  Differential Revision:https://reviews.freebsd.org/D6956

Modified:
  head/sys/dev/hyperv/include/hyperv.h
  head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c
  head/sys/dev/hyperv/vmbus/hv_connection.c
  head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h
  head/sys/dev/hyperv/vmbus/vmbus.c
  head/sys/dev/hyperv/vmbus/vmbus_var.h

Modified: head/sys/dev/hyperv/include/hyperv.h
==
--- head/sys/dev/hyperv/include/hyperv.hTue Jul 12 07:49:38 2016
(r302630)
+++ head/sys/dev/hyperv/include/hyperv.hTue Jul 12 08:11:16 2016
(r302631)
@@ -533,7 +533,6 @@ typedef union {
 } __packed hv_vmbus_connection_id;
 
 typedef struct hv_vmbus_channel {
-   TAILQ_ENTRY(hv_vmbus_channel)   list_entry;
struct hv_device*   device;
struct vmbus_softc  *vmbus_sc;
hv_vmbus_channel_state  state;
@@ -627,6 +626,7 @@ typedef struct hv_vmbus_channel {
void*hv_chan_priv3;
 
struct task ch_detach_task;
+   TAILQ_ENTRY(hv_vmbus_channel)   ch_link;
 } hv_vmbus_channel;
 
 #define HV_VMBUS_CHAN_ISPRIMARY(chan)  ((chan)->primary_channel == NULL)

Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c
==
--- head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Tue Jul 12 07:49:38 2016
(r302630)
+++ head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Tue Jul 12 08:11:16 2016
(r302631)
@@ -108,6 +108,7 @@ hv_vmbus_free_vmbus_channel(hv_vmbus_cha
 static void
 vmbus_channel_process_offer(hv_vmbus_channel *new_channel)
 {
+   struct vmbus_softc *sc = new_channel->vmbus_sc;
hv_vmbus_channel*   channel;
uint32_trelid;
 
@@ -115,7 +116,7 @@ vmbus_channel_process_offer(hv_vmbus_cha
/*
 * Make sure this is a new offer
 */
-   mtx_lock(_vmbus_g_connection.channel_lock);
+   mtx_lock(>vmbus_chlist_lock);
if (relid == 0) {
/*
 * XXX channel0 will not be processed; skip it.
@@ -125,8 +126,7 @@ vmbus_channel_process_offer(hv_vmbus_cha
hv_vmbus_g_connection.channels[relid] = new_channel;
}
 
-   TAILQ_FOREACH(channel, _vmbus_g_connection.channel_anchor,
-   list_entry) {
+   TAILQ_FOREACH(channel, >vmbus_chlist, ch_link) {
if (memcmp(>offer_msg.offer.interface_type,
_channel->offer_msg.offer.interface_type,
sizeof(hv_guid)) == 0 &&
@@ -138,10 +138,9 @@ vmbus_channel_process_offer(hv_vmbus_cha
 
if (channel == NULL) {
/* Install the new primary channel */
-   TAILQ_INSERT_TAIL(_vmbus_g_connection.channel_anchor,
-   new_channel, list_entry);
+   TAILQ_INSERT_TAIL(>vmbus_chlist, new_channel, ch_link);
}
-   mtx_unlock(_vmbus_g_connection.channel_lock);
+   mtx_unlock(>vmbus_chlist_lock);
 
if (channel != NULL) {
/*
@@ -165,11 +164,19 @@ vmbus_channel_process_offer(hv_vmbus_cha

new_channel->offer_msg.offer.sub_channel_index);
}
 
-   /* Insert new channel into channel_anchor. */
-   mtx_lock(_vmbus_g_connection.channel_lock);
-   TAILQ_INSERT_TAIL(_vmbus_g_connection.channel_anchor,
-   new_channel, list_entry);   
-   mtx_unlock(_vmbus_g_connection.channel_lock);
+   /*
+* Insert the new channel to the end of the global
+* channel list.
+*
+* NOTE:
+* The new sub-channel MUST be inserted AFTER it's
+* primary channel, so that the primary channel will
+* be found in the above loop for its baby siblings.
+*/
+   mtx_lock(>vmbus_chlist_lock);
+   TAILQ_INSERT_TAIL(>vmbus_chlist, new_channel,
+   ch_link);
+   mtx_unlock(>vmbus_chlist_lock);
 
if(bootverbose)
printf("VMBUS: new multi-channel offer <%p>, "
@@ -375,16 +382,15 @@ vmbus_channel_on_offers_delivered(struct
  * @brief Release channels that are unattached/unconnected (i.e., no drivers 
associated)
  */
 void
-hv_vmbus_release_unattached_channels(void) 
+hv_vmbus_release_unattached_channels(struct vmbus_softc *sc)
 {

svn commit: r302624 - head/lib/libc/sys

2016-07-12 Thread Edward Tomasz Napierala
Author: trasz
Date: Tue Jul 12 06:00:57 2016
New Revision: 302624
URL: https://svnweb.freebsd.org/changeset/base/302624

Log:
  Add some .Xrs to getloginclass(2).
  
  MFC after:1 month

Modified:
  head/lib/libc/sys/getloginclass.2

Modified: head/lib/libc/sys/getloginclass.2
==
--- head/lib/libc/sys/getloginclass.2   Tue Jul 12 05:55:11 2016
(r302623)
+++ head/lib/libc/sys/getloginclass.2   Tue Jul 12 06:00:57 2016
(r302624)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd March 6, 2011
+.Dd July 12, 2016
 .Dt GETLOGINCLASS 2
 .Os
 .Sh NAME
@@ -87,7 +87,10 @@ The caller tried to set the login class 
 The size of the buffer is smaller than the result to be returned.
 .El
 .Sh SEE ALSO
-.Xr setusercontext 3
+.Xr ps 1 ,
+.Xr setusercontext 3 ,
+.Xr login.conf 5 ,
+.Xr rctl 8
 .Sh HISTORY
 The
 .Fn getloginclass
___
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: r302627 - in stable/11/sys: amd64/cloudabi64 arm64/cloudabi64

2016-07-12 Thread Ed Schouten
Author: ed
Date: Tue Jul 12 06:25:28 2016
New Revision: 302627
URL: https://svnweb.freebsd.org/changeset/base/302627

Log:
  MFC r302448:
  
Don't forget to set sa->narg for CloudABI system calls.
  
It turns out that this value is not used within the system call code
under normal conditions, except when using tracing tools like ktrace.
If we forget to set this value, it is set to random garbage. This may
cause ktrace to hang indefinitely, making it impossible to kill.
  
  Approved by: re@
  Reported by: Michael Plass
  PR: 210800

Modified:
  stable/11/sys/amd64/cloudabi64/cloudabi64_sysvec.c
  stable/11/sys/arm64/cloudabi64/cloudabi64_sysvec.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/amd64/cloudabi64/cloudabi64_sysvec.c
==
--- stable/11/sys/amd64/cloudabi64/cloudabi64_sysvec.c  Tue Jul 12 06:12:58 
2016(r302626)
+++ stable/11/sys/amd64/cloudabi64/cloudabi64_sysvec.c  Tue Jul 12 06:25:28 
2016(r302627)
@@ -96,6 +96,7 @@ cloudabi64_fetch_syscall_args(struct thr
if (sa->code >= CLOUDABI64_SYS_MAXSYSCALL)
return (ENOSYS);
sa->callp = _sysent[sa->code];
+   sa->narg = sa->callp->sy_narg;
 
/* Fetch system call arguments. */
sa->args[0] = frame->tf_rdi;

Modified: stable/11/sys/arm64/cloudabi64/cloudabi64_sysvec.c
==
--- stable/11/sys/arm64/cloudabi64/cloudabi64_sysvec.c  Tue Jul 12 06:12:58 
2016(r302626)
+++ stable/11/sys/arm64/cloudabi64/cloudabi64_sysvec.c  Tue Jul 12 06:25:28 
2016(r302627)
@@ -77,6 +77,7 @@ cloudabi64_fetch_syscall_args(struct thr
if (sa->code >= CLOUDABI64_SYS_MAXSYSCALL)
return (ENOSYS);
sa->callp = _sysent[sa->code];
+   sa->narg = sa->callp->sy_narg;
 
/* Fetch system call arguments. */
for (i = 0; i < MAXARGS; i++)
___
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: r302630 - head/sys/dev/hyperv/vmbus

2016-07-12 Thread Sepherosa Ziehau
Author: sephe
Date: Tue Jul 12 07:49:38 2016
New Revision: 302630
URL: https://svnweb.freebsd.org/changeset/base/302630

Log:
  hyperv/vmbus: Move GPADL index into vmbus_softc
  
  MFC after:1 week
  Sponsored by: Microsoft OSTC
  Differential Revision:https://reviews.freebsd.org/D6954

Modified:
  head/sys/dev/hyperv/vmbus/hv_channel.c
  head/sys/dev/hyperv/vmbus/hv_connection.c
  head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h
  head/sys/dev/hyperv/vmbus/vmbus.c
  head/sys/dev/hyperv/vmbus/vmbus_var.h

Modified: head/sys/dev/hyperv/vmbus/hv_channel.c
==
--- head/sys/dev/hyperv/vmbus/hv_channel.c  Tue Jul 12 07:33:39 2016
(r302629)
+++ head/sys/dev/hyperv/vmbus/hv_channel.c  Tue Jul 12 07:49:38 2016
(r302630)
@@ -343,8 +343,7 @@ hv_vmbus_channel_establish_gpadl(struct 
/*
 * Allocate GPADL id.
 */
-   gpadl = atomic_fetchadd_int(
-   _vmbus_g_connection.next_gpadl_handle, 1);
+   gpadl = vmbus_gpadl_alloc(sc);
*gpadl0 = gpadl;
 
/*

Modified: head/sys/dev/hyperv/vmbus/hv_connection.c
==
--- head/sys/dev/hyperv/vmbus/hv_connection.c   Tue Jul 12 07:33:39 2016
(r302629)
+++ head/sys/dev/hyperv/vmbus/hv_connection.c   Tue Jul 12 07:49:38 2016
(r302630)
@@ -47,8 +47,7 @@
  * Globals
  */
 hv_vmbus_connection hv_vmbus_g_connection =
-   { .connect_state = HV_DISCONNECTED,
- .next_gpadl_handle = 0xE1E10, };
+   { .connect_state = HV_DISCONNECTED };
 
 /**
  * Send a connect request on the partition service connection

Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h
==
--- head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h   Tue Jul 12 07:33:39 2016
(r302629)
+++ head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h   Tue Jul 12 07:49:38 2016
(r302630)
@@ -107,7 +107,6 @@ typedef enum {
 
 typedef struct {
hv_vmbus_connect_state  connect_state;
-   uint32_tnext_gpadl_handle;
 
/**
 * List of primary channels. Sub channels will be linked

Modified: head/sys/dev/hyperv/vmbus/vmbus.c
==
--- head/sys/dev/hyperv/vmbus/vmbus.c   Tue Jul 12 07:33:39 2016
(r302629)
+++ head/sys/dev/hyperv/vmbus/vmbus.c   Tue Jul 12 07:49:38 2016
(r302630)
@@ -70,6 +70,8 @@ __FBSDID("$FreeBSD$");
 #include "acpi_if.h"
 #include "vmbus_if.h"
 
+#define VMBUS_GPADL_START  0xe1e10
+
 struct vmbus_msghc {
struct hypercall_postmsg_in *mh_inprm;
struct hypercall_postmsg_in mh_inprm_save;
@@ -372,6 +374,12 @@ vmbus_msghc_wakeup(struct vmbus_softc *s
wakeup(>mhc_active);
 }
 
+uint32_t
+vmbus_gpadl_alloc(struct vmbus_softc *sc)
+{
+   return atomic_fetchadd_int(>vmbus_gpadl, 1);
+}
+
 static int
 vmbus_connect(struct vmbus_softc *sc, uint32_t version)
 {
@@ -1121,6 +1129,7 @@ vmbus_doattach(struct vmbus_softc *sc)
sc->vmbus_flags |= VMBUS_FLAG_ATTACHED;
 
mtx_init(>vmbus_scan_lock, "vmbus scan", NULL, MTX_DEF);
+   sc->vmbus_gpadl = VMBUS_GPADL_START;
 
/*
 * Create context for "post message" Hypercalls

Modified: head/sys/dev/hyperv/vmbus/vmbus_var.h
==
--- head/sys/dev/hyperv/vmbus/vmbus_var.h   Tue Jul 12 07:33:39 2016
(r302629)
+++ head/sys/dev/hyperv/vmbus/vmbus_var.h   Tue Jul 12 07:49:38 2016
(r302630)
@@ -86,6 +86,7 @@ struct vmbus_softc {
int vmbus_idtvec;
uint32_tvmbus_flags;/* see VMBUS_FLAG_ */
uint32_tvmbus_version;
+   uint32_tvmbus_gpadl;
 
/* Shared memory for vmbus_{rx,tx}_evtflags */
void*vmbus_evtflags;
@@ -148,4 +149,6 @@ voidvmbus_msghc_reset(struct vmbus_msgh
 void   vmbus_scan_done(struct vmbus_softc *);
 void   vmbus_scan_newchan(struct vmbus_softc *);
 
+uint32_t vmbus_gpadl_alloc(struct vmbus_softc *);
+
 #endif /* !_VMBUS_VAR_H_ */
___
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: r302628 - head/sys/sys

2016-07-12 Thread Andrey A. Chernov
Author: ache
Date: Tue Jul 12 07:16:37 2016
New Revision: 302628
URL: https://svnweb.freebsd.org/changeset/base/302628

Log:
  Bump __FreeBSD_version after removing collation from [a-z]-type ranges.

Modified:
  head/sys/sys/param.h

Modified: head/sys/sys/param.h
==
--- head/sys/sys/param.hTue Jul 12 06:25:28 2016(r302627)
+++ head/sys/sys/param.hTue Jul 12 07:16:37 2016(r302628)
@@ -58,7 +58,7 @@
  * in the range 5 to 9.
  */
 #undef __FreeBSD_version
-#define __FreeBSD_version 120  /* Master, propagated to newvers */
+#define __FreeBSD_version 121  /* Master, propagated to newvers */
 
 /*
  * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,
___
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: r302623 - head/sys/dev/hyperv/vmbus

2016-07-12 Thread Sepherosa Ziehau
Author: sephe
Date: Tue Jul 12 05:55:11 2016
New Revision: 302623
URL: https://svnweb.freebsd.org/changeset/base/302623

Log:
  hyperv/vmbus: Minor renaming
  
  MFC after:1 week
  Sponsored by: Microsoft OSTC
  Differential Revision:https://reviews.freebsd.org/D6919

Modified:
  head/sys/dev/hyperv/vmbus/vmbus.c
  head/sys/dev/hyperv/vmbus/vmbus_reg.h

Modified: head/sys/dev/hyperv/vmbus/vmbus.c
==
--- head/sys/dev/hyperv/vmbus/vmbus.c   Tue Jul 12 05:41:34 2016
(r302622)
+++ head/sys/dev/hyperv/vmbus/vmbus.c   Tue Jul 12 05:55:11 2016
(r302623)
@@ -90,10 +90,9 @@ struct vmbus_msghc_ctx {
 #define VMBUS_MSGHC_CTXF_DESTROY   0x0001
 
 static int vmbus_init(struct vmbus_softc *);
-static int vmbus_init_contact(struct vmbus_softc *,
-   uint32_t);
+static int vmbus_connect(struct vmbus_softc *, uint32_t);
 static int vmbus_req_channels(struct vmbus_softc *sc);
-static voidvmbus_uninit(struct vmbus_softc *);
+static voidvmbus_disconnect(struct vmbus_softc *);
 static int vmbus_scan(struct vmbus_softc *);
 static voidvmbus_scan_wait(struct vmbus_softc *);
 static voidvmbus_scan_newdev(struct vmbus_softc *);
@@ -373,20 +372,19 @@ vmbus_msghc_wakeup(struct vmbus_softc *s
 }
 
 static int
-vmbus_init_contact(struct vmbus_softc *sc, uint32_t version)
+vmbus_connect(struct vmbus_softc *sc, uint32_t version)
 {
-   struct vmbus_chanmsg_init_contact *req;
-   const struct vmbus_chanmsg_version_resp *resp;
+   struct vmbus_chanmsg_connect *req;
const struct vmbus_message *msg;
struct vmbus_msghc *mh;
-   int error, supp = 0;
+   int error, done = 0;
 
mh = vmbus_msghc_get(sc, sizeof(*req));
if (mh == NULL)
return ENXIO;
 
req = vmbus_msghc_dataptr(mh);
-   req->chm_hdr.chm_type = VMBUS_CHANMSG_TYPE_INIT_CONTACT;
+   req->chm_hdr.chm_type = VMBUS_CHANMSG_TYPE_CONNECT;
req->chm_ver = version;
req->chm_evtflags = sc->vmbus_evtflags_dma.hv_paddr;
req->chm_mnf1 = sc->vmbus_mnf1_dma.hv_paddr;
@@ -399,12 +397,12 @@ vmbus_init_contact(struct vmbus_softc *s
}
 
msg = vmbus_msghc_wait_result(sc, mh);
-   resp = (const struct vmbus_chanmsg_version_resp *)msg->msg_data;
-   supp = resp->chm_supp;
+   done = ((const struct vmbus_chanmsg_connect_resp *)
+   msg->msg_data)->chm_done;
 
vmbus_msghc_put(sc, mh);
 
-   return (supp ? 0 : EOPNOTSUPP);
+   return (done ? 0 : EOPNOTSUPP);
 }
 
 static int
@@ -415,7 +413,7 @@ vmbus_init(struct vmbus_softc *sc)
for (i = 0; i < nitems(vmbus_version); ++i) {
int error;
 
-   error = vmbus_init_contact(sc, vmbus_version[i]);
+   error = vmbus_connect(sc, vmbus_version[i]);
if (!error) {
hv_vmbus_protocal_version = vmbus_version[i];
device_printf(sc->vmbus_dev, "version %u.%u\n",
@@ -428,35 +426,35 @@ vmbus_init(struct vmbus_softc *sc)
 }
 
 static void
-vmbus_uninit(struct vmbus_softc *sc)
+vmbus_disconnect(struct vmbus_softc *sc)
 {
-   struct vmbus_chanmsg_unload *req;
+   struct vmbus_chanmsg_disconnect *req;
struct vmbus_msghc *mh;
int error;
 
mh = vmbus_msghc_get(sc, sizeof(*req));
if (mh == NULL) {
device_printf(sc->vmbus_dev,
-   "can not get msg hypercall for unload\n");
+   "can not get msg hypercall for disconnect\n");
return;
}
 
req = vmbus_msghc_dataptr(mh);
-   req->chm_hdr.chm_type = VMBUS_CHANMSG_TYPE_UNLOAD;
+   req->chm_hdr.chm_type = VMBUS_CHANMSG_TYPE_DISCONNECT;
 
error = vmbus_msghc_exec_noresult(mh);
vmbus_msghc_put(sc, mh);
 
if (error) {
device_printf(sc->vmbus_dev,
-   "unload msg hypercall failed\n");
+   "disconnect msg hypercall failed\n");
}
 }
 
 static int
 vmbus_req_channels(struct vmbus_softc *sc)
 {
-   struct vmbus_chanmsg_channel_req *req;
+   struct vmbus_chanmsg_chrequest *req;
struct vmbus_msghc *mh;
int error;
 
@@ -465,7 +463,7 @@ vmbus_req_channels(struct vmbus_softc *s
return ENXIO;
 
req = vmbus_msghc_dataptr(mh);
-   req->chm_hdr.chm_type = VMBUS_CHANMSG_TYPE_CHANNEL_REQ;
+   req->chm_hdr.chm_type = VMBUS_CHANMSG_TYPE_CHREQUEST;
 
error = vmbus_msghc_exec_noresult(mh);
vmbus_msghc_put(sc, mh);
@@ -1247,7 +1245,7 @@ vmbus_detach(device_t dev)
 
hv_vmbus_release_unattached_channels();
 
-   vmbus_uninit(sc);
+   vmbus_disconnect(sc);
hv_vmbus_disconnect();
 
if 

svn commit: r302622 - in head/sys/dev/ntb: . ntb_hw

2016-07-12 Thread Sepherosa Ziehau
Author: sephe
Date: Tue Jul 12 05:41:34 2016
New Revision: 302622
URL: https://svnweb.freebsd.org/changeset/base/302622

Log:
  ntb: Fix LINT
  
  Sponsored by: Microsoft OSTC

Modified:
  head/sys/dev/ntb/ntb_hw/ntb_hw.c
  head/sys/dev/ntb/ntb_transport.c

Modified: head/sys/dev/ntb/ntb_hw/ntb_hw.c
==
--- head/sys/dev/ntb/ntb_hw/ntb_hw.cTue Jul 12 05:31:33 2016
(r302621)
+++ head/sys/dev/ntb/ntb_hw/ntb_hw.cTue Jul 12 05:41:34 2016
(r302622)
@@ -617,8 +617,6 @@ SYSCTL_UQUAD(_hw_ntb_xeon_b2b, OID_AUTO,
  */
 MALLOC_DEFINE(M_NTB, "ntb_hw", "ntb_hw driver memory allocations");
 
-SYSCTL_NODE(_hw, OID_AUTO, ntb, CTLFLAG_RW, 0, "NTB sysctls");
-
 /*
  * OS <-> Driver linkage functions
  */

Modified: head/sys/dev/ntb/ntb_transport.c
==
--- head/sys/dev/ntb/ntb_transport.cTue Jul 12 05:31:33 2016
(r302621)
+++ head/sys/dev/ntb/ntb_transport.cTue Jul 12 05:41:34 2016
(r302622)
@@ -882,7 +882,7 @@ ntb_memcpy_rx(struct ntb_transport_qp *q
/* Ensure that the data is globally visible before clearing the flag */
wmb();
 
-   CTR2(KTR_NTB, "RX: copied entry %p to mbuf %p.", entry, m);
+   CTR2(KTR_NTB, "RX: copied entry %p to mbuf %p.", entry, entry->buf);
ntb_rx_copy_callback(qp, entry);
 }
 
___
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: r302625 - stable/11

2016-07-12 Thread Garrett Cooper
Author: ngie
Date: Tue Jul 12 06:06:10 2016
New Revision: 302625
URL: https://svnweb.freebsd.org/changeset/base/302625

Log:
  MFC r302532:
  
  Correct OLD_LIBS change done in r298840
  
  libkvm.so lives in /lib, not /usr/lib
  
  Approved by: re (gjb)

Modified:
  stable/11/ObsoleteFiles.inc
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/ObsoleteFiles.inc
==
--- stable/11/ObsoleteFiles.inc Tue Jul 12 06:00:57 2016(r302624)
+++ stable/11/ObsoleteFiles.inc Tue Jul 12 06:06:10 2016(r302625)
@@ -203,7 +203,7 @@ OLD_FILES+=usr/share/man/man9/rman_await
 # 20160517: ReiserFS removed
 OLD_FILES+=usr/share/man/man5/reiserfs.5.gz
 # 20160430: kvm_getfiles(3) removed from kvm(3)
-OLD_LIBS+=usr/lib/libkvm.so.6
+OLD_LIBS+=lib/libkvm.so.6
 OLD_FILES+=usr/share/man/man3/kvm_getfiles.3.gz
 # 20160423: remove mroute6d
 OLD_FILES+=etc/rc.d/mroute6d
___
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: r302629 - in head/sys: conf dev/hyperv/include dev/hyperv/netvsc dev/hyperv/storvsc dev/hyperv/vmbus modules/hyperv/netvsc modules/hyperv/storvsc modules/hyperv/vmbus

2016-07-12 Thread Sepherosa Ziehau
Author: sephe
Date: Tue Jul 12 07:33:39 2016
New Revision: 302629
URL: https://svnweb.freebsd.org/changeset/base/302629

Log:
  hyperv/vmbus: Rework vmbus version accessing.
  
  Instead of global variable, vmbus version is accessed through
  a vmbus DEVMETHOD now.
  
  MFC after:1 week
  Sponsored by: Microsoft OSTC
  Differential Revision:https://reviews.freebsd.org/D6953

Added:
  head/sys/dev/hyperv/vmbus/vmbus_if.m   (contents, props changed)
Modified:
  head/sys/conf/files.amd64
  head/sys/conf/files.i386
  head/sys/dev/hyperv/include/hyperv.h
  head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
  head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c
  head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c
  head/sys/dev/hyperv/vmbus/hv_connection.c
  head/sys/dev/hyperv/vmbus/vmbus.c
  head/sys/dev/hyperv/vmbus/vmbus_var.h
  head/sys/modules/hyperv/netvsc/Makefile
  head/sys/modules/hyperv/storvsc/Makefile
  head/sys/modules/hyperv/vmbus/Makefile

Modified: head/sys/conf/files.amd64
==
--- head/sys/conf/files.amd64   Tue Jul 12 07:16:37 2016(r302628)
+++ head/sys/conf/files.amd64   Tue Jul 12 07:33:39 2016(r302629)
@@ -278,6 +278,7 @@ dev/hyperv/vmbus/hyperv.c   
optionalhy
 dev/hyperv/vmbus/hyperv_busdma.c   optionalhyperv
 dev/hyperv/vmbus/vmbus.c   optionalhyperv
 dev/hyperv/vmbus/vmbus_et.coptionalhyperv
+dev/hyperv/vmbus/vmbus_if.moptionalhyperv
 dev/hyperv/vmbus/amd64/hyperv_machdep.coptional
hyperv
 dev/hyperv/vmbus/amd64/vmbus_vector.S  optionalhyperv
 dev/nfe/if_nfe.c   optionalnfe pci

Modified: head/sys/conf/files.i386
==
--- head/sys/conf/files.i386Tue Jul 12 07:16:37 2016(r302628)
+++ head/sys/conf/files.i386Tue Jul 12 07:33:39 2016(r302629)
@@ -254,6 +254,7 @@ dev/hyperv/vmbus/hyperv.c   
optionalhy
 dev/hyperv/vmbus/hyperv_busdma.c   optionalhyperv
 dev/hyperv/vmbus/vmbus.c   optionalhyperv
 dev/hyperv/vmbus/vmbus_et.coptionalhyperv
+dev/hyperv/vmbus/vmbus_if.moptionalhyperv
 dev/hyperv/vmbus/i386/hyperv_machdep.c optionalhyperv
 dev/hyperv/vmbus/i386/vmbus_vector.S   optionalhyperv
 dev/ichwd/ichwd.c  optional ichwd

Modified: head/sys/dev/hyperv/include/hyperv.h
==
--- head/sys/dev/hyperv/include/hyperv.hTue Jul 12 07:16:37 2016
(r302628)
+++ head/sys/dev/hyperv/include/hyperv.hTue Jul 12 07:33:39 2016
(r302629)
@@ -73,10 +73,13 @@ typedef uint8_t hv_bool_uint8_t;
  * 2.4   --  Windows 8
  * 3.0   --  Windows 8.1
  */
-#define HV_VMBUS_VERSION_WS2008((0 << 16) | (13))
-#define HV_VMBUS_VERSION_WIN7  ((1 << 16) | (1))
-#define HV_VMBUS_VERSION_WIN8  ((2 << 16) | (4))
-#define HV_VMBUS_VERSION_WIN8_1((3 << 16) | (0))
+#define VMBUS_VERSION_WS2008   ((0 << 16) | (13))
+#define VMBUS_VERSION_WIN7 ((1 << 16) | (1))
+#define VMBUS_VERSION_WIN8 ((2 << 16) | (4))
+#define VMBUS_VERSION_WIN8_1   ((3 << 16) | (0))
+
+#define VMBUS_VERSION_MAJOR(ver)   (((uint32_t)(ver)) >> 16)
+#define VMBUS_VERSION_MINOR(ver)   (((uint32_t)(ver)) & 0x)
 
 /*
  * Make maximum size of pipe payload of 16K
@@ -723,5 +726,4 @@ hv_get_phys_addr(void *virt)
return (ret);
 }
 
-extern uint32_t hv_vmbus_protocal_version;
 #endif  /* __HYPERV_H__ */

Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
==
--- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Tue Jul 12 07:16:37 
2016(r302628)
+++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Tue Jul 12 07:33:39 
2016(r302629)
@@ -114,9 +114,11 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
+
 #include "hv_net_vsc.h"
 #include "hv_rndis.h"
 #include "hv_rndis_filter.h"
+#include "vmbus_if.h"
 
 #define hv_chan_rxrhv_chan_priv1
 #define hv_chan_txrhv_chan_priv2
@@ -2369,8 +2371,10 @@ static int
 hn_create_tx_ring(struct hn_softc *sc, int id)
 {
struct hn_tx_ring *txr = >hn_tx_ring[id];
+   device_t dev = sc->hn_dev;
bus_dma_tag_t parent_dtag;
int error, i;
+   uint32_t version;
 
txr->hn_sc = sc;
txr->hn_tx_idx = id;
@@ -2409,10 +2413,18 @@ hn_create_tx_ring(struct hn_softc *sc, i
}
 
txr->hn_direct_tx_size = 

svn commit: r302626 - head/sys/conf

2016-07-12 Thread Dmitry Chagin
Author: dchagin
Date: Tue Jul 12 06:12:58 2016
New Revision: 302626
URL: https://svnweb.freebsd.org/changeset/base/302626

Log:
  Fix pc98 LINT build.
  
  MFC after:4 days

Modified:
  head/sys/conf/files.pc98

Modified: head/sys/conf/files.pc98
==
--- head/sys/conf/files.pc98Tue Jul 12 06:06:10 2016(r302625)
+++ head/sys/conf/files.pc98Tue Jul 12 06:12:58 2016(r302626)
@@ -63,6 +63,7 @@ compat/linux/linux_ioctl.coptional comp
 compat/linux/linux_ipc.c   optional compat_linux
 compat/linux/linux_mib.c   optional compat_linux
 compat/linux/linux_misc.c  optional compat_linux
+compat/linux/linux_mmap.c  optional compat_linux
 compat/linux/linux_signal.coptional compat_linux
 compat/linux/linux_socket.coptional compat_linux
 compat/linux/linux_stats.c optional compat_linux
___
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"