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-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: 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 = &sc->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 = hn_direct_

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-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: 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(
-   &hv_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->mhc_active);
 }
 
+uint32_t
+vmbus_gpadl_alloc(struct vmbus_softc *sc)
+{
+   return atomic_fetchadd_int(&sc->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(&sc->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-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: 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-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: 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: 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-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: 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(&hv_vmbus_g_connection.channel_lock);
+   mtx_lock(&sc->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, &hv_vmbus_g_connection.channel_anchor,
-   list_entry) {
+   TAILQ_FOREACH(channel, &sc->vmbus_chlist, ch_link) {
if (memcmp(&channel->offer_msg.offer.interface_type,
&new_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(&hv_vmbus_g_connection.channel_anchor,
-   new_channel, list_entry);
+   TAILQ_INSERT_TAIL(&sc->vmbus_chlist, new_channel, ch_link);
}
-   mtx_unlock(&hv_vmbus_g_connection.channel_lock);
+   mtx_unlock(&sc->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(&hv_vmbus_g_connection.channel_lock);
-   TAILQ_INSERT_TAIL(&hv_vmbus_g_connection.channel_anchor,
-   new_channel, list_entry);   
-   mtx_unlock(&hv_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(&sc->vmbus_chlist_lock);
+   TAILQ_INSERT_TAIL(&sc->vmbus_chlist, new_channel,
+   ch_link);
+   mtx_unlock(&sc->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_unattac

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(&sc->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(&channel->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(&sc->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-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: 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 = &channel->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(&channel->ch_sysctl_ctx);
 
/*
 * set rxq to NULL to avoid more requests be scheduled
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: 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-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: 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, &device_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 &=
+   ~HN_RX_F

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&D
  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,
 &msix_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(&msi_pic);
mtx_init(&msi_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-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: 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-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: 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, &sc->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, &channel->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(&sc->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(&eventf->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: head/s

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-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: 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(&sc->vmbus_scan_lock);
+   mtx_destroy(&sc->vmbus_chlist_lock);
 
return (ret);
 }
@@ -1283,6 +1284,8 @@ vmbus_detach(device_t dev)
 
free(sc->vmbus_chmap, M_DEVBUF);
mtx_destroy(&sc->vmbus_scan_lock);
+   mtx_destroy(&sc->vmbus_chlist_lock);
+
return (0);
 }
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: 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-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: 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(&hdr.overhead, sec);
be32enc(&hdr.nl_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-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: 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-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: 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(&pst->aqm_pie_callout)) {
-   /* callout was reset */
-   mtx_unlock(&pst->lock_mtx);
-   return;
-   }
-
-   if (!callout_active(&pst->aqm_pie_callout)) {
-   /* callout was stopped */
-   mtx_unlock(&pst->lock_mtx);
-   mtx_destroy(&pst->lock_mtx);
-   q->psi->nr_active_q--;
-   return;
-   }
-   callout_deactivate(&pst->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=&q->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 +

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-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: 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(&ioat->poll_timer, IOAT_SHRINK_PERIOD,
+   callout_reset(&ioat->shrink_timer, IOAT_SHRINK_PERIOD,
ioat_shrink_timer_callback, ioat);
 }
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: 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-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: 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-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

svn commit: 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 RMS25KB040
 Intel Integrated RAID Module

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-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: 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(&sc->cleanup_lock);
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: 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(&ioat->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(&ioat->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(&ioat->submit_lock);
+
+   ioat_process_events(ioat);
+
+   mtx_lock(&ioat->submit_lock);
+   dug = TRUE;
+   KASSERT(ioat->is_submitter_processing == TRUE,
+   ("is_submitter_processing"));
+   ioat->is_submitter_processing = FALSE;
+   wakeup(&ioat->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,
&ioat->is_resize_pending, 0, "resize pending");
+   SYSCTL_ADD_INT(ctx, state, OID_AUTO, "is_submitter_processing",
+   CTLFLAG_RD, &ioat->is_submitter_processing, 0,
+   "submitter processing");
SYSCTL_ADD_INT(ctx, state, OID_AUTO, "is_completion_pending",
CTLFLAG_RD, &ioat->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-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: 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(&ioat->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(&ioat->submit_lock);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: 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: 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(&ioat->submit_lock, MA_OWNED);
+   KASSERT(!ioat->quiescing || error == ENXIO,
+   ("reserved during quiesce"));
return (error);
 }
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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 = &desc->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 = &desc->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-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: 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-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: 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, &arg, sizeof(arg));
-   if (error != 0 || req->newptr == NULL)
-   return (error);
-
-   error = SYSCTL_IN(req, &arg, sizeof(arg));
-   if (error != 0)
-   return (error);
-
-   if (arg != 0) {
-   ioat_acquire(&ioat->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(&ioat->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-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: 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(&ioat->resetting, IOAT_REFLK, 0, "IRH_drain", 0);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: 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-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: 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)
> -TARGET_CPUARCH=${TARGET_ARCH:C/mips(n32|64)?(el)?/mips/:C/arm(v6)?(eb)?/arm/:C/powerp

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
>> (r3

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:}}
+MACHINE_CPUARCH=$

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-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: 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: 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(&event_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(&channel->inbound);
+   taskqueue_enqueue(channel->rxq, &channel->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 d

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(&sc->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 = &channel->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,
-   &channel->offer_msg.child_rel_id, 0, "channel id");
+   &channel->ch_id, 0, "channel id");
}
SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(devch_id_sysctl), OID_AUTO,
"cpu", CTLFLAG_RD, &channel->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->c

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 = &channel->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: 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(&sc->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, &alloc, 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-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: 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, &sc->vmbus_chlist, ch_link) {
-   if (memcmp(&channel->offer_msg.offer.interface_type,
-   &new_channel->offer_msg.offer.interface_type,
+   if (memcmp(&channel->ch_guid_type, &new_channel->ch_guid_type,
sizeof(hv_guid)) == 0 &&
-   memcmp(&channel->offer_msg.offer.interface_instance,
-   &new_channel->offer_msg.offer.interface_instance,
+   memcmp(&channel->ch_guid_inst, &new_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(&child_dev->class_id, &type, sizeof(hv_guid));
-   memcpy(&child_dev->

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(&new_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-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: 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, &g_net_vsc_device_type.data, sizeof(hv_guid))) {
+   if (VMBUS_PROBE_GUID(device_get_parent(dev), dev,
+   &g_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, &gBlkVscDeviceType, sizeof(hv_guid))) {
+   if (VMBUS_PROBE_GUID(parent, dev, &gBlkVscDeviceType) == 0)
return DRIVER_BLKVSC;
-   } else if (!memcmp(p, &gStorVscDeviceType, sizeof(hv_guid))) {
+   if (VMBUS_PROBE_GUID(parent, dev, &gStorVscDeviceType) == 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, &service_guid, sizeof(hv_guid))) {
+   if (VMBUS_PROBE_GUID(device_get_parent(dev), dev, &service_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))
retu

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-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: 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-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: 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(&props, 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: 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, &recvlen,
&requestid);

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"), &devs, &devcnt) == 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(&hv_dev->device_id, buf, sizeof(buf));
+   /*
+* Trying to find GUID of Network Device
+* TODO: need vmbus interface.
+*/
+   chan = vmbus_get_channel(dev);
+   hyperv_guid2str(&chan->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,
&recvlen, &requestid);

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,
&recv_len, &request_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_

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(&channel->sc_lock);
TAILQ_INSERT_TAIL(&channel->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(&sc->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, cha

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, &net_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,
HV_VMBUS_PACKET_T

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

2016-07-12 Thread Sepherosa Ziehau
Author: sephe
Date: Wed Jul 13 06:17:15 2016
New Revision: 302706
URL: https://svnweb.freebsd.org/changeset/base/302706

Log:
  hyperv: Get rid of hv_device, which is unnecessary indirection.
  
  MFC after:1 week
  Sponsored by: Microsoft OSTC
  Differential Revision:https://reviews.freebsd.org/D7034

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
  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 06:09:34 2016
(r302705)
+++ head/sys/dev/hyperv/include/hyperv.hWed Jul 13 06:17:15 2016
(r302706)
@@ -399,24 +399,6 @@ typedef struct {
 
 #define HW_MACADDR_LEN 6
 
-enum {
-   HV_VMBUS_IVAR_TYPE,
-   HV_VMBUS_IVAR_INSTANCE,
-   HV_VMBUS_IVAR_NODE,
-   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 *)
-
-
 /*
  * Common defines for Hyper-V ICs
  */
@@ -538,7 +520,6 @@ typedef union {
 } __packed hv_vmbus_connection_id;
 
 typedef struct hv_vmbus_channel {
-   struct hv_device*   device;
device_tch_dev;
struct vmbus_softc  *vmbus_sc;
hv_vmbus_channel_state  state;
@@ -652,15 +633,6 @@ hv_set_channel_read_state(hv_vmbus_chann
channel->batched_reading = state;
 }
 
-typedef struct hv_device {
-   hv_guid class_id;
-   hv_guid device_id;
-   device_tdevice;
-   hv_vmbus_channel*   channel;
-} hv_device;
-
-
-
 inthv_vmbus_channel_recv_packet(
hv_vmbus_channel*   channel,
void*   buffer,
@@ -742,4 +714,10 @@ hv_get_phys_addr(void *virt)
return (ret);
 }
 
+static __inline struct hv_vmbus_channel *
+vmbus_get_channel(device_t dev)
+{
+   return device_get_ivars(dev);
+}
+
 #endif  /* __HYPERV_H__ */

Modified: head/sys/dev/hyperv/vmbus/hv_channel.c
==
--- head/sys/dev/hyperv/vmbus/hv_channel.c  Wed Jul 13 06:09:34 2016
(r302705)
+++ head/sys/dev/hyperv/vmbus/hv_channel.c  Wed Jul 13 06:17:15 2016
(r302706)
@@ -106,10 +106,10 @@ vmbus_channel_sysctl_create(hv_vmbus_cha
hv_vmbus_channel* primary_ch = channel->primary_channel;
 
if (primary_ch == NULL) {
-   dev = channel->device->device;
+   dev = channel->ch_dev;
ch_id = channel->ch_id;
} else {
-   dev = primary_ch->device->device;
+   dev = primary_ch->ch_dev;
ch_id = primary_ch->ch_id;
sub_ch_id = channel->ch_subidx;
}

Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c
==
--- head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Wed Jul 13 06:09:34 2016
(r302705)
+++ head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Wed Jul 13 06:17:15 2016
(r302706)
@@ -162,7 +162,6 @@ vmbus_channel_process_offer(hv_vmbus_cha
 * It is a sub channel offer, process it.
 */
new_channel->primary_channel = channel;
-   new_channel->device = channel->device;
new_channel->ch_dev = channel->ch_dev;
mtx_lock(&channel->sc_lock);
TAILQ_INSERT_TAIL(&channel->sc_list_anchor,
@@ -207,13 +206,6 @@ vmbus_channel_process_offer(hv_vmbus_cha
new_channel->state = HV_CHANNEL_OPEN_STATE;
 
/*
-* Start the process of binding this offer to the driver
-* (We need to set the device field before calling
-* hv_vmbus_child_device_add())
-*/
-   new_channel->device = hv_vmbus_child_device_create(new_channel);
-
-   /*
 * Add the new device to the bus. This will kick off device-driver
 * binding which eventually invokes the device driver's AddDevice()
 * method.

Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h
==
--- head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h   Wed Jul 13 06:09:34 2016
(r302705)
+++ head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h   Wed Jul 13 06:17:15 2016
(r302706)
@@ -212,9 +212,6 @@ void
hv_vmbus_free_vmbus_channel(hv_vm
 void

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

2016-07-12 Thread Sepherosa Ziehau
Author: sephe
Date: Wed Jul 13 06:30:33 2016
New Revision: 302707
URL: https://svnweb.freebsd.org/changeset/base/302707

Log:
  hyperv/vmbus: Nuke unused field from hv_vmbus_channel.
  
  MFC after:1 week
  Sponsored by: Microsoft OSTC
  Differential Revision:https://reviews.freebsd.org/D7036

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 06:17:15 2016
(r302706)
+++ head/sys/dev/hyperv/include/hyperv.hWed Jul 13 06:30:33 2016
(r302707)
@@ -564,8 +564,6 @@ typedef struct hv_vmbus_channel {
 */
boolean_t   batched_reading;
 
-   boolean_t   is_dedicated_interrupt;
-
struct hypercall_sigevt_in  *ch_sigevt;
struct hyperv_dma   ch_sigevt_dma;
 

Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c
==
--- head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Wed Jul 13 06:17:15 2016
(r302706)
+++ head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Wed Jul 13 06:30:33 2016
(r302707)
@@ -311,11 +311,8 @@ vmbus_channel_on_offer_internal(struct v
}
new_channel->ch_sigevt->hc_connid = VMBUS_CONNID_EVENT;
 
-   if (sc->vmbus_version != VMBUS_VERSION_WS2008) {
-   new_channel->is_dedicated_interrupt =
-   (offer->is_dedicated_interrupt != 0);
+   if (sc->vmbus_version != VMBUS_VERSION_WS2008)
new_channel->ch_sigevt->hc_connid = offer->connection_id;
-   }
 
new_channel->monitor_group = (uint8_t) offer->monitor_id / 32;
new_channel->monitor_bit = (uint8_t) offer->monitor_id % 32;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

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

Log:
  hyperv/bufring: Remove unused fields
  
  MFC after:1 week
  Sponsored by: Microsoft OSTC
  Differential Revision:https://reviews.freebsd.org/D7037

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

Modified: head/sys/dev/hyperv/include/hyperv.h
==
--- head/sys/dev/hyperv/include/hyperv.hWed Jul 13 06:30:33 2016
(r302707)
+++ head/sys/dev/hyperv/include/hyperv.hWed Jul 13 06:39:04 2016
(r302708)
@@ -471,7 +471,7 @@ typedef struct {
uint8_t reserved[4084];
 
/*
-* WARNING: Ring data starts here + ring_data_start_offset
+* WARNING: Ring data starts here
 *  !!! DO NOT place any fields below this !!!
 */
uint8_t buffer[0];  /* doubles as interrupt mask */
@@ -491,10 +491,8 @@ typedef struct {
 
 typedef struct {
hv_vmbus_ring_buffer*   ring_buffer;
-   uint32_tring_size;  /* Include the shared header */
struct mtx  ring_lock;
uint32_tring_data_size; /* ring_size */
-   uint32_tring_data_start_offset;
 } hv_vmbus_ring_buffer_info;
 
 typedef void (*hv_vmbus_pfn_channel_callback)(void *context);

Modified: head/sys/dev/hyperv/vmbus/hv_ring_buffer.c
==
--- head/sys/dev/hyperv/vmbus/hv_ring_buffer.c  Wed Jul 13 06:30:33 2016
(r302707)
+++ head/sys/dev/hyperv/vmbus/hv_ring_buffer.c  Wed Jul 13 06:39:04 2016
(r302708)
@@ -286,7 +286,6 @@ hv_vmbus_ring_buffer_init(
ring_info->ring_buffer->read_index =
ring_info->ring_buffer->write_index = 0;
 
-   ring_info->ring_size = buffer_len;
ring_info->ring_data_size = buffer_len - sizeof(hv_vmbus_ring_buffer);
 
mtx_init(&ring_info->ring_lock, "vmbus ring buffer", NULL, MTX_SPIN);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

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

Log:
  hyperv/vmbus: Pack bool field into flags field
  
  MFC after:1 week
  Sponsored by: Microsoft OSTC
  Differential Revision:https://reviews.freebsd.org/D7038

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 06:39:04 2016
(r302708)
+++ head/sys/dev/hyperv/include/hyperv.hWed Jul 13 06:46:29 2016
(r302709)
@@ -551,17 +551,6 @@ typedef struct hv_vmbus_channel {
hv_vmbus_pfn_channel_callback   on_channel_callback;
void*   channel_callback_context;
 
-   /*
-* If batched_reading is set to "true", mask the interrupt
-* and read until the channel is empty.
-* If batched_reading is set to "false", the channel is not
-* going to perform batched reading.
-*
-* Batched reading is enabled by default; specific
-* drivers that don't want this behavior can turn it off.
-*/
-   boolean_t   batched_reading;
-
struct hypercall_sigevt_in  *ch_sigevt;
struct hyperv_dma   ch_sigevt_dma;
 
@@ -622,11 +611,23 @@ typedef struct hv_vmbus_channel {
 #define HV_VMBUS_CHAN_ISPRIMARY(chan)  ((chan)->primary_channel == NULL)
 
 #define VMBUS_CHAN_FLAG_HASMNF 0x0001
+/*
+ * If this flag is set, this channel's interrupt will be masked in ISR,
+ * and the RX bufring will be drained before this channel's interrupt is
+ * unmasked.
+ *
+ * This flag is turned on by default.  Drivers can turn it off according
+ * to their own requirement.
+ */
+#define VMBUS_CHAN_FLAG_BATCHREAD  0x0002
 
 static inline void
-hv_set_channel_read_state(hv_vmbus_channel* channel, boolean_t state)
+hv_set_channel_read_state(hv_vmbus_channel* channel, boolean_t on)
 {
-   channel->batched_reading = state;
+   if (!on)
+   channel->ch_flags &= ~VMBUS_CHAN_FLAG_BATCHREAD;
+   else
+   channel->ch_flags |= VMBUS_CHAN_FLAG_BATCHREAD;
 }
 
 inthv_vmbus_channel_recv_packet(

Modified: head/sys/dev/hyperv/vmbus/hv_channel.c
==
--- head/sys/dev/hyperv/vmbus/hv_channel.c  Wed Jul 13 06:39:04 2016
(r302708)
+++ head/sys/dev/hyperv/vmbus/hv_channel.c  Wed Jul 13 06:46:29 2016
(r302709)
@@ -856,11 +856,13 @@ VmbusProcessChannelEvent(void* context, 
void* arg;
uint32_t bytes_to_read;
hv_vmbus_channel* channel = (hv_vmbus_channel*)context;
-   boolean_t is_batched_reading;
+   bool is_batched_reading = false;
+
+   if (channel->ch_flags & VMBUS_CHAN_FLAG_BATCHREAD)
+   is_batched_reading = true;
 
if (channel->on_channel_callback != NULL) {
arg = channel->channel_callback_context;
-   is_batched_reading = channel->batched_reading;
/*
 * Optimize host to guest signaling by ensuring:
 * 1. While reading the channel, we disable interrupts from
@@ -917,7 +919,7 @@ vmbus_event_flags_proc(struct vmbus_soft
if (channel == NULL || channel->rxq == NULL)
continue;
 
-   if (channel->batched_reading)
+   if (channel->ch_flags & VMBUS_CHAN_FLAG_BATCHREAD)
hv_ring_buffer_read_begin(&channel->inbound);
taskqueue_enqueue(channel->rxq, &channel->channel_task);
}

Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c
==
--- head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Wed Jul 13 06:39:04 2016
(r302708)
+++ head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Wed Jul 13 06:46:29 2016
(r302709)
@@ -282,21 +282,19 @@ vmbus_channel_on_offer_internal(struct v
 {
hv_vmbus_channel* new_channel;
 
-   /* Allocate the channel object and save this offer */
+   /*
+* Allocate the channel object and save this offer
+*/
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;
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
-* reading. A specific service can choose to
-* disabl

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

2016-07-12 Thread Sepherosa Ziehau
Author: sephe
Date: Wed Jul 13 06:55:21 2016
New Revision: 302710
URL: https://svnweb.freebsd.org/changeset/base/302710

Log:
  hyperv/vmbus: Remove unnecessary callback check.
  
  MFC after:1 week
  Sponsored by: Microsoft OSTC
  Differential Revision:https://reviews.freebsd.org/D7046

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

Modified: head/sys/dev/hyperv/vmbus/hv_channel.c
==
--- head/sys/dev/hyperv/vmbus/hv_channel.c  Wed Jul 13 06:46:29 2016
(r302709)
+++ head/sys/dev/hyperv/vmbus/hv_channel.c  Wed Jul 13 06:55:21 2016
(r302710)
@@ -861,31 +861,29 @@ VmbusProcessChannelEvent(void* context, 
if (channel->ch_flags & VMBUS_CHAN_FLAG_BATCHREAD)
is_batched_reading = true;
 
-   if (channel->on_channel_callback != NULL) {
-   arg = channel->channel_callback_context;
-   /*
-* Optimize host to guest signaling by ensuring:
-* 1. While reading the channel, we disable interrupts from
-*host.
-* 2. Ensure that we process all posted messages from the host
-*before returning from this callback.
-* 3. Once we return, enable signaling from the host. Once this
-*state is set we check to see if additional packets are
-*available to read. In this case we repeat the process.
-*/
-   do {
-   if (is_batched_reading)
-   hv_ring_buffer_read_begin(&channel->inbound);
-
-   channel->on_channel_callback(arg);
-
-   if (is_batched_reading)
-   bytes_to_read =
-   hv_ring_buffer_read_end(&channel->inbound);
-   else
-   bytes_to_read = 0;
-   } while (is_batched_reading && (bytes_to_read != 0));
-   }
+   arg = channel->channel_callback_context;
+   /*
+* Optimize host to guest signaling by ensuring:
+* 1. While reading the channel, we disable interrupts from
+*host.
+* 2. Ensure that we process all posted messages from the host
+*before returning from this callback.
+* 3. Once we return, enable signaling from the host. Once this
+*state is set we check to see if additional packets are
+*available to read. In this case we repeat the process.
+*/
+   do {
+   if (is_batched_reading)
+   hv_ring_buffer_read_begin(&channel->inbound);
+
+   channel->on_channel_callback(arg);
+
+   if (is_batched_reading)
+   bytes_to_read =
+   hv_ring_buffer_read_end(&channel->inbound);
+   else
+   bytes_to_read = 0;
+   } while (is_batched_reading && (bytes_to_read != 0));
 }
 
 static __inline void
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"