svn commit: r301915 - in stable/10/sys/dev/hyperv: netvsc vmbus
Author: sephe Date: Wed Jun 15 05:57:06 2016 New Revision: 301915 URL: https://svnweb.freebsd.org/changeset/base/301915 Log: MFC 296181,296184,296187,296188,296252,296253,296289,296290 296181 hyperv/channel: Add debug sysctl nodes for channel indices It would serve as a debug tool, if the shared buffer ring's indices stopped updating. Submitted by: HongJiang Zhang Reviewed by:sephe, Jun Su Modified by:sephe MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D5402 296184 hyperv/hn: Switch to if_transmit by default after r296178 MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D5485 296187 hyperv/hn: Utilize mbuf flowid MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D5488 296188 hyperv/channel: Add sysctl node for channel owner cpu And add sysctl node for sub-channel's channel id. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D5489 296252 hyperv/hn: Set hash per-packet-info for each packet transmission So that the host could dispatch the TX done back to this TX ring's owner channel MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D5498 296253 hyperv/channel: Nuke useless stack variable MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D5499 296289 hyperv/chan: Add sysctl node to check whether monitor is allocated or not MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D5502 296290 hyperv/chan: Function renaming; no functional change The renamed function create a sysctl tree for channel, and many non-statistics nodes exists, so don't claim it only adds sysctl nodes for statistics. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D5503 Modified: stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.h stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c stable/10/sys/dev/hyperv/netvsc/hv_rndis.h stable/10/sys/dev/hyperv/vmbus/hv_channel.c stable/10/sys/dev/hyperv/vmbus/hv_ring_buffer.c stable/10/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.h == --- stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.hWed Jun 15 05:31:35 2016(r301914) +++ stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.hWed Jun 15 05:57:06 2016(r301915) @@ -1000,10 +1000,11 @@ struct buf_ring; struct hn_rx_ring { struct ifnet*hn_ifp; - struct lro_ctrl hn_lro; + int hn_rx_idx; /* Trust csum verification on host side */ int hn_trust_hcsum; /* HN_TRUST_HCSUM_ */ + struct lro_ctrl hn_lro; u_long hn_csum_ip; u_long hn_csum_tcp; @@ -1038,6 +1039,7 @@ struct hn_tx_ring { struct buf_ring *hn_mbuf_br; int hn_oactive; + int hn_tx_idx; struct mtx hn_tx_lock; struct hn_softc *hn_sc; Modified: stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c == --- stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Wed Jun 15 05:31:35 2016(r301914) +++ stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Wed Jun 15 05:57:06 2016(r301915) @@ -140,6 +140,7 @@ __FBSDID("$FreeBSD$"); #define HN_RNDIS_MSG_LEN \ (sizeof(rndis_msg) + \ + RNDIS_HASH_PPI_SIZE + \ RNDIS_VLAN_PPI_SIZE + \ RNDIS_TSO_PPI_SIZE + \ RNDIS_CSUM_PPI_SIZE) @@ -276,7 +277,7 @@ static int hn_bind_tx_taskq = -1; SYSCTL_INT(_hw_hn, OID_AUTO, bind_tx_taskq, CTLFLAG_RDTUN, _bind_tx_taskq, 0, "Bind TX taskqueue to the specified cpu"); -static int hn_use_if_start = 1; +static int hn_use_if_start = 0; SYSCTL_INT(_hw_hn, OID_AUTO, use_if_start, CTLFLAG_RDTUN, _use_if_start, 0, "Use if_start TX method"); @@ -757,6 +758,7 @@ hn_encap(struct hn_tx_ring *txr, struct rndis_msg *rndis_mesg; rndis_packet *rndis_pkt; rndis_per_packet_info *rppi; + struct ndis_hash_info *hash_info; uint32_t rndis_msg_size; packet = >netvsc_pkt; @@ -781,6 +783,18
svn commit: r301914 - stable/10/sys/dev/hyperv/vmbus
Author: sephe Date: Wed Jun 15 05:31:35 2016 New Revision: 301914 URL: https://svnweb.freebsd.org/changeset/base/301914 Log: MFC 296180,297634 296180 hyperv: Use proper fence function to keep store-load order for msgs sfence only makes sure about the store-store order, which is not sufficient here. Use atomic_thread_fence_seq_cst() as suggested jhb and kib (a locked op in the nutshell, which should have the Reviewed by:jhb, kib, Jun Su MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D5436 297634 hyperv: Use mb() instead of atomic_thread_fence_seq_cst() Since atomic_thread_fence_seq_cst() will become compiler fence on UP kernel. Reviewed by:kib, Dexuan Cui MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D5852 Modified: stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c == --- stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Wed Jun 15 05:16:37 2016(r301913) +++ stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Wed Jun 15 05:31:35 2016(r301914) @@ -116,8 +116,12 @@ handled: * message_pending and EOMing. Otherwise, the EOMing will * not deliver any more messages * since there is no empty slot +* +* NOTE: +* mb() is used here, since atomic_thread_fence_seq_cst() +* will become compler fence on UP kernel. */ - wmb(); + mb(); if (msg->header.message_flags.u.message_pending) { /* @@ -186,8 +190,12 @@ hv_vmbus_isr(struct trapframe *frame) * message_pending and EOMing. Otherwise, the EOMing will * not deliver any more messages * since there is no empty slot +* +* NOTE: +* mb() is used here, since atomic_thread_fence_seq_cst() +* will become compler fence on UP kernel. */ - wmb(); + mb(); if (msg->header.message_flags.u.message_pending) { /* ___ svn-src-stable-10@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10 To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"
svn commit: r301913 - in stable/10/sys: net sys
Author: sephe Date: Wed Jun 15 05:16:37 2016 New Revision: 301913 URL: https://svnweb.freebsd.org/changeset/base/301913 Log: MFC 296178 buf_ring/drbr: Add buf_ring_peek_clear_sc and use it in drbr_peek Unlike buf_ring_peek, it only supports single consumer mode, and it clears the cons_head if DEBUG_BUFRING/INVARIANTS is defined. The normal use case of drbr_peek for network drivers is: m = drbr_peek(br); err = hw_spec_encap(); /* could m_defrag/m_collapse */ (*) if (err) { if (m == NULL) drbr_advance(br); else drbr_putback(br, m); /* break the loop */ } drbr_advance(br); The race is: If hw_spec_encap() m_defrag or m_collapse the mbuf, i.e. the old mbuf was freed, or like the Hyper-V's network driver, that transmission- done does not even require the TX lock; then on the other CPU at the (*) time, the freed mbuf could be recycled and being drbr_enqueue even before the current CPU had the chance to call drbr_{advance,putback}. This triggers a panic in drbr_enqueue duplicated element check, if DEBUG_BUFRING/INVARIANTS is defined. Use buf_ring_peek_clear_sc() in drbr_peek() to fix the above race. This change is a NO-OP, if neither DEBUG_BUFRING nor INVARIANTS are defined. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D5416 Modified: stable/10/sys/net/if_var.h stable/10/sys/sys/buf_ring.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/net/if_var.h == --- stable/10/sys/net/if_var.h Wed Jun 15 03:48:55 2016(r301912) +++ stable/10/sys/net/if_var.h Wed Jun 15 05:16:37 2016(r301913) @@ -705,7 +705,7 @@ drbr_peek(struct ifnet *ifp, struct buf_ return (m); } #endif - return(buf_ring_peek(br)); + return(buf_ring_peek_clear_sc(br)); } static __inline void Modified: stable/10/sys/sys/buf_ring.h == --- stable/10/sys/sys/buf_ring.hWed Jun 15 03:48:55 2016 (r301912) +++ stable/10/sys/sys/buf_ring.hWed Jun 15 05:16:37 2016 (r301913) @@ -263,6 +263,37 @@ buf_ring_peek(struct buf_ring *br) return (br->br_ring[br->br_cons_head]); } +static __inline void * +buf_ring_peek_clear_sc(struct buf_ring *br) +{ +#ifdef DEBUG_BUFRING + void *ret; + + if (!mtx_owned(br->br_lock)) + panic("lock not held on single consumer dequeue"); +#endif + /* +* I believe it is safe to not have a memory barrier +* here because we control cons and tail is worst case +* a lagging indicator so we worst case we might +* return NULL immediately after a buffer has been enqueued +*/ + if (br->br_cons_head == br->br_prod_tail) + return (NULL); + +#ifdef DEBUG_BUFRING + /* +* Single consumer, i.e. cons_head will not move while we are +* running, so atomic_swap_ptr() is not necessary here. +*/ + ret = br->br_ring[br->br_cons_head]; + br->br_ring[br->br_cons_head] = NULL; + return (ret); +#else + return (br->br_ring[br->br_cons_head]); +#endif +} + static __inline int buf_ring_full(struct buf_ring *br) { ___ svn-src-stable-10@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10 To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"
svn commit: r301912 - in stable/10/sys/dev/hyperv: include netvsc storvsc vmbus
Author: sephe Date: Wed Jun 15 03:48:55 2016 New Revision: 301912 URL: https://svnweb.freebsd.org/changeset/base/301912 Log: MFC 296083,296084,296085,296086,296087,296088,296089 296083 hyperv: Remove useless channel inbound_lock It serves no purpose. Reviewed by:Hongjiang Zhang MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D5450 296084 hyperv: Always set device for channels And unregister hv_device only for primary channels, who own the hv_device. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D5451 296085 hyperv/hn: Pass channel as the channel callback argument This is the preamble to pass channel back to hn(4) upon TX/RX done. Reviewed by:Hongjiang Zhang MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D5452 296086 hyperv/hn: Pass channel to TX/RX done This is preamble to associate the TX/RX rings to their channel. While I'm here, revoke unused netvsc_recv_rollup. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D5453 296087 hyperv/hn: Associate TX/RX ring with channel This fixes the TX/RX ring selection for TX/RX done. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D5454 296088 hyperv/hn: Remove the useless num_outstanding_sends We rely on taskqueue draining now. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D5456 296089 hyperv/hn: Make transmission path channel aware Chimney sending buffer still needs conversion, which will be done along with the upcoming vRSS support. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D5457 Modified: stable/10/sys/dev/hyperv/include/hyperv.h stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.c stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.h stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c stable/10/sys/dev/hyperv/netvsc/hv_rndis.h stable/10/sys/dev/hyperv/netvsc/hv_rndis_filter.c stable/10/sys/dev/hyperv/netvsc/hv_rndis_filter.h stable/10/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c stable/10/sys/dev/hyperv/vmbus/hv_channel.c stable/10/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/hyperv/include/hyperv.h == --- stable/10/sys/dev/hyperv/include/hyperv.h Wed Jun 15 03:17:05 2016 (r301911) +++ stable/10/sys/dev/hyperv/include/hyperv.h Wed Jun 15 03:48:55 2016 (r301912) @@ -753,8 +753,6 @@ typedef struct hv_vmbus_channel { */ hv_vmbus_ring_buffer_info inbound; - struct mtx inbound_lock; - struct taskqueue * rxq; struct task channel_task; hv_vmbus_pfn_channel_callback on_channel_callback; @@ -824,12 +822,16 @@ typedef struct hv_vmbus_channel { * This will be NULL for the primary channel. */ struct hv_vmbus_channel *primary_channel; + /* -* Support per channel state for use by vmbus drivers. +* Driver private data */ - void*per_channel_state; + void*hv_chan_priv1; + void*hv_chan_priv2; } hv_vmbus_channel; +#define HV_VMBUS_CHAN_ISPRIMARY(chan) ((chan)->primary_channel == NULL) + static inline void hv_set_channel_read_state(hv_vmbus_channel* channel, boolean_t state) { Modified: stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.c == --- stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.cWed Jun 15 03:17:05 2016(r301911) +++ stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.cWed Jun 15 03:48:55 2016(r301912) @@ -62,7 +62,8 @@ static int hv_nv_connect_to_vsp(struct static void hv_nv_on_send_completion(netvsc_dev *net_dev, struct hv_device *device, hv_vm_packet_descriptor *pkt); static void hv_nv_on_receive(netvsc_dev *net_dev, -struct hv_device *device, hv_vm_packet_descriptor *pkt); +struct hv_device *device, struct hv_vmbus_channel *chan, +hv_vm_packet_descriptor *pkt); /* * @@ -115,7 +116,7 @@ hv_nv_get_inbound_net_device(struct hv_d * permit incoming packets if and only if there * are outstanding sends. */ -
svn commit: r301911 - in stable/10/sys/dev/hyperv: netvsc vmbus
Author: sephe Date: Wed Jun 15 03:17:05 2016 New Revision: 301911 URL: https://svnweb.freebsd.org/changeset/base/301911 Log: MFC 296022,296024,296076 296022 hyperv/hn: Implement ifnet.if_transmit method It will be turned on by default later. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D5415 296024 hyperv/hn: Hold the TX ring lock then drain TX desc buf_ring Reported by:Hongxiong Xian MFC after: 1 week Sponsored by: Microsoft OSTC 296076 hyperv: Use atomic_fetchadd_int to get GPADL id. Reviewed by:Hongjiang Zhang MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D5439 Modified: stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.h stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c stable/10/sys/dev/hyperv/vmbus/hv_channel.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.h == --- stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.hWed Jun 15 01:59:55 2016(r301910) +++ stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.hWed Jun 15 03:17:05 2016(r301911) @@ -1034,6 +1034,9 @@ struct hn_tx_ring { struct task hn_tx_task; struct task hn_txeof_task; + struct buf_ring *hn_mbuf_br; + int hn_oactive; + struct mtx hn_tx_lock; struct hn_softc *hn_sc; Modified: stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c == --- stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Wed Jun 15 01:59:55 2016(r301910) +++ stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Wed Jun 15 03:17:05 2016(r301911) @@ -274,6 +274,10 @@ static int hn_bind_tx_taskq = -1; SYSCTL_INT(_hw_hn, OID_AUTO, bind_tx_taskq, CTLFLAG_RDTUN, _bind_tx_taskq, 0, "Bind TX taskqueue to the specified cpu"); +static int hn_use_if_start = 1; +SYSCTL_INT(_hw_hn, OID_AUTO, use_if_start, CTLFLAG_RDTUN, +_use_if_start, 0, "Use if_start TX method"); + /* * Forward declarations */ @@ -313,6 +317,13 @@ static void hn_create_rx_data(struct hn_ static void hn_destroy_rx_data(struct hn_softc *sc); static void hn_set_tx_chimney_size(struct hn_softc *, int); +static int hn_transmit(struct ifnet *, struct mbuf *); +static void hn_xmit_qflush(struct ifnet *); +static int hn_xmit(struct hn_tx_ring *, int); +static void hn_xmit_txeof(struct hn_tx_ring *); +static void hn_xmit_taskfunc(void *, int); +static void hn_xmit_txeof_taskfunc(void *, int); + static int hn_ifmedia_upd(struct ifnet *ifp __unused) { @@ -444,13 +455,18 @@ netvsc_attach(device_t dev) ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; ifp->if_ioctl = hn_ioctl; - ifp->if_start = hn_start; ifp->if_init = hn_ifinit; /* needed by hv_rf_on_device_add() code */ ifp->if_mtu = ETHERMTU; - IFQ_SET_MAXLEN(>if_snd, 512); - ifp->if_snd.ifq_drv_maxlen = 511; - IFQ_SET_READY(>if_snd); + if (hn_use_if_start) { + ifp->if_start = hn_start; + IFQ_SET_MAXLEN(>if_snd, 512); + ifp->if_snd.ifq_drv_maxlen = 511; + IFQ_SET_READY(>if_snd); + } else { + ifp->if_transmit = hn_transmit; + ifp->if_qflush = hn_xmit_qflush; + } ifmedia_init(>hn_media, 0, hn_ifmedia_upd, hn_ifmedia_sts); ifmedia_add(>hn_media, IFM_ETHER | IFM_AUTO, 0, NULL); @@ -946,6 +962,12 @@ again: if (!error) { ETHER_BPF_MTAP(ifp, txd->m); if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1); + if (!hn_use_if_start) { + if_inc_counter(ifp, IFCOUNTER_OBYTES, + txd->m->m_pkthdr.len); + if (txd->m->m_flags & M_MCAST) + if_inc_counter(ifp, IFCOUNTER_OMCASTS, 1); + } } hn_txdesc_put(txr, txd); @@ -998,6 +1020,8 @@ hn_start_locked(struct hn_tx_ring *txr, struct ifnet *ifp = sc->hn_ifp; struct hv_device *device_ctx = vmbus_get_devctx(sc->hn_dev); + KASSERT(hn_use_if_start, + ("hn_start_locked is called, when if_start is disabled")); KASSERT(txr == >hn_tx_ring[0], ("not the first TX ring")); mtx_assert(>hn_tx_lock, MA_OWNED); @@ -1555,7 +1579,7 @@ static void hn_stop(hn_softc_t *sc) { struct ifnet *ifp; - int ret; + int ret, i; struct hv_device *device_ctx = vmbus_get_devctx(sc->hn_dev); ifp = sc->hn_ifp; @@ -1565,6 +1589,9 @@ hn_stop(hn_softc_t *sc) atomic_clear_int(>if_drv_flags,
svn commit: r301910 - stable/10/sys/kern
Author: jamie Date: Wed Jun 15 01:59:55 2016 New Revision: 301910 URL: https://svnweb.freebsd.org/changeset/base/301910 Log: MFC r301764: Fix a vnode leak when giving a child jail a too-long path when debug.disablefullpath=1. Modified: stable/10/sys/kern/kern_jail.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/kern/kern_jail.c == --- stable/10/sys/kern/kern_jail.c Wed Jun 15 01:58:54 2016 (r301909) +++ stable/10/sys/kern/kern_jail.c Wed Jun 15 01:59:55 2016 (r301910) @@ -1022,6 +1022,7 @@ kern_jail_set(struct thread *td, struct if (len + (path[0] == '/' && strcmp(mypr->pr_path, "/") ? strlen(mypr->pr_path) : 0) > MAXPATHLEN) { error = ENAMETOOLONG; + vrele(root); goto done_free; } } ___ svn-src-stable-10@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10 To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"
svn commit: r301909 - stable/10/sys/kern
Author: jamie Date: Wed Jun 15 01:58:54 2016 New Revision: 301909 URL: https://svnweb.freebsd.org/changeset/base/301909 Log: MFC r301760: Re-order some jail parameter reading to prevent a vnode leak. Modified: stable/10/sys/kern/kern_jail.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/kern/kern_jail.c == --- stable/10/sys/kern/kern_jail.c Wed Jun 15 01:57:22 2016 (r301908) +++ stable/10/sys/kern/kern_jail.c Wed Jun 15 01:58:54 2016 (r301909) @@ -932,6 +932,46 @@ kern_jail_set(struct thread *td, struct } #endif + error = vfs_getopt(opts, "osrelease", (void **), ); + if (error == ENOENT) + osrelstr = NULL; + else if (error != 0) + goto done_free; + else { + if (flags & JAIL_UPDATE) { + error = EINVAL; + vfs_opterror(opts, + "osrelease cannot be changed after creation"); + goto done_errmsg; + } + if (len == 0 || len >= OSRELEASELEN) { + error = EINVAL; + vfs_opterror(opts, + "osrelease string must be 1-%d bytes long", + OSRELEASELEN - 1); + goto done_errmsg; + } + } + + error = vfs_copyopt(opts, "osreldate", , sizeof(osreldt)); + if (error == ENOENT) + osreldt = 0; + else if (error != 0) + goto done_free; + else { + if (flags & JAIL_UPDATE) { + error = EINVAL; + vfs_opterror(opts, + "osreldate cannot be changed after creation"); + goto done_errmsg; + } + if (osreldt == 0) { + error = EINVAL; + vfs_opterror(opts, "osreldate cannot be 0"); + goto done_errmsg; + } + } + fullpath_disabled = 0; root = NULL; error = vfs_getopt(opts, "path", (void **), ); @@ -987,46 +1027,6 @@ kern_jail_set(struct thread *td, struct } } - error = vfs_getopt(opts, "osrelease", (void **), ); - if (error == ENOENT) - osrelstr = NULL; - else if (error != 0) - goto done_free; - else { - if (flags & JAIL_UPDATE) { - error = EINVAL; - vfs_opterror(opts, - "osrelease cannot be changed after creation"); - goto done_errmsg; - } - if (len == 0 || len >= OSRELEASELEN) { - error = EINVAL; - vfs_opterror(opts, - "osrelease string must be 1-%d bytes long", - OSRELEASELEN - 1); - goto done_errmsg; - } - } - - error = vfs_copyopt(opts, "osreldate", , sizeof(osreldt)); - if (error == ENOENT) - osreldt = 0; - else if (error != 0) - goto done_free; - else { - if (flags & JAIL_UPDATE) { - error = EINVAL; - vfs_opterror(opts, - "osreldate cannot be changed after creation"); - goto done_errmsg; - } - if (osreldt == 0) { - error = EINVAL; - vfs_opterror(opts, "osreldate cannot be 0"); - goto done_errmsg; - } - } - /* * Find the specified jail, or at least its parent. * This abuses the file error codes ENOENT and EEXIST. ___ svn-src-stable-10@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10 To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"
svn commit: r301907 - stable/10/sys/kern
Author: jamie Date: Wed Jun 15 01:56:20 2016 New Revision: 301907 URL: https://svnweb.freebsd.org/changeset/base/301907 Log: MFC r301745: Make sure the OSD methods for jail set and remove can't run concurrently, by holding allprison_lock exclusively (even if only for a moment before downgrading) on all paths that call PR_METHOD_REMOVE. Since they may run on a downgraded lock, it's still possible for them to run concurrently with PR_METHOD_GET, which will need to use the prison lock. Modified: stable/10/sys/kern/kern_jail.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/kern/kern_jail.c == --- stable/10/sys/kern/kern_jail.c Wed Jun 15 01:54:17 2016 (r301906) +++ stable/10/sys/kern/kern_jail.c Wed Jun 15 01:56:20 2016 (r301907) @@ -2400,7 +2400,14 @@ sys_jail_attach(struct thread *td, struc if (error) return (error); - sx_slock(_lock); + /* +* Start with exclusive hold on allprison_lock to ensure that a possible +* PR_METHOD_REMOVE call isn't concurrent with jail_set or jail_remove. +* But then immediately downgrade it since we don't need to stop +* readers. +*/ + sx_xlock(_lock); + sx_downgrade(_lock); pr = prison_find_child(td->td_ucred->cr_prison, uap->jid); if (pr == NULL) { sx_sunlock(_lock); @@ -2618,9 +2625,11 @@ prison_complete(void *context, int pendi { struct prison *pr = context; + sx_xlock(_lock); mtx_lock(>pr_mtx); prison_deref(pr, pr->pr_uref - ? PD_DEREF | PD_DEUREF | PD_LOCKED : PD_LOCKED); + ? PD_DEREF | PD_DEUREF | PD_LOCKED | PD_LIST_XLOCKED + : PD_LOCKED | PD_LIST_XLOCKED); } /* @@ -2664,13 +2673,8 @@ prison_deref(struct prison *pr, int flag */ if (lasturef) { if (!(flags & (PD_LIST_SLOCKED | PD_LIST_XLOCKED))) { - if (ref > 1) { - sx_slock(_lock); - flags |= PD_LIST_SLOCKED; - } else { - sx_xlock(_lock); - flags |= PD_LIST_XLOCKED; - } + sx_xlock(_lock); + flags |= PD_LIST_XLOCKED; } (void)osd_jail_call(pr, PR_METHOD_REMOVE, NULL); mtx_lock(>pr_mtx); ___ svn-src-stable-10@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10 To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"
svn commit: r301906 - stable/10/sys/kern
Author: jamie Date: Wed Jun 15 01:54:17 2016 New Revision: 301906 URL: https://svnweb.freebsd.org/changeset/base/301906 Log: MFC r301737: Remove a comment that was part of copied code, and is misleading in the new location. Modified: stable/10/sys/kern/sysv_msg.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/kern/sysv_msg.c == --- stable/10/sys/kern/sysv_msg.c Wed Jun 15 01:49:01 2016 (r301905) +++ stable/10/sys/kern/sysv_msg.c Wed Jun 15 01:54:17 2016 (r301906) @@ -326,12 +326,6 @@ msgunload() #endif for (msqid = 0; msqid < msginfo.msgmni; msqid++) { - /* -* Look for an unallocated and unlocked msqid_ds. -* msqid_ds's can be locked by msgsnd or msgrcv while -* they are copying the message in/out. We can't -* re-use the entry until they release it. -*/ msqkptr = [msqid]; if (msqkptr->u.msg_qbytes != 0 || (msqkptr->u.msg_perm.mode & MSG_LOCKED) != 0) ___ svn-src-stable-10@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10 To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"
svn commit: r301905 - in stable/10: lib/libc/sys sys/kern
Author: jamie Date: Wed Jun 15 01:49:01 2016 New Revision: 301905 URL: https://svnweb.freebsd.org/changeset/base/301905 Log: MFC r300983: Mark jail(2), and the sysctls that it (and only it) uses as deprecated. jail(8) has long used jail_set(2), and those sysctl only cause confusion. Modified: stable/10/lib/libc/sys/jail.2 stable/10/sys/kern/kern_jail.c Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libc/sys/jail.2 == --- stable/10/lib/libc/sys/jail.2 Wed Jun 15 01:42:53 2016 (r301904) +++ stable/10/lib/libc/sys/jail.2 Wed Jun 15 01:49:01 2016 (r301905) @@ -106,7 +106,7 @@ pointers can be set to an arrays of IPv4 the prison, or NULL if none. IPv4 addresses must be in network byte order. .Pp -This is equivalent to the +This is equivalent to, and deprecated in favor of, the .Fn jail_set system call (see below), with the parameters .Va path , Modified: stable/10/sys/kern/kern_jail.c == --- stable/10/sys/kern/kern_jail.c Wed Jun 15 01:42:53 2016 (r301904) +++ stable/10/sys/kern/kern_jail.c Wed Jun 15 01:49:01 2016 (r301905) @@ -4306,7 +4306,7 @@ SYSCTL_PROC(_security_jail, OID_AUTO, vn #if defined(INET) || defined(INET6) SYSCTL_UINT(_security_jail, OID_AUTO, jail_max_af_ips, CTLFLAG_RW, _max_af_ips, 0, -"Number of IP addresses a jail may have at most per address family"); +"Number of IP addresses a jail may have at most per address family (deprecated)"); #endif /* @@ -4346,59 +4346,59 @@ sysctl_jail_default_allow(SYSCTL_HANDLER SYSCTL_PROC(_security_jail, OID_AUTO, set_hostname_allowed, CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE, NULL, PR_ALLOW_SET_HOSTNAME, sysctl_jail_default_allow, "I", -"Processes in jail can set their hostnames"); +"Processes in jail can set their hostnames (deprecated)"); SYSCTL_PROC(_security_jail, OID_AUTO, socket_unixiproute_only, CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE, (void *)1, PR_ALLOW_SOCKET_AF, sysctl_jail_default_allow, "I", -"Processes in jail are limited to creating UNIX/IP/route sockets only"); +"Processes in jail are limited to creating UNIX/IP/route sockets only (deprecated)"); SYSCTL_PROC(_security_jail, OID_AUTO, sysvipc_allowed, CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE, NULL, PR_ALLOW_SYSVIPC, sysctl_jail_default_allow, "I", -"Processes in jail can use System V IPC primitives"); +"Processes in jail can use System V IPC primitives (deprecated)"); SYSCTL_PROC(_security_jail, OID_AUTO, allow_raw_sockets, CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE, NULL, PR_ALLOW_RAW_SOCKETS, sysctl_jail_default_allow, "I", -"Prison root can create raw sockets"); +"Prison root can create raw sockets (deprecated)"); SYSCTL_PROC(_security_jail, OID_AUTO, chflags_allowed, CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE, NULL, PR_ALLOW_CHFLAGS, sysctl_jail_default_allow, "I", -"Processes in jail can alter system file flags"); +"Processes in jail can alter system file flags (deprecated)"); SYSCTL_PROC(_security_jail, OID_AUTO, mount_allowed, CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE, NULL, PR_ALLOW_MOUNT, sysctl_jail_default_allow, "I", -"Processes in jail can mount/unmount jail-friendly file systems"); +"Processes in jail can mount/unmount jail-friendly file systems (deprecated)"); SYSCTL_PROC(_security_jail, OID_AUTO, mount_devfs_allowed, CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE, NULL, PR_ALLOW_MOUNT_DEVFS, sysctl_jail_default_allow, "I", -"Processes in jail can mount the devfs file system"); +"Processes in jail can mount the devfs file system (deprecated)"); SYSCTL_PROC(_security_jail, OID_AUTO, mount_fdescfs_allowed, CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE, NULL, PR_ALLOW_MOUNT_FDESCFS, sysctl_jail_default_allow, "I", -"Processes in jail can mount the fdescfs file system"); +"Processes in jail can mount the fdescfs file system (deprecated)"); SYSCTL_PROC(_security_jail, OID_AUTO, mount_nullfs_allowed, CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE, NULL, PR_ALLOW_MOUNT_NULLFS, sysctl_jail_default_allow, "I", -"Processes in jail can mount the nullfs file system"); +"Processes in jail can mount the nullfs file system (deprecated)"); SYSCTL_PROC(_security_jail, OID_AUTO, mount_procfs_allowed, CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE, NULL, PR_ALLOW_MOUNT_PROCFS, sysctl_jail_default_allow, "I", -"Processes in jail can mount the procfs file system"); +"Processes in jail can mount the procfs file system (deprecated)"); SYSCTL_PROC(_security_jail, OID_AUTO, mount_linprocfs_allowed, CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE, NULL, PR_ALLOW_MOUNT_LINPROCFS, sysctl_jail_default_allow, "I", -"Processes in jail can mount the
svn commit: r301904 - stable/10/sys/dev/ntb/ntb_hw
Author: mav Date: Wed Jun 15 01:42:53 2016 New Revision: 301904 URL: https://svnweb.freebsd.org/changeset/base/301904 Log: MFC r301293: When negotiating NTB_SB01BASE_LOCKUP workaround, don't try to limit the BAR size to 1MB. According to Xeon v3 specifications and my tests, that size register is write-once and so not writeable after BIOS written it. Instead of that, make the code work with BAR of any sufficient size, properly calculating offset within its base. It also simplifies the code. Sponsored by: iXsystems, Inc. Modified: stable/10/sys/dev/ntb/ntb_hw/ntb_hw.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/ntb/ntb_hw/ntb_hw.c == --- stable/10/sys/dev/ntb/ntb_hw/ntb_hw.c Wed Jun 15 01:41:43 2016 (r301903) +++ stable/10/sys/dev/ntb/ntb_hw/ntb_hw.c Wed Jun 15 01:42:53 2016 (r301904) @@ -75,7 +75,6 @@ __FBSDID("$FreeBSD$"); #defineNTB_MSIX_VER_GUARD 0xaabbccdd #defineNTB_MSIX_RECEIVED 0xe0f0e0f0 -#defineONE_MB (1024u * 1024) /* * PCI constants could be somewhere more generic, but aren't defined/used in @@ -239,6 +238,7 @@ struct ntb_softc { /* Memory window used to access peer bar0 */ #define B2B_MW_DISABLEDUINT8_MAX uint8_t b2b_mw_idx; + uint32_tmsix_xlat; uint8_t msix_mw_idx; uint8_t mw_count; @@ -1375,12 +1375,12 @@ ntb_get_msix_info(struct ntb_softc *ntb) laddr = bus_read_4(msix->msix_table_res, offset + PCI_MSIX_ENTRY_LOWER_ADDR); - ntb_printf(2, "local lower MSIX addr(%u): 0x%x\n", i, laddr); + ntb_printf(2, "local MSIX addr(%u): 0x%x\n", i, laddr); KASSERT((laddr & MSI_INTEL_ADDR_BASE) == MSI_INTEL_ADDR_BASE, ("local MSIX addr 0x%x not in MSI base 0x%x", laddr, MSI_INTEL_ADDR_BASE)); - ntb->msix_data[i].nmd_ofs = laddr & ~MSI_INTEL_ADDR_BASE; + ntb->msix_data[i].nmd_ofs = laddr; data = bus_read_4(msix->msix_table_res, offset + PCI_MSIX_ENTRY_DATA); @@ -1674,15 +1674,6 @@ xeon_reset_sbar_size(struct ntb_softc *n bar_sz--; else bar_sz = 0; - } else if (HAS_FEATURE(NTB_SB01BASE_LOCKUP) && - ntb_mw_to_bar(ntb, ntb->msix_mw_idx) == idx) { - /* Restrict LAPIC BAR to 1MB */ - pci_write_config(ntb->device, bar->psz_off, 20, 1); - pci_write_config(ntb->device, bar->ssz_off, 20, 1); - bar_sz = pci_read_config(ntb->device, bar->psz_off, 1); - bar_sz = pci_read_config(ntb->device, bar->ssz_off, 1); - (void)bar_sz; - return; } pci_write_config(ntb->device, bar->ssz_off, bar_sz, 1); bar_sz = pci_read_config(ntb->device, bar->ssz_off, 1); @@ -1693,24 +1684,19 @@ static void xeon_set_sbar_base_and_limit(struct ntb_softc *ntb, uint64_t bar_addr, enum ntb_bar idx, enum ntb_bar regbar) { - uint64_t reg_val, lmt_addr; + uint64_t reg_val; uint32_t base_reg, lmt_reg; bar_get_xlat_params(ntb, idx, _reg, NULL, _reg); if (idx == regbar) bar_addr += ntb->b2b_off; - lmt_addr = bar_addr; - - if (HAS_FEATURE(NTB_SB01BASE_LOCKUP) && - ntb_mw_to_bar(ntb, ntb->msix_mw_idx) == idx) - lmt_addr += ONE_MB; /* * Set limit registers first to avoid an errata where setting the base * registers locks the limit registers. */ if (!bar_is_64bit(ntb, idx)) { - ntb_reg_write(4, lmt_reg, lmt_addr); + ntb_reg_write(4, lmt_reg, bar_addr); reg_val = ntb_reg_read(4, lmt_reg); (void)reg_val; @@ -1718,7 +1704,7 @@ xeon_set_sbar_base_and_limit(struct ntb_ reg_val = ntb_reg_read(4, base_reg); (void)reg_val; } else { - ntb_reg_write(8, lmt_reg, lmt_addr); + ntb_reg_write(8, lmt_reg, bar_addr); reg_val = ntb_reg_read(8, lmt_reg); (void)reg_val; @@ -1747,31 +1733,13 @@ xeon_set_pbar_xlat(struct ntb_softc *ntb static int xeon_setup_msix_bar(struct ntb_softc *ntb) { - struct ntb_pci_bar_info *lapic_bar; enum ntb_bar bar_num; - int rc; if (!HAS_FEATURE(NTB_SB01BASE_LOCKUP)) return (0); bar_num = ntb_mw_to_bar(ntb, ntb->msix_mw_idx); - lapic_bar = >bar_info[bar_num]; - - /* Restrict LAPIC BAR to 1MB */ - if (lapic_bar->size > ONE_MB) { - rc = bus_adjust_resource(ntb->device, SYS_RES_MEMORY, -
svn commit: r301903 - stable/10/sys/dev/ntb/ntb_hw
Author: mav Date: Wed Jun 15 01:41:43 2016 New Revision: 301903 URL: https://svnweb.freebsd.org/changeset/base/301903 Log: MFC r301292: When negotiating MSIX parameters, give other head time to see our NTB_MSIX_RECEIVED status, before making upper layers overwrite it. This is not completely perfect, but now it works better then before. Sponsored by: iXsystems, Inc. Modified: stable/10/sys/dev/ntb/ntb_hw/ntb_hw.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/ntb/ntb_hw/ntb_hw.c == --- stable/10/sys/dev/ntb/ntb_hw/ntb_hw.c Wed Jun 15 01:39:43 2016 (r301902) +++ stable/10/sys/dev/ntb/ntb_hw/ntb_hw.c Wed Jun 15 01:41:43 2016 (r301903) @@ -2820,6 +2820,8 @@ ntb_exchange_msix(void *ctx) ntb = ctx; + if (ntb->peer_msix_good) + goto msix_good; if (ntb->peer_msix_done) goto msix_done; @@ -2851,16 +2853,21 @@ msix_done: goto reschedule; ntb->peer_msix_good = true; + /* Give peer time to see our NTB_MSIX_RECEIVED. */ + goto reschedule; +msix_good: ntb_poll_link(ntb); ntb_link_event(ntb); return; reschedule: ntb->lnk_sta = pci_read_config(ntb->device, ntb->reg->lnk_sta, 2); - if (_xeon_link_is_up(ntb)) - callout_reset(>peer_msix_work, hz / 100, ntb_exchange_msix, ntb); - else + if (_xeon_link_is_up(ntb)) { + callout_reset(>peer_msix_work, + hz * (ntb->peer_msix_good ? 2 : 1) / 100, + ntb_exchange_msix, ntb); + } else ntb_spad_clear(ntb); } ___ svn-src-stable-10@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10 To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"
svn commit: r301902 - stable/10/sys/dev/ntb/if_ntb
Author: mav Date: Wed Jun 15 01:39:43 2016 New Revision: 301902 URL: https://svnweb.freebsd.org/changeset/base/301902 Log: MFC r300610: Re-enable write combining, disabled by default at r295486. if_ntb(4) strongly benefits from WC, improving throughput from 350Mbit/s to 8-10Gbit/s on my tests. Modified: stable/10/sys/dev/ntb/if_ntb/if_ntb.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/ntb/if_ntb/if_ntb.c == --- stable/10/sys/dev/ntb/if_ntb/if_ntb.c Tue Jun 14 23:58:02 2016 (r301901) +++ stable/10/sys/dev/ntb/if_ntb/if_ntb.c Wed Jun 15 01:39:43 2016 (r301902) @@ -621,6 +621,10 @@ ntb_transport_probe(struct ntb_softc *nt mw->xlat_size = 0; mw->virt_addr = NULL; mw->dma_addr = 0; + + rc = ntb_mw_set_wc(nt->ntb, i, VM_MEMATTR_WRITE_COMBINING); + if (rc) + ntb_printf(0, "Unable to set mw%d caching\n", i); } qp_bitmap = ntb_db_valid_mask(ntb); ___ svn-src-stable-10@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10 To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"