svn commit: r302873 - in head/sys/dev/hyperv: include vmbus
Author: sephe Date: Fri Jul 15 05:59:27 2016 New Revision: 302873 URL: https://svnweb.freebsd.org/changeset/base/302873 Log: hyperv/vmbus: Set vcpuid to 0, if MSR_HV_VP_INDEX does not exist. Mainly for compatibility. While I'm here, rename cpuid related fields in hv_vmbus_channel. MFC after:1 week Sponsored by: Microsoft OSTC Differential Revision:https://reviews.freebsd.org/D7141 Modified: head/sys/dev/hyperv/include/hyperv.h head/sys/dev/hyperv/vmbus/hv_channel.c head/sys/dev/hyperv/vmbus/vmbus.c Modified: head/sys/dev/hyperv/include/hyperv.h == --- head/sys/dev/hyperv/include/hyperv.hFri Jul 15 05:51:58 2016 (r302872) +++ head/sys/dev/hyperv/include/hyperv.hFri Jul 15 05:59:27 2016 (r302873) @@ -274,16 +274,13 @@ typedef struct hv_vmbus_channel { struct hyperv_mon_param *ch_monprm; struct hyperv_dma ch_monprm_dma; + int ch_cpuid; /* owner cpu */ /* -* From Win8, this field specifies the target virtual process -* on which to deliver the interrupt from the host to guest. -* Before Win8, all channel interrupts would only be -* delivered on cpu 0. Setting this value to 0 would preserve -* the earlier behavior. +* Virtual cpuid for ch_cpuid; it is used to communicate cpuid +* related information w/ Hyper-V. If MSR_HV_VP_INDEX does not +* exist, ch_vcpuid will always be 0 for compatibility. */ - uint32_ttarget_vcpu; - /* The corresponding CPUID in the guest */ - uint32_ttarget_cpu; + uint32_tch_vcpuid; /* * If this is a primary channel, ch_subchan* fields Modified: head/sys/dev/hyperv/vmbus/hv_channel.c == --- head/sys/dev/hyperv/vmbus/hv_channel.c Fri Jul 15 05:51:58 2016 (r302872) +++ head/sys/dev/hyperv/vmbus/hv_channel.c Fri Jul 15 05:59:27 2016 (r302873) @@ -157,7 +157,7 @@ vmbus_channel_sysctl_create(hv_vmbus_cha >ch_id, 0, "channel id"); } SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(devch_id_sysctl), OID_AUTO, - "cpu", CTLFLAG_RD, >target_cpu, 0, "owner CPU id"); + "cpu", CTLFLAG_RD, >ch_cpuid, 0, "owner CPU id"); SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(devch_id_sysctl), OID_AUTO, "monitor_allocated", CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE, channel, 0, vmbus_channel_sysctl_monalloc, "I", @@ -226,7 +226,7 @@ hv_vmbus_channel_open( vmbus_chan_update_evtflagcnt(sc, new_channel); new_channel->rxq = VMBUS_PCPU_GET(new_channel->vmbus_sc, event_tq, - new_channel->target_cpu); + new_channel->ch_cpuid); if (new_channel->ch_flags & VMBUS_CHAN_FLAG_BATCHREAD) { TASK_INIT(_channel->channel_task, 0, vmbus_chan_task, new_channel); @@ -290,7 +290,7 @@ hv_vmbus_channel_open( req->chm_chanid = new_channel->ch_id; req->chm_openid = new_channel->ch_id; req->chm_gpadl = new_channel->ch_bufring_gpadl; - req->chm_vcpuid = new_channel->target_vcpu; + req->chm_vcpuid = new_channel->ch_vcpuid; req->chm_rxbr_pgofs = send_ring_buffer_size >> PAGE_SHIFT; if (user_data_len) memcpy(req->chm_udata, user_data, user_data_len); @@ -1005,7 +1005,7 @@ vmbus_chan_update_evtflagcnt(struct vmbu int flag_cnt; flag_cnt = (chan->ch_id / VMBUS_EVTFLAG_LEN) + 1; - flag_cnt_ptr = VMBUS_PCPU_PTR(sc, event_flags_cnt, chan->target_cpu); + flag_cnt_ptr = VMBUS_PCPU_PTR(sc, event_flags_cnt, chan->ch_cpuid); for (;;) { int old_flag_cnt; @@ -1017,8 +1017,7 @@ vmbus_chan_update_evtflagcnt(struct vmbu if (bootverbose) { device_printf(sc->vmbus_dev, "channel%u update cpu%d flag_cnt to %d\n", - chan->ch_id, - chan->target_cpu, flag_cnt); + chan->ch_id, chan->ch_cpuid, flag_cnt); } break; } @@ -1162,13 +1161,12 @@ vmbus_channel_cpu_set(struct hv_vmbus_ch cpu = 0; } - chan->target_cpu = cpu; - chan->target_vcpu = VMBUS_PCPU_GET(chan->vmbus_sc, vcpuid, cpu); + chan->ch_cpuid = cpu; + chan->ch_vcpuid = VMBUS_PCPU_GET(chan->vmbus_sc, vcpuid, cpu); if (bootverbose) { printf("vmbus_chan%u: assigned to cpu%u [vcpu%u]\n", - chan->ch_id, - chan->target_cpu, chan->target_vcpu); +
Re: svn commit: r302865 - head
> On Jul 14, 2016, at 21:43, Cy Schubertwrote: > > Author: cy > Date: Fri Jul 15 04:43:38 2016 > New Revision: 302865 > URL: https://svnweb.freebsd.org/changeset/base/302865 > > Log: > When building multiple kernels using KERNCONF, non-existent KERNCONF > files will produce an error and buildkernel will fail. Previously missing > KERNCONF files silently failed giving no indication as to why, only to > subsequently discover during installkernel that the desired kernel was > never built in the first place. > > Reviewed by:ngie@ > MFC after:1 week > Differential Revision:D7167 Relnotes: yes > Modified: > head/Makefile.inc1 > > Modified: head/Makefile.inc1 > == > --- head/Makefile.inc1Fri Jul 15 04:42:08 2016(r302864) > +++ head/Makefile.inc1Fri Jul 15 04:43:38 2016(r302865) > @@ -1140,6 +1140,8 @@ BUILDKERNELS+=${_kernel} > .if empty(INSTALLKERNEL) && !defined(NO_INSTALLKERNEL) > INSTALLKERNEL= ${_kernel} > .endif > +.else > +.error Missing KERNCONF ${KERNCONFDIR}/${_kernel} > .endif > .endfor > > ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r302872 - in head/sys/dev/hyperv: include vmbus
Author: sephe Date: Fri Jul 15 05:51:58 2016 New Revision: 302872 URL: https://svnweb.freebsd.org/changeset/base/302872 Log: hyperv/vmbus: Busdma-fy channel bufring. MFC after:1 week Sponsored by: Microsoft OSTC Differential Revision:https://reviews.freebsd.org/D7140 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.hFri Jul 15 05:40:34 2016 (r302871) +++ head/sys/dev/hyperv/include/hyperv.hFri Jul 15 05:51:58 2016 (r302872) @@ -257,13 +257,6 @@ typedef struct hv_vmbus_channel { int ch_montrig_idx; /* MNF trig index */ uint32_tch_montrig_mask;/* MNF trig mask */ - uint32_tring_buffer_gpadl_handle; - /* -* Allocated memory for ring buffer -*/ - void* ring_buffer_pages; - unsigned long ring_buffer_size; - uint32_tring_buffer_page_count; /* * send to parent */ @@ -312,6 +305,10 @@ typedef struct hv_vmbus_channel { void*hv_chan_priv2; void*hv_chan_priv3; + void*ch_bufring;/* TX+RX bufrings */ + struct hyperv_dma ch_bufring_dma; + uint32_tch_bufring_gpadl; + struct task ch_detach_task; TAILQ_ENTRY(hv_vmbus_channel) ch_prilink; /* primary chan link */ uint32_tch_subidx; /* subchan index */ Modified: head/sys/dev/hyperv/vmbus/hv_channel.c == --- head/sys/dev/hyperv/vmbus/hv_channel.c Fri Jul 15 05:40:34 2016 (r302871) +++ head/sys/dev/hyperv/vmbus/hv_channel.c Fri Jul 15 05:51:58 2016 (r302872) @@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -202,7 +203,7 @@ hv_vmbus_channel_open( struct vmbus_msghc *mh; uint32_t status; int ret = 0; - void *in, *out; + uint8_t *br; if (user_data_len > VMBUS_CHANMSG_CHOPEN_UDATA_SIZE) { device_printf(sc->vmbus_dev, @@ -210,6 +211,10 @@ hv_vmbus_channel_open( user_data_len, new_channel->ch_id); return EINVAL; } + KASSERT((send_ring_buffer_size & PAGE_MASK) == 0, + ("send bufring size is not multiple page")); + KASSERT((recv_ring_buffer_size & PAGE_MASK) == 0, + ("recv bufring size is not multiple page")); if (atomic_testandset_int(_channel->ch_stflags, VMBUS_CHAN_ST_OPENED_SHIFT)) @@ -230,46 +235,43 @@ hv_vmbus_channel_open( vmbus_chan_task_nobatch, new_channel); } - /* Allocate the ring buffer */ - out = contigmalloc((send_ring_buffer_size + recv_ring_buffer_size), - M_DEVBUF, M_ZERO, 0UL, BUS_SPACE_MAXADDR, PAGE_SIZE, 0); - KASSERT(out != NULL, - ("Error VMBUS: contigmalloc failed to allocate Ring Buffer!")); - if (out == NULL) { + /* +* Allocate the TX+RX bufrings. +* XXX should use ch_dev dtag +*/ + br = hyperv_dmamem_alloc(bus_get_dma_tag(sc->vmbus_dev), + PAGE_SIZE, 0, send_ring_buffer_size + recv_ring_buffer_size, + _channel->ch_bufring_dma, BUS_DMA_WAITOK | BUS_DMA_ZERO); + if (br == NULL) { + device_printf(sc->vmbus_dev, "bufring allocation failed\n"); ret = ENOMEM; goto failed; } + new_channel->ch_bufring = br; - in = ((uint8_t *) out + send_ring_buffer_size); - - new_channel->ring_buffer_pages = out; - new_channel->ring_buffer_page_count = (send_ring_buffer_size + - recv_ring_buffer_size) >> PAGE_SHIFT; - new_channel->ring_buffer_size = send_ring_buffer_size + - recv_ring_buffer_size; - - hv_vmbus_ring_buffer_init( - _channel->outbound, - out, - send_ring_buffer_size); - - hv_vmbus_ring_buffer_init( - _channel->inbound, - in, - recv_ring_buffer_size); + /* TX bufring comes first */ + hv_vmbus_ring_buffer_init(_channel->outbound, + br, send_ring_buffer_size); + /* RX bufring immediately follows TX bufring */ + hv_vmbus_ring_buffer_init(_channel->inbound, + br + send_ring_buffer_size, recv_ring_buffer_size); /* Create sysctl tree for this channel */ vmbus_channel_sysctl_create(new_channel); - /** -* Establish the gpadl
svn commit: r302871 - in head/sys/dev/hyperv: include vmbus
Author: sephe Date: Fri Jul 15 05:40:34 2016 New Revision: 302871 URL: https://svnweb.freebsd.org/changeset/base/302871 Log: hyperv/vmbus: Add vmbus_chan_gpadl_connect, which takes GPA physaddr MFC after:1 week Sponsored by: Microsoft OSTC Differential Revision:https://reviews.freebsd.org/D7139 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.hFri Jul 15 05:29:04 2016 (r302870) +++ head/sys/dev/hyperv/include/hyperv.hFri Jul 15 05:40:34 2016 (r302871) @@ -409,6 +409,9 @@ int hv_vmbus_channel_teardown_gpdal( hv_vmbus_channel* channel, uint32_tgpadl_handle); +intvmbus_chan_gpadl_connect(struct hv_vmbus_channel *chan, + bus_addr_t paddr, int size, uint32_t *gpadl); + struct hv_vmbus_channel* vmbus_select_outgoing_channel(struct hv_vmbus_channel *promary); void vmbus_channel_cpu_set(struct hv_vmbus_channel *chan, int cpu); Modified: head/sys/dev/hyperv/vmbus/hv_channel.c == --- head/sys/dev/hyperv/vmbus/hv_channel.c Fri Jul 15 05:29:04 2016 (r302870) +++ head/sys/dev/hyperv/vmbus/hv_channel.c Fri Jul 15 05:40:34 2016 (r302871) @@ -330,26 +330,33 @@ failed: */ int hv_vmbus_channel_establish_gpadl(struct hv_vmbus_channel *channel, -void *contig_buffer, uint32_t size, uint32_t *gpadl0) +void *contig_buffer, uint32_t size, uint32_t *gpadl) { - struct vmbus_softc *sc = channel->vmbus_sc; + return vmbus_chan_gpadl_connect(channel, + hv_get_phys_addr(contig_buffer), size, gpadl); +} + +int +vmbus_chan_gpadl_connect(struct hv_vmbus_channel *chan, bus_addr_t paddr, +int size, uint32_t *gpadl0) +{ + struct vmbus_softc *sc = chan->vmbus_sc; struct vmbus_msghc *mh; struct vmbus_chanmsg_gpadl_conn *req; const struct vmbus_message *msg; size_t reqsz; uint32_t gpadl, status; int page_count, range_len, i, cnt, error; - uint64_t page_id, paddr; + uint64_t page_id; /* * Preliminary checks. */ KASSERT((size & PAGE_MASK) == 0, - ("invalid GPA size %u, not multiple page size", size)); + ("invalid GPA size %d, not multiple page size", size)); page_count = size >> PAGE_SHIFT; - paddr = hv_get_phys_addr(contig_buffer); KASSERT((paddr & PAGE_MASK) == 0, ("GPA is not page aligned %jx", (uintmax_t)paddr)); page_id = paddr >> PAGE_SHIFT; @@ -390,13 +397,13 @@ hv_vmbus_channel_establish_gpadl(struct if (mh == NULL) { device_printf(sc->vmbus_dev, "can not get msg hypercall for gpadl->chan%u\n", - channel->ch_id); + chan->ch_id); return EIO; } req = vmbus_msghc_dataptr(mh); req->chm_hdr.chm_type = VMBUS_CHANMSG_TYPE_GPADL_CONN; - req->chm_chanid = channel->ch_id; + req->chm_chanid = chan->ch_id; req->chm_gpadl = gpadl; req->chm_range_len = range_len; req->chm_range_cnt = 1; @@ -409,7 +416,7 @@ hv_vmbus_channel_establish_gpadl(struct if (error) { device_printf(sc->vmbus_dev, "gpadl->chan%u msg hypercall exec failed: %d\n", - channel->ch_id, error); + chan->ch_id, error); vmbus_msghc_put(sc, mh); return error; } @@ -445,12 +452,12 @@ hv_vmbus_channel_establish_gpadl(struct if (status != 0) { device_printf(sc->vmbus_dev, "gpadl->chan%u failed: " - "status %u\n", channel->ch_id, status); + "status %u\n", chan->ch_id, status); return EIO; } else { if (bootverbose) { device_printf(sc->vmbus_dev, "gpadl->chan%u " - "succeeded\n", channel->ch_id); + "succeeded\n", chan->ch_id); } } return 0; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r302870 - head/sys/dev/hyperv/vmbus
Author: sephe Date: Fri Jul 15 05:29:04 2016 New Revision: 302870 URL: https://svnweb.freebsd.org/changeset/base/302870 Log: hyperv/vmbus: Use iovec for bufring scatter/gather list. MFC after:1 week Sponsored by: Microsoft OSTC Differential Revision:https://reviews.freebsd.org/D7134 Modified: head/sys/dev/hyperv/vmbus/hv_channel.c head/sys/dev/hyperv/vmbus/hv_ring_buffer.c head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Modified: head/sys/dev/hyperv/vmbus/hv_channel.c == --- head/sys/dev/hyperv/vmbus/hv_channel.c Fri Jul 15 05:15:21 2016 (r302869) +++ head/sys/dev/hyperv/vmbus/hv_channel.c Fri Jul 15 05:29:04 2016 (r302870) @@ -616,7 +616,7 @@ hv_vmbus_channel_send_packet( uint64_taligned_data; uint32_tpacket_len_aligned; boolean_t need_sig; - hv_vmbus_sg_buffer_list buffer_list[3]; + struct ioveciov[3]; packet_len = sizeof(hv_vm_packet_descriptor) + buffer_len; packet_len_aligned = HV_ALIGN_UP(packet_len, sizeof(uint64_t)); @@ -630,17 +630,16 @@ hv_vmbus_channel_send_packet( desc.length8 = (uint16_t) (packet_len_aligned >> 3); desc.transaction_id = request_id; - buffer_list[0].data = - buffer_list[0].length = sizeof(hv_vm_packet_descriptor); + iov[0].iov_base = + iov[0].iov_len = sizeof(hv_vm_packet_descriptor); - buffer_list[1].data = buffer; - buffer_list[1].length = buffer_len; + iov[1].iov_base = buffer; + iov[1].iov_len = buffer_len; - buffer_list[2].data = _data; - buffer_list[2].length = packet_len_aligned - packet_len; + iov[2].iov_base = _data; + iov[2].iov_len = packet_len_aligned - packet_len; - ret = hv_ring_buffer_write(>outbound, buffer_list, 3, - _sig); + ret = hv_ring_buffer_write(>outbound, iov, 3, _sig); /* TODO: We should determine if this is optional */ if (ret == 0 && need_sig) @@ -668,7 +667,7 @@ hv_vmbus_channel_send_packet_pagebuffer( uint32_tpacket_len; uint32_tpage_buflen; uint32_tpacketLen_aligned; - hv_vmbus_sg_buffer_list buffer_list[4]; + struct ioveciov[4]; hv_vmbus_channel_packet_page_buffer desc; uint32_tdescSize; uint64_talignedData = 0; @@ -694,20 +693,19 @@ hv_vmbus_channel_send_packet_pagebuffer( desc.transaction_id = request_id; desc.range_count = page_count; - buffer_list[0].data = - buffer_list[0].length = descSize; + iov[0].iov_base = + iov[0].iov_len = descSize; - buffer_list[1].data = page_buffers; - buffer_list[1].length = page_buflen; + iov[1].iov_base = page_buffers; + iov[1].iov_len = page_buflen; - buffer_list[2].data = buffer; - buffer_list[2].length = buffer_len; + iov[2].iov_base = buffer; + iov[2].iov_len = buffer_len; - buffer_list[3].data = - buffer_list[3].length = packetLen_aligned - packet_len; + iov[3].iov_base = + iov[3].iov_len = packetLen_aligned - packet_len; - ret = hv_ring_buffer_write(>outbound, buffer_list, 4, - _sig); + ret = hv_ring_buffer_write(>outbound, iov, 4, _sig); /* TODO: We should determine if this is optional */ if (ret == 0 && need_sig) @@ -735,7 +733,7 @@ hv_vmbus_channel_send_packet_multipagebu uint32_tpacket_len_aligned; uint32_tpfn_count; uint64_taligned_data = 0; - hv_vmbus_sg_buffer_list buffer_list[3]; + struct ioveciov[3]; hv_vmbus_channel_packet_multipage_buffer desc; pfn_count = @@ -772,17 +770,16 @@ hv_vmbus_channel_send_packet_multipagebu memcpy(desc.range.pfn_array, multi_page_buffer->pfn_array, pfn_count * sizeof(uint64_t)); - buffer_list[0].data = - buffer_list[0].length = desc_size; + iov[0].iov_base = + iov[0].iov_len = desc_size; - buffer_list[1].data = buffer; - buffer_list[1].length = buffer_len; + iov[1].iov_base = buffer; + iov[1].iov_len = buffer_len; - buffer_list[2].data = _data; - buffer_list[2].length = packet_len_aligned - packet_len; + iov[2].iov_base = _data; + iov[2].iov_len = packet_len_aligned - packet_len; - ret = hv_ring_buffer_write(>outbound, buffer_list, 3, - _sig); + ret = hv_ring_buffer_write(>outbound, iov, 3, _sig); /* TODO: We should determine if this is optional */ if (ret == 0 && need_sig) Modified:
svn commit: r302869 - head/sys/dev/hyperv/vmbus
Author: sephe Date: Fri Jul 15 05:15:21 2016 New Revision: 302869 URL: https://svnweb.freebsd.org/changeset/base/302869 Log: hyperv/vmbus: Remove unused function definition/declaration. MFC after:1 week Sponsored by: Microsoft OSTC Differential Revision:https://reviews.freebsd.org/D7131 Modified: head/sys/dev/hyperv/vmbus/hv_ring_buffer.c head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Modified: head/sys/dev/hyperv/vmbus/hv_ring_buffer.c == --- head/sys/dev/hyperv/vmbus/hv_ring_buffer.c Fri Jul 15 05:06:15 2016 (r302868) +++ head/sys/dev/hyperv/vmbus/hv_ring_buffer.c Fri Jul 15 05:15:21 2016 (r302869) @@ -261,16 +261,6 @@ static uint32_t copy_from_ring_buffer( uint32_tdest_len, uint32_tstart_read_offset); - -/** - * @brief Get the interrupt mask for the specified ring buffer. - */ -uint32_t -hv_vmbus_get_ring_buffer_interrupt_mask(hv_vmbus_ring_buffer_info *rbi) -{ - return rbi->ring_buffer->interrupt_mask; -} - /** * @brief Initialize the ring buffer. */ Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h == --- head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Fri Jul 15 05:06:15 2016 (r302868) +++ head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Fri Jul 15 05:15:21 2016 (r302869) @@ -110,13 +110,6 @@ inthv_ring_buffer_read( uint32_tbuffer_len, uint32_toffset); -uint32_t hv_vmbus_get_ring_buffer_interrupt_mask( - hv_vmbus_ring_buffer_info *ring_info); - -void hv_vmbus_dump_ring_info( - hv_vmbus_ring_buffer_info *ring_info, - char*prefix); - void hv_ring_buffer_read_begin( hv_vmbus_ring_buffer_info *ring_info); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r302868 - head/sys/dev/hyperv/vmbus
Author: sephe Date: Fri Jul 15 05:06:15 2016 New Revision: 302868 URL: https://svnweb.freebsd.org/changeset/base/302868 Log: hyperv/vmbus: Function rename MFC after:1 week Sponsored by: Microsoft OSTC Differential Revision:https://reviews.freebsd.org/D7129 Modified: head/sys/dev/hyperv/vmbus/hv_channel.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 Fri Jul 15 04:54:07 2016 (r302867) +++ head/sys/dev/hyperv/vmbus/hv_channel.c Fri Jul 15 05:06:15 2016 (r302868) @@ -1233,7 +1233,7 @@ vmbus_chan_msgproc_choffer(struct vmbus_ * Error is ignored here; don't have much to do if error * really happens. */ - hv_vmbus_child_device_register(chan); + vmbus_add_child(chan); } } @@ -1274,7 +1274,7 @@ vmbus_chan_detach_task(void *xchan, int if (VMBUS_CHAN_ISPRIMARY(chan)) { /* Only primary channel owns the device */ - hv_vmbus_child_device_unregister(chan); + vmbus_delete_child(chan); /* NOTE: DO NOT free primary channel for now */ } else { struct vmbus_softc *sc = chan->vmbus_sc; @@ -1336,7 +1336,7 @@ vmbus_chan_destroy_all(struct vmbus_soft TAILQ_REMOVE(>vmbus_prichans, chan, ch_prilink); mtx_unlock(>vmbus_prichan_lock); - hv_vmbus_child_device_unregister(chan); + vmbus_delete_child(chan); vmbus_chan_free(chan); mtx_lock(>vmbus_prichan_lock); Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h == --- head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Fri Jul 15 04:54:07 2016 (r302867) +++ head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Fri Jul 15 05:06:15 2016 (r302868) @@ -123,9 +123,4 @@ voidhv_ring_buffer_read_begin( uint32_t hv_ring_buffer_read_end( hv_vmbus_ring_buffer_info *ring_info); -inthv_vmbus_child_device_register( - struct hv_vmbus_channel *chan); -inthv_vmbus_child_device_unregister( - struct hv_vmbus_channel *chan); - #endif /* __HYPERV_PRIV_H__ */ Modified: head/sys/dev/hyperv/vmbus/vmbus.c == --- head/sys/dev/hyperv/vmbus/vmbus.c Fri Jul 15 04:54:07 2016 (r302867) +++ head/sys/dev/hyperv/vmbus/vmbus.c Fri Jul 15 05:06:15 2016 (r302868) @@ -1021,7 +1021,7 @@ vmbus_child_pnpinfo_str(device_t dev, de } int -hv_vmbus_child_device_register(struct hv_vmbus_channel *chan) +vmbus_add_child(struct hv_vmbus_channel *chan) { struct vmbus_softc *sc = chan->vmbus_sc; device_t parent = sc->vmbus_dev; @@ -1046,7 +1046,7 @@ done: } int -hv_vmbus_child_device_unregister(struct hv_vmbus_channel *chan) +vmbus_delete_child(struct hv_vmbus_channel *chan) { int error; Modified: head/sys/dev/hyperv/vmbus/vmbus_var.h == --- head/sys/dev/hyperv/vmbus/vmbus_var.h Fri Jul 15 04:54:07 2016 (r302867) +++ head/sys/dev/hyperv/vmbus/vmbus_var.h Fri Jul 15 05:06:15 2016 (r302868) @@ -146,6 +146,8 @@ struct vmbus_msghc; void vmbus_event_proc(struct vmbus_softc *, int); void vmbus_event_proc_compat(struct vmbus_softc *, int); void vmbus_handle_intr(struct trapframe *); +intvmbus_add_child(struct hv_vmbus_channel *); +intvmbus_delete_child(struct hv_vmbus_channel *); void vmbus_et_intr(struct trapframe *); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r302866 - head
In message <201607150450.u6f4oede061...@repo.freebsd.org>, Cy Schubert writes: > Author: cy > Date: Fri Jul 15 04:50:40 2016 > New Revision: 302866 > URL: https://svnweb.freebsd.org/changeset/base/302866 > > Log: > Document that missing KERNCONF files will now cause buildkernel to fail. > > Suggested by: ngie@ > Differential Revision: D7167 > > Modified: > head/UPDATING > > Modified: head/UPDATING > = > = > --- head/UPDATING Fri Jul 15 04:43:38 2016(r302865) > +++ head/UPDATING Fri Jul 15 04:50:40 2016(r302866) > @@ -31,6 +31,14 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 12 > disable the most expensive debugging functionality run > "ln -s 'abort:false,junk:false' /etc/malloc.conf".) > > +20160714: > + As of r302865 when building multiple kernels using KERNCONF, > + non-existent KERNCONF files will produce an error and buildkernel > + will fail. Previous to r302865 missing KERNCONF files silently > + failed giving no indication as to why, only to subsequently discover > + during installkernel that the desired kernel was never built in the > + first place. > + > 20160622: > The libc stub for the pipe(2) system call has been replaced with > a wrapper which calls the pipe2(2) system call and the pipe(2) is now > X-MFC with: r302865. -- Cheers, Cy Schubert <cy.schub...@cschubert.com> FreeBSD UNIX: <c...@freebsd.org> Web: http://www.FreeBSD.org The need of the many outweighs the greed of the few. ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r302865 - head
In message <201607150443.u6f4hcan060...@repo.freebsd.org>, Cy Schubert writes: > Author: cy > Date: Fri Jul 15 04:43:38 2016 > New Revision: 302865 > URL: https://svnweb.freebsd.org/changeset/base/302865 > > Log: > When building multiple kernels using KERNCONF, non-existent KERNCONF > files will produce an error and buildkernel will fail. Previously missing > KERNCONF files silently failed giving no indication as to why, only to > subsequently discover during installkernel that the desired kernel was > never built in the first place. > > Reviewed by:ngie@ > MFC after: 1 week > Differential Revision: D7167 > > Modified: > head/Makefile.inc1 > > Modified: head/Makefile.inc1 > = > = > --- head/Makefile.inc1Fri Jul 15 04:42:08 2016(r302864) > +++ head/Makefile.inc1Fri Jul 15 04:43:38 2016(r302865) > @@ -1140,6 +1140,8 @@ BUILDKERNELS+= ${_kernel} > .if empty(INSTALLKERNEL) && !defined(NO_INSTALLKERNEL) > INSTALLKERNEL= ${_kernel} > .endif > +.else > +.error Missing KERNCONF ${KERNCONFDIR}/${_kernel} > .endif > .endfor > > Ngie@ suggested that this also be a relnotes candidate. I'm not sure if I'd go so far. I'll leave it open for discussion or if re@ wants to. -- Cheers, Cy SchubertFreeBSD UNIX: Web: http://www.FreeBSD.org The need of the many outweighs the greed of the few. ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r302867 - head/sys/dev/hyperv/vmbus
Author: sephe Date: Fri Jul 15 04:54:07 2016 New Revision: 302867 URL: https://svnweb.freebsd.org/changeset/base/302867 Log: hyperv/vmbus: Remove unused struct MFC after:1 week Sponsored by: Microsoft OSTC Differential Revision:https://reviews.freebsd.org/D7127 Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h == --- head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Fri Jul 15 04:50:40 2016 (r302866) +++ head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Fri Jul 15 04:54:07 2016 (r302867) @@ -45,29 +45,6 @@ typedef struct { uint32_tlength; } hv_vmbus_sg_buffer_list; -typedef struct { - uint32_tcurrent_interrupt_mask; - uint32_tcurrent_read_index; - uint32_tcurrent_write_index; - uint32_tbytes_avail_to_read; - uint32_tbytes_avail_to_write; -} hv_vmbus_ring_buffer_debug_info; - -typedef struct { - uint32_trel_id; - struct hyperv_guid interface_type; - struct hyperv_guid interface_instance; - uint32_tmonitor_id; - uint32_tserver_monitor_pending; - uint32_tserver_monitor_latency; - uint32_tserver_monitor_connection_id; - uint32_tclient_monitor_pending; - uint32_tclient_monitor_latency; - uint32_tclient_monitor_connection_id; - hv_vmbus_ring_buffer_debug_info inbound; - hv_vmbus_ring_buffer_debug_info outbound; -} hv_vmbus_channel_debug_info; - /* * The format must be the same as hv_vm_data_gpa_direct */ ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r302866 - head
Author: cy Date: Fri Jul 15 04:50:40 2016 New Revision: 302866 URL: https://svnweb.freebsd.org/changeset/base/302866 Log: Document that missing KERNCONF files will now cause buildkernel to fail. Suggested by: ngie@ Differential Revision:D7167 Modified: head/UPDATING Modified: head/UPDATING == --- head/UPDATING Fri Jul 15 04:43:38 2016(r302865) +++ head/UPDATING Fri Jul 15 04:50:40 2016(r302866) @@ -31,6 +31,14 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 12 disable the most expensive debugging functionality run "ln -s 'abort:false,junk:false' /etc/malloc.conf".) +20160714: + As of r302865 when building multiple kernels using KERNCONF, + non-existent KERNCONF files will produce an error and buildkernel + will fail. Previous to r302865 missing KERNCONF files silently + failed giving no indication as to why, only to subsequently discover + during installkernel that the desired kernel was never built in the + first place. + 20160622: The libc stub for the pipe(2) system call has been replaced with a wrapper which calls the pipe2(2) system call and the pipe(2) is now ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r302865 - head
Author: cy Date: Fri Jul 15 04:43:38 2016 New Revision: 302865 URL: https://svnweb.freebsd.org/changeset/base/302865 Log: When building multiple kernels using KERNCONF, non-existent KERNCONF files will produce an error and buildkernel will fail. Previously missing KERNCONF files silently failed giving no indication as to why, only to subsequently discover during installkernel that the desired kernel was never built in the first place. Reviewed by: ngie@ MFC after:1 week Differential Revision:D7167 Modified: head/Makefile.inc1 Modified: head/Makefile.inc1 == --- head/Makefile.inc1 Fri Jul 15 04:42:08 2016(r302864) +++ head/Makefile.inc1 Fri Jul 15 04:43:38 2016(r302865) @@ -1140,6 +1140,8 @@ BUILDKERNELS+=${_kernel} .if empty(INSTALLKERNEL) && !defined(NO_INSTALLKERNEL) INSTALLKERNEL= ${_kernel} .endif +.else +.error Missing KERNCONF ${KERNCONFDIR}/${_kernel} .endif .endfor ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r302864 - in head/sys: conf dev/hyperv/vmbus modules/hyperv/vmbus
Author: sephe Date: Fri Jul 15 04:42:08 2016 New Revision: 302864 URL: https://svnweb.freebsd.org/changeset/base/302864 Log: hyperv/vmbus: Merge hv_channel_mgmt.c into hv_channel.c MFC after:1 week Sponsored by: Microsoft OSTC Differential Revision:https://reviews.freebsd.org/D7126 Deleted: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Modified: head/sys/conf/files.amd64 head/sys/conf/files.i386 head/sys/dev/hyperv/vmbus/hv_channel.c head/sys/modules/hyperv/vmbus/Makefile Modified: head/sys/conf/files.amd64 == --- head/sys/conf/files.amd64 Fri Jul 15 02:29:10 2016(r302863) +++ head/sys/conf/files.amd64 Fri Jul 15 04:42:08 2016(r302864) @@ -271,7 +271,6 @@ dev/hyperv/utilities/hv_shutdown.c opt dev/hyperv/utilities/hv_timesync.c optionalhyperv 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_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.i386Fri Jul 15 02:29:10 2016(r302863) +++ head/sys/conf/files.i386Fri Jul 15 04:42:08 2016(r302864) @@ -247,7 +247,6 @@ dev/hyperv/utilities/hv_shutdown.c opt dev/hyperv/utilities/hv_timesync.c optionalhyperv 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_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 Fri Jul 15 02:29:10 2016 (r302863) +++ head/sys/dev/hyperv/vmbus/hv_channel.c Fri Jul 15 04:42:08 2016 (r302864) @@ -53,8 +53,28 @@ __FBSDID("$FreeBSD$"); static voidvmbus_chan_send_event(hv_vmbus_channel* channel); static voidvmbus_chan_update_evtflagcnt(struct vmbus_softc *, const struct hv_vmbus_channel *); + static voidvmbus_chan_task(void *, int); static voidvmbus_chan_task_nobatch(void *, int); +static voidvmbus_chan_detach_task(void *, int); + +static voidvmbus_chan_msgproc_choffer(struct vmbus_softc *, + const struct vmbus_message *); +static voidvmbus_chan_msgproc_chrescind(struct vmbus_softc *, + const struct vmbus_message *); + +/* + * Vmbus channel message processing. + */ +static const vmbus_chanmsg_proc_t +vmbus_chan_msgprocs[VMBUS_CHANMSG_TYPE_MAX] = { + VMBUS_CHANMSG_PROC(CHOFFER, vmbus_chan_msgproc_choffer), + VMBUS_CHANMSG_PROC(CHRESCIND, vmbus_chan_msgproc_chrescind), + + VMBUS_CHANMSG_PROC_WAKEUP(CHOPEN_RESP), + VMBUS_CHANMSG_PROC_WAKEUP(GPADL_CONNRESP), + VMBUS_CHANMSG_PROC_WAKEUP(GPADL_DISCONNRESP) +}; /** * @brief Trigger an event notification on the specified channel @@ -984,3 +1004,463 @@ vmbus_chan_update_evtflagcnt(struct vmbu } } } + +static struct hv_vmbus_channel * +vmbus_chan_alloc(struct vmbus_softc *sc) +{ + struct hv_vmbus_channel *chan; + + chan = malloc(sizeof(*chan), M_DEVBUF, M_WAITOK | M_ZERO); + + chan->ch_monprm = hyperv_dmamem_alloc(bus_get_dma_tag(sc->vmbus_dev), + HYPERCALL_PARAM_ALIGN, 0, sizeof(struct hyperv_mon_param), + >ch_monprm_dma, BUS_DMA_WAITOK | BUS_DMA_ZERO); + if (chan->ch_monprm == NULL) { + device_printf(sc->vmbus_dev, "monprm alloc failed\n"); + free(chan, M_DEVBUF); + return NULL; + } + + chan->vmbus_sc = sc; + mtx_init(>ch_subchan_lock, "vmbus subchan", NULL, MTX_DEF); + TAILQ_INIT(>ch_subchans); + TASK_INIT(>ch_detach_task, 0, vmbus_chan_detach_task, chan); + + return chan; +} + +static void +vmbus_chan_free(struct hv_vmbus_channel *chan) +{ + /* TODO: assert sub-channel list is empty */ + /* TODO: asset no longer on the primary channel's sub-channel list */ + /* TODO: asset no longer on the vmbus channel list */ + hyperv_dmamem_free(>ch_monprm_dma, chan->ch_monprm); +
Re: svn commit: r302854 - head/sys/kern
On Fri, Jul 15, 2016 at 07:19:22AM +1000, Bruce Evans wrote: > On Fri, 15 Jul 2016, Bruce Evans wrote: > >> Log: > >> Let DDB's buf printer handle NULL pointers in the buf page array. > > > > I noticed some other bugs in this code: > > Oops, that was supposed to be a private reply. I'm glad it leaked: %p abuse is unfortunately not that rare, and getting developers' attention is a good thing. E.g., every time I do kldstat(8) on my PowerPC box I sigh: % kldstat Id Refs AddressSize Name 17 0x10 e0c378 kernel 21 0xd20dd000 1d000tmpfs.ko 32 0xd2114000 18000geom_sched.ko 41 0xd2131000 13000gsched_rr.ko ./danfe ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r302863 - stable/10/sys/dev/hyperv/storvsc
Author: sephe Date: Fri Jul 15 02:29:10 2016 New Revision: 302863 URL: https://svnweb.freebsd.org/changeset/base/302863 Log: MFC 302541,302605 302541 hyperv/stor: Fix the INQUIRY checks Don't check the area that the host has not filled. PR: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=209443 PR: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=210425 Submitted by: Hongjiang Zhang Reviewed by:sephe, Dexuan Cui Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6955 302605 hyperv/stor: Save the response status and xfer length properly. The current command response handling discards status and xfer length unconditionally, so that all of the commands would be considered successful, even if errors happened. When errors really happens, this causes all kinds of wiredness, since the buffer will not be filled on the host side and sense data will be ignored. Most of the time, errors do not happen, however, error does happen for the request sent immediately after the disk resizing. Discarding the SCSI status (SCSI_STATUS_CHECK_COND) and sense data (capacity changes) prevents the disk resizing from working properly. This commit saves the response status and xfer length properly for later use. Submitted by: Dexuan Cui Noticed by: sephe Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7181 Modified: stable/10/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c == --- stable/10/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Fri Jul 15 02:24:39 2016(r302862) +++ stable/10/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Fri Jul 15 02:29:10 2016(r302863) @@ -805,6 +805,13 @@ hv_storvsc_on_iocompletion(struct storvs vm_srb = _packet->u.vm_srb; + /* +* Copy some fields of the host's response into the request structure, +* because the fields will be used later in storvsc_io_done(). +*/ + request->vstor_packet.u.vm_srb.scsi_status = vm_srb->scsi_status; + request->vstor_packet.u.vm_srb.transfer_len = vm_srb->transfer_len; + if (((vm_srb->scsi_status & 0xFF) == SCSI_STATUS_CHECK_COND) && (vm_srb->srb_status & SRB_STATUS_AUTOSENSE_VALID)) { /* Autosense data available */ @@ -1939,62 +1946,24 @@ create_storvsc_request(union ccb *ccb, s } /* - * Modified based on scsi_print_inquiry which is responsible to - * print the detail information for scsi_inquiry_data. - * + * SCSI Inquiry checks qualifier and type. + * If qualifier is 011b, means the device server is not capable + * of supporting a peripheral device on this logical unit, and + * the type should be set to 1Fh. + * * Return 1 if it is valid, 0 otherwise. */ static inline int is_inquiry_valid(const struct scsi_inquiry_data *inq_data) { uint8_t type; - char vendor[16], product[48], revision[16]; - - /* -* Check device type and qualifier -*/ - if (!(SID_QUAL_IS_VENDOR_UNIQUE(inq_data) || - SID_QUAL(inq_data) == SID_QUAL_LU_CONNECTED)) + if (SID_QUAL(inq_data) != SID_QUAL_LU_CONNECTED) { return (0); - + } type = SID_TYPE(inq_data); - switch (type) { - case T_DIRECT: - case T_SEQUENTIAL: - case T_PRINTER: - case T_PROCESSOR: - case T_WORM: - case T_CDROM: - case T_SCANNER: - case T_OPTICAL: - case T_CHANGER: - case T_COMM: - case T_STORARRAY: - case T_ENCLOSURE: - case T_RBC: - case T_OCRW: - case T_OSD: - case T_ADC: - break; - case T_NODEVICE: - default: + if (type == T_NODEVICE) { return (0); } - - /* -* Check vendor, product, and revision -*/ - cam_strvis(vendor, inq_data->vendor, sizeof(inq_data->vendor), - sizeof(vendor)); - cam_strvis(product, inq_data->product, sizeof(inq_data->product), - sizeof(product)); - cam_strvis(revision, inq_data->revision, sizeof(inq_data->revision), - sizeof(revision)); - if (strlen(vendor) == 0 || - strlen(product) == 0 || - strlen(revision) == 0) - return (0); - return (1); } @@ -2071,7 +2040,6 @@ storvsc_io_done(struct hv_storvsc_reques ccb->ccb_h.status &= ~CAM_STATUS_MASK; if (vm_srb->scsi_status == SCSI_STATUS_OK) { const struct scsi_generic *cmd; - /* * Check whether the
svn commit: r302862 - stable/11/sys/dev/hyperv/storvsc
Author: sephe Date: Fri Jul 15 02:24:39 2016 New Revision: 302862 URL: https://svnweb.freebsd.org/changeset/base/302862 Log: MFC 302541,302605 302541 hyperv/stor: Fix the INQUIRY checks Don't check the area that the host has not filled. PR: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=209443 PR: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=210425 Submitted by: Hongjiang Zhang Reviewed by:sephe, Dexuan Cui Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6955 302605 hyperv/stor: Save the response status and xfer length properly. The current command response handling discards status and xfer length unconditionally, so that all of the commands would be considered successful, even if errors happened. When errors really happens, this causes all kinds of wiredness, since the buffer will not be filled on the host side and sense data will be ignored. Most of the time, errors do not happen, however, error does happen for the request sent immediately after the disk resizing. Discarding the SCSI status (SCSI_STATUS_CHECK_COND) and sense data (capacity changes) prevents the disk resizing from working properly. This commit saves the response status and xfer length properly for later use. Submitted by: Dexuan Cui Noticed by: sephe Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7181 Approved by: re (gjb) Modified: stable/11/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c == --- stable/11/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Thu Jul 14 23:35:55 2016(r302861) +++ stable/11/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Fri Jul 15 02:24:39 2016(r302862) @@ -805,6 +805,13 @@ hv_storvsc_on_iocompletion(struct storvs vm_srb = _packet->u.vm_srb; + /* +* Copy some fields of the host's response into the request structure, +* because the fields will be used later in storvsc_io_done(). +*/ + request->vstor_packet.u.vm_srb.scsi_status = vm_srb->scsi_status; + request->vstor_packet.u.vm_srb.transfer_len = vm_srb->transfer_len; + if (((vm_srb->scsi_status & 0xFF) == SCSI_STATUS_CHECK_COND) && (vm_srb->srb_status & SRB_STATUS_AUTOSENSE_VALID)) { /* Autosense data available */ @@ -1939,62 +1946,24 @@ create_storvsc_request(union ccb *ccb, s } /* - * Modified based on scsi_print_inquiry which is responsible to - * print the detail information for scsi_inquiry_data. - * + * SCSI Inquiry checks qualifier and type. + * If qualifier is 011b, means the device server is not capable + * of supporting a peripheral device on this logical unit, and + * the type should be set to 1Fh. + * * Return 1 if it is valid, 0 otherwise. */ static inline int is_inquiry_valid(const struct scsi_inquiry_data *inq_data) { uint8_t type; - char vendor[16], product[48], revision[16]; - - /* -* Check device type and qualifier -*/ - if (!(SID_QUAL_IS_VENDOR_UNIQUE(inq_data) || - SID_QUAL(inq_data) == SID_QUAL_LU_CONNECTED)) + if (SID_QUAL(inq_data) != SID_QUAL_LU_CONNECTED) { return (0); - + } type = SID_TYPE(inq_data); - switch (type) { - case T_DIRECT: - case T_SEQUENTIAL: - case T_PRINTER: - case T_PROCESSOR: - case T_WORM: - case T_CDROM: - case T_SCANNER: - case T_OPTICAL: - case T_CHANGER: - case T_COMM: - case T_STORARRAY: - case T_ENCLOSURE: - case T_RBC: - case T_OCRW: - case T_OSD: - case T_ADC: - break; - case T_NODEVICE: - default: + if (type == T_NODEVICE) { return (0); } - - /* -* Check vendor, product, and revision -*/ - cam_strvis(vendor, inq_data->vendor, sizeof(inq_data->vendor), - sizeof(vendor)); - cam_strvis(product, inq_data->product, sizeof(inq_data->product), - sizeof(product)); - cam_strvis(revision, inq_data->revision, sizeof(inq_data->revision), - sizeof(revision)); - if (strlen(vendor) == 0 || - strlen(product) == 0 || - strlen(revision) == 0) - return (0); - return (1); } @@ -2071,7 +2040,6 @@ storvsc_io_done(struct hv_storvsc_reques ccb->ccb_h.status &= ~CAM_STATUS_MASK; if (vm_srb->scsi_status == SCSI_STATUS_OK) { const struct scsi_generic *cmd; - /*
svn commit: r302861 - head/share/man/man3
Author: jhb Date: Thu Jul 14 23:35:55 2016 New Revision: 302861 URL: https://svnweb.freebsd.org/changeset/base/302861 Log: Fix rendering issues. - Use Ta to separate column headers. - Correct width of the 'Code' column in the last table. MFC after:3 days Differential Revision:https://reviews.freebsd.org/D7118 Modified: head/share/man/man3/siginfo.3 Modified: head/share/man/man3/siginfo.3 == --- head/share/man/man3/siginfo.3 Thu Jul 14 23:28:53 2016 (r302860) +++ head/share/man/man3/siginfo.3 Thu Jul 14 23:35:55 2016 (r302861) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 14, 2012 +.Dd July 14, 2016 .Dt SIGINFO 3 .Os .Sh NAME @@ -54,7 +54,7 @@ In either case, the system returns the i .Vt siginfo_t , which includes the following information: .Bl -column ".Vt union signal" ".Va si_overrun" -.It Sy "Type Member Description" +.It Sy Type Ta Sy Member Ta Sy Description .It Vt int Ta Va si_signo Ta signal number .It Vt int Ta Va si_errno Ta @@ -107,7 +107,7 @@ for use as values of that are signal-specific or non-signal-specific reasons why the signal was generated: .Bl -column ".Dv SIGPOLL" ".Dv CLD_CONTINUED" -.It Sy "Signal CodeReason" +.It Sy Signal Ta Sy Code Ta Sy Reason .It Dv SIGILL Ta Dv ILL_ILLOPC Ta illegal opcode .It Ta Dv ILL_ILLOPN Ta @@ -206,7 +206,7 @@ signal sent by .Pp In addition, the following signal-specific information is available: .Bl -column ".Dv SIGPOLL" ".Dv CLD_CONTINUED" -.It Sy "Signal Member Value" +.It Sy Signal Ta Sy Member Ta Sy Value .It Dv SIGILL Ta Va si_addr Ta address of faulting instruction .It Ta Va si_trapno Ta @@ -240,8 +240,8 @@ or .El .Pp Finally, the following code-specific information is available: -.Bl -column ".Dv SI_QUEUE" ".Va si_overrun" -.It Sy "Code Member Value" +.Bl -column ".Dv SI_ASYNCIO" ".Va si_overrun" +.It Sy Code Ta Sy Member Ta Sy Value .It Dv SI_USER Ta Va si_pid Ta the process ID that sent the signal .It Ta Va si_uid Ta ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r302860 - head/lib/librt
Author: jhb Date: Thu Jul 14 23:28:53 2016 New Revision: 302860 URL: https://svnweb.freebsd.org/changeset/base/302860 Log: Fix aio system call wrappers in librt. - Update aio_return/waitcomplete wrappers for the ssize_t return type. - Fix the aio_return() wrapper to fail with EINVAL on a pending job. This matches the semantics of the in-kernel system call. Also, aio_return() returns errors via errno, not via the return value. Reviewed by: kib (earlier version) MFC after:1 week Sponsored by: Chelsio Communications Differential Revision:https://reviews.freebsd.org/D7120 Modified: head/lib/librt/aio.c Modified: head/lib/librt/aio.c == --- head/lib/librt/aio.cThu Jul 14 23:20:05 2016(r302859) +++ head/lib/librt/aio.cThu Jul 14 23:28:53 2016(r302860) @@ -54,8 +54,8 @@ typedef void (*aio_func)(union sigval va extern int __sys_aio_read(struct aiocb *iocb); extern int __sys_aio_write(struct aiocb *iocb); -extern int __sys_aio_waitcomplete(struct aiocb **iocbp, struct timespec *timeout); -extern int __sys_aio_return(struct aiocb *iocb); +extern ssize_t __sys_aio_waitcomplete(struct aiocb **iocbp, struct timespec *timeout); +extern ssize_t __sys_aio_return(struct aiocb *iocb); extern int __sys_aio_error(struct aiocb *iocb); extern int __sys_aio_fsync(int op, struct aiocb *iocb); @@ -136,12 +136,13 @@ __aio_write(struct aiocb *iocb) return aio_io(iocb, &__sys_aio_write); } -int +ssize_t __aio_waitcomplete(struct aiocb **iocbp, struct timespec *timeout) { + ssize_t ret; int err; - int ret = __sys_aio_waitcomplete(iocbp, timeout); + ret = __sys_aio_waitcomplete(iocbp, timeout); if (*iocbp) { if ((*iocbp)->aio_sigevent.sigev_notify == SIGEV_THREAD) { err = errno; @@ -155,13 +156,20 @@ __aio_waitcomplete(struct aiocb **iocbp, return (ret); } -int +ssize_t __aio_return(struct aiocb *iocb) { if (iocb->aio_sigevent.sigev_notify == SIGEV_THREAD) { - if (__sys_aio_error(iocb) == EINPROGRESS) - return (EINPROGRESS); + if (__sys_aio_error(iocb) == EINPROGRESS) { + /* +* Fail with EINVAL to match the semantics of +* __sys_aio_return() for an in-progress +* request. +*/ + errno = EINVAL; + return (-1); + } __sigev_list_lock(); __sigev_delete(SI_ASYNCIO, (sigev_id_t)iocb); __sigev_list_unlock(); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r302859 - in head: sys/kern usr.bin/gcore
On 7/14/16 7:20 PM, John Baldwin wrote: > Author: jhb > Date: Thu Jul 14 23:20:05 2016 > New Revision: 302859 > URL: https://svnweb.freebsd.org/changeset/base/302859 > > Log: > Include command line arguments in core dump process info. > > Fill in pr_psargs in the NT_PRSINFO ELF core dump note with command > line arguments. > > Reviewed by:kib > Differential Revision: https://reviews.freebsd.org/D7116 Meant to include an MFC after tag. The effect is that gdb will now display the command line from a core dump rather than just the command name (albeit truncated to 80 characters). lldb doesn't grok NT_PRSINFO on FreeBSD yet so is unaffected. -- John Baldwin ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r302859 - in head: sys/kern usr.bin/gcore
Author: jhb Date: Thu Jul 14 23:20:05 2016 New Revision: 302859 URL: https://svnweb.freebsd.org/changeset/base/302859 Log: Include command line arguments in core dump process info. Fill in pr_psargs in the NT_PRSINFO ELF core dump note with command line arguments. Reviewed by: kib Differential Revision:https://reviews.freebsd.org/D7116 Modified: head/sys/kern/imgact_elf.c head/usr.bin/gcore/elfcore.c Modified: head/sys/kern/imgact_elf.c == --- head/sys/kern/imgact_elf.c Thu Jul 14 23:14:10 2016(r302858) +++ head/sys/kern/imgact_elf.c Thu Jul 14 23:20:05 2016(r302859) @@ -1823,8 +1823,12 @@ typedef vm_offset_t elf_ps_strings_t; static void __elfN(note_prpsinfo)(void *arg, struct sbuf *sb, size_t *sizep) { + struct sbuf sbarg; + size_t len; + char *cp, *end; struct proc *p; elf_prpsinfo_t *psinfo; + int error; p = (struct proc *)arg; if (sb != NULL) { @@ -1833,13 +1837,43 @@ __elfN(note_prpsinfo)(void *arg, struct psinfo->pr_version = PRPSINFO_VERSION; psinfo->pr_psinfosz = sizeof(elf_prpsinfo_t); strlcpy(psinfo->pr_fname, p->p_comm, sizeof(psinfo->pr_fname)); - /* -* XXX - We don't fill in the command line arguments properly -* yet. -*/ - strlcpy(psinfo->pr_psargs, p->p_comm, - sizeof(psinfo->pr_psargs)); - + PROC_LOCK(p); + if (p->p_args != NULL) { + len = sizeof(psinfo->pr_psargs) - 1; + if (len > p->p_args->ar_length) + len = p->p_args->ar_length; + memcpy(psinfo->pr_psargs, p->p_args->ar_args, len); + PROC_UNLOCK(p); + error = 0; + } else { + _PHOLD(p); + PROC_UNLOCK(p); + sbuf_new(, psinfo->pr_psargs, + sizeof(psinfo->pr_psargs), SBUF_FIXEDLEN); + error = proc_getargv(curthread, p, ); + PRELE(p); + if (sbuf_finish() == 0) + len = sbuf_len() - 1; + else + len = sizeof(psinfo->pr_psargs) - 1; + sbuf_delete(); + } + if (error || len == 0) + strlcpy(psinfo->pr_psargs, p->p_comm, + sizeof(psinfo->pr_psargs)); + else { + KASSERT(len < sizeof(psinfo->pr_psargs), + ("len is too long: %zu vs %zu", len, + sizeof(psinfo->pr_psargs))); + cp = psinfo->pr_psargs; + end = cp + len - 1; + for (;;) { + cp = memchr(cp, '\0', end - cp); + if (cp == NULL) + break; + *cp = ' '; + } + } sbuf_bcat(sb, psinfo, sizeof(*psinfo)); free(psinfo, M_TEMP); } Modified: head/usr.bin/gcore/elfcore.c == --- head/usr.bin/gcore/elfcore.cThu Jul 14 23:14:10 2016 (r302858) +++ head/usr.bin/gcore/elfcore.cThu Jul 14 23:20:05 2016 (r302859) @@ -548,6 +548,7 @@ readmap(pid_t pid) static void * elf_note_prpsinfo(void *arg, size_t *sizep) { + char *cp, *end; pid_t pid; elfcore_prpsinfo_t *psinfo; struct kinfo_proc kip; @@ -571,7 +572,20 @@ elf_note_prpsinfo(void *arg, size_t *siz if (kip.ki_pid != pid) err(1, "kern.proc.pid.%u", pid); strlcpy(psinfo->pr_fname, kip.ki_comm, sizeof(psinfo->pr_fname)); - strlcpy(psinfo->pr_psargs, psinfo->pr_fname, sizeof(psinfo->pr_psargs)); + name[2] = KERN_PROC_ARGS; + len = sizeof(psinfo->pr_psargs) - 1; + if (sysctl(name, 4, psinfo->pr_psargs, , NULL, 0) == 0 && len > 0) { + cp = psinfo->pr_psargs; + end = cp + len - 1; + for (;;) { + cp = memchr(cp, '\0', end - cp); + if (cp == NULL) + break; + *cp = ' '; + } + } else + strlcpy(psinfo->pr_psargs, kip.ki_comm, + sizeof(psinfo->pr_psargs)); *sizep = sizeof(*psinfo); return (psinfo); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to
svn commit: r302858 - head/sys/sys
Author: jhb Date: Thu Jul 14 23:14:10 2016 New Revision: 302858 URL: https://svnweb.freebsd.org/changeset/base/302858 Log: Move nested include of inside _KERNEL. This removes namespace pollution for userland brought in by r299122. PR: 210319 Submitted by: knu MFC after:1 week Modified: head/sys/sys/cpuset.h Modified: head/sys/sys/cpuset.h == --- head/sys/sys/cpuset.h Thu Jul 14 20:17:08 2016(r302857) +++ head/sys/sys/cpuset.h Thu Jul 14 23:14:10 2016(r302858) @@ -35,7 +35,6 @@ #include #include -#include #define_NCPUBITS _BITSET_BITS #define_NCPUWORDS __bitset_words(CPU_SETSIZE) @@ -92,6 +91,8 @@ #defineCPUSET_DEFAULT 0 #ifdef _KERNEL +#include + LIST_HEAD(setlist, cpuset); /* ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r302854 - head/sys/kern
On Fri, 15 Jul 2016, Bruce Evans wrote: Log: Let DDB's buf printer handle NULL pointers in the buf page array. I noticed some other bugs in this code: Oops, that was supposed to be a private reply. Bruce ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r302854 - head/sys/kern
Log: Let DDB's buf printer handle NULL pointers in the buf page array. I noticed some other bugs in this code: Modified: head/sys/kern/vfs_bio.c == --- head/sys/kern/vfs_bio.c Thu Jul 14 17:31:29 2016(r302853) +++ head/sys/kern/vfs_bio.c Thu Jul 14 18:49:05 2016(r302854) @@ -4725,8 +4725,12 @@ DB_SHOW_COMMAND(buffer, db_show_buffer) for (i = 0; i < bp->b_npages; i++) { vm_page_t m; 2 style bugs. m = bp->b_pages[i]; - db_printf("(%p, 0x%lx, 0x%lx)", (void *)m->object, - (u_long)m->pindex, (u_long)VM_PAGE_TO_PHYS(m)); + if (m != NULL) + db_printf("(%p, 0x%lx, 0x%lx)", m->object, This loses the careful cast of m->object to void *. %p gives undefined behaviour on pointers that are not void *. All other nearby %p's and most elsewhere have this bug. %p is a bad format anyway. On exotic arches, the cast might actually change the representation, but %p is only useful in debugging code and there you would usually prefer to see the raw bits. %p also gives little control over the format (none in userland, and undocumented extensions in the kernel). To get control of the format, the value can be printed using %<...>j[dx...] after casting to (uintmax_t)(uintptr_t)(void *) (sometimes to const/volatile void *). This cast is even uglier but more needed. It may still corrupt the resolution. To get full control, pointers should be printed by copying there bits and printing the array. The explicit 0x prefix should only be used in tabular formats. Here the value is often 0. This should be printed using %#. + (u_long)m->pindex, This is broken on all 32-bit systems. pindex is 64 bits to handle large file offsets (64-bit file offset needs 52-bit pindex with 4K pages). The casts truncates to 32 bits. + (u_long)VM_PAGE_TO_PHYS(m)); This is broken on 32-bit systems with large physical adress spaces (only i386 with PAE?). vm_paddr_t is 64 bits to handle large physical offsets. i386 with PAE needs only 44. This reduces to 32. printf format checking gives too many printf format bugs from bad fixes using bogus casts to make the arg type match the format. + else + db_printf("( ??? )"); Perhaps just "()". "???" looks like an error. There shouldn't be any spaces near the parentheses since that is not English style and the nonzero case doesn't use them. I think the parentheses should be braces. We're printing a (sub)struct and C uses braces for structs. Also, the array could be in brackets. It is now delimited by a ':' and a newline. if ((i + 1) < bp->b_npages) Style bug (extra parentheses). db_printf(","); } Other bugs in this function: - no cast to void * for bp, b_bufobj, b_data, b_dep, b_kvabase - b*flags is uint32_t is cast to u_int. The cast is only needed with 16-bit ints, but BSD never supported them and POSIX has required >= 32 bit ints since 2001. - formatting in both the source and output for one line was broken by adding b_dep. It and the previous line were limit to 4 fields to keep the output line lengths below 80 on 32 bit arches. There are many %p formats and possibly large integers, so this formatting probably never worked on 64- bit arches. b_dep is a 5th field on a line. The source formatting is obfuscated so that it is not obviously too long in the output. - after printing 2 lines ending in b_dep using 1 db_printf(), we use another db_printf() for the next line. I prefer 1 printf() in 1 source line per output line. - related fields are mostly grouped logically. The newer fields b_bufobj and b_dep are not. b_dep on the 3rd line would be better. I might express the arrays b_data and b_kvasize as %p[%d] with the size not named. This gives more chance of 4 fields/line fitting. Bruce ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r302857 - head/etc/rc.d
Author: jamie Date: Thu Jul 14 20:17:08 2016 New Revision: 302857 URL: https://svnweb.freebsd.org/changeset/base/302857 Log: Start jails non-parallel if jail_parallel_start is NO. This was true for an explicitly specified jail list; now it's also true for all jails. PR: 209112 MFC after:3 days Modified: head/etc/rc.d/jail Modified: head/etc/rc.d/jail == --- head/etc/rc.d/jail Thu Jul 14 20:15:55 2016(r302856) +++ head/etc/rc.d/jail Thu Jul 14 20:17:08 2016(r302857) @@ -451,6 +451,9 @@ jail_start() command=$jail_program rc_flags=$jail_flags command_args="-f $jail_conf -c" + if ! checkyesno jail_parallel_start; then + command_args="$command_args -p1" + fi _tmp=`mktemp -t jail` || exit 3 if $command $rc_flags $command_args >> $_tmp 2>&1; then $jail_jls jid name | while read _id _name; do @@ -458,7 +461,7 @@ jail_start() echo $_id > /var/run/jail_${_name}.id done else - tail -1 $_tmp + cat $_tmp fi rm -f $_tmp echo '.' @@ -545,7 +548,7 @@ jail_stop() _tmp=`mktemp -t jail` || exit 3 $command $rc_flags $command_args $_j >> $_tmp 2>&1 if $jail_jls -j $_j > /dev/null 2>&1; then - tail -1 $_tmp + cat $_tmp else rm -f /var/run/jail_${_j}.id fi @@ -568,7 +571,7 @@ jail_stop() _tmp=`mktemp -t jail` || exit 3 $command -q -f $_conf -r $_j >> $_tmp 2>&1 if $jail_jls -j $_j > /dev/null 2>&1; then - tail -1 $_tmp + cat $_tmp else rm -f /var/run/jail_${_j}.id fi ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r302856 - head/usr.sbin/jail
Author: jamie Date: Thu Jul 14 20:15:55 2016 New Revision: 302856 URL: https://svnweb.freebsd.org/changeset/base/302856 Log: Fix up the order in which jail creation processes are run, to preserve the config file's order in the non-parallel-start case. PR: 209112 MFC after:3 days Modified: head/usr.sbin/jail/command.c head/usr.sbin/jail/jailp.h head/usr.sbin/jail/state.c Modified: head/usr.sbin/jail/command.c == --- head/usr.sbin/jail/command.cThu Jul 14 19:51:54 2016 (r302855) +++ head/usr.sbin/jail/command.cThu Jul 14 20:15:55 2016 (r302856) @@ -92,9 +92,13 @@ next_command(struct cfjail *j) int create_failed, stopping; if (paralimit == 0) { - requeue(j, ); + if (j->flags & JF_FROM_RUNQ) + requeue_head(j, ); + else + requeue(j, ); return 1; } + j->flags &= ~JF_FROM_RUNQ; create_failed = (j->flags & (JF_STOP | JF_FAILED)) == JF_FAILED; stopping = (j->flags & JF_STOP) != 0; comparam = *j->comparam; @@ -160,20 +164,23 @@ next_command(struct cfjail *j) int finish_command(struct cfjail *j) { + struct cfjail *rj; int error; if (!(j->flags & JF_SLEEPQ)) return 0; j->flags &= ~JF_SLEEPQ; - if (*j->comparam == IP_STOP_TIMEOUT) - { + if (*j->comparam == IP_STOP_TIMEOUT) { j->flags &= ~JF_TIMEOUT; j->pstatus = 0; return 0; } paralimit++; - if (!TAILQ_EMPTY()) - requeue(TAILQ_FIRST(), ); + if (!TAILQ_EMPTY()) { + rj = TAILQ_FIRST(); + rj->flags |= JF_FROM_RUNQ; + requeue(rj, ); + } error = 0; if (j->flags & JF_TIMEOUT) { j->flags &= ~JF_TIMEOUT; @@ -259,7 +266,7 @@ next_proc(int nonblock) } /* - * Run a single command for a jail, possible inside the jail. + * Run a single command for a jail, possibly inside the jail. */ static int run_command(struct cfjail *j) Modified: head/usr.sbin/jail/jailp.h == --- head/usr.sbin/jail/jailp.h Thu Jul 14 19:51:54 2016(r302855) +++ head/usr.sbin/jail/jailp.h Thu Jul 14 20:15:55 2016(r302856) @@ -64,6 +64,7 @@ #define JF_PERSIST 0x0100 /* Jail is temporarily persistent */ #define JF_TIMEOUT 0x0200 /* A command (or process kill) timed out */ #define JF_SLEEPQ 0x0400 /* Waiting on a command and/or timeout */ +#define JF_FROM_RUNQ 0x0800 /* Has already been on the run queue */ #define JF_OP_MASK (JF_START | JF_SET | JF_STOP) #define JF_RESTART (JF_START | JF_STOP) @@ -223,6 +224,7 @@ extern struct cfjail *next_jail(void); extern int start_state(const char *target, int docf, unsigned state, int running); extern void requeue(struct cfjail *j, struct cfjails *queue); +extern void requeue_head(struct cfjail *j, struct cfjails *queue); extern void yyerror(const char *); extern int yylex(void); Modified: head/usr.sbin/jail/state.c == --- head/usr.sbin/jail/state.c Thu Jul 14 19:51:54 2016(r302855) +++ head/usr.sbin/jail/state.c Thu Jul 14 20:15:55 2016(r302856) @@ -397,6 +397,14 @@ requeue(struct cfjail *j, struct cfjails } } +void +requeue_head(struct cfjail *j, struct cfjails *queue) +{ +TAILQ_REMOVE(j->queue, j, tq); +TAILQ_INSERT_HEAD(queue, j, tq); +j->queue = queue; +} + /* * Add a dependency edge between two jails. */ ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r302855 - head/etc/rc.d
On Thu, Jul 14, 2016 at 12:51 PM, Jamie Grittonwrote: > Author: jamie > Date: Thu Jul 14 19:51:54 2016 > New Revision: 302855 > URL: https://svnweb.freebsd.org/changeset/base/302855 > > Log: > Wait for jails to complete startup if jail_parallel_start is YES, > instead of assuming they'll take less than one second. > > PR: 203172 > Submitted by: dmitry2...@yandex.ru MFC after: ? ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r302855 - head/etc/rc.d
Author: jamie Date: Thu Jul 14 19:51:54 2016 New Revision: 302855 URL: https://svnweb.freebsd.org/changeset/base/302855 Log: Wait for jails to complete startup if jail_parallel_start is YES, instead of assuming they'll take less than one second. PR: 203172 Submitted by: dmitry2...@yandex.ru Modified: head/etc/rc.d/jail Modified: head/etc/rc.d/jail == --- head/etc/rc.d/jail Thu Jul 14 18:49:05 2016(r302854) +++ head/etc/rc.d/jail Thu Jul 14 19:51:54 2016(r302855) @@ -440,7 +440,7 @@ jail_status() jail_start() { - local _j _jv _jid _jl _id _name + local _j _jv _jid _id _name if [ $# = 0 ]; then return @@ -470,29 +470,30 @@ jail_start() # Start jails in parallel and then check jail id when # jail_parallel_start is YES. # - _jl= for _j in $@; do _j=$(echo $_j | tr /. _) _jv=$(echo -n $_j | tr -c '[:alnum:]' _) parse_options $_j $_jv || continue - _jl="$_jl $_j" eval rc_flags=\${jail_${_jv}_flags:-$jail_flags} eval command=\${jail_${_jv}_program:-$jail_program} command_args="-i -f $_conf -c $_j" - $command $rc_flags $command_args \ - >/dev/null 2>&1 /var/run/jail_${_j}.id - else - echo " cannot start jail " \ - "\"${_hostname:-${_j}}\": " - fi + ( + _tmp=`mktemp -t jail_${_j}` || exit 3 + if $command $rc_flags $command_args \ + >> $_tmp 2>&1 /var/run/jail_${_j}.id + else + echo " cannot start jail " \ + "\"${_hostname:-${_j}}\": " + cat $_tmp + fi + rm -f $_tmp + ) & done + wait else # # Start jails one-by-one when jail_parallel_start is NO. ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r302854 - head/sys/kern
Author: markj Date: Thu Jul 14 18:49:05 2016 New Revision: 302854 URL: https://svnweb.freebsd.org/changeset/base/302854 Log: Let DDB's buf printer handle NULL pointers in the buf page array. A buf's b_pages and b_npages fields may be inconsistent after a panic. For instance, vfs_vmio_invalidate() sets b_npages to zero only after all pages are unwired and their page array entries are cleared. MFC after:1 week Sponsored by: EMC / Isilon Storage Division Modified: head/sys/kern/vfs_bio.c Modified: head/sys/kern/vfs_bio.c == --- head/sys/kern/vfs_bio.c Thu Jul 14 17:31:29 2016(r302853) +++ head/sys/kern/vfs_bio.c Thu Jul 14 18:49:05 2016(r302854) @@ -4725,8 +4725,12 @@ DB_SHOW_COMMAND(buffer, db_show_buffer) for (i = 0; i < bp->b_npages; i++) { vm_page_t m; m = bp->b_pages[i]; - db_printf("(%p, 0x%lx, 0x%lx)", (void *)m->object, - (u_long)m->pindex, (u_long)VM_PAGE_TO_PHYS(m)); + if (m != NULL) + db_printf("(%p, 0x%lx, 0x%lx)", m->object, + (u_long)m->pindex, + (u_long)VM_PAGE_TO_PHYS(m)); + else + db_printf("( ??? )"); if ((i + 1) < bp->b_npages) db_printf(","); } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r302853 - in head/sys/arm64: arm64 include
Author: andrew Date: Thu Jul 14 17:31:29 2016 New Revision: 302853 URL: https://svnweb.freebsd.org/changeset/base/302853 Log: Finish removing the non-INTRNG support from sys/arm64. Obtained from:ABT Systems Ltd MFC after:1 month Sponsored by: The FreeBSD Foundation Modified: head/sys/arm64/arm64/autoconf.c head/sys/arm64/arm64/mp_machdep.c head/sys/arm64/arm64/nexus.c head/sys/arm64/include/intr.h Modified: head/sys/arm64/arm64/autoconf.c == --- head/sys/arm64/arm64/autoconf.c Thu Jul 14 17:23:49 2016 (r302852) +++ head/sys/arm64/arm64/autoconf.c Thu Jul 14 17:31:29 2016 (r302853) @@ -81,12 +81,8 @@ static void configure_final(void *dummy) { -#ifdef INTRNG /* Enable interrupt reception on this CPU */ intr_enable(); -#else - arm_enable_intr(); -#endif cninit_finish(); if (bootverbose) Modified: head/sys/arm64/arm64/mp_machdep.c == --- head/sys/arm64/arm64/mp_machdep.c Thu Jul 14 17:23:49 2016 (r302852) +++ head/sys/arm64/arm64/mp_machdep.c Thu Jul 14 17:31:29 2016 (r302853) @@ -65,7 +65,6 @@ __FBSDID("$FreeBSD$"); #include -#ifdef INTRNG #include "pic_if.h" typedef void intr_ipi_send_t(void *, cpuset_t, u_int); @@ -86,7 +85,6 @@ static struct intr_ipi ipi_sources[INTR_ static struct intr_ipi *intr_ipi_lookup(u_int); static void intr_pic_ipi_setup(u_int, const char *, intr_ipi_handler_t *, void *); -#endif /* INTRNG */ boolean_t ofw_cpu_reg(phandle_t node, u_int, cell_t *); @@ -214,18 +212,12 @@ release_aps(void *dummy __unused) { int cpu, i; -#ifdef INTRNG intr_pic_ipi_setup(IPI_AST, "ast", ipi_ast, NULL); intr_pic_ipi_setup(IPI_PREEMPT, "preempt", ipi_preempt, NULL); intr_pic_ipi_setup(IPI_RENDEZVOUS, "rendezvous", ipi_rendezvous, NULL); intr_pic_ipi_setup(IPI_STOP, "stop", ipi_stop, NULL); intr_pic_ipi_setup(IPI_STOP_HARD, "stop hard", ipi_stop, NULL); intr_pic_ipi_setup(IPI_HARDCLOCK, "hardclock", ipi_hardclock, NULL); -#else - /* Setup the IPI handler */ - for (i = 0; i < INTR_IPI_COUNT; i++) - arm_setup_ipihandler(ipi_handler, i); -#endif atomic_store_rel_int(_ready, 1); /* Wake up the other CPUs */ @@ -253,9 +245,6 @@ void init_secondary(uint64_t cpu) { struct pcpu *pcpup; -#ifndef INTRNG - int i; -#endif pcpup = &__pcpu[cpu]; /* @@ -282,15 +271,7 @@ init_secondary(uint64_t cpu) */ identify_cpu(); -#ifdef INTRNG intr_pic_init_secondary(); -#else - /* Configure the interrupt controller */ - arm_init_secondary(); - - for (i = 0; i < INTR_IPI_COUNT; i++) - arm_unmask_ipi(i); -#endif /* Start per-CPU event timers. */ cpu_initclocks_ap(); @@ -322,7 +303,6 @@ init_secondary(uint64_t cpu) /* NOTREACHED */ } -#ifdef INTRNG /* * Send IPI thru interrupt controller. */ @@ -378,7 +358,6 @@ intr_ipi_send(cpuset_t cpus, u_int ipi) ii->ii_send(ii->ii_send_arg, cpus, ipi); } -#endif static void ipi_ast(void *dummy __unused) @@ -432,44 +411,6 @@ ipi_stop(void *dummy __unused) CTR0(KTR_SMP, "IPI_STOP (restart)"); } -#ifndef INTRNG -static int -ipi_handler(void *arg) -{ - u_int cpu, ipi; - - arg = (void *)((uintptr_t)arg & ~(1 << 16)); - KASSERT((uintptr_t)arg < INTR_IPI_COUNT, - ("Invalid IPI %ju", (uintptr_t)arg)); - - cpu = PCPU_GET(cpuid); - ipi = (uintptr_t)arg; - - switch(ipi) { - case IPI_AST: - ipi_ast(NULL); - break; - case IPI_PREEMPT: - ipi_preempt(NULL); - break; - case IPI_RENDEZVOUS: - ipi_rendezvous(NULL); - break; - case IPI_STOP: - case IPI_STOP_HARD: - ipi_stop(NULL); - break; - case IPI_HARDCLOCK: - ipi_hardclock(NULL); - break; - default: - panic("Unknown IPI %#0x on cpu %d", ipi, curcpu); - } - - return (FILTER_HANDLED); -} -#endif - struct cpu_group * cpu_topo(void) { @@ -624,7 +565,6 @@ cpu_mp_setmaxid(void) mp_maxid = 0; } -#ifdef INTRNG /* * Lookup IPI source. */ @@ -768,4 +708,3 @@ ipi_selected(cpuset_t cpus, u_int ipi) CTR2(KTR_SMP, "%s: ipi: %x", __func__, ipi); intr_ipi_send(cpus, ipi); } -#endif /* INTRNG */ Modified: head/sys/arm64/arm64/nexus.c == --- head/sys/arm64/arm64/nexus.cThu Jul 14 17:23:49 2016 (r302852) +++ head/sys/arm64/arm64/nexus.cThu Jul 14 17:31:29 2016 (r302853) @@ -271,13 +271,9 @@ nexus_config_intr(device_t dev, int irq, enum
svn commit: r302852 - head/sys/arm64/cavium
Author: andrew Date: Thu Jul 14 17:23:49 2016 New Revision: 302852 URL: https://svnweb.freebsd.org/changeset/base/302852 Log: Remove the non-INTRNG support from the ThunderX PCIe drivers. Obtained from:ABT Systems Ltd MFC after:1 month Sponsored by: The FreeBSD Foundation Modified: head/sys/arm64/cavium/thunder_pcie_pem_fdt.c Modified: head/sys/arm64/cavium/thunder_pcie_pem_fdt.c == --- head/sys/arm64/cavium/thunder_pcie_pem_fdt.cThu Jul 14 17:16:51 2016(r302851) +++ head/sys/arm64/cavium/thunder_pcie_pem_fdt.cThu Jul 14 17:23:49 2016(r302852) @@ -109,7 +109,6 @@ thunder_pem_fdt_probe(device_t dev) return (ENXIO); } -#ifdef INTRNG static int thunder_pem_fdt_alloc_msi(device_t pci, device_t child, int count, int maxcount, int *irqs) @@ -162,44 +161,6 @@ thunder_pem_fdt_map_msi(device_t pci, de NULL); return (intr_map_msi(pci, child, msi_parent, irq, addr, data)); } -#else -static int -thunder_pem_fdt_alloc_msi(device_t pci, device_t child, int count, int maxcount, -int *irqs) -{ - - return (arm_alloc_msi(pci, child, count, maxcount, irqs)); -} - -static int -thunder_pem_fdt_release_msi(device_t pci, device_t child, int count, int *irqs) -{ - - return (arm_release_msi(pci, child, count, irqs)); -} - -static int -thunder_pem_fdt_alloc_msix(device_t pci, device_t child, int *irq) -{ - - return (arm_alloc_msix(pci, child, irq)); -} - -static int -thunder_pem_fdt_release_msix(device_t pci, device_t child, int irq) -{ - - return (arm_release_msix(pci, child, irq)); -} - -static int -thunder_pem_fdt_map_msi(device_t pci, device_t child, int irq, uint64_t *addr, -uint32_t *data) -{ - - return (arm_map_msi(pci, child, irq, addr, data)); -} -#endif static int thunder_pem_fdt_get_id(device_t dev, device_t child, enum pci_id_type type, ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r302851 - head/sys/arm64/arm64
Author: andrew Date: Thu Jul 14 17:16:51 2016 New Revision: 302851 URL: https://svnweb.freebsd.org/changeset/base/302851 Log: Move gic_v3_irqsrc into the GICv3 driver source as it's only needed there. Remove unused macros from the GICv3 header. Obtained from:ABT Systems Ltd MFC after:1 month Sponsored by: The FreeBSD Foundation Modified: head/sys/arm64/arm64/gic_v3.c head/sys/arm64/arm64/gic_v3_var.h Modified: head/sys/arm64/arm64/gic_v3.c == --- head/sys/arm64/arm64/gic_v3.c Thu Jul 14 17:16:10 2016 (r302850) +++ head/sys/arm64/arm64/gic_v3.c Thu Jul 14 17:16:51 2016 (r302851) @@ -134,6 +134,13 @@ enum gic_v3_xdist { REDIST, }; +struct gic_v3_irqsrc { + struct intr_irqsrc gi_isrc; + uint32_tgi_irq; + enum intr_polarity gi_pol; + enum intr_trigger gi_trig; +}; + /* Helper routines starting with gic_v3_ */ static int gic_v3_dist_init(struct gic_v3_softc *); static int gic_v3_redist_alloc(struct gic_v3_softc *); Modified: head/sys/arm64/arm64/gic_v3_var.h == --- head/sys/arm64/arm64/gic_v3_var.h Thu Jul 14 17:16:10 2016 (r302850) +++ head/sys/arm64/arm64/gic_v3_var.h Thu Jul 14 17:16:51 2016 (r302851) @@ -36,12 +36,7 @@ DECLARE_CLASS(gic_v3_driver); -struct gic_v3_irqsrc { - struct intr_irqsrc gi_isrc; - uint32_tgi_irq; - enum intr_polarity gi_pol; - enum intr_trigger gi_trig; -}; +struct gic_v3_irqsrc; struct redist_lpis { vm_offset_t conf_base; @@ -140,27 +135,4 @@ void gic_r_write_8(device_t, bus_size_t, reg, val); \ }) -#definePCI_DEVID_GENERIC(pci_dev) \ -({ \ - ((pci_get_domain(pci_dev) << PCI_RID_DOMAIN_SHIFT) |\ - (pci_get_bus(pci_dev) << PCI_RID_BUS_SHIFT) | \ - (pci_get_slot(pci_dev) << PCI_RID_SLOT_SHIFT) | \ - (pci_get_function(pci_dev) << PCI_RID_FUNC_SHIFT)); \ -}) - -/* - * Request number of maximum MSI-X vectors for this device. - * Device can ask for less vectors than maximum supported but not more. - */ -#definePCI_MSIX_NUM(pci_dev) \ -({ \ - struct pci_devinfo *dinfo; \ - pcicfgregs *cfg;\ - \ - dinfo = device_get_ivars(pci_dev); \ - cfg = >cfg; \ - \ - cfg->msix.msix_msgnum; \ -}) - #endif /* _GIC_V3_VAR_H_ */ ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r302850 - head/usr.sbin/bhyve
Author: mav Date: Thu Jul 14 17:16:10 2016 New Revision: 302850 URL: https://svnweb.freebsd.org/changeset/base/302850 Log: Make PCI interupts allocation static when using bootrom (UEFI). This makes factual interrupt routing match one shipped with UEFI firmware. With old firmware this make legacy interrupts work reliable for functions 0 of PCI slots 3-6. Updated UEFI image fixes problem completely. Modified: head/usr.sbin/bhyve/ioapic.c head/usr.sbin/bhyve/ioapic.h head/usr.sbin/bhyve/pci_emul.c head/usr.sbin/bhyve/pci_irq.c head/usr.sbin/bhyve/pci_irq.h Modified: head/usr.sbin/bhyve/ioapic.c == --- head/usr.sbin/bhyve/ioapic.cThu Jul 14 17:10:54 2016 (r302849) +++ head/usr.sbin/bhyve/ioapic.cThu Jul 14 17:16:10 2016 (r302850) @@ -29,11 +29,14 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include #include "ioapic.h" +#include "pci_emul.h" +#include "pci_lpc.h" /* * Assign PCI INTx interrupts to I/O APIC pins in a round-robin @@ -64,11 +67,15 @@ ioapic_init(struct vmctx *ctx) } int -ioapic_pci_alloc_irq(void) +ioapic_pci_alloc_irq(struct pci_devinst *pi) { static int last_pin; if (pci_pins == 0) return (-1); + if (lpc_bootrom()) { + /* For external bootrom use fixed mapping. */ + return (16 + (4 + pi->pi_slot + pi->pi_lintr.pin) % 8); + } return (16 + (last_pin++ % pci_pins)); } Modified: head/usr.sbin/bhyve/ioapic.h == --- head/usr.sbin/bhyve/ioapic.hThu Jul 14 17:10:54 2016 (r302849) +++ head/usr.sbin/bhyve/ioapic.hThu Jul 14 17:16:10 2016 (r302850) @@ -30,10 +30,12 @@ #ifndef _IOAPIC_H_ #define_IOAPIC_H_ +struct pci_devinst; + /* * Allocate a PCI IRQ from the I/O APIC. */ void ioapic_init(struct vmctx *ctx); -intioapic_pci_alloc_irq(void); +intioapic_pci_alloc_irq(struct pci_devinst *pi); #endif Modified: head/usr.sbin/bhyve/pci_emul.c == --- head/usr.sbin/bhyve/pci_emul.c Thu Jul 14 17:10:54 2016 (r302849) +++ head/usr.sbin/bhyve/pci_emul.c Thu Jul 14 17:16:10 2016 (r302850) @@ -1504,7 +1504,7 @@ pci_lintr_route(struct pci_devinst *pi) * is not yet assigned. */ if (ii->ii_ioapic_irq == 0) - ii->ii_ioapic_irq = ioapic_pci_alloc_irq(); + ii->ii_ioapic_irq = ioapic_pci_alloc_irq(pi); assert(ii->ii_ioapic_irq > 0); /* @@ -1512,7 +1512,7 @@ pci_lintr_route(struct pci_devinst *pi) * not yet assigned. */ if (ii->ii_pirq_pin == 0) - ii->ii_pirq_pin = pirq_alloc_pin(pi->pi_vmctx); + ii->ii_pirq_pin = pirq_alloc_pin(pi); assert(ii->ii_pirq_pin > 0); pi->pi_lintr.ioapic_irq = ii->ii_ioapic_irq; Modified: head/usr.sbin/bhyve/pci_irq.c == --- head/usr.sbin/bhyve/pci_irq.c Thu Jul 14 17:10:54 2016 (r302849) +++ head/usr.sbin/bhyve/pci_irq.c Thu Jul 14 17:16:10 2016 (r302850) @@ -193,19 +193,25 @@ pci_irq_deassert(struct pci_devinst *pi) } int -pirq_alloc_pin(struct vmctx *ctx) +pirq_alloc_pin(struct pci_devinst *pi) { + struct vmctx *ctx = pi->pi_vmctx; int best_count, best_irq, best_pin, irq, pin; pirq_cold = 0; - /* First, find the least-used PIRQ pin. */ - best_pin = 0; - best_count = pirqs[0].use_count; - for (pin = 1; pin < nitems(pirqs); pin++) { - if (pirqs[pin].use_count < best_count) { - best_pin = pin; - best_count = pirqs[pin].use_count; + if (lpc_bootrom()) { + /* For external bootrom use fixed mapping. */ + best_pin = (4 + pi->pi_slot + pi->pi_lintr.pin) % 8; + } else { + /* Find the least-used PIRQ pin. */ + best_pin = 0; + best_count = pirqs[0].use_count; + for (pin = 1; pin < nitems(pirqs); pin++) { + if (pirqs[pin].use_count < best_count) { + best_pin = pin; + best_count = pirqs[pin].use_count; + } } } pirqs[best_pin].use_count++; Modified: head/usr.sbin/bhyve/pci_irq.h == --- head/usr.sbin/bhyve/pci_irq.h Thu Jul 14 17:10:54 2016 (r302849) +++ head/usr.sbin/bhyve/pci_irq.h Thu Jul 14 17:16:10 2016 (r302850) @@ -37,7 +37,7 @@ void pci_irq_deassert(struct pci_devinst void pci_irq_init(struct vmctx *ctx); void
svn commit: r302849 - head/sys/arm64/arm64
Author: andrew Date: Thu Jul 14 17:10:54 2016 New Revision: 302849 URL: https://svnweb.freebsd.org/changeset/base/302849 Log: Move structures only used by the GICv3 ITS driver from a shared header to the ITS driver file. There is no need for other drivers to need to know about these structures. Obtained from:ABT Systems Ltd MFC after:1 month Sponsored by: The FreeBSD Foundation Modified: head/sys/arm64/arm64/gic_v3_var.h head/sys/arm64/arm64/gicv3_its.c Modified: head/sys/arm64/arm64/gic_v3_var.h == --- head/sys/arm64/arm64/gic_v3_var.h Thu Jul 14 17:05:25 2016 (r302848) +++ head/sys/arm64/arm64/gic_v3_var.h Thu Jul 14 17:10:54 2016 (r302849) @@ -108,87 +108,6 @@ void gic_r_write_4(device_t, bus_size_t, void gic_r_write_8(device_t, bus_size_t, uint64_t var); /* - * ITS - */ - -/* LPI chunk owned by ITS device */ -struct lpi_chunk { - u_int lpi_base; - u_int lpi_free; /* First free LPI in set */ - u_int lpi_num;/* Total number of LPIs in chunk */ - u_int lpi_busy; /* Number of busy LPIs in chink */ -}; - -/* ITS device */ -struct its_dev { - TAILQ_ENTRY(its_dev)entry; - /* PCI device */ - device_tpci_dev; - /* Device ID (i.e. PCI device ID) */ - uint32_tdevid; - /* List of assigned LPIs */ - struct lpi_chunklpis; - /* Virtual address of ITT */ - vm_offset_t itt; - size_t itt_size; -}; - -/* - * ITS command descriptor. - * Idea for command description passing taken from Linux. - */ -struct its_cmd_desc { - uint8_t cmd_type; - - union { - struct { - struct its_dev *its_dev; - struct its_col *col; - uint32_t id; - } cmd_desc_movi; - - struct { - struct its_col *col; - } cmd_desc_sync; - - struct { - struct its_col *col; - uint8_t valid; - } cmd_desc_mapc; - - struct { - struct its_dev *its_dev; - struct its_col *col; - uint32_t pid; - uint32_t id; - } cmd_desc_mapvi; - - struct { - struct its_dev *its_dev; - struct its_col *col; - uint32_t pid; - } cmd_desc_mapi; - - struct { - struct its_dev *its_dev; - uint8_t valid; - } cmd_desc_mapd; - - struct { - struct its_dev *its_dev; - struct its_col *col; - uint32_t pid; - } cmd_desc_inv; - - struct { - struct its_col *col; - } cmd_desc_invall; - }; -}; - -#defineITS_TARGET_NONE 0xFBADBEEF - -/* * GIC Distributor accessors. * Notice that only GIC sofc can be passed. */ Modified: head/sys/arm64/arm64/gicv3_its.c == --- head/sys/arm64/arm64/gicv3_its.cThu Jul 14 17:05:25 2016 (r302848) +++ head/sys/arm64/arm64/gicv3_its.cThu Jul 14 17:10:54 2016 (r302849) @@ -123,6 +123,83 @@ MALLOC_DEFINE(M_GICV3_ITS, "GICv3 ITS", #defineCMD_VALID_SHIFT (63) #defineCMD_VALID_MASK (1UL << CMD_VALID_SHIFT) +#defineITS_TARGET_NONE 0xFBADBEEF + +/* LPI chunk owned by ITS device */ +struct lpi_chunk { + u_int lpi_base; + u_int lpi_free; /* First free LPI in set */ + u_int lpi_num;/* Total number of LPIs in chunk */ + u_int lpi_busy; /* Number of busy LPIs in chink */ +}; + +/* ITS device */ +struct its_dev { + TAILQ_ENTRY(its_dev)entry; + /* PCI device */ + device_tpci_dev; + /* Device ID (i.e. PCI device ID) */ + uint32_tdevid; + /* List of assigned LPIs */ + struct lpi_chunklpis; + /* Virtual address of ITT */ + vm_offset_t itt; + size_t itt_size; +}; + +/* + * ITS command descriptor. + * Idea for command description passing taken from Linux. + */ +struct its_cmd_desc { + uint8_t cmd_type; + + union { + struct { + struct its_dev *its_dev; + struct its_col *col; + uint32_t id; + } cmd_desc_movi; + + struct { + struct its_col *col; + } cmd_desc_sync; + + struct { + struct its_col *col;
svn commit: r302848 - head/sys/arm64/arm64
Author: andrew Date: Thu Jul 14 17:05:25 2016 New Revision: 302848 URL: https://svnweb.freebsd.org/changeset/base/302848 Log: Remove the non-INTRNG support from the GICv3 interrupt controller driver. This is no longer needed. Obtained from:ABT Systems Ltd MFC after:1 month Sponsored by: The FreeBSD Foundation Modified: head/sys/arm64/arm64/gic_v3.c head/sys/arm64/arm64/gic_v3_fdt.c head/sys/arm64/arm64/gic_v3_var.h Modified: head/sys/arm64/arm64/gic_v3.c == --- head/sys/arm64/arm64/gic_v3.c Thu Jul 14 16:52:18 2016 (r302847) +++ head/sys/arm64/arm64/gic_v3.c Thu Jul 14 17:05:25 2016 (r302848) @@ -69,7 +69,6 @@ __FBSDID("$FreeBSD$"); static bus_read_ivar_t gic_v3_read_ivar; -#ifdef INTRNG static pic_disable_intr_t gic_v3_disable_intr; static pic_enable_intr_t gic_v3_enable_intr; static pic_map_intr_t gic_v3_map_intr; @@ -90,18 +89,6 @@ static u_int gic_irq_cpu; static u_int sgi_to_ipi[GIC_LAST_SGI - GIC_FIRST_SGI + 1]; static u_int sgi_first_unused = GIC_FIRST_SGI; #endif -#else -/* Device and PIC methods */ -static int gic_v3_bind(device_t, u_int, u_int); -static void gic_v3_dispatch(device_t, struct trapframe *); -static void gic_v3_eoi(device_t, u_int); -static void gic_v3_mask_irq(device_t, u_int); -static void gic_v3_unmask_irq(device_t, u_int); -#ifdef SMP -static void gic_v3_init_secondary(device_t); -static void gic_v3_ipi_send(device_t, cpuset_t, u_int); -#endif -#endif static device_method_t gic_v3_methods[] = { /* Device interface */ @@ -110,7 +97,6 @@ static device_method_t gic_v3_methods[] /* Bus interface */ DEVMETHOD(bus_read_ivar,gic_v3_read_ivar), -#ifdef INTRNG /* Interrupt controller interface */ DEVMETHOD(pic_disable_intr, gic_v3_disable_intr), DEVMETHOD(pic_enable_intr, gic_v3_enable_intr), @@ -126,18 +112,6 @@ static device_method_t gic_v3_methods[] DEVMETHOD(pic_ipi_send, gic_v3_ipi_send), DEVMETHOD(pic_ipi_setup,gic_v3_ipi_setup), #endif -#else - /* PIC interface */ - DEVMETHOD(pic_bind, gic_v3_bind), - DEVMETHOD(pic_dispatch, gic_v3_dispatch), - DEVMETHOD(pic_eoi, gic_v3_eoi), - DEVMETHOD(pic_mask, gic_v3_mask_irq), - DEVMETHOD(pic_unmask, gic_v3_unmask_irq), -#ifdef SMP - DEVMETHOD(pic_init_secondary, gic_v3_init_secondary), - DEVMETHOD(pic_ipi_send, gic_v3_ipi_send), -#endif -#endif /* End */ DEVMETHOD_END @@ -188,7 +162,6 @@ static gic_v3_initseq_t gic_v3_secondary }; #endif -#ifdef INTRNG uint32_t gic_r_read_4(device_t dev, bus_size_t offset) { @@ -224,7 +197,6 @@ gic_r_write_8(device_t dev, bus_size_t o sc = device_get_softc(dev); bus_write_8(sc->gic_redists.pcpu[PCPU_GET(cpuid)], offset, val); } -#endif /* * Device interface. @@ -238,10 +210,8 @@ gic_v3_attach(device_t dev) int rid; int err; size_t i; -#ifdef INTRNG u_int irq; const char *name; -#endif sc = device_get_softc(dev); sc->gic_registered = FALSE; @@ -290,7 +260,6 @@ gic_v3_attach(device_t dev) if (sc->gic_nirqs > GIC_I_NUM_MAX) sc->gic_nirqs = GIC_I_NUM_MAX; -#ifdef INTRNG sc->gic_irqs = malloc(sizeof(*sc->gic_irqs) * sc->gic_nirqs, M_GIC_V3, M_WAITOK | M_ZERO); name = device_get_nameunit(dev); @@ -318,7 +287,6 @@ gic_v3_attach(device_t dev) return (err); } } -#endif /* Get the number of supported interrupt identifier bits */ sc->gic_idbits = GICD_TYPER_IDBITS(typer); @@ -334,14 +302,6 @@ gic_v3_attach(device_t dev) if (err != 0) return (err); } - /* -* Full success. -* Now register PIC to the interrupts handling layer. -*/ -#ifndef INTRNG - arm_register_root_pic(dev, sc->gic_nirqs); - sc->gic_registered = TRUE; -#endif return (0); } @@ -394,7 +354,6 @@ gic_v3_read_ivar(device_t dev, device_t return (ENOENT); } -#ifdef INTRNG int arm_gic_v3_intr(void *arg) { @@ -914,215 +873,6 @@ gic_v3_ipi_setup(device_t dev, u_int ipi return (0); } #endif /* SMP */ -#else /* INTRNG */ -/* - * PIC interface. - */ - -static int -gic_v3_bind(device_t dev, u_int irq, u_int cpuid) -{ - uint64_t aff; - struct gic_v3_softc *sc; - - sc = device_get_softc(dev); - - if (irq <= GIC_LAST_PPI) { - /* Can't bind PPI to another CPU but it's not an error */ - return (0); - } else if (irq >= GIC_FIRST_SPI && irq <= GIC_LAST_SPI) { - aff = CPU_AFFINITY(cpuid); - gic_d_write(sc, 4, GICD_IROUTER(irq), aff); - return (0); - } else if (irq >=
svn commit: r302847 - head/sys/dev/pci
Author: andrew Date: Thu Jul 14 16:52:18 2016 New Revision: 302847 URL: https://svnweb.freebsd.org/changeset/base/302847 Log: Remove support for the arm64 pre-INTRNG interrupt framework from the PCI driver. Support for this was removed in r302375. Obtained from:ABT Systems Ltd MFC after:1 month Sponsored by: The FreeBSD Foundation Modified: head/sys/dev/pci/pci_host_generic.c Modified: head/sys/dev/pci/pci_host_generic.c == --- head/sys/dev/pci/pci_host_generic.c Thu Jul 14 15:39:31 2016 (r302846) +++ head/sys/dev/pci/pci_host_generic.c Thu Jul 14 16:52:18 2016 (r302847) @@ -724,8 +724,6 @@ generic_pcie_alloc_msi(device_t pci, dev NULL); return (intr_alloc_msi(pci, child, msi_parent, count, maxcount, irqs)); -#elif defined(__aarch64__) - return (arm_alloc_msi(pci, child, count, maxcount, irqs)); #else return (ENXIO); #endif @@ -740,8 +738,6 @@ generic_pcie_release_msi(device_t pci, d ofw_bus_msimap(ofw_bus_get_node(pci), pci_get_rid(child), _parent, NULL); return (intr_release_msi(pci, child, msi_parent, count, irqs)); -#elif defined(__aarch64__) - return (arm_release_msi(pci, child, count, irqs)); #else return (ENXIO); #endif @@ -757,8 +753,6 @@ generic_pcie_map_msi(device_t pci, devic ofw_bus_msimap(ofw_bus_get_node(pci), pci_get_rid(child), _parent, NULL); return (intr_map_msi(pci, child, msi_parent, irq, addr, data)); -#elif defined(__aarch64__) - return (arm_map_msi(pci, child, irq, addr, data)); #else return (ENXIO); #endif @@ -773,8 +767,6 @@ generic_pcie_alloc_msix(device_t pci, de ofw_bus_msimap(ofw_bus_get_node(pci), pci_get_rid(child), _parent, NULL); return (intr_alloc_msix(pci, child, msi_parent, irq)); -#elif defined(__aarch64__) - return (arm_alloc_msix(pci, child, irq)); #else return (ENXIO); #endif @@ -789,8 +781,6 @@ generic_pcie_release_msix(device_t pci, ofw_bus_msimap(ofw_bus_get_node(pci), pci_get_rid(child), _parent, NULL); return (intr_release_msix(pci, child, msi_parent, irq)); -#elif defined(__aarch64__) - return (arm_release_msix(pci, child, irq)); #else return (ENXIO); #endif ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r302846 - in stable/10/cddl: contrib/opensolaris/common/ctf contrib/opensolaris/lib/libnvpair lib/libavl lib/libctf lib/libnvpair lib/libumem lib/libuutil
Author: asomers Date: Thu Jul 14 15:39:31 2016 New Revision: 302846 URL: https://svnweb.freebsd.org/changeset/base/302846 Log: MFC changes relating to warnings in opensolaris-derived libraries MFC r257592 MFC r257657 MFC r257638 MFC r257647 MFC r302141 r257592 | sbruno | 2013-11-03 14:05:44 -0700 (Sun, 03 Nov 2013) | 8 lines This library uses macros to define fprintf behvavior for several object types The compiler will see the non-string literal arguments to the fprintf calls and omit warnings for them. Quiese these warnings in contrib code: cddl/contrib/opensolaris/lib/libnvpair/libnvpair.c:743:12: warning: format string is not a string literal (potentially insecure) [-Wformat-security] ARENDER(pctl, nvlist_array, nvl, name, val, nelem); r257657 | sbruno | 2013-11-04 14:32:07 -0700 (Mon, 04 Nov 2013) | 5 lines Quiesce warning assigning to void * from const ctf_header_t * by explicity casting to void * before assignment. Submitted as Illumos issue 4287 r257638 | sbruno | 2013-11-04 09:15:43 -0700 (Mon, 04 Nov 2013) | 6 lines Quiesce warning regarding %llf which has no effect. Submitted as illumos issue #4284 Reviewed by:delphij r257647 | sbruno | 2013-11-04 12:32:35 -0700 (Mon, 04 Nov 2013) | 4 lines spelling in comments fixup Submitted by: Joerg Sonnenbergerr302141 | asomers | 2016-06-23 09:02:57 -0600 (Thu, 23 Jun 2016) | 14 lines Raise the WARNS level in cddl/lib cddl/lib/libavl/Makefile cddl/lib/libctf/Makefile cddl/lib/libnvpair/Makefile cddl/lib/libumem/Makefile cddl/lib/libuutil/Makefile Increase WARNS to the highest working level for each of these libraries Sponsored by: Spectra Logic Corp Modified: stable/10/cddl/contrib/opensolaris/common/ctf/ctf_create.c stable/10/cddl/contrib/opensolaris/lib/libnvpair/libnvpair.c stable/10/cddl/lib/libavl/Makefile stable/10/cddl/lib/libctf/Makefile stable/10/cddl/lib/libnvpair/Makefile stable/10/cddl/lib/libumem/Makefile stable/10/cddl/lib/libuutil/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/cddl/contrib/opensolaris/common/ctf/ctf_create.c == --- stable/10/cddl/contrib/opensolaris/common/ctf/ctf_create.c Thu Jul 14 15:09:08 2016(r302845) +++ stable/10/cddl/contrib/opensolaris/common/ctf/ctf_create.c Thu Jul 14 15:39:31 2016(r302846) @@ -65,7 +65,7 @@ ctf_create(int *errp) cts.cts_name = _CTF_SECTION; cts.cts_type = SHT_PROGBITS; cts.cts_flags = 0; - cts.cts_data = + cts.cts_data = (void *) cts.cts_size = sizeof (hdr); cts.cts_entsize = 1; cts.cts_offset = 0; Modified: stable/10/cddl/contrib/opensolaris/lib/libnvpair/libnvpair.c == --- stable/10/cddl/contrib/opensolaris/lib/libnvpair/libnvpair.cThu Jul 14 15:09:08 2016(r302845) +++ stable/10/cddl/contrib/opensolaris/lib/libnvpair/libnvpair.cThu Jul 14 15:39:31 2016(r302846) @@ -210,7 +210,7 @@ NVLIST_PRTFUNC(int32, int32_t, int32_t, NVLIST_PRTFUNC(uint32, uint32_t, uint32_t, "0x%x") NVLIST_PRTFUNC(int64, int64_t, longlong_t, "%lld") NVLIST_PRTFUNC(uint64, uint64_t, u_longlong_t, "0x%llx") -NVLIST_PRTFUNC(double, double, double, "0x%llf") +NVLIST_PRTFUNC(double, double, double, "0x%f") NVLIST_PRTFUNC(string, char *, char *, "%s") NVLIST_PRTFUNC(hrtime, hrtime_t, hrtime_t, "0x%llx") Modified: stable/10/cddl/lib/libavl/Makefile == --- stable/10/cddl/lib/libavl/Makefile Thu Jul 14 15:09:08 2016 (r302845) +++ stable/10/cddl/lib/libavl/Makefile Thu Jul 14 15:39:31 2016 (r302846) @@ -4,7 +4,7 @@ LIB= avl SRCS= avl.c -WARNS?=0 +WARNS?=3 CFLAGS+= -I${.CURDIR}/../../../sys/cddl/compat/opensolaris CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common Modified: stable/10/cddl/lib/libctf/Makefile == --- stable/10/cddl/lib/libctf/Makefile Thu Jul 14 15:09:08 2016 (r302845) +++ stable/10/cddl/lib/libctf/Makefile Thu Jul 14 15:39:31 2016 (r302846) @@ -17,7 +17,7 @@ SRCS= ctf_create.c \ ctf_types.c \ ctf_util.c -WARNS?=0 +WARNS?=2 CFLAGS+= -DCTF_OLD_VERSIONS CFLAGS+= -I${.CURDIR}/../../../sys/cddl/compat/opensolaris \ Modified: stable/10/cddl/lib/libnvpair/Makefile == --- stable/10/cddl/lib/libnvpair/Makefile Thu Jul 14 15:09:08 2016 (r302845) +++ stable/10/cddl/lib/libnvpair/Makefile Thu Jul 14 15:39:31 2016
svn commit: r302845 - head/usr.bin/mail
Author: pfg Date: Thu Jul 14 15:09:08 2016 New Revision: 302845 URL: https://svnweb.freebsd.org/changeset/base/302845 Log: mail(1): check for out of memory conditions when calling calloc(3). X-MFC with: r302771 Modified: head/usr.bin/mail/vars.c Modified: head/usr.bin/mail/vars.c == --- head/usr.bin/mail/vars.cThu Jul 14 14:48:40 2016(r302844) +++ head/usr.bin/mail/vars.cThu Jul 14 15:09:08 2016(r302845) @@ -56,7 +56,8 @@ assign(const char *name, const char *val h = hash(name); vp = lookup(name); if (vp == NULL) { - vp = calloc(1, sizeof(*vp)); + if ((vp = calloc(1, sizeof(*vp))) == NULL) + err(1, "Out of memory"); vp->v_name = vcopy(name); vp->v_link = variables[h]; variables[h] = vp; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r302843 - head/sys/amd64/vmm/io
Author: mav Date: Thu Jul 14 14:35:25 2016 New Revision: 302843 URL: https://svnweb.freebsd.org/changeset/base/302843 Log: Increase number of I/O APIC pins from 24 to 32 to give PCI up to 16 IRQs. Move HPET to the top of the supported 0-31 range. Proposed by: jhb@, grehan@ Modified: head/sys/amd64/vmm/io/vhpet.c head/sys/amd64/vmm/io/vioapic.c Modified: head/sys/amd64/vmm/io/vhpet.c == --- head/sys/amd64/vmm/io/vhpet.c Thu Jul 14 14:16:20 2016 (r302842) +++ head/sys/amd64/vmm/io/vhpet.c Thu Jul 14 14:35:25 2016 (r302843) @@ -715,8 +715,10 @@ vhpet_init(struct vm *vm) vhpet->freq_sbt = bttosbt(bt); pincount = vioapic_pincount(vm); - if (pincount >= 24) - allowed_irqs = 0x00f0; /* irqs 20, 21, 22 and 23 */ + if (pincount >= 32) + allowed_irqs = 0xff00; /* irqs 24-31 */ + else if (pincount >= 20) + allowed_irqs = 0xf << (pincount - 4); /* 4 upper irqs */ else allowed_irqs = 0; Modified: head/sys/amd64/vmm/io/vioapic.c == --- head/sys/amd64/vmm/io/vioapic.c Thu Jul 14 14:16:20 2016 (r302842) +++ head/sys/amd64/vmm/io/vioapic.c Thu Jul 14 14:35:25 2016 (r302843) @@ -49,7 +49,7 @@ __FBSDID("$FreeBSD$"); #defineIOREGSEL0x00 #defineIOWIN 0x10 -#defineREDIR_ENTRIES 24 +#defineREDIR_ENTRIES 32 #defineRTBL_RO_BITS((uint64_t)(IOART_REM_IRR | IOART_DELIVS)) struct vioapic { ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r302842 - head
Author: ngie Date: Thu Jul 14 14:16:20 2016 New Revision: 302842 URL: https://svnweb.freebsd.org/changeset/base/302842 Log: Don't delete usr/share/local/kk_KZ.UTF-8 with "make delete-old" after r302329 kk_KZ.UTF-8 was originally removed in r290494, but restored as an alias to en_US.UTF-8 in r302329 MFC after: 1 week X-MFC with: r302329 PR: 211046 Reported by: dhw, O. HartmanSponsored by: EMC / Isilon Storage Division Modified: head/ObsoleteFiles.inc Modified: head/ObsoleteFiles.inc == --- head/ObsoleteFiles.inc Thu Jul 14 13:55:38 2016(r302841) +++ head/ObsoleteFiles.inc Thu Jul 14 14:16:20 2016(r302842) @@ -460,13 +460,6 @@ OLD_FILES+=usr/share/locale/kk_KZ.PT154/ OLD_FILES+=usr/share/locale/kk_KZ.PT154/LC_NUMERIC OLD_FILES+=usr/share/locale/kk_KZ.PT154/LC_TIME OLD_DIRS+=usr/share/locale/kk_KZ.PT154/ -OLD_FILES+=usr/share/locale/kk_KZ.UTF-8/LC_COLLATE -OLD_FILES+=usr/share/locale/kk_KZ.UTF-8/LC_CTYPE -OLD_FILES+=usr/share/locale/kk_KZ.UTF-8/LC_MESSAGES -OLD_FILES+=usr/share/locale/kk_KZ.UTF-8/LC_MONETARY -OLD_FILES+=usr/share/locale/kk_KZ.UTF-8/LC_NUMERIC -OLD_FILES+=usr/share/locale/kk_KZ.UTF-8/LC_TIME -OLD_DIRS+=usr/share/locale/kk_KZ.UTF-8 OLD_FILES+=usr/share/locale/la_LN.ISO8859-1/LC_COLLATE OLD_FILES+=usr/share/locale/la_LN.ISO8859-1/LC_CTYPE OLD_FILES+=usr/share/locale/la_LN.ISO8859-1/LC_TIME ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r302841 - head/sys/dev/drm2
Author: ngie Date: Thu Jul 14 13:55:38 2016 New Revision: 302841 URL: https://svnweb.freebsd.org/changeset/base/302841 Log: Always panic if an invalid capability is passed to `capable(..)` instead of just with INVARIANTS rwatson's point was valid in the sense that if the data passed at runtime is invalid, it should always trip the invariant, not just in the debug case. This is a deterrent against malicious input, or input caused by hardware errors. MFC after: 4 days X-MFC with: r302577 Requested by: rwatson Sponsored by: EMC / Isilon Storage Division Modified: head/sys/dev/drm2/drm_os_freebsd.h Modified: head/sys/dev/drm2/drm_os_freebsd.h == --- head/sys/dev/drm2/drm_os_freebsd.h Thu Jul 14 11:53:39 2016 (r302840) +++ head/sys/dev/drm2/drm_os_freebsd.h Thu Jul 14 13:55:38 2016 (r302841) @@ -439,8 +439,7 @@ capable(enum __drm_capabilities cap) case CAP_SYS_ADMIN: return DRM_SUSER(curthread); default: - KASSERT(false, - ("%s: unhandled capability: %0x", __func__, cap)); + panic("%s: unhandled capability: %0x", __func__, cap); return (false); } } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r302577 - head/sys/dev/drm2
> On Jul 13, 2016, at 16:56, Ngie Cooperwrote: > > On Wed, Jul 13, 2016 at 4:54 AM, Robert Watson wrote: >> On Mon, 11 Jul 2016, Garrett Cooper wrote: >> >>> Add missing default case to capable(..) function definition >>> >>> By definition (enum __drm_capabilities), cases other than CAP_SYS_ADMIN >>> aren't possible. Add in a KASSERT safety belt and return false in >>> !INVARIANTS case if an invalid value is passed in, as it would be a >>> programmer error. >>> >>> This fixes a -Wreturn-type error with gcc 5.3.0. >>> >>> Differential Revision: https://reviews.freebsd.org/D7188 >>> MFC after: 1 week >>> Reported by: devel/amd64-gcc (5.3.0) >>> Reviewed by: dumbbell >>> Sponsored by: EMC / Isilon Storage Division >> >> Per my comment in the review, I think a panic() here would be preferable to >> a KASSERT(), as it would come without perceptible runtime cost, and failstop >> the system if we were violating a design-time security invariant. > >Good point. I'll commit the change tonight. Fixed in r302841. Thanks! signature.asc Description: Message signed with OpenPGP using GPGMail
svn commit: r302840 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
Author: avg Date: Thu Jul 14 11:53:39 2016 New Revision: 302840 URL: https://svnweb.freebsd.org/changeset/base/302840 Log: MFV r302645: 6878 Add scrub completion info to "zpool history" illumos/illumos-gate@1825bc56e5a1f7ef6f0dc3137f3b35f5850c1100 https://github.com/illumos/illumos-gate/commit/1825bc56e5a1f7ef6f0dc3137f3b35f5850c1100 https://www.illumos.org/issues/6878 Summary of changes: * Replace generic "scan done" message with "scan aborted, restarting", "scan cancelled", or "scan done" * Log number of errors using spa_get_errlog_size * Refactor scan restarting check into static function Reviewed by: Matthew AhrensReviewed by: Dan Kimmel Approved by: Dan McDonald Author: Nav Ravindranath MFC after:2 weeks Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c Directory Properties: head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c == --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c Thu Jul 14 11:51:01 2016(r302839) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c Thu Jul 14 11:53:39 2016(r302840) @@ -56,7 +56,8 @@ typedef int (scan_cb_t)(dsl_pool_t *, co static scan_cb_t dsl_scan_scrub_cb; static void dsl_scan_cancel_sync(void *, dmu_tx_t *); -static void dsl_scan_sync_state(dsl_scan_t *, dmu_tx_t *tx); +static void dsl_scan_sync_state(dsl_scan_t *, dmu_tx_t *); +static boolean_t dsl_scan_restarting(dsl_scan_t *, dmu_tx_t *); unsigned int zfs_top_maxinflight = 32; /* maximum I/Os per top-level */ unsigned int zfs_resilver_delay = 2; /* number of ticks to delay resilver */ @@ -320,8 +321,15 @@ dsl_scan_done(dsl_scan_t *scn, boolean_t else scn->scn_phys.scn_state = DSS_CANCELED; - spa_history_log_internal(spa, "scan done", tx, - "complete=%u", complete); + if (dsl_scan_restarting(scn, tx)) + spa_history_log_internal(spa, "scan aborted, restarting", tx, + "errors=%llu", spa_get_errlog_size(spa)); + else if (!complete) + spa_history_log_internal(spa, "scan cancelled", tx, + "errors=%llu", spa_get_errlog_size(spa)); + else + spa_history_log_internal(spa, "scan done", tx, + "errors=%llu", spa_get_errlog_size(spa)); if (DSL_SCAN_IS_SCRUB_RESILVER(scn)) { mutex_enter(>spa_scrub_lock); @@ -1476,8 +1484,7 @@ dsl_scan_sync(dsl_pool_t *dp, dmu_tx_t * * that we can restart an old-style scan while the pool is being * imported (see dsl_scan_init). */ - if (scn->scn_restart_txg != 0 && - scn->scn_restart_txg <= tx->tx_txg) { + if (dsl_scan_restarting(scn, tx)) { pool_scan_func_t func = POOL_SCAN_SCRUB; dsl_scan_done(scn, B_FALSE, tx); if (vdev_resilver_needed(spa->spa_root_vdev, NULL, NULL)) @@ -1904,3 +1911,10 @@ dsl_scan(dsl_pool_t *dp, pool_scan_func_ return (dsl_sync_task(spa_name(spa), dsl_scan_setup_check, dsl_scan_setup_sync, , 0, ZFS_SPACE_CHECK_NONE)); } + +static boolean_t +dsl_scan_restarting(dsl_scan_t *scn, dmu_tx_t *tx) +{ + return (scn->scn_restart_txg != 0 && + scn->scn_restart_txg <= tx->tx_txg); +} ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r302839 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
Author: avg Date: Thu Jul 14 11:51:01 2016 New Revision: 302839 URL: https://svnweb.freebsd.org/changeset/base/302839 Log: MFV r302650: 6940 Cannot unlink directories when over quota illumos/illumos-gate@99189164df06057fb968ca7be701bb1a0d5da8c9 https://github.com/illumos/illumos-gate/commit/99189164df06057fb968ca7be701bb1a0d5da8c9 https://www.illumos.org/issues/6940 Similar to #6334, but this time with empty directories: $ zfs create tank/quota $ zfs set quota=10M tank/quota $ zfs snapshot tank/quota@snap1 $ zfs set mountpoint=/mnt/tank/quota tank/quota $ mkdir /mnt/tank/quota/dir # create an empty directory $ mkfile 11M /mnt/tank/quota/11M /mnt/tank/quota/11M: initialized 9830400 of 11534336 bytes: Disc quota exceeded $ rmdir /mnt/tank/quota/dir # now unlink the empty directory rmdir: directory "/mnt/tank/quota/dir": Disc quota exceeded From user perspective, I would expect that ZFS is always able to remove files and directories even when the quota is exceeded. Reviewed by: Dan McDonaldReviewed by: Matthew Ahrens Approved by: Robert Mustacchi Author: Simon Klinkert MFC after:2 weeks Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Directory Properties: head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c == --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Thu Jul 14 11:48:42 2016(r302838) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Thu Jul 14 11:51:01 2016(r302839) @@ -2438,6 +2438,7 @@ top: dmu_tx_hold_zap(tx, zfsvfs->z_unlinkedobj, FALSE, NULL); zfs_sa_upgrade_txholds(tx, zp); zfs_sa_upgrade_txholds(tx, dzp); + dmu_tx_mark_netfree(tx); error = dmu_tx_assign(tx, waited ? TXG_WAITED : TXG_NOWAIT); if (error) { rw_exit(>z_parent_lock); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r302838 - in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys
Author: avg Date: Thu Jul 14 11:48:42 2016 New Revision: 302838 URL: https://svnweb.freebsd.org/changeset/base/302838 Log: MFV r302644: 6513 partially filled holes lose birth time illumos/illumos-gate@8df0bcf0df7622a075cc6e52f659d2fcfdd08cdc https://github.com/illumos/illumos-gate/commit/8df0bcf0df7622a075cc6e52f659d2fcfdd08cdc https://www.illumos.org/issues/6513 If a ZFS object contains a hole at level one, and then a data block is created at level 0 underneath that l1 block, l0 holes will be created. However, these l0 holes do not have the birth time property set; as a result, incremental sends will not send those holes. Fix is to modify the dbuf_read code to fill in birth time data. Reviewed by: Matthew AhrensReviewed by: George Wilson Reviewed by: Boris Protopopov Approved by: Richard Lowe Author: Paul Dagnelie MFC after:3 weeks Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode_sync.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/arc.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Directory Properties: head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c == --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Thu Jul 14 11:42:53 2016(r302837) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Thu Jul 14 11:48:42 2016(r302838) @@ -21,7 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012, Joyent, Inc. All rights reserved. - * Copyright (c) 2011, 2015 by Delphix. All rights reserved. + * Copyright (c) 2011, 2016 by Delphix. All rights reserved. * Copyright (c) 2014 by Saso Kiselkov. All rights reserved. * Copyright 2015 Nexenta Systems, Inc. All rights reserved. */ @@ -784,6 +784,7 @@ typedef struct arc_write_callback arc_wr struct arc_write_callback { void*awcb_private; arc_done_func_t *awcb_ready; + arc_done_func_t *awcb_children_ready; arc_done_func_t *awcb_physdone; arc_done_func_t *awcb_done; arc_buf_t *awcb_buf; @@ -5106,6 +5107,15 @@ arc_write_ready(zio_t *zio) hdr->b_flags |= ARC_FLAG_IO_IN_PROGRESS; } +static void +arc_write_children_ready(zio_t *zio) +{ + arc_write_callback_t *callback = zio->io_private; + arc_buf_t *buf = callback->awcb_buf; + + callback->awcb_children_ready(zio, buf, callback->awcb_private); +} + /* * The SPA calls this callback for each physical write that happens on behalf * of a logical write. See the comment in dbuf_write_physdone() for details. @@ -5202,7 +5212,8 @@ arc_write_done(zio_t *zio) zio_t * arc_write(zio_t *pio, spa_t *spa, uint64_t txg, blkptr_t *bp, arc_buf_t *buf, boolean_t l2arc, boolean_t l2arc_compress, -const zio_prop_t *zp, arc_done_func_t *ready, arc_done_func_t *physdone, +const zio_prop_t *zp, arc_done_func_t *ready, +arc_done_func_t *children_ready, arc_done_func_t *physdone, arc_done_func_t *done, void *private, zio_priority_t priority, int zio_flags, const zbookmark_phys_t *zb) { @@ -5222,13 +5233,16 @@ arc_write(zio_t *pio, spa_t *spa, uint64 hdr->b_flags |= ARC_FLAG_L2COMPRESS; callback = kmem_zalloc(sizeof (arc_write_callback_t), KM_SLEEP); callback->awcb_ready = ready; + callback->awcb_children_ready = children_ready; callback->awcb_physdone = physdone; callback->awcb_done = done; callback->awcb_private = private; callback->awcb_buf = buf; zio = zio_write(pio, spa, txg, bp, buf->b_data, hdr->b_size, zp, - arc_write_ready, arc_write_physdone, arc_write_done, callback, + arc_write_ready, + (children_ready != NULL) ? arc_write_children_ready : NULL, + arc_write_physdone, arc_write_done, callback, priority, zio_flags, zb); return (zio); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c == --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Thu Jul 14 11:42:53 2016(r302837) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Thu Jul 14 11:48:42 2016(r302838) @@ -486,13 +486,49 @@ dbuf_verify(dmu_buf_impl_t *db) * If the blkptr isn't set but they
svn commit: r302837 - in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys
Author: avg Date: Thu Jul 14 11:42:53 2016 New Revision: 302837 URL: https://svnweb.freebsd.org/changeset/base/302837 Log: MFV r302641: 6844 dnode_next_offset can detect fictional holes illumos/illumos-gate@11ceac77ea8034bf2fe9bdd6d314f5d1e5ceeba3 https://github.com/illumos/illumos-gate/commit/11ceac77ea8034bf2fe9bdd6d314f5d1e5ceeba3 https://www.illumos.org/issues/6844 dnode_next_offset is used in a variety of places to iterate over the holes or allocated blocks in a dnode. It operates under the premise that it can iterate over the blockpointers of a dnode in open context while holding only the dn_struct_rwlock as reader. Unfortunately, this premise does not hold. When we create the zio for a dbuf, we pass in the actual block pointer in the indirect block above that dbuf. When we later zero the bp in zio_write_compress, we are directly modifying the bp. The state of the bp is now inconsistent from the perspective of dnode_next_offset: the bp will appear to be a hole until zio_dva_allocate finally finishes filling it in. In the meantime, dnode_next_offset can detect a hole in the dnode when none exists. I was able to experimentally demonstrate this behavior with the following setup: 1. Create a file with 1 million dbufs. 2. Create a thread that randomly dirties L2 blocks by writing to the first L0 block under them. 3. Observe dnode_next_offset, waiting for it to skip over a hole in the middle of a file. 4. Do dnode_next_offset in a loop until we skip over such a non-existent hole. The fix is to ensure that it is valid to iterate over the indirect blocks in a dnode while holding the dn_struct_rwlock by passing the zio a copy of the BP and updating the actual BP in dbuf_write_ready while holding the lock. Reviewed by: Matthew AhrensReviewed by: George Wilson Reviewed by: Boris Protopopov Approved by: Dan McDonald Author: Alex Reece MFC after:3 weeks Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dbuf.h Directory Properties: head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c == --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Thu Jul 14 11:39:36 2016(r302836) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Thu Jul 14 11:42:53 2016(r302837) @@ -2883,7 +2883,8 @@ dbuf_write_ready(zio_t *zio, arc_buf_t * uint64_t fill = 0; int i; - ASSERT3P(db->db_blkptr, ==, bp); + ASSERT3P(db->db_blkptr, !=, NULL); + ASSERT3P(>db_data_pending->dr_bp_copy, ==, bp); DB_DNODE_ENTER(db); dn = DB_DNODE(db); @@ -2905,7 +2906,7 @@ dbuf_write_ready(zio_t *zio, arc_buf_t * #ifdef ZFS_DEBUG if (db->db_blkid == DMU_SPILL_BLKID) { ASSERT(dn->dn_phys->dn_flags & DNODE_FLAG_SPILL_BLKPTR); - ASSERT(!(BP_IS_HOLE(db->db_blkptr)) && + ASSERT(!(BP_IS_HOLE(bp)) && db->db_blkptr == >dn_phys->dn_spill); } #endif @@ -2946,6 +2947,10 @@ dbuf_write_ready(zio_t *zio, arc_buf_t * bp->blk_fill = fill; mutex_exit(>db_mtx); + + rw_enter(>dn_struct_rwlock, RW_WRITER); + *db->db_blkptr = *bp; + rw_exit(>dn_struct_rwlock); } /* @@ -3124,6 +3129,8 @@ dbuf_write(dbuf_dirty_record_t *dr, arc_ zio_t *zio; int wp_flag = 0; + ASSERT(dmu_tx_is_syncing(tx)); + DB_DNODE_ENTER(db); dn = DB_DNODE(db); os = dn->dn_objset; @@ -3182,6 +3189,14 @@ dbuf_write(dbuf_dirty_record_t *dr, arc_ dmu_write_policy(os, dn, db->db_level, wp_flag, ); DB_DNODE_EXIT(db); + /* +* We copy the blkptr now (rather than when we instantiate the dirty +* record), because its value can change between open context and +* syncing context. We do not need to hold dn_struct_rwlock to read +* db_blkptr because we are in syncing context. +*/ + dr->dr_bp_copy = *db->db_blkptr; + if (db->db_level == 0 && dr->dt.dl.dr_override_state == DR_OVERRIDDEN) { /* @@ -3191,7 +3206,7 @@ dbuf_write(dbuf_dirty_record_t *dr, arc_ void *contents = (data != NULL) ? data->b_data : NULL; dr->dr_zio = zio_write(zio, os->os_spa, txg, - db->db_blkptr, contents, db->db.db_size, , + >dr_bp_copy, contents, db->db.db_size, , dbuf_write_override_ready, NULL, dbuf_write_override_done, dr, ZIO_PRIORITY_ASYNC_WRITE, ZIO_FLAG_MUSTSUCCEED, ); mutex_enter(>db_mtx); @@
svn commit: r302836 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
Author: avg Date: Thu Jul 14 11:39:36 2016 New Revision: 302836 URL: https://svnweb.freebsd.org/changeset/base/302836 Log: MFV r302640: 6874 rollback and receive need to reset ZPL state to what's on disk illumos/illumos-gate@1fdcbd00c9cbac286b5f92e08877e8cb3c448420 https://github.com/illumos/illumos-gate/commit/1fdcbd00c9cbac286b5f92e08877e8cb3c448420 https://www.illumos.org/issues/6874 When we do a clone swap (caused by "zfs rollback" or "zfs receive"), the ZPL doesn't completely reload the state from the DMU; some values remain cached in the zfsvfs_t. steps to reproduce: ``` #!/bin/bash -x zfs destroy -R test/fs zfs destroy -R test/recvd zfs create test/fs zfs snapshot test/fs@a zfs set userquota@$USER=1m test/fs zfs snapshot test/fs@b zfs send test/fs@a | zfs recv test/recvd zfs send -i @a test/fs@b | zfs recv test/recvd zfs userspace test/recvd 1. should show 1m quota dd if=/dev/urandom of=/test/recvd/file bs=1k count=1024 sync dd if=/dev/urandom of=/test/recvd/file2 bs=1k count=1024 2. should fail with ENOSPC sync zfs unmount test/recvd zfs mount test/recvd zfs userspace test/recvd 3. if bug above, now shows 1m quota dd if=/dev/urandom of=/test/recvd/file3 bs=1k count=1024 4. if bug above, now fails with ENOSPC ``` Reviewed by: George WilsonReviewed by: Paul Dagnelie Approved by: Garrett D'Amore Author: Matthew Ahrens MFC after:3 weeks Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Directory Properties: head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c == --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.cThu Jul 14 11:13:26 2016(r302835) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.cThu Jul 14 11:39:36 2016(r302836) @@ -22,7 +22,7 @@ * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2011 Pawel Jakub Dawidek . * All rights reserved. - * Copyright (c) 2012, 2014 by Delphix. All rights reserved. + * Copyright (c) 2012, 2015 by Delphix. All rights reserved. * Copyright (c) 2014 Integros [integros.com] */ @@ -846,72 +846,46 @@ zfs_owner_overquota(zfsvfs_t *zfsvfs, zn return (zfs_fuid_overquota(zfsvfs, isgroup, fuid)); } -int -zfsvfs_create(const char *osname, zfsvfs_t **zfvp) +/* + * Associate this zfsvfs with the given objset, which must be owned. + * This will cache a bunch of on-disk state from the objset in the + * zfsvfs. + */ +static int +zfsvfs_init(zfsvfs_t *zfsvfs, objset_t *os) { - objset_t *os; - zfsvfs_t *zfsvfs; - uint64_t zval; - int i, error; - uint64_t sa_obj; - - /* -* XXX: Fix struct statfs so this isn't necessary! -* -* The 'osname' is used as the filesystem's special node, which means -* it must fit in statfs.f_mntfromname, or else it can't be -* enumerated, so libzfs_mnttab_find() returns NULL, which causes -* 'zfs unmount' to think it's not mounted when it is. -*/ - if (strlen(osname) >= MNAMELEN) - return (SET_ERROR(ENAMETOOLONG)); - - zfsvfs = kmem_zalloc(sizeof (zfsvfs_t), KM_SLEEP); - - /* -* We claim to always be readonly so we can open snapshots; -* other ZPL code will prevent us from writing to snapshots. -*/ - error = dmu_objset_own(osname, DMU_OST_ZFS, B_TRUE, zfsvfs, ); - if (error) { - kmem_free(zfsvfs, sizeof (zfsvfs_t)); - return (error); - } + int error; + uint64_t val; - /* -* Initialize the zfs-specific filesystem structure. -* Should probably make this a kmem cache, shuffle fields, -* and just bzero up to z_hold_mtx[]. -*/ - zfsvfs->z_vfs = NULL; - zfsvfs->z_parent = zfsvfs; zfsvfs->z_max_blksz = SPA_OLD_MAXBLOCKSIZE; zfsvfs->z_show_ctldir = ZFS_SNAPDIR_VISIBLE; zfsvfs->z_os = os; error = zfs_get_zplprop(os, ZFS_PROP_VERSION, >z_version); - if (error) { - goto out; - } else if (zfsvfs->z_version > + if (error != 0) + return (error); + if (zfsvfs->z_version > zfs_zpl_version_map(spa_version(dmu_objset_spa(os { (void) printf("Can't mount a version %lld file system " "on a version %lld pool\n. Pool must be upgraded to mount " "this file system.", (u_longlong_t)zfsvfs->z_version,
svn commit: r302835 - head/sys/amd64/amd64
Author: avg Date: Thu Jul 14 11:13:26 2016 New Revision: 302835 URL: https://svnweb.freebsd.org/changeset/base/302835 Log: remove a stray change from r302834 MFC after:3 weeks X-MFC with: r302834 Modified: head/sys/amd64/amd64/initcpu.c Modified: head/sys/amd64/amd64/initcpu.c == --- head/sys/amd64/amd64/initcpu.c Thu Jul 14 11:03:05 2016 (r302834) +++ head/sys/amd64/amd64/initcpu.c Thu Jul 14 11:13:26 2016 (r302835) @@ -193,7 +193,6 @@ initializecpu(void) void initializecpucache(void) { - uint64_t msr; /* * CPUID with %eax = 1, %ebx returns ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r302834 - head/sys/amd64/amd64
Author: avg Date: Thu Jul 14 11:03:05 2016 New Revision: 302834 URL: https://svnweb.freebsd.org/changeset/base/302834 Log: fix-up for configuration of AMD Family 10h processors borrowed from Linux http://lxr.free-electrons.com/source/arch/x86/kernel/cpu/amd.c#L643 BIOS may configure Family 10h processors to convert WC+ cache type to CD. That can hurt performance of guest VMs using nested paging. Reviewed by: kib MFC after:3 weeks Differential Revision: https://reviews.freebsd.org/D6059 Modified: head/sys/amd64/amd64/initcpu.c Modified: head/sys/amd64/amd64/initcpu.c == --- head/sys/amd64/amd64/initcpu.c Thu Jul 14 09:47:49 2016 (r302833) +++ head/sys/amd64/amd64/initcpu.c Thu Jul 14 11:03:05 2016 (r302834) @@ -94,6 +94,20 @@ init_amd(void) wrmsr(MSR_NB_CFG1, msr); } } + + /* +* BIOS may configure Family 10h processors to convert WC+ cache type +* to CD. That can hurt performance of guest VMs using nested paging. +* The relevant MSR bit is not documented in the BKDG, +* the fix is borrowed from Linux. +*/ + if (CPUID_TO_FAMILY(cpu_id) == 0x10) { + if ((cpu_feature2 & CPUID2_HV) == 0) { + msr = rdmsr(0xc001102a); + msr &= ~((uint64_t)1 << 24); + wrmsr(0xc001102a, msr); + } + } } /* @@ -179,6 +193,7 @@ initializecpu(void) void initializecpucache(void) { + uint64_t msr; /* * CPUID with %eax = 1, %ebx returns ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r302833 - head/gnu/usr.bin/grep
Author: ache Date: Thu Jul 14 09:47:49 2016 New Revision: 302833 URL: https://svnweb.freebsd.org/changeset/base/302833 Log: Back out non-collating [a-z] ranges. Instead of changing the whole course to another POSIX-permitted way for consistency and uniformity I decide to completely ignore missing regex fucntionality and focus on fixing bugs in what we have now, too many small obstacles we have choicing other way, counting ports. Corresponding libc changes are backed out in r302824. Modified: head/gnu/usr.bin/grep/dfa.c Modified: head/gnu/usr.bin/grep/dfa.c == --- head/gnu/usr.bin/grep/dfa.c Thu Jul 14 09:45:07 2016(r302832) +++ head/gnu/usr.bin/grep/dfa.c Thu Jul 14 09:47:49 2016(r302833) @@ -2547,13 +2547,8 @@ match_mb_charset (struct dfa *d, int s, wcbuf[2] = work_mbc->range_sts[i]; wcbuf[4] = work_mbc->range_ends[i]; -#ifdef __FreeBSD__ - if (wcscmp(wcbuf, wcbuf+2) >= 0 && - wcscmp(wcbuf+4, wcbuf) >= 0) -#else if (wcscoll(wcbuf, wcbuf+2) >= 0 && wcscoll(wcbuf+4, wcbuf) >= 0) -#endif goto charset_matched; } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r302832 - head/contrib/libgnuregex
Author: ache Date: Thu Jul 14 09:45:07 2016 New Revision: 302832 URL: https://svnweb.freebsd.org/changeset/base/302832 Log: Back out non-collating [a-z] ranges. Instead of changing the whole course to another POSIX-permitted way for consistency and uniformity I decide to completely ignore missing regex fucntionality and focus on fixing bugs in what we have now, too many small obstacles we have choicing other way, counting ports. Corresponding libc changes are backed out in r302824. Modified: head/contrib/libgnuregex/regcomp.c head/contrib/libgnuregex/regexec.c Modified: head/contrib/libgnuregex/regcomp.c == --- head/contrib/libgnuregex/regcomp.c Thu Jul 14 09:40:42 2016 (r302831) +++ head/contrib/libgnuregex/regcomp.c Thu Jul 14 09:45:07 2016 (r302832) @@ -2664,11 +2664,7 @@ build_range_exp (bitset_t sbcset, bracke return REG_ECOLLATE; cmp_buf[0] = start_wc; cmp_buf[4] = end_wc; -#ifdef __FreeBSD__ -if (wcscmp (cmp_buf, cmp_buf + 4) > 0) -#else if (wcscoll (cmp_buf, cmp_buf + 4) > 0) -#endif return REG_ERANGE; /* Got valid collation sequence values, add them as a new entry. @@ -2710,13 +2706,8 @@ build_range_exp (bitset_t sbcset, bracke for (wc = 0; wc < SBC_MAX; ++wc) { cmp_buf[2] = wc; -#ifdef __FreeBSD__ - if (wcscmp (cmp_buf, cmp_buf + 2) <= 0 - && wcscmp (cmp_buf + 2, cmp_buf + 4) <= 0) -#else if (wcscoll (cmp_buf, cmp_buf + 2) <= 0 && wcscoll (cmp_buf + 2, cmp_buf + 4) <= 0) -#endif bitset_set (sbcset, wc); } } Modified: head/contrib/libgnuregex/regexec.c == --- head/contrib/libgnuregex/regexec.c Thu Jul 14 09:40:42 2016 (r302831) +++ head/contrib/libgnuregex/regexec.c Thu Jul 14 09:45:07 2016 (r302832) @@ -3964,13 +3964,8 @@ check_node_accept_bytes (const re_dfa_t { cmp_buf[0] = cset->range_starts[i]; cmp_buf[4] = cset->range_ends[i]; -#ifdef __FreeBSD__ - if (wcscmp (cmp_buf, cmp_buf + 2) <= 0 - && wcscmp (cmp_buf + 2, cmp_buf + 4) <= 0) -#else if (wcscoll (cmp_buf, cmp_buf + 2) <= 0 && wcscoll (cmp_buf + 2, cmp_buf + 4) <= 0) -#endif { match_len = char_len; goto check_node_accept_bytes_match; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r302831 - head/contrib/tcsh
Author: ache Date: Thu Jul 14 09:40:42 2016 New Revision: 302831 URL: https://svnweb.freebsd.org/changeset/base/302831 Log: To mimic system glob, we definitely don't need manual upper/lower hack. The author clearly disagree in the comment, so this patch will be not submitted upstream. Modified: head/contrib/tcsh/glob.c Modified: head/contrib/tcsh/glob.c == --- head/contrib/tcsh/glob.cThu Jul 14 09:37:16 2016(r302830) +++ head/contrib/tcsh/glob.cThu Jul 14 09:40:42 2016(r302831) @@ -142,12 +142,14 @@ globcharcoll(__Char c1, __Char c2, int c c1 = towlower(c1); c2 = towlower(c2); } else { +#ifndef __FreeBSD__ /* This should not be here, but I'll rather leave it in than engage in a LC_COLLATE flamewar about a shell I don't use... */ if (iswlower(c1) && iswupper(c2)) return (1); if (iswupper(c1) && iswlower(c2)) return (-1); +#endif } s1[0] = c1; s2[0] = c2; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r302830 - head/contrib/tcsh
Author: ache Date: Thu Jul 14 09:37:16 2016 New Revision: 302830 URL: https://svnweb.freebsd.org/changeset/base/302830 Log: Back out non-collating [a-z] ranges. Instead of changing the whole course to another POSIX-permitted way for consistency and uniformity I decide to completely ignore missing regex fucntionality and focus on fixing bugs in what we have now, too many small obstacles we have choicing other way, counting ports. Corresponding libc changes are backed out in r302824. Modified: head/contrib/tcsh/glob.c Modified: head/contrib/tcsh/glob.c == --- head/contrib/tcsh/glob.cThu Jul 14 09:34:42 2016(r302829) +++ head/contrib/tcsh/glob.cThu Jul 14 09:37:16 2016(r302830) @@ -142,23 +142,17 @@ globcharcoll(__Char c1, __Char c2, int c c1 = towlower(c1); c2 = towlower(c2); } else { -#ifndef __FreeBSD__ /* This should not be here, but I'll rather leave it in than engage in a LC_COLLATE flamewar about a shell I don't use... */ if (iswlower(c1) && iswupper(c2)) return (1); if (iswupper(c1) && iswlower(c2)) return (-1); -#endif } s1[0] = c1; s2[0] = c2; s1[1] = s2[1] = '\0'; -#ifdef __FreeBSD__ -return wcscmp(s1, s2); -#else return wcscoll(s1, s2); -#endif # else /* not WIDE_STRINGS */ char s1[2], s2[2]; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r302829 - in head/bin/sh: . tests/builtins
Author: ache Date: Thu Jul 14 09:34:42 2016 New Revision: 302829 URL: https://svnweb.freebsd.org/changeset/base/302829 Log: Back out non-collating [a-z] ranges. Instead of changing the whole course to another POSIX-permitted way for consistency and uniformity I decide to completely ignore missing regex fucntionality and focus on fixing bugs in what we have now, too many small obstacles we have choicing other way, counting ports. Corresponding libc changes are backed out in r302824. Modified: head/bin/sh/expand.c head/bin/sh/tests/builtins/case7.0 Modified: head/bin/sh/expand.c == --- head/bin/sh/expand.cThu Jul 14 09:31:52 2016(r302828) +++ head/bin/sh/expand.cThu Jul 14 09:34:42 2016(r302829) @@ -107,6 +107,7 @@ static void expmeta(char *, char *, stru static int expsortcmp(const void *, const void *); static int patmatch(const char *, const char *); static void cvtnum(int, char *); +static int collate_range_cmp(wchar_t, wchar_t); void emptyarglist(struct arglist *list) @@ -137,6 +138,16 @@ appendarglist(struct arglist *list, char list->args[list->count++] = str; } +static int +collate_range_cmp(wchar_t c1, wchar_t c2) +{ + static wchar_t s1[2], s2[2]; + + s1[0] = c1; + s2[0] = c2; + return (wcscoll(s1, s2)); +} + static char * stputs_quotes(const char *data, const char *syntax, char *p) { @@ -1348,7 +1359,9 @@ patmatch(const char *pattern, const char return 0; } else wc2 = (unsigned char)*p++; - if (wc <= chr && chr <= wc2) + if ( collate_range_cmp(chr, wc) >= 0 + && collate_range_cmp(chr, wc2) <= 0 + ) found = 1; } else { if (chr == wc) Modified: head/bin/sh/tests/builtins/case7.0 == --- head/bin/sh/tests/builtins/case7.0 Thu Jul 14 09:31:52 2016 (r302828) +++ head/bin/sh/tests/builtins/case7.0 Thu Jul 14 09:34:42 2016 (r302829) @@ -14,6 +14,11 @@ c1=e c2=$(printf '\366') case $c1$c2 in -[a-z][!a-z]) ;; +[a-z][a-z]) ;; +*) echo wrong at $LINENO ;; +esac + +case $c1$c2 in +[a-f][n-p]) ;; *) echo wrong at $LINENO ;; esac ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r302828 - head/contrib/one-true-awk
Author: ache Date: Thu Jul 14 09:31:52 2016 New Revision: 302828 URL: https://svnweb.freebsd.org/changeset/base/302828 Log: Back out non-collating [a-z] ranges. Instead of changing the whole course to another POSIX-permitted way for consistency and uniformity I decide to completely ignore missing regex fucntionality and focus on fixing bugs in what we have now, too many small obstacles we have choicing other way, counting ports. Corresponding libc changes are backed out in r302824. Modified: head/contrib/one-true-awk/b.c Modified: head/contrib/one-true-awk/b.c == --- head/contrib/one-true-awk/b.c Thu Jul 14 09:26:53 2016 (r302827) +++ head/contrib/one-true-awk/b.c Thu Jul 14 09:31:52 2016 (r302828) @@ -296,11 +296,7 @@ static int collate_range_cmp(int a, int return 0; s[0][0] = a; s[1][0] = b; -#ifdef __FreeBSD__ - return (strcmp(s[0], s[1])); -#else return (strcoll(s[0], s[1])); -#endif } char *cclenter(const char *argp) /* add a character class */ ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r302827 - head/usr.bin/tr
Author: ache Date: Thu Jul 14 09:26:53 2016 New Revision: 302827 URL: https://svnweb.freebsd.org/changeset/base/302827 Log: Optimize [Cc]flag case: don't repeatedly add the last character of string2 to squeeze cset when string2 reach its EOS state. Modified: head/usr.bin/tr/tr.c Modified: head/usr.bin/tr/tr.c == --- head/usr.bin/tr/tr.cThu Jul 14 09:24:55 2016(r302826) +++ head/usr.bin/tr/tr.cThu Jul 14 09:26:53 2016(r302827) @@ -272,10 +272,11 @@ endloop: if (Cflag && !iswrune(cnt)) continue; if (cmap_lookup(map, cnt) == OOBCH) { - if (next()) + if (next()) { cmap_add(map, cnt, s2.lastch); - if (sflag) - cset_add(squeeze, s2.lastch); + if (sflag) + cset_add(squeeze, s2.lastch); + } } else cmap_add(map, cnt, cnt); if ((s2.state == EOS || s2.state == INFINITE) && ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r302826 - head/usr.bin/tr
Author: ache Date: Thu Jul 14 09:24:55 2016 New Revision: 302826 URL: https://svnweb.freebsd.org/changeset/base/302826 Log: Document incomplete support of [=equiv=] and collation for ranges. Modified: head/usr.bin/tr/tr.1 Modified: head/usr.bin/tr/tr.1 == --- head/usr.bin/tr/tr.1Thu Jul 14 09:19:53 2016(r302825) +++ head/usr.bin/tr/tr.1Thu Jul 14 09:24:55 2016(r302826) @@ -334,6 +334,10 @@ should be used instead of explicit chara and .Dq Li A-Z . .Pp +.Dq Li [=equiv=] +expression and collation for ranges +are implemented for single byte locales only. +.Pp System V has historically implemented character ranges using the syntax .Dq Li [c-c] instead of the ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r302825 - head/usr.bin/tr
Author: ache Date: Thu Jul 14 09:19:53 2016 New Revision: 302825 URL: https://svnweb.freebsd.org/changeset/base/302825 Log: Back out non-collating [a-z] ranges (r302594). Instead of changing the whole course to another POSIX-permitted way for consistency and uniformity I decide to completely ignore missing regex fucntionality and focus on fixing bugs in what we have now, too many small obstacles we have choicing other way, counting ports. Corresponding libc changes are backed out in r302824. Modified: head/usr.bin/tr/str.c head/usr.bin/tr/tr.1 head/usr.bin/tr/tr.c Modified: head/usr.bin/tr/str.c == --- head/usr.bin/tr/str.c Thu Jul 14 09:07:25 2016(r302824) +++ head/usr.bin/tr/str.c Thu Jul 14 09:19:53 2016(r302825) @@ -53,7 +53,7 @@ static int backslash(STR *, int *); static int bracket(STR *); static voidgenclass(STR *); static voidgenequiv(STR *); -static int genrange(STR *); +static int genrange(STR *, int); static voidgenseq(STR *); wint_t @@ -93,7 +93,7 @@ next(STR *s) } /* We can start a range at any time. */ - if (s->str[0] == '-' && genrange(s)) + if (s->str[0] == '-' && genrange(s, is_octal)) return (next(s)); return (1); case RANGE: @@ -237,16 +237,18 @@ genequiv(STR *s) } static int -genrange(STR *s) +genrange(STR *s, int was_octal) { - int stopval; + int stopval, octal; char *savestart; + int n, cnt, *p; size_t clen; wchar_t wc; + octal = 0; savestart = s->str; if (*++s->str == '\\') - stopval = backslash(s, NULL); + stopval = backslash(s, ); else { clen = mbrtowc(, s->str, MB_LEN_MAX, NULL); if (clen == (size_t)-1 || clen == (size_t)-2) @@ -254,13 +256,37 @@ genrange(STR *s) stopval = wc; s->str += clen; } - if (stopval < s->lastch) { + /* +* XXX Characters are not ordered according to collating sequence in +* multibyte locales. +*/ + if (octal || was_octal || MB_CUR_MAX > 1) { + if (stopval < s->lastch) { + s->str = savestart; + return (0); + } + s->cnt = stopval - s->lastch + 1; + s->state = RANGE; + --s->lastch; + return (1); + } + if (charcoll((const void *), (const void *)&(s->lastch)) < 0) { s->str = savestart; return (0); } - s->cnt = stopval - s->lastch + 1; - s->state = RANGE; - --s->lastch; + if ((s->set = p = malloc((NCHARS_SB + 1) * sizeof(int))) == NULL) + err(1, "genrange() malloc"); + for (cnt = 0; cnt < NCHARS_SB; cnt++) + if (charcoll((const void *), (const void *)&(s->lastch)) >= 0 && + charcoll((const void *), (const void *)) <= 0) + *p++ = cnt; + *p = OOBCH; + n = p - s->set; + + s->cnt = 0; + s->state = SET; + if (n > 1) + mergesort(s->set, n, sizeof(*(s->set)), charcoll); return (1); } Modified: head/usr.bin/tr/tr.1 == --- head/usr.bin/tr/tr.1Thu Jul 14 09:07:25 2016(r302824) +++ head/usr.bin/tr/tr.1Thu Jul 14 09:19:53 2016(r302825) @@ -164,6 +164,14 @@ as defined by the collation sequence. If either or both of the range endpoints are octal sequences, it represents the range of specific coded values between the range endpoints, inclusive. +.Pp +.Bf Em +See the +.Sx COMPATIBILITY +section below for an important note regarding +differences in the way the current +implementation interprets range expressions differently from +previous implementations. .Ef .It [:class:] Represents all characters belonging to the defined character class. @@ -299,16 +307,22 @@ Remove diacritical marks from all accent .Pp .Dl "tr \*q[=e=]\*q \*qe\*q" .Sh COMPATIBILITY +Previous .Fx implementations of .Nm did not order characters in range expressions according to the current -locale's collation order, making it possible to convert accented Latin -characters from upper to lower case using +locale's collation order, making it possible to convert unaccented Latin +characters (esp.\& as found in English text) from upper to lower case using the traditional .Ux idiom of .Dq Li "tr A-Z a-z" . +Since +.Nm +now obeys the locale's collation order, this idiom may not produce +correct results when there is not a 1:1 mapping between lower and +upper case, or when the order of characters within the two cases differs. As noted in the .Sx EXAMPLES section above, the
svn commit: r302824 - in head/lib/libc: gen locale regex stdio
Author: ache Date: Thu Jul 14 09:07:25 2016 New Revision: 302824 URL: https://svnweb.freebsd.org/changeset/base/302824 Log: 1) Eliminate possibility to call __*collate_range_cmp() with inclomplete locale (which cause core dump) by removing whole 'table' argument by which it passed. 2) Restore __collate_range_cmp() in __sccl(). 3) Collating [a-z] range in regcomp() only for single bytes locales (we can't do it now for other ones). In previous state only first 256 wchars are considered and all others are just silently dropped from the range. Modified: head/lib/libc/gen/fnmatch.c head/lib/libc/gen/glob.c head/lib/libc/locale/collate.h head/lib/libc/locale/collcmp.c head/lib/libc/regex/regcomp.c head/lib/libc/stdio/vfscanf.c Modified: head/lib/libc/gen/fnmatch.c == --- head/lib/libc/gen/fnmatch.c Thu Jul 14 08:40:59 2016(r302823) +++ head/lib/libc/gen/fnmatch.c Thu Jul 14 09:07:25 2016(r302824) @@ -296,8 +296,8 @@ rangematch(const char *pattern, wchar_t if (table->__collate_load_error ? c <= test && test <= c2 : - __wcollate_range_cmp(table, c, test) <= 0 - && __wcollate_range_cmp(table, test, c2) <= 0 + __wcollate_range_cmp(c, test) <= 0 + && __wcollate_range_cmp(test, c2) <= 0 ) ok = 1; } else if (c == test) Modified: head/lib/libc/gen/glob.c == --- head/lib/libc/gen/glob.cThu Jul 14 08:40:59 2016(r302823) +++ head/lib/libc/gen/glob.cThu Jul 14 09:07:25 2016(r302824) @@ -832,8 +832,8 @@ match(Char *name, Char *pat, Char *paten if ((*pat & M_MASK) == M_RNG) { if (table->__collate_load_error ? CHAR(c) <= CHAR(k) && CHAR(k) <= CHAR(pat[1]) : - __wcollate_range_cmp(table, CHAR(c), CHAR(k)) <= 0 - && __wcollate_range_cmp(table, CHAR(k), CHAR(pat[1])) <= 0 + __wcollate_range_cmp(CHAR(c), CHAR(k)) <= 0 + && __wcollate_range_cmp(CHAR(k), CHAR(pat[1])) <= 0 ) ok = 1; pat += 2; Modified: head/lib/libc/locale/collate.h == --- head/lib/libc/locale/collate.h Thu Jul 14 08:40:59 2016 (r302823) +++ head/lib/libc/locale/collate.h Thu Jul 14 09:07:25 2016 (r302824) @@ -128,8 +128,8 @@ int __collate_load_tables(const char *); int__collate_equiv_value(locale_t, const wchar_t *, size_t); void _collate_lookup(struct xlocale_collate *,const wchar_t *, int *, int *, int, const int **); -int__collate_range_cmp(struct xlocale_collate *, char, char); -int__wcollate_range_cmp(struct xlocale_collate *, wchar_t, wchar_t); +int__collate_range_cmp(char, char); +int__wcollate_range_cmp(wchar_t, wchar_t); size_t _collate_wxfrm(struct xlocale_collate *, const wchar_t *, wchar_t *, size_t); size_t _collate_sxfrm(struct xlocale_collate *, const wchar_t *, char *, Modified: head/lib/libc/locale/collcmp.c == --- head/lib/libc/locale/collcmp.c Thu Jul 14 08:40:59 2016 (r302823) +++ head/lib/libc/locale/collcmp.c Thu Jul 14 09:07:25 2016 (r302824) @@ -34,14 +34,13 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include "collate.h" /* * Compare two characters using collate */ -int __collate_range_cmp(struct xlocale_collate *table, char c1, char c2) +int __collate_range_cmp(char c1, char c2) { char s1[2], s2[2]; @@ -49,12 +48,10 @@ int __collate_range_cmp(struct xlocale_c s1[1] = '\0'; s2[0] = c2; s2[1] = '\0'; - struct _xlocale l = {{0}}; - l.components[XLC_COLLATE] = (struct xlocale_component *)table; - return (strcoll_l(s1, s2, )); + return (strcoll(s1, s2)); } -int __wcollate_range_cmp(struct xlocale_collate *table, wchar_t c1, wchar_t c2) +int __wcollate_range_cmp(wchar_t c1, wchar_t c2) { wchar_t s1[2], s2[2]; @@ -62,7 +59,5 @@ int __wcollate_range_cmp(struct xlocale_ s1[1] = L'\0'; s2[0] = c2; s2[1] = L'\0'; - struct _xlocale l = {{0}}; - l.components[XLC_COLLATE] = (struct xlocale_component *)table; - return (wcscoll_l(s1, s2, )); + return (wcscoll(s1, s2)); } Modified:
svn commit: r302823 - head/sys/dev/hyperv/vmbus
Author: sephe Date: Thu Jul 14 08:40:59 2016 New Revision: 302823 URL: https://svnweb.freebsd.org/changeset/base/302823 Log: hyperv/vmbus: Move bus related message processing into vmbus. MFC after:1 week Sponsored by: Microsoft OSTC Differential Revision:https://reviews.freebsd.org/D7125 Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c 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 Thu Jul 14 08:20:17 2016 (r302822) +++ head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Thu Jul 14 08:40:59 2016 (r302823) @@ -37,13 +37,8 @@ #include #include -typedef void (*vmbus_chanmsg_proc_t) - (struct vmbus_softc *, const struct vmbus_message *); - static voidvmbus_chan_detach_task(void *, int); -static voidvmbus_channel_on_offers_delivered(struct vmbus_softc *, - const struct vmbus_message *); static voidvmbus_chan_msgproc_choffer(struct vmbus_softc *, const struct vmbus_message *); static voidvmbus_chan_msgproc_chrescind(struct vmbus_softc *, @@ -52,27 +47,16 @@ static void vmbus_chan_msgproc_chrescind /* * Vmbus channel message processing. */ - -#define VMBUS_CHANMSG_PROC(name, func) \ - [VMBUS_CHANMSG_TYPE_##name] = func -#define VMBUS_CHANMSG_PROC_WAKEUP(name)\ - VMBUS_CHANMSG_PROC(name, vmbus_msghc_wakeup) - static const vmbus_chanmsg_proc_t -vmbus_chanmsg_process[VMBUS_CHANMSG_TYPE_MAX] = { +vmbus_chan_msgprocs[VMBUS_CHANMSG_TYPE_MAX] = { VMBUS_CHANMSG_PROC(CHOFFER, vmbus_chan_msgproc_choffer), VMBUS_CHANMSG_PROC(CHRESCIND, vmbus_chan_msgproc_chrescind), - VMBUS_CHANMSG_PROC(CHOFFER_DONE,vmbus_channel_on_offers_delivered), VMBUS_CHANMSG_PROC_WAKEUP(CHOPEN_RESP), VMBUS_CHANMSG_PROC_WAKEUP(GPADL_CONNRESP), - VMBUS_CHANMSG_PROC_WAKEUP(GPADL_DISCONNRESP), - VMBUS_CHANMSG_PROC_WAKEUP(CONNECT_RESP) + VMBUS_CHANMSG_PROC_WAKEUP(GPADL_DISCONNRESP) }; -#undef VMBUS_CHANMSG_PROC_WAKEUP -#undef VMBUS_CHANMSG_PROC - static struct hv_vmbus_channel * vmbus_chan_alloc(struct vmbus_softc *sc) { @@ -390,19 +374,6 @@ remove: } } -/** - * - * @brief Invoked when all offers have been delivered. - */ -static void -vmbus_channel_on_offers_delivered(struct vmbus_softc *sc, -const struct vmbus_message *msg __unused) -{ - - /* No more new channels for the channel request. */ - vmbus_scan_done(sc); -} - /* * Detach all devices and destroy the corresponding primary channels. */ @@ -538,13 +509,10 @@ vmbus_chan_msgproc(struct vmbus_softc *s uint32_t msg_type; msg_type = ((const struct vmbus_chanmsg_hdr *)msg->msg_data)->chm_type; - if (msg_type >= VMBUS_CHANMSG_TYPE_MAX) { - device_printf(sc->vmbus_dev, "unknown message type 0x%x\n", - msg_type); - return; - } + KASSERT(msg_type < VMBUS_CHANMSG_TYPE_MAX, + ("invalid message type %u", msg_type)); - msg_proc = vmbus_chanmsg_process[msg_type]; + msg_proc = vmbus_chan_msgprocs[msg_type]; if (msg_proc != NULL) msg_proc(sc, msg); } Modified: head/sys/dev/hyperv/vmbus/vmbus.c == --- head/sys/dev/hyperv/vmbus/vmbus.c Thu Jul 14 08:20:17 2016 (r302822) +++ head/sys/dev/hyperv/vmbus/vmbus.c Thu Jul 14 08:40:59 2016 (r302823) @@ -98,7 +98,12 @@ static int vmbus_req_channels(struct v static voidvmbus_disconnect(struct vmbus_softc *); static int vmbus_scan(struct vmbus_softc *); static voidvmbus_scan_wait(struct vmbus_softc *); +static voidvmbus_scan_newchan(struct vmbus_softc *); static voidvmbus_scan_newdev(struct vmbus_softc *); +static voidvmbus_scan_done(struct vmbus_softc *, + const struct vmbus_message *); +static voidvmbus_chanmsg_handle(struct vmbus_softc *, + const struct vmbus_message *); static int vmbus_sysctl_version(SYSCTL_HANDLER_ARGS); @@ -122,6 +127,12 @@ static const uint32_t vmbus_version[] = VMBUS_VERSION_WS2008 }; +static const vmbus_chanmsg_proc_t +vmbus_chanmsg_handlers[VMBUS_CHANMSG_TYPE_MAX] = { + VMBUS_CHANMSG_PROC(CHOFFER_DONE, vmbus_scan_done), + VMBUS_CHANMSG_PROC_WAKEUP(CONNECT_RESP) +}; + static struct vmbus_msghc * vmbus_msghc_alloc(bus_dma_tag_t parent_dtag) { @@ -480,7 +491,7 @@ vmbus_req_channels(struct vmbus_softc *s return error; } -void +static void vmbus_scan_newchan(struct vmbus_softc
svn commit: r302822 - in stable/11/sys: amd64/conf i386/conf pc98/conf powerpc/conf sparc64/conf
Author: gjb Date: Thu Jul 14 08:20:17 2016 New Revision: 302822 URL: https://svnweb.freebsd.org/changeset/base/302822 Log: Remove GENERIC-NODEBUG kernel configurations, missed during the stable/11 branch. This is a direct commit to stable/11. Approved by: re (kib) Sponsored by: The FreeBSD Foundation Deleted: stable/11/sys/amd64/conf/GENERIC-NODEBUG stable/11/sys/i386/conf/GENERIC-NODEBUG stable/11/sys/pc98/conf/GENERIC-NODEBUG stable/11/sys/powerpc/conf/GENERIC-NODEBUG stable/11/sys/sparc64/conf/GENERIC-NODEBUG ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r302821 - stable/11/release
Author: gjb Date: Thu Jul 14 08:19:25 2016 New Revision: 302821 URL: https://svnweb.freebsd.org/changeset/base/302821 Log: Remove the 'debug.witness.trace' entry, as WITNESS is not enabled on stable branches by default. This is a direct commit to stable/11. Approved by: re (kib) Sponsored by: The FreeBSD Foundation Modified: stable/11/release/Makefile Modified: stable/11/release/Makefile == --- stable/11/release/Makefile Thu Jul 14 08:18:12 2016(r302820) +++ stable/11/release/Makefile Thu Jul 14 08:19:25 2016(r302821) @@ -187,7 +187,6 @@ disc1: packagesystem ln -fs /tmp/bsdinstall_etc/resolv.conf ${.TARGET}/etc/resolv.conf echo sendmail_enable=\"NONE\" > ${.TARGET}/etc/rc.conf echo hostid_enable=\"NO\" >> ${.TARGET}/etc/rc.conf - echo debug.witness.trace=0 >> ${.TARGET}/etc/sysctl.conf echo vfs.mountroot.timeout=\"10\" >> ${.TARGET}/boot/loader.conf cp ${.CURDIR}/rc.local ${.TARGET}/etc touch ${.TARGET} @@ -213,7 +212,6 @@ bootonly: packagesystem ln -fs /tmp/bsdinstall_etc/resolv.conf ${.TARGET}/etc/resolv.conf echo sendmail_enable=\"NONE\" > ${.TARGET}/etc/rc.conf echo hostid_enable=\"NO\" >> ${.TARGET}/etc/rc.conf - echo debug.witness.trace=0 >> ${.TARGET}/etc/sysctl.conf echo vfs.mountroot.timeout=\"10\" >> ${.TARGET}/boot/loader.conf cp ${.CURDIR}/rc.local ${.TARGET}/etc @@ -236,7 +234,6 @@ dvd: packagesystem ln -fs /tmp/bsdinstall_etc/resolv.conf ${.TARGET}/etc/resolv.conf echo sendmail_enable=\"NONE\" > ${.TARGET}/etc/rc.conf echo hostid_enable=\"NO\" >> ${.TARGET}/etc/rc.conf - echo debug.witness.trace=0 >> ${.TARGET}/etc/sysctl.conf echo vfs.mountroot.timeout=\"10\" >> ${.TARGET}/boot/loader.conf cp ${.CURDIR}/rc.local ${.TARGET}/etc touch ${.TARGET} ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r302820 - in head/lib/libc: gen locale regex stdio
Author: ache Date: Thu Jul 14 08:18:12 2016 New Revision: 302820 URL: https://svnweb.freebsd.org/changeset/base/302820 Log: Back out non-collating [a-z] ranges. Instead of changing whole course to another POSIX-permitted way for consistency and uniformity I decide to completely ignore missing regex fucntionality and concentrace on fixing bugs in what we have now, too many small obstacles instead, counting ports. Modified: head/lib/libc/gen/fnmatch.c head/lib/libc/gen/glob.c head/lib/libc/locale/collate.h head/lib/libc/locale/collcmp.c head/lib/libc/regex/regcomp.c head/lib/libc/stdio/vfscanf.c Modified: head/lib/libc/gen/fnmatch.c == --- head/lib/libc/gen/fnmatch.c Thu Jul 14 08:15:13 2016(r302819) +++ head/lib/libc/gen/fnmatch.c Thu Jul 14 08:18:12 2016(r302820) @@ -63,6 +63,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include "collate.h" + #defineEOS '\0' #define RANGE_MATCH 1 @@ -236,6 +238,8 @@ rangematch(const char *pattern, wchar_t wchar_t c, c2; size_t pclen; const char *origpat; + struct xlocale_collate *table = + (struct xlocale_collate*)__get_locale()->components[XLC_COLLATE]; /* * A bracket expression starting with an unquoted circumflex @@ -290,7 +294,11 @@ rangematch(const char *pattern, wchar_t if (flags & FNM_CASEFOLD) c2 = towlower(c2); - if (c <= test && test <= c2) + if (table->__collate_load_error ? + c <= test && test <= c2 : + __wcollate_range_cmp(table, c, test) <= 0 + && __wcollate_range_cmp(table, test, c2) <= 0 + ) ok = 1; } else if (c == test) ok = 1; Modified: head/lib/libc/gen/glob.c == --- head/lib/libc/gen/glob.cThu Jul 14 08:15:13 2016(r302819) +++ head/lib/libc/gen/glob.cThu Jul 14 08:18:12 2016(r302820) @@ -92,6 +92,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include "collate.h" + /* * glob(3) expansion limits. Stop the expansion if any of these limits * is reached. This caps the runtime in the face of DoS attacks. See @@ -802,6 +804,8 @@ match(Char *name, Char *pat, Char *paten { int ok, negate_range; Char c, k; + struct xlocale_collate *table = + (struct xlocale_collate*)__get_locale()->components[XLC_COLLATE]; while (pat < patend) { c = *pat++; @@ -826,7 +830,11 @@ match(Char *name, Char *pat, Char *paten ++pat; while (((c = *pat++) & M_MASK) != M_END) if ((*pat & M_MASK) == M_RNG) { - if (CHAR(c) <= CHAR(k) && CHAR(k) <= CHAR(pat[1])) + if (table->__collate_load_error ? + CHAR(c) <= CHAR(k) && CHAR(k) <= CHAR(pat[1]) : + __wcollate_range_cmp(table, CHAR(c), CHAR(k)) <= 0 + && __wcollate_range_cmp(table, CHAR(k), CHAR(pat[1])) <= 0 + ) ok = 1; pat += 2; } else if (c == k) Modified: head/lib/libc/locale/collate.h == --- head/lib/libc/locale/collate.h Thu Jul 14 08:15:13 2016 (r302819) +++ head/lib/libc/locale/collate.h Thu Jul 14 08:18:12 2016 (r302820) @@ -128,7 +128,8 @@ int __collate_load_tables(const char *); int__collate_equiv_value(locale_t, const wchar_t *, size_t); void _collate_lookup(struct xlocale_collate *,const wchar_t *, int *, int *, int, const int **); -int__collate_range_cmp(int, int); +int__collate_range_cmp(struct xlocale_collate *, char, char); +int__wcollate_range_cmp(struct xlocale_collate *, wchar_t, wchar_t); size_t _collate_wxfrm(struct xlocale_collate *, const wchar_t *, wchar_t *, size_t); size_t _collate_sxfrm(struct xlocale_collate *, const wchar_t *, char *, Modified: head/lib/libc/locale/collcmp.c == --- head/lib/libc/locale/collcmp.c Thu Jul 14 08:15:13 2016 (r302819) +++ head/lib/libc/locale/collcmp.c Thu Jul 14 08:18:12 2016 (r302820) @@ -33,13 +33,15 @@ __FBSDID("$FreeBSD$"); #include +#include +#include #include "collate.h" /* * Compare two characters using collate */
svn commit: r302819 - in head/sys/dev/hyperv: include vmbus
Author: sephe Date: Thu Jul 14 08:15:13 2016 New Revision: 302819 URL: https://svnweb.freebsd.org/changeset/base/302819 Log: hyperv/vmbus: Sub-channel related fields renaming And reorganize comment. MFC after:1 week Sponsored by: Microsoft OSTC Differential Revision:https://reviews.freebsd.org/D7113 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.hThu Jul 14 07:59:01 2016 (r302818) +++ head/sys/dev/hyperv/include/hyperv.hThu Jul 14 08:15:13 2016 (r302819) @@ -293,30 +293,17 @@ typedef struct hv_vmbus_channel { uint32_ttarget_cpu; /* -* Support for multi-channels. -* The initial offer is considered the primary channel and this -* offer message will indicate if the host supports multi-channels. -* The guest is free to ask for multi-channels to be offerred and can -* open these multi-channels as a normal "primary" channel. However, -* all multi-channels will have the same type and instance guids as the -* primary channel. Requests sent on a given channel will result in a -* response on the same channel. +* If this is a primary channel, ch_subchan* fields +* contain sub-channels belonging to this primary +* channel. */ - - struct mtx sc_lock; - - /* -* Link list of all the multi-channels if this is a primary channel -*/ - TAILQ_HEAD(, hv_vmbus_channel) sc_list_anchor; - TAILQ_ENTRY(hv_vmbus_channel) sc_list_entry; - int subchan_cnt; - - /* -* The primary channel this sub-channle belongs to. -* This will be NULL for the primary channel. -*/ - struct hv_vmbus_channel *primary_channel; + struct mtx ch_subchan_lock; + TAILQ_HEAD(, hv_vmbus_channel) ch_subchans; + int ch_subchan_cnt; + + /* If this is a sub-channel */ + TAILQ_ENTRY(hv_vmbus_channel) ch_sublink; /* sub-channel link */ + struct hv_vmbus_channel *ch_prichan;/* owner primary chan */ /* * Driver private data Modified: head/sys/dev/hyperv/vmbus/hv_channel.c == --- head/sys/dev/hyperv/vmbus/hv_channel.c Thu Jul 14 07:59:01 2016 (r302818) +++ head/sys/dev/hyperv/vmbus/hv_channel.c Thu Jul 14 08:15:13 2016 (r302819) @@ -100,7 +100,7 @@ vmbus_channel_sysctl_create(hv_vmbus_cha uint16_t sub_ch_id; char name[16]; - hv_vmbus_channel* primary_ch = channel->primary_channel; + hv_vmbus_channel* primary_ch = channel->ch_prichan; if (primary_ch == NULL) { dev = channel->ch_dev; @@ -563,7 +563,7 @@ hv_vmbus_channel_close(struct hv_vmbus_c /* * Close all sub-channels, if any. */ - subchan_cnt = chan->subchan_cnt; + subchan_cnt = chan->ch_subchan_cnt; if (subchan_cnt > 0) { struct hv_vmbus_channel **subchan; int i; Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c == --- head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Thu Jul 14 07:59:01 2016 (r302818) +++ head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Thu Jul 14 08:15:13 2016 (r302819) @@ -90,8 +90,8 @@ vmbus_chan_alloc(struct vmbus_softc *sc) } chan->vmbus_sc = sc; - mtx_init(>sc_lock, "vmbus multi channel", NULL, MTX_DEF); - TAILQ_INIT(>sc_list_anchor); + mtx_init(>ch_subchan_lock, "vmbus subchan", NULL, MTX_DEF); + TAILQ_INIT(>ch_subchans); TASK_INIT(>ch_detach_task, 0, vmbus_chan_detach_task, chan); return chan; @@ -104,7 +104,7 @@ vmbus_chan_free(struct hv_vmbus_channel /* TODO: asset no longer on the primary channel's sub-channel list */ /* TODO: asset no longer on the vmbus channel list */ hyperv_dmamem_free(>ch_monprm_dma, chan->ch_monprm); - mtx_destroy(>sc_lock); + mtx_destroy(>ch_subchan_lock); free(chan, M_DEVBUF); } @@ -136,6 +136,10 @@ vmbus_chan_add(struct hv_vmbus_channel * mtx_lock(>vmbus_prichan_lock); TAILQ_FOREACH(prichan, >vmbus_prichans, ch_prilink) { + /* +* Sub-channel will have the same type GUID and instance +* GUID as its primary channel. +*/ if (memcmp(>ch_guid_type, >ch_guid_type, sizeof(struct hyperv_guid)) == 0 &&
svn commit: r302818 - head/sys/dev/hyperv/vmbus
Author: sephe Date: Thu Jul 14 07:59:01 2016 New Revision: 302818 URL: https://svnweb.freebsd.org/changeset/base/302818 Log: hyperv/vmbus: Fix the racy channel close. It is not safe to iterate the sub-channel list w/o lock on the close path, while it's even more difficult to hold the lock and iterate the sub-channel list. We leverage the vmbua_{get,rel}_subchan() functions to solve this dilemma. MFC after:1 week Sponsored by: Microsoft OSTC Differential Revision:https://reviews.freebsd.org/D7112 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 Thu Jul 14 07:48:26 2016 (r302817) +++ head/sys/dev/hyperv/vmbus/hv_channel.c Thu Jul 14 07:59:01 2016 (r302818) @@ -542,35 +542,40 @@ hv_vmbus_channel_close_internal(hv_vmbus M_DEVBUF); } -/** - * @brief Close the specified channel +/* + * Caller should make sure that all sub-channels have + * been added to 'chan' and all to-be-closed channels + * are not being opened. */ void -hv_vmbus_channel_close(hv_vmbus_channel *channel) +hv_vmbus_channel_close(struct hv_vmbus_channel *chan) { - hv_vmbus_channel* sub_channel; + int subchan_cnt; - if (channel->primary_channel != NULL) { + if (!VMBUS_CHAN_ISPRIMARY(chan)) { /* -* We only close multi-channels when the primary is -* closed. +* Sub-channel is closed when its primary channel +* is closed; done. */ return; } /* -* Close all multi-channels first. +* Close all sub-channels, if any. */ - TAILQ_FOREACH(sub_channel, >sc_list_anchor, - sc_list_entry) { - if ((sub_channel->ch_stflags & VMBUS_CHAN_ST_OPENED) == 0) - continue; - hv_vmbus_channel_close_internal(sub_channel); + subchan_cnt = chan->subchan_cnt; + if (subchan_cnt > 0) { + struct hv_vmbus_channel **subchan; + int i; + + subchan = vmbus_get_subchan(chan, subchan_cnt); + for (i = 0; i < subchan_cnt; ++i) + hv_vmbus_channel_close_internal(subchan[i]); + vmbus_rel_subchan(subchan, subchan_cnt); } - /* -* Then close the primary channel. -*/ - hv_vmbus_channel_close_internal(channel); + + /* Then close the primary channel. */ + hv_vmbus_channel_close_internal(chan); } /** ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r302817 - in head/sys/dev/hyperv: include vmbus
Author: sephe Date: Thu Jul 14 07:48:26 2016 New Revision: 302817 URL: https://svnweb.freebsd.org/changeset/base/302817 Log: hyperv/vmbus: Field renaming to reflect reality MFC after:1 week Sponsored by: Microsoft OSTC Differential Revision:https://reviews.freebsd.org/D7111 Modified: head/sys/dev/hyperv/include/hyperv.h head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c 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.hThu Jul 14 07:39:34 2016 (r302816) +++ head/sys/dev/hyperv/include/hyperv.hThu Jul 14 07:48:26 2016 (r302817) @@ -326,7 +326,7 @@ typedef struct hv_vmbus_channel { void*hv_chan_priv3; struct task ch_detach_task; - TAILQ_ENTRY(hv_vmbus_channel) ch_link; + TAILQ_ENTRY(hv_vmbus_channel) ch_prilink; /* primary chan link */ uint32_tch_subidx; /* subchan index */ volatile uint32_t ch_stflags; /* atomic-op */ /* VMBUS_CHAN_ST_ */ Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c == --- head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Thu Jul 14 07:39:34 2016 (r302816) +++ head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Thu Jul 14 07:48:26 2016 (r302817) @@ -134,8 +134,8 @@ vmbus_chan_add(struct hv_vmbus_channel * newchan->ch_id, newchan->ch_subidx); } - mtx_lock(>vmbus_chlist_lock); - TAILQ_FOREACH(prichan, >vmbus_chlist, ch_link) { + mtx_lock(>vmbus_prichan_lock); + TAILQ_FOREACH(prichan, >vmbus_prichans, ch_prilink) { if (memcmp(>ch_guid_type, >ch_guid_type, sizeof(struct hyperv_guid)) == 0 && memcmp(>ch_guid_inst, >ch_guid_inst, @@ -145,18 +145,19 @@ vmbus_chan_add(struct hv_vmbus_channel * if (VMBUS_CHAN_ISPRIMARY(newchan)) { if (prichan == NULL) { /* Install the new primary channel */ - TAILQ_INSERT_TAIL(>vmbus_chlist, newchan, ch_link); - mtx_unlock(>vmbus_chlist_lock); + TAILQ_INSERT_TAIL(>vmbus_prichans, newchan, + ch_prilink); + mtx_unlock(>vmbus_prichan_lock); return 0; } else { - mtx_unlock(>vmbus_chlist_lock); + mtx_unlock(>vmbus_prichan_lock); device_printf(sc->vmbus_dev, "duplicated primary " "chan%u\n", newchan->ch_id); return EINVAL; } } else { /* Sub-channel */ if (prichan == NULL) { - mtx_unlock(>vmbus_chlist_lock); + mtx_unlock(>vmbus_prichan_lock); device_printf(sc->vmbus_dev, "no primary chan for " "chan%u\n", newchan->ch_id); return EINVAL; @@ -168,7 +169,7 @@ vmbus_chan_add(struct hv_vmbus_channel * * XXX refcnt prichan */ } - mtx_unlock(>vmbus_chlist_lock); + mtx_unlock(>vmbus_prichan_lock); /* * This is a sub-channel; link it with the primary channel. @@ -406,20 +407,20 @@ vmbus_chan_destroy_all(struct vmbus_soft { struct hv_vmbus_channel *chan; - mtx_lock(>vmbus_chlist_lock); - while ((chan = TAILQ_FIRST(>vmbus_chlist)) != NULL) { + mtx_lock(>vmbus_prichan_lock); + while ((chan = TAILQ_FIRST(>vmbus_prichans)) != NULL) { KASSERT(VMBUS_CHAN_ISPRIMARY(chan), ("not primary channel")); - TAILQ_REMOVE(>vmbus_chlist, chan, ch_link); - mtx_unlock(>vmbus_chlist_lock); + TAILQ_REMOVE(>vmbus_prichans, chan, ch_prilink); + mtx_unlock(>vmbus_prichan_lock); hv_vmbus_child_device_unregister(chan); vmbus_chan_free(chan); - mtx_lock(>vmbus_chlist_lock); + mtx_lock(>vmbus_prichan_lock); } bzero(sc->vmbus_chmap, sizeof(struct hv_vmbus_channel *) * VMBUS_CHAN_MAX); - mtx_unlock(>vmbus_chlist_lock); + mtx_unlock(>vmbus_prichan_lock); } /** Modified: head/sys/dev/hyperv/vmbus/vmbus.c == --- head/sys/dev/hyperv/vmbus/vmbus.c Thu Jul 14 07:39:34 2016 (r302816) +++ head/sys/dev/hyperv/vmbus/vmbus.c Thu Jul 14 07:48:26 2016 (r302817) @@ -1104,8 +1104,8 @@ vmbus_doattach(struct vmbus_softc *sc)
svn commit: r302816 - head/sys/dev/hyperv/vmbus
Author: sephe Date: Thu Jul 14 07:39:34 2016 New Revision: 302816 URL: https://svnweb.freebsd.org/changeset/base/302816 Log: hyperv/vmbus: Release vmbus channel lock before detach devices Device detach method may sleep. While I'm here, rename the function, fix indentation and function comment. MFC after:1 week Sponsored by: Microsoft OSTC Differential Revision:https://reviews.freebsd.org/D7110 Modified: 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 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 Thu Jul 14 07:31:43 2016 (r302815) +++ head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Thu Jul 14 07:39:34 2016 (r302816) @@ -398,27 +398,27 @@ vmbus_channel_on_offers_delivered(struct vmbus_scan_done(sc); } -/** - * @brief Release channels that are unattached/unconnected (i.e., no drivers associated) +/* + * Detach all devices and destroy the corresponding primary channels. */ void -hv_vmbus_release_unattached_channels(struct vmbus_softc *sc) +vmbus_chan_destroy_all(struct vmbus_softc *sc) { - hv_vmbus_channel *channel; + struct hv_vmbus_channel *chan; mtx_lock(>vmbus_chlist_lock); + while ((chan = TAILQ_FIRST(>vmbus_chlist)) != NULL) { + KASSERT(VMBUS_CHAN_ISPRIMARY(chan), ("not primary channel")); + TAILQ_REMOVE(>vmbus_chlist, chan, ch_link); + mtx_unlock(>vmbus_chlist_lock); - while (!TAILQ_EMPTY(>vmbus_chlist)) { - channel = TAILQ_FIRST(>vmbus_chlist); - KASSERT(VMBUS_CHAN_ISPRIMARY(channel), ("not primary channel")); - TAILQ_REMOVE(>vmbus_chlist, channel, ch_link); + hv_vmbus_child_device_unregister(chan); + vmbus_chan_free(chan); - hv_vmbus_child_device_unregister(channel); - vmbus_chan_free(channel); + mtx_lock(>vmbus_chlist_lock); } bzero(sc->vmbus_chmap, sizeof(struct hv_vmbus_channel *) * VMBUS_CHAN_MAX); - mtx_unlock(>vmbus_chlist_lock); } Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h == --- head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Thu Jul 14 07:31:43 2016 (r302815) +++ head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Thu Jul 14 07:39:34 2016 (r302816) @@ -146,9 +146,6 @@ voidhv_ring_buffer_read_begin( uint32_t hv_ring_buffer_read_end( hv_vmbus_ring_buffer_info *ring_info); -void hv_vmbus_release_unattached_channels( - struct vmbus_softc *); - inthv_vmbus_child_device_register( struct hv_vmbus_channel *chan); inthv_vmbus_child_device_unregister( Modified: head/sys/dev/hyperv/vmbus/vmbus.c == --- head/sys/dev/hyperv/vmbus/vmbus.c Thu Jul 14 07:31:43 2016 (r302815) +++ head/sys/dev/hyperv/vmbus/vmbus.c Thu Jul 14 07:39:34 2016 (r302816) @@ -1239,7 +1239,7 @@ vmbus_detach(device_t dev) { struct vmbus_softc *sc = device_get_softc(dev); - hv_vmbus_release_unattached_channels(sc); + vmbus_chan_destroy_all(sc); vmbus_disconnect(sc); Modified: head/sys/dev/hyperv/vmbus/vmbus_var.h == --- head/sys/dev/hyperv/vmbus/vmbus_var.h Thu Jul 14 07:31:43 2016 (r302815) +++ head/sys/dev/hyperv/vmbus/vmbus_var.h Thu Jul 14 07:39:34 2016 (r302816) @@ -138,6 +138,7 @@ voidvmbus_handle_intr(struct trapframe void vmbus_et_intr(struct trapframe *); void vmbus_chan_msgproc(struct vmbus_softc *, const struct vmbus_message *); +void vmbus_chan_destroy_all(struct vmbus_softc *); struct vmbus_msghc *vmbus_msghc_get(struct vmbus_softc *, size_t); void vmbus_msghc_put(struct vmbus_softc *, struct vmbus_msghc *); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r302815 - head/sys/dev/hyperv/vmbus
Author: sephe Date: Thu Jul 14 07:31:43 2016 New Revision: 302815 URL: https://svnweb.freebsd.org/changeset/base/302815 Log: hyperv/vmbus: Only add primary channels to vmbus channel list - Make the vmbus_chan_add more straightforward. - Partially fix the hv_vmbus_release_unattached_channels(). MFC after:1 week Sponsored by: Microsoft OSTC Differential Revision:https://reviews.freebsd.org/D7109 Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c == --- head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Thu Jul 14 07:24:03 2016 (r302814) +++ head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Thu Jul 14 07:31:43 2016 (r302815) @@ -142,52 +142,55 @@ vmbus_chan_add(struct hv_vmbus_channel * sizeof(struct hyperv_guid)) == 0) break; } - if (prichan == NULL) { - /* Install the new primary channel */ - TAILQ_INSERT_TAIL(>vmbus_chlist, newchan, ch_link); - } - mtx_unlock(>vmbus_chlist_lock); - - if (prichan != NULL) { - if (newchan->ch_subidx == 0) { + if (VMBUS_CHAN_ISPRIMARY(newchan)) { + if (prichan == NULL) { + /* Install the new primary channel */ + TAILQ_INSERT_TAIL(>vmbus_chlist, newchan, ch_link); + mtx_unlock(>vmbus_chlist_lock); + return 0; + } else { + mtx_unlock(>vmbus_chlist_lock); device_printf(sc->vmbus_dev, "duplicated primary " "chan%u\n", newchan->ch_id); return EINVAL; } - - /* -* This is a sub-channel. -*/ - newchan->primary_channel = prichan; - newchan->ch_dev = prichan->ch_dev; - mtx_lock(>sc_lock); - TAILQ_INSERT_TAIL(>sc_list_anchor, newchan, - sc_list_entry); - mtx_unlock(>sc_lock); - + } else { /* Sub-channel */ + if (prichan == NULL) { + mtx_unlock(>vmbus_chlist_lock); + device_printf(sc->vmbus_dev, "no primary chan for " + "chan%u\n", newchan->ch_id); + return EINVAL; + } /* -* Insert the new channel to the end of the global -* channel list. +* Found the primary channel for this sub-channel and +* move on. * -* NOTE: -* The new sub-channel MUST be inserted AFTER it's -* primary channel, so that the primary channel will -* be found in the above loop for its baby siblings. -*/ - mtx_lock(>vmbus_chlist_lock); - TAILQ_INSERT_TAIL(>vmbus_chlist, newchan, ch_link); - mtx_unlock(>vmbus_chlist_lock); - - /* -* Bump up sub-channel count and notify anyone that is -* interested in this sub-channel, after this sub-channel -* is setup. +* XXX refcnt prichan */ - mtx_lock(>sc_lock); - prichan->subchan_cnt++; - mtx_unlock(>sc_lock); - wakeup(prichan); } + mtx_unlock(>vmbus_chlist_lock); + + /* +* This is a sub-channel; link it with the primary channel. +*/ + KASSERT(!VMBUS_CHAN_ISPRIMARY(newchan), + ("new channel is not sub-channel")); + KASSERT(prichan != NULL, ("no primary channel")); + + newchan->primary_channel = prichan; + newchan->ch_dev = prichan->ch_dev; + + mtx_lock(>sc_lock); + TAILQ_INSERT_TAIL(>sc_list_anchor, newchan, sc_list_entry); + /* +* Bump up sub-channel count and notify anyone that is +* interested in this sub-channel, after this sub-channel +* is setup. +*/ + prichan->subchan_cnt++; + mtx_unlock(>sc_lock); + wakeup(prichan); + return 0; } @@ -370,10 +373,6 @@ vmbus_chan_detach_task(void *xchan, int } } remove: - mtx_lock(>vmbus_chlist_lock); - TAILQ_REMOVE(>vmbus_chlist, chan, ch_link); - mtx_unlock(>vmbus_chlist_lock); - mtx_lock(_chan->sc_lock); TAILQ_REMOVE(_chan->sc_list_anchor, chan, sc_list_entry); KASSERT(pri_chan->subchan_cnt > 0, @@ -411,12 +410,10 @@ hv_vmbus_release_unattached_channels(str while (!TAILQ_EMPTY(>vmbus_chlist)) { channel = TAILQ_FIRST(>vmbus_chlist); + KASSERT(VMBUS_CHAN_ISPRIMARY(channel), ("not primary channel"));
svn commit: r302814 - in head/sys/dev/hyperv: include netvsc vmbus
Author: sephe Date: Thu Jul 14 07:24:03 2016 New Revision: 302814 URL: https://svnweb.freebsd.org/changeset/base/302814 Log: hyperv/vmbus: Use sub-channel index to detect primary channel In case that VMBUS_CHAN_ISPRIMARY is needed in the early place of channel setup. MFC after:1 week Sponsored by: Microsoft OSTC Differential Revision:https://reviews.freebsd.org/D7108 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 Modified: head/sys/dev/hyperv/include/hyperv.h == --- head/sys/dev/hyperv/include/hyperv.hThu Jul 14 07:08:59 2016 (r302813) +++ head/sys/dev/hyperv/include/hyperv.hThu Jul 14 07:24:03 2016 (r302814) @@ -336,7 +336,7 @@ typedef struct hv_vmbus_channel { struct sysctl_ctx_list ch_sysctl_ctx; } hv_vmbus_channel; -#define HV_VMBUS_CHAN_ISPRIMARY(chan) ((chan)->primary_channel == NULL) +#define VMBUS_CHAN_ISPRIMARY(chan) ((chan)->ch_subidx == 0) #define VMBUS_CHAN_FLAG_HASMNF 0x0001 /* Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c == --- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Thu Jul 14 07:08:59 2016(r302813) +++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Thu Jul 14 07:24:03 2016(r302814) @@ -2957,7 +2957,7 @@ static void hn_subchan_attach(struct hn_softc *sc, struct hv_vmbus_channel *chan) { - KASSERT(!HV_VMBUS_CHAN_ISPRIMARY(chan), + KASSERT(!VMBUS_CHAN_ISPRIMARY(chan), ("subchannel callback on primary channel")); KASSERT(chan->ch_subidx > 0, ("invalid channel subidx %u", Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c == --- head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Thu Jul 14 07:08:59 2016 (r302813) +++ head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Thu Jul 14 07:24:03 2016 (r302814) @@ -285,7 +285,7 @@ vmbus_chan_msgproc_choffer(struct vmbus_ return; } - if (HV_VMBUS_CHAN_ISPRIMARY(chan)) { + if (VMBUS_CHAN_ISPRIMARY(chan)) { /* * Add device for this primary channel. * @@ -332,7 +332,7 @@ vmbus_chan_detach_task(void *xchan, int { struct hv_vmbus_channel *chan = xchan; - if (HV_VMBUS_CHAN_ISPRIMARY(chan)) { + if (VMBUS_CHAN_ISPRIMARY(chan)) { /* Only primary channel owns the device */ hv_vmbus_child_device_unregister(chan); /* NOTE: DO NOT free primary channel for now */ @@ -413,7 +413,7 @@ hv_vmbus_release_unattached_channels(str channel = TAILQ_FIRST(>vmbus_chlist); TAILQ_REMOVE(>vmbus_chlist, channel, ch_link); - if (HV_VMBUS_CHAN_ISPRIMARY(channel)) { + if (VMBUS_CHAN_ISPRIMARY(channel)) { /* Only primary channel owns the device */ hv_vmbus_child_device_unregister(channel); } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r302813 - head/sys/dev/hyperv/vmbus
Author: sephe Date: Thu Jul 14 07:08:59 2016 New Revision: 302813 URL: https://svnweb.freebsd.org/changeset/base/302813 Log: hyperv/vmbus: Cleanup vmbus_chan_add() MFC after:1 week Sponsored by: Microsoft OSTC Differential Revision:https://reviews.freebsd.org/D7106 Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c == --- head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Thu Jul 14 06:59:04 2016 (r302812) +++ head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Thu Jul 14 07:08:59 2016 (r302813) @@ -108,105 +108,85 @@ vmbus_chan_free(struct hv_vmbus_channel free(chan, M_DEVBUF); } -/** - * @brief Process the offer by creating a channel/device - * associated with this offer - */ static int -vmbus_chan_add(hv_vmbus_channel *new_channel) +vmbus_chan_add(struct hv_vmbus_channel *newchan) { - struct vmbus_softc *sc = new_channel->vmbus_sc; - hv_vmbus_channel* channel; + struct vmbus_softc *sc = newchan->vmbus_sc; + struct hv_vmbus_channel *prichan; - /* -* Make sure this is a new offer -*/ - mtx_lock(>vmbus_chlist_lock); - if (new_channel->ch_id == 0) { + if (newchan->ch_id == 0) { /* * XXX * Chan0 will neither be processed nor should be offered; * skip it. */ - mtx_unlock(>vmbus_chlist_lock); - device_printf(sc->vmbus_dev, "got chan0 offer\n"); + device_printf(sc->vmbus_dev, "got chan0 offer, discard\n"); return EINVAL; - } else { - sc->vmbus_chmap[new_channel->ch_id] = new_channel; + } else if (newchan->ch_id >= VMBUS_CHAN_MAX) { + device_printf(sc->vmbus_dev, "invalid chan%u offer\n", + newchan->ch_id); + return EINVAL; + } + sc->vmbus_chmap[newchan->ch_id] = newchan; + + if (bootverbose) { + device_printf(sc->vmbus_dev, "chan%u subidx%u offer\n", + newchan->ch_id, newchan->ch_subidx); } - TAILQ_FOREACH(channel, >vmbus_chlist, ch_link) { - if (memcmp(>ch_guid_type, _channel->ch_guid_type, + mtx_lock(>vmbus_chlist_lock); + TAILQ_FOREACH(prichan, >vmbus_chlist, ch_link) { + if (memcmp(>ch_guid_type, >ch_guid_type, sizeof(struct hyperv_guid)) == 0 && - memcmp(>ch_guid_inst, _channel->ch_guid_inst, + memcmp(>ch_guid_inst, >ch_guid_inst, sizeof(struct hyperv_guid)) == 0) break; } - - if (channel == NULL) { + if (prichan == NULL) { /* Install the new primary channel */ - TAILQ_INSERT_TAIL(>vmbus_chlist, new_channel, ch_link); + TAILQ_INSERT_TAIL(>vmbus_chlist, newchan, ch_link); } mtx_unlock(>vmbus_chlist_lock); - if (bootverbose) { - char logstr[64]; - - logstr[0] = '\0'; - if (channel != NULL) { - snprintf(logstr, sizeof(logstr), ", primary chan%u", - channel->ch_id); + if (prichan != NULL) { + if (newchan->ch_subidx == 0) { + device_printf(sc->vmbus_dev, "duplicated primary " + "chan%u\n", newchan->ch_id); + return EINVAL; } - device_printf(sc->vmbus_dev, "chan%u subchanid%u offer%s\n", - new_channel->ch_id, - new_channel->ch_subidx, logstr); - } - if (channel != NULL) { /* -* Check if this is a sub channel. +* This is a sub-channel. */ - if (new_channel->ch_subidx != 0) { - /* -* It is a sub channel offer, process it. -*/ - new_channel->primary_channel = channel; - new_channel->ch_dev = channel->ch_dev; - mtx_lock(>sc_lock); - TAILQ_INSERT_TAIL(>sc_list_anchor, - new_channel, sc_list_entry); - mtx_unlock(>sc_lock); - - /* -* Insert the new channel to the end of the global -* channel list. -* -* NOTE: -* The new sub-channel MUST be inserted AFTER it's -* primary channel, so that the primary channel will -* be found in the above loop for its baby siblings. -*/ - mtx_lock(>vmbus_chlist_lock); -
svn commit: r302812 - in head/sys/dev/hyperv: include netvsc vmbus
Author: sephe Date: Thu Jul 14 06:59:04 2016 New Revision: 302812 URL: https://svnweb.freebsd.org/changeset/base/302812 Log: hyperv/vmbus: Nuke the channel open state. Channel is either opened or not-opened. MFC after:1 week Sponsored by: Microsoft OSTC Differential Revision:https://reviews.freebsd.org/D7105 Modified: head/sys/dev/hyperv/include/hyperv.h head/sys/dev/hyperv/netvsc/hv_net_vsc.c 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 Modified: head/sys/dev/hyperv/include/hyperv.h == --- head/sys/dev/hyperv/include/hyperv.hThu Jul 14 06:48:24 2016 (r302811) +++ head/sys/dev/hyperv/include/hyperv.hThu Jul 14 06:59:04 2016 (r302812) @@ -244,18 +244,9 @@ typedef struct { typedef void (*hv_vmbus_pfn_channel_callback)(void *context); -typedef enum { - HV_CHANNEL_OFFER_STATE, - HV_CHANNEL_OPENING_STATE, - HV_CHANNEL_OPEN_STATE, - HV_CHANNEL_OPENED_STATE, - HV_CHANNEL_CLOSING_NONDESTRUCTIVE_STATE, -} hv_vmbus_channel_state; - typedef struct hv_vmbus_channel { device_tch_dev; struct vmbus_softc *vmbus_sc; - hv_vmbus_channel_state state; uint32_tch_flags; /* VMBUS_CHAN_FLAG_ */ uint32_tch_id; /* channel id */ @@ -337,7 +328,8 @@ typedef struct hv_vmbus_channel { struct task ch_detach_task; TAILQ_ENTRY(hv_vmbus_channel) ch_link; uint32_tch_subidx; /* subchan index */ - + volatile uint32_t ch_stflags; /* atomic-op */ + /* VMBUS_CHAN_ST_ */ struct hyperv_guid ch_guid_type; struct hyperv_guid ch_guid_inst; @@ -357,6 +349,9 @@ typedef struct hv_vmbus_channel { */ #define VMBUS_CHAN_FLAG_BATCHREAD 0x0002 +#define VMBUS_CHAN_ST_OPENED_SHIFT 0 +#define VMBUS_CHAN_ST_OPENED (1 << VMBUS_CHAN_ST_OPENED_SHIFT) + static inline void hv_set_channel_read_state(hv_vmbus_channel* channel, boolean_t on) { Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.c == --- head/sys/dev/hyperv/netvsc/hv_net_vsc.c Thu Jul 14 06:48:24 2016 (r302811) +++ head/sys/dev/hyperv/netvsc/hv_net_vsc.c Thu Jul 14 06:59:04 2016 (r302812) @@ -719,11 +719,6 @@ hv_nv_on_device_remove(struct hn_softc * /* Now, we can close the channel safely */ - if (!destroy_channel) { - sc->hn_prichan->state = - HV_CHANNEL_CLOSING_NONDESTRUCTIVE_STATE; - } - free(sc->hn_prichan->hv_chan_rdbuf, M_NETVSC); hv_vmbus_channel_close(sc->hn_prichan); Modified: head/sys/dev/hyperv/vmbus/hv_channel.c == --- head/sys/dev/hyperv/vmbus/hv_channel.c Thu Jul 14 06:48:24 2016 (r302811) +++ head/sys/dev/hyperv/vmbus/hv_channel.c Thu Jul 14 06:59:04 2016 (r302812) @@ -191,17 +191,9 @@ hv_vmbus_channel_open( return EINVAL; } - mtx_lock(_channel->sc_lock); - if (new_channel->state == HV_CHANNEL_OPEN_STATE) { - new_channel->state = HV_CHANNEL_OPENING_STATE; - } else { - mtx_unlock(_channel->sc_lock); - if(bootverbose) - printf("VMBUS: Trying to open channel <%p> which in " - "%d state.\n", new_channel, new_channel->state); - return (EINVAL); - } - mtx_unlock(_channel->sc_lock); + if (atomic_testandset_int(_channel->ch_stflags, + VMBUS_CHAN_ST_OPENED_SHIFT)) + panic("double-open chan%u", new_channel->ch_id); new_channel->on_channel_callback = pfn_on_channel_callback; new_channel->channel_callback_context = context; @@ -223,8 +215,10 @@ hv_vmbus_channel_open( M_DEVBUF, M_ZERO, 0UL, BUS_SPACE_MAXADDR, PAGE_SIZE, 0); KASSERT(out != NULL, ("Error VMBUS: contigmalloc failed to allocate Ring Buffer!")); - if (out == NULL) - return (ENOMEM); + if (out == NULL) { + ret = ENOMEM; + goto failed; + } in = ((uint8_t *) out + send_ring_buffer_size); @@ -265,7 +259,8 @@ hv_vmbus_channel_open( device_printf(sc->vmbus_dev, "can not get msg hypercall for chopen(chan%u)\n", new_channel->ch_id); - return ENXIO; + ret = ENXIO; + goto failed; } req = vmbus_msghc_dataptr(mh); @@ -284,7 +279,7 @@ hv_vmbus_channel_open(
svn commit: r302811 - head/sys/dev/hyperv/vmbus
Author: sephe Date: Thu Jul 14 06:48:24 2016 New Revision: 302811 URL: https://svnweb.freebsd.org/changeset/base/302811 Log: hyperv/vmbus: Cleanup vmbus_chan_msgproc_choffer MFC after:1 week Sponsored by: Microsoft OSTC Differential Revision:https://reviews.freebsd.org/D7104 Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c == --- head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Thu Jul 14 06:40:42 2016 (r302810) +++ head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Thu Jul 14 06:48:24 2016 (r302811) @@ -247,7 +247,7 @@ vmbus_channel_cpu_rr(struct hv_vmbus_cha } static void -vmbus_channel_select_defcpu(struct hv_vmbus_channel *chan) +vmbus_chan_cpu_default(struct hv_vmbus_channel *chan) { /* * By default, pin the channel to cpu0. Devices having @@ -262,56 +262,54 @@ vmbus_chan_msgproc_choffer(struct vmbus_ const struct vmbus_message *msg) { const struct vmbus_chanmsg_choffer *offer; - hv_vmbus_channel* new_channel; + struct hv_vmbus_channel *chan; int error; offer = (const struct vmbus_chanmsg_choffer *)msg->msg_data; - /* -* Allocate the channel object and save this offer -*/ - new_channel = vmbus_chan_alloc(sc); - if (new_channel == NULL) { + chan = vmbus_chan_alloc(sc); + if (chan == NULL) { device_printf(sc->vmbus_dev, "allocate chan%u failed\n", offer->chm_chanid); return; } - new_channel->ch_id = offer->chm_chanid; - new_channel->ch_subidx = offer->chm_subidx; - new_channel->ch_guid_type = offer->chm_chtype; - new_channel->ch_guid_inst = offer->chm_chinst; + chan->ch_id = offer->chm_chanid; + chan->ch_subidx = offer->chm_subidx; + chan->ch_guid_type = offer->chm_chtype; + chan->ch_guid_inst = offer->chm_chinst; /* Batch reading is on by default */ - new_channel->ch_flags |= VMBUS_CHAN_FLAG_BATCHREAD; - if (offer->chm_flags1 & VMBUS_CHOFFER_FLAG1_HASMNF) - new_channel->ch_flags |= VMBUS_CHAN_FLAG_HASMNF; + chan->ch_flags |= VMBUS_CHAN_FLAG_BATCHREAD; - new_channel->ch_monprm->mp_connid = VMBUS_CONNID_EVENT; + chan->ch_monprm->mp_connid = VMBUS_CONNID_EVENT; if (sc->vmbus_version != VMBUS_VERSION_WS2008) - new_channel->ch_monprm->mp_connid = offer->chm_connid; + chan->ch_monprm->mp_connid = offer->chm_connid; - if (new_channel->ch_flags & VMBUS_CHAN_FLAG_HASMNF) { - new_channel->ch_montrig_idx = - offer->chm_montrig / VMBUS_MONTRIG_LEN; - if (new_channel->ch_montrig_idx >= VMBUS_MONTRIGS_MAX) + if (offer->chm_flags1 & VMBUS_CHOFFER_FLAG1_HASMNF) { + /* +* Setup MNF stuffs. +*/ + chan->ch_flags |= VMBUS_CHAN_FLAG_HASMNF; + chan->ch_montrig_idx = offer->chm_montrig / VMBUS_MONTRIG_LEN; + if (chan->ch_montrig_idx >= VMBUS_MONTRIGS_MAX) panic("invalid monitor trigger %u", offer->chm_montrig); - new_channel->ch_montrig_mask = + chan->ch_montrig_mask = 1 << (offer->chm_montrig % VMBUS_MONTRIG_LEN); } /* Select default cpu for this channel. */ - vmbus_channel_select_defcpu(new_channel); + vmbus_chan_cpu_default(chan); - error = vmbus_chan_add(new_channel); + error = vmbus_chan_add(chan); if (error) { device_printf(sc->vmbus_dev, "add chan%u failed: %d\n", - new_channel->ch_id, error); - vmbus_chan_free(new_channel); + chan->ch_id, error); + vmbus_chan_free(chan); return; } - if (HV_VMBUS_CHAN_ISPRIMARY(new_channel)) { + if (HV_VMBUS_CHAN_ISPRIMARY(chan)) { /* * Add device for this primary channel. * @@ -319,7 +317,7 @@ vmbus_chan_msgproc_choffer(struct vmbus_ * Error is ignored here; don't have much to do if error * really happens. */ - hv_vmbus_child_device_register(new_channel); + hv_vmbus_child_device_register(chan); } } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r302810 - head/sys/dev/hyperv/vmbus
Author: sephe Date: Thu Jul 14 06:40:42 2016 New Revision: 302810 URL: https://svnweb.freebsd.org/changeset/base/302810 Log: hyperv/vmbus: Move new channel scan notification to device register And nuke now unnecessary function indirection. MFC after:1 week Sponsored by: Microsoft OSTC Differential Revision:https://reviews.freebsd.org/D7103 Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c head/sys/dev/hyperv/vmbus/vmbus.c Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c == --- head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Thu Jul 14 06:29:12 2016 (r302809) +++ head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Thu Jul 14 06:40:42 2016 (r302810) @@ -40,14 +40,12 @@ typedef void (*vmbus_chanmsg_proc_t) (struct vmbus_softc *, const struct vmbus_message *); -static voidvmbus_channel_on_offer_internal(struct vmbus_softc *, - const struct vmbus_chanmsg_choffer *); static voidvmbus_chan_detach_task(void *, int); -static voidvmbus_channel_on_offer(struct vmbus_softc *, - const struct vmbus_message *); static voidvmbus_channel_on_offers_delivered(struct vmbus_softc *, const struct vmbus_message *); +static voidvmbus_chan_msgproc_choffer(struct vmbus_softc *, + const struct vmbus_message *); static voidvmbus_chan_msgproc_chrescind(struct vmbus_softc *, const struct vmbus_message *); @@ -62,7 +60,7 @@ static void vmbus_chan_msgproc_chrescind static const vmbus_chanmsg_proc_t vmbus_chanmsg_process[VMBUS_CHANMSG_TYPE_MAX] = { - VMBUS_CHANMSG_PROC(CHOFFER, vmbus_channel_on_offer), + VMBUS_CHANMSG_PROC(CHOFFER, vmbus_chan_msgproc_choffer), VMBUS_CHANMSG_PROC(CHRESCIND, vmbus_chan_msgproc_chrescind), VMBUS_CHANMSG_PROC(CHOFFER_DONE,vmbus_channel_on_offers_delivered), @@ -259,28 +257,16 @@ vmbus_channel_select_defcpu(struct hv_vm vmbus_channel_cpu_set(chan, 0); } -/** - * @brief Handler for channel offers from Hyper-V/Azure - * - * Handler for channel offers from vmbus in parent partition. - */ -static void -vmbus_channel_on_offer(struct vmbus_softc *sc, const struct vmbus_message *msg) -{ - /* New channel is offered by vmbus */ - vmbus_scan_newchan(sc); - - vmbus_channel_on_offer_internal(sc, - (const struct vmbus_chanmsg_choffer *)msg->msg_data); -} - static void -vmbus_channel_on_offer_internal(struct vmbus_softc *sc, -const struct vmbus_chanmsg_choffer *offer) +vmbus_chan_msgproc_choffer(struct vmbus_softc *sc, +const struct vmbus_message *msg) { + const struct vmbus_chanmsg_choffer *offer; hv_vmbus_channel* new_channel; int error; + offer = (const struct vmbus_chanmsg_choffer *)msg->msg_data; + /* * Allocate the channel object and save this offer */ Modified: head/sys/dev/hyperv/vmbus/vmbus.c == --- head/sys/dev/hyperv/vmbus/vmbus.c Thu Jul 14 06:29:12 2016 (r302809) +++ head/sys/dev/hyperv/vmbus/vmbus.c Thu Jul 14 06:40:42 2016 (r302810) @@ -994,6 +994,9 @@ hv_vmbus_child_device_register(struct hv device_t parent = sc->vmbus_dev; int error = 0; + /* New channel has been offered */ + vmbus_scan_newchan(sc); + chan->ch_dev = device_add_child(parent, NULL, -1); if (chan->ch_dev == NULL) { device_printf(parent, "device_add_child for chan%u failed\n", ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r302809 - head/sys/dev/hyperv/vmbus
Author: sephe Date: Thu Jul 14 06:29:12 2016 New Revision: 302809 URL: https://svnweb.freebsd.org/changeset/base/302809 Log: hyperv/vmbus: Move device register and channel free to the caller. This paves the way for more cleanup/disentangle. MFC after:1 week Sponsored by: Microsoft OSTC Differential Revision:https://reviews.freebsd.org/D7102 Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c == --- head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Thu Jul 14 06:18:11 2016 (r302808) +++ head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Thu Jul 14 06:29:12 2016 (r302809) @@ -114,8 +114,8 @@ vmbus_chan_free(struct hv_vmbus_channel * @brief Process the offer by creating a channel/device * associated with this offer */ -static void -vmbus_channel_process_offer(hv_vmbus_channel *new_channel) +static int +vmbus_chan_add(hv_vmbus_channel *new_channel) { struct vmbus_softc *sc = new_channel->vmbus_sc; hv_vmbus_channel* channel; @@ -126,9 +126,13 @@ vmbus_channel_process_offer(hv_vmbus_cha mtx_lock(>vmbus_chlist_lock); if (new_channel->ch_id == 0) { /* -* XXX channel0 will not be processed; skip it. +* XXX +* Chan0 will neither be processed nor should be offered; +* skip it. */ - printf("VMBUS: got channel0 offer\n"); + mtx_unlock(>vmbus_chlist_lock); + device_printf(sc->vmbus_dev, "got chan0 offer\n"); + return EINVAL; } else { sc->vmbus_chmap[new_channel->ch_id] = new_channel; } @@ -201,27 +205,16 @@ vmbus_channel_process_offer(hv_vmbus_cha mtx_unlock(>sc_lock); wakeup(channel); - return; + return 0; } - printf("VMBUS: duplicated primary channel%u\n", + device_printf(sc->vmbus_dev, "duplicated primary chan%u\n", new_channel->ch_id); - vmbus_chan_free(new_channel); - return; + return EINVAL; } new_channel->state = HV_CHANNEL_OPEN_STATE; - - /* -* 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); + return 0; } void @@ -286,6 +279,7 @@ vmbus_channel_on_offer_internal(struct v const struct vmbus_chanmsg_choffer *offer) { hv_vmbus_channel* new_channel; + int error; /* * Allocate the channel object and save this offer @@ -323,7 +317,24 @@ vmbus_channel_on_offer_internal(struct v /* Select default cpu for this channel. */ vmbus_channel_select_defcpu(new_channel); - vmbus_channel_process_offer(new_channel); + error = vmbus_chan_add(new_channel); + if (error) { + device_printf(sc->vmbus_dev, "add chan%u failed: %d\n", + new_channel->ch_id, error); + vmbus_chan_free(new_channel); + return; + } + + if (HV_VMBUS_CHAN_ISPRIMARY(new_channel)) { + /* +* Add device for this primary channel. +* +* NOTE: +* Error is ignored here; don't have much to do if error +* really happens. +*/ + hv_vmbus_child_device_register(new_channel); + } } /* ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r302808 - head/sys/dev/hyperv/vmbus
Author: sephe Date: Thu Jul 14 06:18:11 2016 New Revision: 302808 URL: https://svnweb.freebsd.org/changeset/base/302808 Log: hyperv/vmbus: Alloc/Free monitor param in vmbus channel alloc/free. MFC after:1 week Sponsored by: Microsoft OSTC Differential Revision:https://reviews.freebsd.org/D7101 Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c == --- head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Thu Jul 14 06:10:16 2016 (r302807) +++ head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Thu Jul 14 06:18:11 2016 (r302808) @@ -40,7 +40,6 @@ typedef void (*vmbus_chanmsg_proc_t) (struct vmbus_softc *, const struct vmbus_message *); -static struct hv_vmbus_channel *hv_vmbus_allocate_channel(struct vmbus_softc *); static voidvmbus_channel_on_offer_internal(struct vmbus_softc *, const struct vmbus_chanmsg_choffer *); static voidvmbus_chan_detach_task(void *, int); @@ -76,32 +75,39 @@ vmbus_chanmsg_process[VMBUS_CHANMSG_TYPE #undef VMBUS_CHANMSG_PROC_WAKEUP #undef VMBUS_CHANMSG_PROC -/** - * @brief Allocate and initialize a vmbus channel object - */ static struct hv_vmbus_channel * -hv_vmbus_allocate_channel(struct vmbus_softc *sc) +vmbus_chan_alloc(struct vmbus_softc *sc) { - struct hv_vmbus_channel *channel; + struct hv_vmbus_channel *chan; - channel = malloc(sizeof(*channel), M_DEVBUF, M_WAITOK | M_ZERO); - channel->vmbus_sc = sc; + chan = malloc(sizeof(*chan), M_DEVBUF, M_WAITOK | M_ZERO); - mtx_init(>sc_lock, "vmbus multi channel", NULL, MTX_DEF); - TAILQ_INIT(>sc_list_anchor); - TASK_INIT(>ch_detach_task, 0, vmbus_chan_detach_task, channel); + chan->ch_monprm = hyperv_dmamem_alloc(bus_get_dma_tag(sc->vmbus_dev), + HYPERCALL_PARAM_ALIGN, 0, sizeof(struct hyperv_mon_param), + >ch_monprm_dma, BUS_DMA_WAITOK | BUS_DMA_ZERO); + if (chan->ch_monprm == NULL) { + device_printf(sc->vmbus_dev, "monprm alloc failed\n"); + free(chan, M_DEVBUF); + return NULL; + } + + chan->vmbus_sc = sc; + mtx_init(>sc_lock, "vmbus multi channel", NULL, MTX_DEF); + TAILQ_INIT(>sc_list_anchor); + TASK_INIT(>ch_detach_task, 0, vmbus_chan_detach_task, chan); - return (channel); + return chan; } -/** - * @brief Release the resources used by the vmbus channel object - */ -void -hv_vmbus_free_vmbus_channel(hv_vmbus_channel* channel) +static void +vmbus_chan_free(struct hv_vmbus_channel *chan) { - mtx_destroy(>sc_lock); - free(channel, M_DEVBUF); + /* TODO: assert sub-channel list is empty */ + /* TODO: asset no longer on the primary channel's sub-channel list */ + /* TODO: asset no longer on the vmbus channel list */ + hyperv_dmamem_free(>ch_monprm_dma, chan->ch_monprm); + mtx_destroy(>sc_lock); + free(chan, M_DEVBUF); } /** @@ -200,7 +206,7 @@ vmbus_channel_process_offer(hv_vmbus_cha printf("VMBUS: duplicated primary channel%u\n", new_channel->ch_id); - hv_vmbus_free_vmbus_channel(new_channel); + vmbus_chan_free(new_channel); return; } @@ -284,7 +290,13 @@ vmbus_channel_on_offer_internal(struct v /* * Allocate the channel object and save this offer */ - new_channel = hv_vmbus_allocate_channel(sc); + new_channel = vmbus_chan_alloc(sc); + if (new_channel == NULL) { + device_printf(sc->vmbus_dev, "allocate chan%u failed\n", + offer->chm_chanid); + return; + } + new_channel->ch_id = offer->chm_chanid; new_channel->ch_subidx = offer->chm_subidx; new_channel->ch_guid_type = offer->chm_chtype; @@ -295,17 +307,6 @@ vmbus_channel_on_offer_internal(struct v if (offer->chm_flags1 & VMBUS_CHOFFER_FLAG1_HASMNF) new_channel->ch_flags |= VMBUS_CHAN_FLAG_HASMNF; - new_channel->ch_monprm = hyperv_dmamem_alloc( - bus_get_dma_tag(sc->vmbus_dev), - HYPERCALL_PARAM_ALIGN, 0, sizeof(struct hyperv_mon_param), - _channel->ch_monprm_dma, BUS_DMA_WAITOK | BUS_DMA_ZERO); - if (new_channel->ch_monprm == NULL) { - device_printf(sc->vmbus_dev, "monprm alloc failed\n"); - /* XXX */ - mtx_destroy(_channel->sc_lock); - free(new_channel, M_DEVBUF); - return; - } new_channel->ch_monprm->mp_connid = VMBUS_CONNID_EVENT; if (sc->vmbus_version != VMBUS_VERSION_WS2008) new_channel->ch_monprm->mp_connid = offer->chm_connid; @@ -410,7 +411,7 @@ remove: mtx_unlock(_chan->sc_lock);
svn commit: r302807 - head/contrib/ldns-host
Author: ngie Date: Thu Jul 14 06:10:16 2016 New Revision: 302807 URL: https://svnweb.freebsd.org/changeset/base/302807 Log: Initialize first_serial to 0 in dozonetransfer(..) to fix -Wuninitialized warning MFC after: 3 days X-MFC with: r302779 Pointyhat to: des PR: 209177 Reported by: Jenkins (sparc64 job), gcc 4.2.1, gcc 5.3.0 Sponsored by: EMC / Isilon Storage Division Modified: head/contrib/ldns-host/ldns-host.c Modified: head/contrib/ldns-host/ldns-host.c == --- head/contrib/ldns-host/ldns-host.c Thu Jul 14 06:10:00 2016 (r302806) +++ head/contrib/ldns-host/ldns-host.c Thu Jul 14 06:10:16 2016 (r302807) @@ -888,7 +888,7 @@ dozonetransfer(ldns_resolver *res, ldns_ ldns_rr_list *rrl; ldns_rr *rr; size_t i, nsoa = 0; -uint32_t first_serial; +uint32_t first_serial = 0; rrtype = o_rrtype; o_rrtype = (o_mode == M_AXFR) ? LDNS_RR_TYPE_AXFR : LDNS_RR_TYPE_IXFR; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r302806 - head/sys/dev/hyperv/vmbus
Author: sephe Date: Thu Jul 14 06:10:00 2016 New Revision: 302806 URL: https://svnweb.freebsd.org/changeset/base/302806 Log: hyperv/vmbus: Get rid of rel{_id,id}, use channel id consistently. MFC after:1 week Sponsored by: Microsoft OSTC Differential Revision:https://reviews.freebsd.org/D7100 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 Thu Jul 14 06:00:40 2016 (r302805) +++ head/sys/dev/hyperv/vmbus/hv_channel.c Thu Jul 14 06:10:00 2016 (r302806) @@ -897,25 +897,23 @@ vmbus_event_flags_proc(struct vmbus_soft int f; for (f = 0; f < flag_cnt; ++f) { - uint32_t rel_id_base; + uint32_t chid_base; u_long flags; - int bit; + int chid_ofs; if (event_flags[f] == 0) continue; flags = atomic_swap_long(_flags[f], 0); - rel_id_base = f << VMBUS_EVTFLAG_SHIFT; + chid_base = f << VMBUS_EVTFLAG_SHIFT; - while ((bit = ffsl(flags)) != 0) { + while ((chid_ofs = ffsl(flags)) != 0) { struct hv_vmbus_channel *channel; - uint32_t rel_id; - --bit; /* NOTE: ffsl is 1-based */ - flags &= ~(1UL << bit); + --chid_ofs; /* NOTE: ffsl is 1-based */ + flags &= ~(1UL << chid_ofs); - rel_id = rel_id_base + bit; - channel = sc->vmbus_chmap[rel_id]; + channel = sc->vmbus_chmap[chid_base + chid_ofs]; /* if channel is closed or closing */ if (channel == NULL || channel->rxq == NULL) Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c == --- head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Thu Jul 14 06:00:40 2016 (r302805) +++ head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Thu Jul 14 06:10:00 2016 (r302806) @@ -113,20 +113,18 @@ vmbus_channel_process_offer(hv_vmbus_cha { struct vmbus_softc *sc = new_channel->vmbus_sc; hv_vmbus_channel* channel; - uint32_trelid; - relid = new_channel->ch_id; /* * Make sure this is a new offer */ mtx_lock(>vmbus_chlist_lock); - if (relid == 0) { + if (new_channel->ch_id == 0) { /* * XXX channel0 will not be processed; skip it. */ printf("VMBUS: got channel0 offer\n"); } else { - sc->vmbus_chmap[relid] = new_channel; + sc->vmbus_chmap[new_channel->ch_id] = new_channel; } TAILQ_FOREACH(channel, >vmbus_chlist, ch_link) { ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r302805 - in head/sys/dev/hyperv: include vmbus
Author: sephe Date: Thu Jul 14 06:00:40 2016 New Revision: 302805 URL: https://svnweb.freebsd.org/changeset/base/302805 Log: hyperv/vmbus: Remove unused bits MFC after:1 week Sponsored by: Microsoft OSTC Differential Revision:https://reviews.freebsd.org/D7095 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.hThu Jul 14 05:49:14 2016 (r302804) +++ head/sys/dev/hyperv/include/hyperv.hThu Jul 14 06:00:40 2016 (r302805) @@ -82,32 +82,6 @@ typedef uint8_t hv_bool_uint8_t; #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 - */ - -#define HV_MAX_PIPE_DATA_PAYLOAD (sizeof(BYTE) * 16384) - -/* - * Define pipe_mode values - */ - -#define HV_VMBUS_PIPE_TYPE_BYTE0x -#define HV_VMBUS_PIPE_TYPE_MESSAGE 0x0004 - -/* - * The size of the user defined data buffer for non-pipe offers - */ - -#define HV_MAX_USER_DEFINED_BYTES 120 - -/* - * The size of the user defined data buffer for pipe offers - */ - -#define HV_MAX_PIPE_USER_DEFINED_BYTES 116 - - #define HV_MAX_PAGE_BUFFER_COUNT 32 #define HV_MAX_MULTIPAGE_BUFFER_COUNT 32 @@ -129,49 +103,6 @@ struct hyperv_guid { inthyperv_guid2str(const struct hyperv_guid *, char *, size_t); -/* - * At the center of the Channel Management library is - * the Channel Offer. This struct contains the - * fundamental information about an offer. - */ - -typedef struct hv_vmbus_channel_offer { - struct hyperv_guid interface_type; - struct hyperv_guid interface_instance; - uint64_tinterrupt_latency_in_100ns_units; - uint32_tinterface_revision; - uint32_tserver_context_area_size; /* in bytes */ - uint16_tchannel_flags; - uint16_tmmio_megabytes; /* in bytes * 1024 * 1024 */ - union - { -/* - * Non-pipes: The user has HV_MAX_USER_DEFINED_BYTES bytes. - */ - struct { - uint8_t user_defined[HV_MAX_USER_DEFINED_BYTES]; - } __packed standard; - -/* - * Pipes: The following structure is an integrated pipe protocol, which - *is implemented on top of standard user-defined data. pipe - *clients have HV_MAX_PIPE_USER_DEFINED_BYTES left for their - *own use. - */ - struct { - uint32_tpipe_mode; - uint8_t user_defined[HV_MAX_PIPE_USER_DEFINED_BYTES]; - } __packed pipe; - } u; - - /* -* Sub_channel_index, newly added in Win8. -*/ - uint16_tsub_channel_index; - uint16_tpadding; - -} __packed hv_vmbus_channel_offer; - typedef struct { uint16_t type; uint16_t data_offset8; @@ -213,64 +144,6 @@ typedef enum { #define HV_VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED1 -/* - * Version 1 messages - */ -typedef enum { - HV_CHANNEL_MESSAGE_INVALID = 0, - HV_CHANNEL_MESSAGE_OFFER_CHANNEL= 1, - HV_CHANNEL_MESSAGE_RESCIND_CHANNEL_OFFER= 2, - HV_CHANNEL_MESSAGE_REQUEST_OFFERS = 3, - HV_CHANNEL_MESSAGE_ALL_OFFERS_DELIVERED = 4, - HV_CHANNEL_MESSAGE_OPEN_CHANNEL = 5, - HV_CHANNEL_MESSAGE_OPEN_CHANNEL_RESULT = 6, - HV_CHANNEL_MESSAGE_CLOSE_CHANNEL= 7, - HV_CHANNEL_MESSAGEL_GPADL_HEADER= 8, - HV_CHANNEL_MESSAGE_GPADL_BODY = 9, - HV_CHANNEL_MESSAGE_GPADL_CREATED= 10, - HV_CHANNEL_MESSAGE_GPADL_TEARDOWN = 11, - HV_CHANNEL_MESSAGE_GPADL_TORNDOWN = 12, - HV_CHANNEL_MESSAGE_REL_ID_RELEASED = 13, - HV_CHANNEL_MESSAGE_INITIATED_CONTACT= 14, - HV_CHANNEL_MESSAGE_VERSION_RESPONSE = 15, - HV_CHANNEL_MESSAGE_UNLOAD = 16, - HV_CHANNEL_MESSAGE_COUNT -} hv_vmbus_channel_msg_type; - -typedef struct { - hv_vmbus_channel_msg_type message_type; - uint32_tpadding; -} __packed hv_vmbus_channel_msg_header; - -/* - * Channel Offer parameters - */ -typedef struct { - hv_vmbus_channel_msg_header header; - hv_vmbus_channel_offer offer; - uint32_tchild_rel_id; - uint8_t monitor_id; - /* -* This field has been split into a bit field on Win7 -* and higher. -*/ - uint8_t