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(&sc->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(&sc->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, &sc->vmbus_chlist, ch_link) { - if (memcmp(&channel->ch_guid_type, &new_channel->ch_guid_type, + mtx_lock(&sc->vmbus_chlist_lock); + TAILQ_FOREACH(prichan, &sc->vmbus_chlist, ch_link) { + if (memcmp(&prichan->ch_guid_type, &newchan->ch_guid_type, sizeof(struct hyperv_guid)) == 0 && - memcmp(&channel->ch_guid_inst, &new_channel->ch_guid_inst, + memcmp(&prichan->ch_guid_inst, &newchan->ch_guid_inst, sizeof(struct hyperv_guid)) == 0) break; } - - if (channel == NULL) { + if (prichan == NULL) { /* Install the new primary channel */ - TAILQ_INSERT_TAIL(&sc->vmbus_chlist, new_channel, ch_link); + TAILQ_INSERT_TAIL(&sc->vmbus_chlist, newchan, ch_link); } mtx_unlock(&sc->vmbus_chlist_lock); - if (bootverbose) { - char logstr[64]; - - logstr[0] = '\0'; - if (channel != NULL) { - snprintf(logstr, sizeof(logstr), ", primary chan%u", - channel->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(&channel->sc_lock); - TAILQ_INSERT_TAIL(&channel->sc_list_anchor, - new_channel, sc_list_entry); - mtx_unlock(&channel->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 lo
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(&sc->vmbus_chlist); TAILQ_REMOVE(&sc->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-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: 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(&sc->vmbus_chlist, newchan, ch_link); - } - mtx_unlock(&sc->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(&sc->vmbus_chlist, newchan, ch_link); + mtx_unlock(&sc->vmbus_chlist_lock); + return 0; + } else { + mtx_unlock(&sc->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(&prichan->sc_lock); - TAILQ_INSERT_TAIL(&prichan->sc_list_anchor, newchan, - sc_list_entry); - mtx_unlock(&prichan->sc_lock); - + } else { /* Sub-channel */ + if (prichan == NULL) { + mtx_unlock(&sc->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(&sc->vmbus_chlist_lock); - TAILQ_INSERT_TAIL(&sc->vmbus_chlist, newchan, ch_link); - mtx_unlock(&sc->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(&prichan->sc_lock); - prichan->subchan_cnt++; - mtx_unlock(&prichan->sc_lock); - wakeup(prichan); } + mtx_unlock(&sc->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(&prichan->sc_lock); + TAILQ_INSERT_TAIL(&prichan->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(&prichan->sc_lock); + wakeup(prichan); + return 0; } @@ -370,10 +373,6 @@ vmbus_chan_detach_task(void *xchan, int } } remove: - mtx_lock(&sc->vmbus_chlist_lock); - TAILQ_REMOVE(&sc->vmbus_chlist, chan, ch_link); - mtx_unlock(&sc->vmbus_chlist_lock); - mtx_lock(&pri_chan->sc_lock); TAILQ_REMOVE(&pri_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(&sc->vmbus_chlis
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(&sc->vmbus_chlist_lock); + while ((chan = TAILQ_FIRST(&sc->vmbus_chlist)) != NULL) { + KASSERT(VMBUS_CHAN_ISPRIMARY(chan), ("not primary channel")); + TAILQ_REMOVE(&sc->vmbus_chlist, chan, ch_link); + mtx_unlock(&sc->vmbus_chlist_lock); - while (!TAILQ_EMPTY(&sc->vmbus_chlist)) { - channel = TAILQ_FIRST(&sc->vmbus_chlist); - KASSERT(VMBUS_CHAN_ISPRIMARY(channel), ("not primary channel")); - TAILQ_REMOVE(&sc->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(&sc->vmbus_chlist_lock); } bzero(sc->vmbus_chmap, sizeof(struct hv_vmbus_channel *) * VMBUS_CHAN_MAX); - mtx_unlock(&sc->vmbus_chlist_lock); } Modified: head/sys/dev/hyperv/vmbus/hv_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-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: 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(&sc->vmbus_chlist_lock); - TAILQ_FOREACH(prichan, &sc->vmbus_chlist, ch_link) { + mtx_lock(&sc->vmbus_prichan_lock); + TAILQ_FOREACH(prichan, &sc->vmbus_prichans, ch_prilink) { if (memcmp(&prichan->ch_guid_type, &newchan->ch_guid_type, sizeof(struct hyperv_guid)) == 0 && memcmp(&prichan->ch_guid_inst, &newchan->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(&sc->vmbus_chlist, newchan, ch_link); - mtx_unlock(&sc->vmbus_chlist_lock); + TAILQ_INSERT_TAIL(&sc->vmbus_prichans, newchan, + ch_prilink); + mtx_unlock(&sc->vmbus_prichan_lock); return 0; } else { - mtx_unlock(&sc->vmbus_chlist_lock); + mtx_unlock(&sc->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(&sc->vmbus_chlist_lock); + mtx_unlock(&sc->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(&sc->vmbus_chlist_lock); + mtx_unlock(&sc->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(&sc->vmbus_chlist_lock); - while ((chan = TAILQ_FIRST(&sc->vmbus_chlist)) != NULL) { + mtx_lock(&sc->vmbus_prichan_lock); + while ((chan = TAILQ_FIRST(&sc->vmbus_prichans)) != NULL) { KASSERT(VMBUS_CHAN_ISPRIMARY(chan), ("not primary channel")); - TAILQ_REMOVE(&sc->vmbus_chlist, chan, ch_link); - mtx_unlock(&sc->vmbus_chlist_lock); + TAILQ_REMOVE(&sc->vmbus_prichans, chan, ch_prilink); + mtx_unlock(&sc->vmbus_prichan_lock); hv_vmbus_child_device_unregister(chan); vmbus_chan_free(chan); - mtx_lock(&sc->vmbus_chlist_lock); + mtx_lock(&sc->vmbus_prichan_lock); } bzero(sc->vmbus_chmap, sizeof(struct hv_vmbus_channel *) * VMBUS_CHAN_MAX); - mtx_unlock(&sc->vmbus_chlist_lock); + mtx_unlock(&sc->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/hype
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, &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-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: 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(&chan->sc_lock, "vmbus multi channel", NULL, MTX_DEF); - TAILQ_INIT(&chan->sc_list_anchor); + mtx_init(&chan->ch_subchan_lock, "vmbus subchan", NULL, MTX_DEF); + TAILQ_INIT(&chan->ch_subchans); TASK_INIT(&chan->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(&chan->ch_monprm_dma, chan->ch_monprm); - mtx_destroy(&chan->sc_lock); + mtx_destroy(&chan->ch_subchan_lock); free(chan, M_DEVBUF); } @@ -136,6 +136,10 @@ vmbus_chan_add(struct hv_vmbus_channel * mtx_lock(&sc->vmbus_prichan_lock); TAILQ_FOREACH(prichan, &sc->vmbus_prichans, ch_prilink) { + /* +* Sub-channel will have the same type GUID and instance +* GUID as its primary channel. +*/ if (memcmp(&prichan->ch_guid_type, &newchan->ch_guid_type,
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 */ -int
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 *sc
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, &l)); + 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, &l)); + return (wcscoll(s1, s2)); } Modified: h
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, &octal); else { clen = mbrtowc(&wc, 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 *)&stopval, (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 *)&cnt, (const void *)&(s->lastch)) >= 0 && + charcoll((const void *)&cnt, (const void *)&stopval) <= 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 EXAM
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-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: 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(&s2)) + if (next(&s2)) { 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-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: 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-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: 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-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: 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-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: 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-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: 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-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: 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-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r302601 - in head/sys: arm/include arm64/include [clang 3.8.0: powerpc int instead of 32-bit SYSVR4's long and 64-bit ELF V2 long]
[Top post of a history note for powerpc and wchar_t's type in FreeBSD. The history is from looking around in svn.] [The below is not a complaint or a request for a change. It just looks like int for wchar_t for powerpc was a choice made long ago for simpler code given FreeBSD's pre-existing structure.] int being used for powerpc wchar_t on FreeBSD goes back to at least 2001-Jan-1. [FYI: "27 February, 2008: FreeBSD 7.0 is the first release to officially support the FreeBSD/ppc port". So long before official support.] wchar_t's type is one place where FreeBSD choose to override the powerpc (and powerpc64) ABI standards (that indicate long, not int). I'm not sure if this was implicit vs. explicitly realizing the ABI mismatch. [The SYSVR4 32-bit powerpc ABI goes back to 1995.] I first traced the history back to 2002-Aug-23: -r102315 of sys/sys/_types.h standardized FreeBSD on the following until the ARM change: typedef int __ct_rune_t; typedef __ct_rune_t __rune_t; typedef __ct_rune_t __wchar_t; typedef __ct_rune_t __wint_t; Prior to this there was 2002-Aug-21's -r102227 sys/powerpc/include/_types.h that used __int32_t. Prior to that had ansi.h and types.h instead of _types.h --and ansi.h had: #define _BSD_WCHAR_T_ _BSD_CT_RUNE_T_ /* wchar_t (see below) */ . . . #define _BSD_CT_RUNE_T_ int /* arg type for ctype funcs */ Going back to sys/powerpc/include/ansi.h's -r70571 (2001-Jan-1 creation in svn): #define _BSD_WCHAR_T_ int /* wchar_t */ And the comments back then say: . . . It is not * unsigned so that EOF (-1) can be naturally assigned to it and used. . . . The reason an int was * chosen over a long is that the is*() and to*() routines take ints (says * ANSI C), but they use __ct_rune_t instead of int. I've decided to not go any farther back in time (if there is prior history for wchar_t for powerpc). Ignoring the temporary __int32_t use: FreeBSD has had its own powerpc wchar_t type (int) for at least the last 15 years, at least when viewed just relative to the powerpc ABI(s) FreeBSD is based on for powerpc. Modern gcc versions even have the FreeBSD wchar_t type correct for powerpc variants in recent times: int. Previously some notation (L based notation) used the wrong type for one of the powerpc variants (32-bit vs. 64-bit), causing lots of false-positive compiler notices. gcc had followed the ABI involved (long int) until the correction. === Mark Millard markmi at dsl-only.net On 2016-Jul-13, at 11:46 PM, Mark Millard wrote: > On 2016-Jul-13, at 6:00 PM, Andrey Chernov wrote: > >> On 13.07.2016 11:53, Mark Millard wrote: >>> [The below does note that TARGET=powerpc has a mix of signed wchar_t and >>> unsigned char types and most architectures have both being signed types.] >> >> POSIX says nothing about wchar_t and char should be the same (un)signed. >> It is arm ABI docs may say so only. They are different entities >> differently encoded and cross assigning between wchar_t and char is not >> recommended. > > [My "odd" would better have been the longer phrase "unusual for FreeBSD" for > the signed type mismatch point.] > > C11 (9899:2011[2012]) and C++11 (14882:2011(E)) agree with your POSIX note: > no constraint to have the same signed type status as char. > > But when I then looked at the "System V Application Binary Interface PowerpC > Processor Supplement" (1995-Sept SunSoft document) that I believe FreeBSD > uses for powerpc (32-bit only: TARGET_ARCH=powerpc) it has: > > typedef long wchar_t; > > as part of: Figure 6-39 (page labeled 6-38). > > While agreeing about the signed-type status for wchar_t this does not agree > with FreeBSD 11.0's use of int as the type: > > sys/powerpc/include/_types.h:typedef int ___wchar_t; > sys/powerpc/include/_types.h:#define __WCHAR_MIN __INT_MIN /* min > value for a wchar_t */ > sys/powerpc/include/_types.h:#define __WCHAR_MAX __INT_MAX /* max > value for a wchar_t */ > > # clang --target=powerpc-freebsd11 -std=c99 -E -dM - < /dev/null | more > . . . > #define __WCHAR_MAX__ 2147483647 > #define __WCHAR_TYPE__ int > #define __WCHAR_WIDTH__ 32 > . . . > > I'm not as sure of which document is official for TARGET_ARCH=powerpc64 but > using "Power Architecture 64-bit ELF V2 ABI Specification" (Open POWER ABI > for Linux Supplement) as an example of what likely is common for that > context: 5.1.3 Types Defined in Standard header lists: > > typedef long wchar_t; > > which again does not agree with FreeBSD 11.0's use of int as the type: > > # clang --target=powerpc64-freebsd11 -std=c99 -E -dM - < /dev/null | more > . . . > #define __WCHAR_MAX__ 2147483647 > #define __WCHAR_TYPE__ int > #define __WCHAR_WIDTH__ 32 > . . . > > > === > Mark Millard > markmi at dsl-only.net > > >> >> On 2016-Jul-11, at 8:57 PM, Andrey Chernov wrote: >> >>> On 12.07.2016 5:44, Mark Millard wrote: My unders
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-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: 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-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: 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 Wilson Reviewed 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, &os); - 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, &zfsvfs->z_version); - if (error) { - goto out; - } else if (zfsvfs->z_version > + if (error != 0) + return (error); + if (zfsvfs->z_version > zfs_zpl_version_map(spa_version(dmu_objset_spa(os { (void) printf("Can't mount a version %lld file system " "on a version %lld pool\n. Pool must be upgraded to mount " "this file system.", (u_longlong_t)zfsvfs->z_version, (u_longlong_t)spa_version(dmu_objset_spa(os))); - error = SET_ERROR(ENOTSUP); - goto out; +
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 Ahrens Reviewed 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->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->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->db_mtx); + + rw_enter(&dn->dn_struct_rwlock, RW_WRITER); + *db->db_blkptr = *bp; + rw_exit(&dn->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, &zp); 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, &zp, + &dr->dr_bp_copy, contents, db->db.db_size, &zp, dbuf_write_override_ready, NULL, dbuf_write_override_done, dr, ZIO_PRIORITY_ASYNC_WRITE, ZIO_FLAG_MUSTSUCCEED, &zb); mutex_enter(&db->db_mtx); @@ -3203,14 +3218,14 @@ dbuf_write(dbuf_dirty_record_t *dr, arc_
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 Ahrens Reviewed 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 have nonzero data, * it had better be dirty, otherwise we'll lose that * data when
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 McDonald Reviewed 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(&zp->z_parent_lock); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: 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 Ahrens Reviewed 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->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, &func, 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-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r302577 - head/sys/dev/drm2
> On Jul 13, 2016, at 16:56, Ngie Cooper wrote: > > 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: 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-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: 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. Hartman Sponsored 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-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: 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-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: 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-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: 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), &msi_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), &msi_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), &msi_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), &msi_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-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: 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 >= G
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: 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 pci_irq_reserve(i
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 = &dinfo->cfg; \ - \ - cfg->msix.msix_msgnum; \ -}) - #endif /* _GIC_V3_VAR_H_ */ ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: 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-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: 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(&aps_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, enu
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-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r302855 - head/etc/rc.d
On Thu, Jul 14, 2016 at 12:51 PM, Jamie Gritton wrote: > 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-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: 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-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: 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, &runnable); + if (j->flags & JF_FROM_RUNQ) + requeue_head(j, &runnable); + else + requeue(j, &runnable); 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(&runnable)) - requeue(TAILQ_FIRST(&runnable), &ready); + if (!TAILQ_EMPTY(&runnable)) { + rj = TAILQ_FIRST(&runnable); + rj->flags |= JF_FROM_RUNQ; + requeue(rj, &ready); + } 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-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: 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-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: 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-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: 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-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: 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-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: 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(&sbarg, psinfo->pr_psargs, + sizeof(psinfo->pr_psargs), SBUF_FIXEDLEN); + error = proc_getargv(curthread, p, &sbarg); + PRELE(p); + if (sbuf_finish(&sbarg) == 0) + len = sbuf_len(&sbarg) - 1; + else + len = sizeof(psinfo->pr_psargs) - 1; + sbuf_delete(&sbarg); + } + 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, &len, 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-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send an
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-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: 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-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: 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-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: 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-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: 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), + &chan->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(&chan->ch_subchan_lock, "vmbus subchan", NULL, MTX_DEF); + TAILQ_INIT(&chan->ch_subchans); + TASK_INIT(&chan->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(&chan->ch_monprm_dma, chan->ch_monprm); +
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-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: 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-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: 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-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: 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 FreeBSD UNIX: Web: http://www.FreeBSD.org The need of the many outweighs the greed of the few. ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: 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 Schubert FreeBSD UNIX: Web: http://www.FreeBSD.org The need of the many outweighs the greed of the few. ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: 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(&sc->vmbus_prichans, chan, ch_prilink); mtx_unlock(&sc->vmbus_prichan_lock); - hv_vmbus_child_device_unregister(chan); + vmbus_delete_child(chan); vmbus_chan_free(chan); mtx_lock(&sc->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-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: 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-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: 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 = &desc; - buffer_list[0].length = sizeof(hv_vm_packet_descriptor); + iov[0].iov_base = &desc; + 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 = &aligned_data; - buffer_list[2].length = packet_len_aligned - packet_len; + iov[2].iov_base = &aligned_data; + iov[2].iov_len = packet_len_aligned - packet_len; - ret = hv_ring_buffer_write(&channel->outbound, buffer_list, 3, - &need_sig); + ret = hv_ring_buffer_write(&channel->outbound, iov, 3, &need_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 = &desc; - buffer_list[0].length = descSize; + iov[0].iov_base = &desc; + 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 = &alignedData; - buffer_list[3].length = packetLen_aligned - packet_len; + iov[3].iov_base = &alignedData; + iov[3].iov_len = packetLen_aligned - packet_len; - ret = hv_ring_buffer_write(&channel->outbound, buffer_list, 4, - &need_sig); + ret = hv_ring_buffer_write(&channel->outbound, iov, 4, &need_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 = &desc; - buffer_list[0].length = desc_size; + iov[0].iov_base = &desc; + 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 = &aligned_data; - buffer_list[2].length = packet_len_aligned - packet_len; + iov[2].iov_base = &aligned_data; + iov[2].iov_len = packet_len_aligned - packet_len; - ret = hv_ring_buffer_write(&channel->outbound, buffer_list, 3, - &need_sig); + ret = hv_ring_buffer_write(&
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-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: 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(&new_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, + &new_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( - &new_channel->outbound, - out, - send_ring_buffer_size); - - hv_vmbus_ring_buffer_init( - &new_channel->inbound, - in, - recv_ring_buffer_size); + /* TX bufring comes first */ + hv_vmbus_ring_buffer_init(&new_channel->outbound, + br, send_ring_buffer_size); + /* RX bufring immediately follows TX bufring */ + hv_vmbus_ring_buffer_init(&new_channel->inbound, + br + send_ring_buffer_size, recv_ring_buffer_size); /* Create sysctl tree for this channel */ vmbus_channel_sysctl_create(new_channel); - /** -
Re: svn commit: r302865 - head
> On Jul 14, 2016, at 21:43, Cy Schubert wrote: > > 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-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: 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 &channel->ch_id, 0, "channel id"); } SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(devch_id_sysctl), OID_AUTO, - "cpu", CTLFLAG_RD, &channel->target_cpu, 0, "owner CPU id"); + "cpu", CTLFLAG_RD, &channel->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(&new_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
svn commit: r302874 - in head/sys/dev/hyperv: include vmbus
Author: sephe Date: Fri Jul 15 06:08:48 2016 New Revision: 302874 URL: https://svnweb.freebsd.org/changeset/base/302874 Log: hyperv/vmbus: Field rename MFC after:1 week Sponsored by: Microsoft OSTC Differential Revision:https://reviews.freebsd.org/D7146 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:59:27 2016 (r302873) +++ head/sys/dev/hyperv/include/hyperv.hFri Jul 15 06:08:48 2016 (r302874) @@ -242,7 +242,7 @@ typedef struct { uint32_tring_data_size; /* ring_size */ } hv_vmbus_ring_buffer_info; -typedef void (*hv_vmbus_pfn_channel_callback)(void *context); +typedef void (*vmbus_chan_callback_t)(void *); typedef struct hv_vmbus_channel { device_tch_dev; @@ -266,10 +266,10 @@ typedef struct hv_vmbus_channel { */ hv_vmbus_ring_buffer_info inbound; - struct taskqueue * rxq; - struct task channel_task; - hv_vmbus_pfn_channel_callback on_channel_callback; - void* channel_callback_context; + struct taskqueue*ch_tq; + struct task ch_task; + vmbus_chan_callback_t ch_cb; + void*ch_cbarg; struct hyperv_mon_param *ch_monprm; struct hyperv_dma ch_monprm_dma; @@ -362,9 +362,8 @@ int hv_vmbus_channel_open( uint32_trecv_ring_buffer_size, void* user_data, uint32_tuser_data_len, - hv_vmbus_pfn_channel_callback - pfn_on_channel_callback, - void* context); + vmbus_chan_callback_t cb, + void*cbarg); void hv_vmbus_channel_close(hv_vmbus_channel *channel); Modified: head/sys/dev/hyperv/vmbus/hv_channel.c == --- head/sys/dev/hyperv/vmbus/hv_channel.c Fri Jul 15 05:59:27 2016 (r302873) +++ head/sys/dev/hyperv/vmbus/hv_channel.c Fri Jul 15 06:08:48 2016 (r302874) @@ -193,8 +193,8 @@ hv_vmbus_channel_open( uint32_trecv_ring_buffer_size, void* user_data, uint32_tuser_data_len, - hv_vmbus_pfn_channel_callback pfn_on_channel_callback, - void* context) + vmbus_chan_callback_t cb, + void*cbarg) { struct vmbus_softc *sc = new_channel->vmbus_sc; const struct vmbus_chanmsg_chopen_resp *resp; @@ -220,19 +220,19 @@ hv_vmbus_channel_open( 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; + new_channel->ch_cb = cb; + new_channel->ch_cbarg = cbarg; vmbus_chan_update_evtflagcnt(sc, new_channel); - new_channel->rxq = VMBUS_PCPU_GET(new_channel->vmbus_sc, event_tq, + new_channel->ch_tq = VMBUS_PCPU_GET(new_channel->vmbus_sc, event_tq, new_channel->ch_cpuid); if (new_channel->ch_flags & VMBUS_CHAN_FLAG_BATCHREAD) { - TASK_INIT(&new_channel->channel_task, 0, - vmbus_chan_task, new_channel); + TASK_INIT(&new_channel->ch_task, 0, vmbus_chan_task, + new_channel); } else { - TASK_INIT(&new_channel->channel_task, 0, - vmbus_chan_task_nobatch, new_channel); + TASK_INIT(&new_channel->ch_task, 0, vmbus_chan_task_nobatch, + new_channel); } /* @@ -521,7 +521,7 @@ hv_vmbus_channel_close_internal(hv_vmbus struct vmbus_softc *sc = channel->vmbus_sc; struct vmbus_msghc *mh; struct vmbus_chanmsg_chclose *req; - struct taskqueue *rxq = channel->rxq; + struct taskqueue *tq = channel->ch_tq; int error; /* TODO: stringent check */ @@ -530,11 +530,11 @@ hv_vmbus_channel_close_internal(hv_vmbus sysctl_ctx_free(&channel->ch_sysctl_ctx); /* -* set rxq to NULL to avoid more requests be scheduled +* Set ch_tq to NULL to avoid more requests be scheduled */ - channel->rxq = NULL; - taskqueue_drain(rxq, &channel->channel_ta
svn commit: r302875 - head/sys/dev/hyperv/vmbus
Author: sephe Date: Fri Jul 15 06:16:39 2016 New Revision: 302875 URL: https://svnweb.freebsd.org/changeset/base/302875 Log: hyperv/vmbus: Redefine channel packet. The channel packet header will be shared w/ PRP (physical region page) list channel packet and SG (scatter gather) list channel packet. MFC after:1 week Sponsored by: Microsoft OSTC Differential Revision:https://reviews.freebsd.org/D7155 Modified: head/sys/dev/hyperv/vmbus/hv_channel.c head/sys/dev/hyperv/vmbus/vmbus_reg.h Modified: head/sys/dev/hyperv/vmbus/hv_channel.c == --- head/sys/dev/hyperv/vmbus/hv_channel.c Fri Jul 15 06:08:48 2016 (r302874) +++ head/sys/dev/hyperv/vmbus/hv_channel.c Fri Jul 15 06:16:39 2016 (r302875) @@ -634,27 +634,28 @@ hv_vmbus_channel_send_packet( uint32_tflags) { int ret = 0; - hv_vm_packet_descriptor desc; + struct vmbus_chanpkt pkt; uint32_tpacket_len; uint64_taligned_data; uint32_tpacket_len_aligned; boolean_t need_sig; struct ioveciov[3]; - packet_len = sizeof(hv_vm_packet_descriptor) + buffer_len; - packet_len_aligned = HV_ALIGN_UP(packet_len, sizeof(uint64_t)); + packet_len = sizeof(pkt) + buffer_len; + packet_len_aligned = roundup2(packet_len, VMBUS_CHANPKT_SIZE_ALIGN); aligned_data = 0; - /* Setup the descriptor */ - desc.type = type; /* HV_VMBUS_PACKET_TYPE_DATA_IN_BAND; */ - desc.flags = flags; /* HV_VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED */ - /* in 8-bytes granularity */ - desc.data_offset8 = sizeof(hv_vm_packet_descriptor) >> 3; - desc.length8 = (uint16_t) (packet_len_aligned >> 3); - desc.transaction_id = request_id; + /* +* Setup channel packet. +*/ + pkt.cp_hdr.cph_type = type; + pkt.cp_hdr.cph_flags = flags; + pkt.cp_hdr.cph_data_ofs = sizeof(pkt) >> VMBUS_CHANPKT_SIZE_SHIFT; + pkt.cp_hdr.cph_len = packet_len_aligned >> VMBUS_CHANPKT_SIZE_SHIFT; + pkt.cp_hdr.cph_xactid = request_id; - iov[0].iov_base = &desc; - iov[0].iov_len = sizeof(hv_vm_packet_descriptor); + iov[0].iov_base = &pkt; + iov[0].iov_len = sizeof(pkt); iov[1].iov_base = buffer; iov[1].iov_len = buffer_len; Modified: head/sys/dev/hyperv/vmbus/vmbus_reg.h == --- head/sys/dev/hyperv/vmbus/vmbus_reg.h Fri Jul 15 06:08:48 2016 (r302874) +++ head/sys/dev/hyperv/vmbus/vmbus_reg.h Fri Jul 15 06:16:39 2016 (r302875) @@ -117,6 +117,25 @@ struct vmbus_gpa_range { } __packed; /* + * Channel packets + */ + +#define VMBUS_CHANPKT_SIZE_SHIFT 3 +#define VMBUS_CHANPKT_SIZE_ALIGN (1 << VMBUS_CHANPKT_SIZE_SHIFT) + +struct vmbus_chanpkt_hdr { + uint16_tcph_type; + uint16_tcph_data_ofs; /* in 8 bytes */ + uint16_tcph_len;/* in 8 bytes */ + uint16_tcph_flags; + uint64_tcph_xactid; +} __packed; + +struct vmbus_chanpkt { + struct vmbus_chanpkt_hdr cp_hdr; +} __packed; + +/* * Channel messages * - Embedded in vmbus_message.msg_data, e.g. response and notification. * - Embedded in hypercall_postmsg_in.hc_data, e.g. request. ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r302324 - head/lib/libc/locale
On 07/03/16 11:00 AM, Baptiste Daroussin wrote: > Author: bapt > Date: Sun Jul 3 15:00:12 2016 > New Revision: 302324 > URL: https://svnweb.freebsd.org/changeset/base/302324 > > Log: > Fix a bad test resulting in a segfault with ISO-8859-5 locales > > Reported by:Lauri Tirkkonen from Illumos > Approved by:re@ (gjb) > > Modified: > head/lib/libc/locale/collate.c > > Modified: head/lib/libc/locale/collate.c > == > --- head/lib/libc/locale/collate.cSun Jul 3 11:45:54 2016 > (r302323) > +++ head/lib/libc/locale/collate.cSun Jul 3 15:00:12 2016 > (r302324) > @@ -310,7 +310,7 @@ _collate_lookup(struct xlocale_collate * > if ((sptr = *state) != NULL) { > *pri = *sptr; > sptr++; > - if ((sptr == *state) || (sptr == NULL)) > + if ((sptr == *state) || (*sptr == 0)) > *state = NULL; > else > *state = sptr; I had a serious regression with ko_KR.UTF-8 locale after this commit. MATE is unusable because mate-panel is busy looping and eating 100% CPU. GNOME 3 does not start at all, i.e., nothing but mouse cursor on black screen. After reverting this commit, everything is back to normal. Please investigate. IMHO, this must be fixed before 11.0-BETA2 build. Thanks, Jung-uk Kim signature.asc Description: OpenPGP digital signature
Re: svn commit: r302324 - head/lib/libc/locale
On 15/07/2016 4:19 PM, Jung-uk Kim wrote: > On 07/03/16 11:00 AM, Baptiste Daroussin wrote: >> Author: bapt >> Date: Sun Jul 3 15:00:12 2016 >> New Revision: 302324 >> URL: https://svnweb.freebsd.org/changeset/base/302324 >> >> Log: >> Fix a bad test resulting in a segfault with ISO-8859-5 locales >> >> Reported by: Lauri Tirkkonen from Illumos >> Approved by: re@ (gjb) >> >> Modified: >> head/lib/libc/locale/collate.c >> >> Modified: head/lib/libc/locale/collate.c >> == >> --- head/lib/libc/locale/collate.c Sun Jul 3 11:45:54 2016 >> (r302323) >> +++ head/lib/libc/locale/collate.c Sun Jul 3 15:00:12 2016 >> (r302324) >> @@ -310,7 +310,7 @@ _collate_lookup(struct xlocale_collate * >> if ((sptr = *state) != NULL) { >> *pri = *sptr; >> sptr++; >> -if ((sptr == *state) || (sptr == NULL)) >> +if ((sptr == *state) || (*sptr == 0)) >> *state = NULL; >> else >> *state = sptr; > > I had a serious regression with ko_KR.UTF-8 locale after this commit. > MATE is unusable because mate-panel is busy looping and eating 100% CPU. > GNOME 3 does not start at all, i.e., nothing but mouse cursor on black > screen. After reverting this commit, everything is back to normal. > Please investigate. IMHO, this must be fixed before 11.0-BETA2 build. > > Thanks, > > Jung-uk Kim > Please report a bug so it can be tracked and not forgotten: Add re@ and original committer to cc Set mfc-stable11 to ? Add keyword: regression ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r302876 - in head/sys/dev/hyperv: include netvsc vmbus
Author: sephe Date: Fri Jul 15 06:29:19 2016 New Revision: 302876 URL: https://svnweb.freebsd.org/changeset/base/302876 Log: hyperv/vmbus: Rework sglist sending. MFC after:1 week Sponsored by: Microsoft OSTC Differential Revision:https://reviews.freebsd.org/D7156 Added: head/sys/dev/hyperv/include/vmbus.h (contents, props changed) Modified: head/sys/dev/hyperv/include/hyperv.h head/sys/dev/hyperv/netvsc/hv_net_vsc.c head/sys/dev/hyperv/netvsc/hv_net_vsc.h head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c head/sys/dev/hyperv/netvsc/hv_rndis_filter.c head/sys/dev/hyperv/netvsc/hv_rndis_filter.h head/sys/dev/hyperv/vmbus/hv_channel.c head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h head/sys/dev/hyperv/vmbus/vmbus_reg.h Modified: head/sys/dev/hyperv/include/hyperv.h == --- head/sys/dev/hyperv/include/hyperv.hFri Jul 15 06:16:39 2016 (r302875) +++ head/sys/dev/hyperv/include/hyperv.hFri Jul 15 06:29:19 2016 (r302876) @@ -82,7 +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) -#define HV_MAX_PAGE_BUFFER_COUNT 32 #define HV_MAX_MULTIPAGE_BUFFER_COUNT 32 #define HV_ALIGN_UP(value, align) \ @@ -227,12 +226,6 @@ typedef struct { typedef struct { int length; int offset; - uint64_tpfn; -} __packed hv_vmbus_page_buffer; - -typedef struct { - int length; - int offset; uint64_tpfn_array[HV_MAX_MULTIPAGE_BUFFER_COUNT]; } __packed hv_vmbus_multipage_buffer; @@ -375,14 +368,6 @@ inthv_vmbus_channel_send_packet( hv_vmbus_packet_typetype, uint32_tflags); -inthv_vmbus_channel_send_packet_pagebuffer( - hv_vmbus_channel* channel, - hv_vmbus_page_bufferpage_buffers[], - uint32_tpage_count, - void* buffer, - uint32_tbuffer_len, - uint64_trequest_id); - inthv_vmbus_channel_send_packet_multipagebuffer( hv_vmbus_channel* channel, hv_vmbus_multipage_buffer* multi_page_buffer, Added: head/sys/dev/hyperv/include/vmbus.h == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/hyperv/include/vmbus.h Fri Jul 15 06:29:19 2016 (r302876) @@ -0,0 +1,49 @@ +/*- + * Copyright (c) 2016 Microsoft Corp. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice unmodified, this list of conditions, and the following + *disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _VMBUS_H_ +#define _VMBUS_H_ + +#include + +/* This is actually vmbus_gpa_range.gpa_page[1] */ +struct vmbus_gpa { + uint32_tgpa_len; + uint32_tgpa_ofs; + uint64_tgpa_page; +} __packed; + +#define VMBUS_CHAN_SGLIST_MAX 32 + +struct hv_vmbus_channel; + +intvmbus_chan_send_sglist(struct hv_vmbus_channel *chan, + struct vmbus_gpa sg[], int sglen, void *data, int dlen, + uint64_t xactid); + +#endif /* !_VMBUS_H_ */ Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.c == --- head/sys/dev/hyperv
svn commit: r302877 - in head/sys/dev/ath: . ath_hal ath_hal/ar5212 ath_rate/sample
Author: adrian Date: Fri Jul 15 06:39:35 2016 New Revision: 302877 URL: https://svnweb.freebsd.org/changeset/base/302877 Log: [ath] [ath_hal] break out the duration calculation to optionally include SIFS. The pre-11n calculations include SIFS, but the 11n ones don't. The reason is that (mostly) the 11n hardware is doing the SIFS calculation for us but the pre-11n hardware isn't. This means that we're over-shooting the times in the duration field for non-11n frames on 11n hardware, which is OK, if not a little inefficient. Now, this is all fine for what the hardware needs for doing duration math for ACK, RTS/CTS, frame length, etc, but it isn't useful for doing PHY duration calculations. Ie, given a frame to TX and its timestamp, what would the end of the actual transmission time be; and similar for an RX timestamp and figuring out its original length. So, this adds a new field to the duration routines which requests SIFS or no SIFS to be included. All the callers currently will call it requesting SIFS, so this /should/ be a glorious no-op. I'm however planning some future work around airtime fairness and positioning which requires these routines to have SIFS be optional. Notably though, the 11n version doesn't do any SIFS addition at the moment. I'll go and tweak and verify all of the packet durations before I go and flip that part on. Tested: * AR9330, STA mode * AR9330, AP mode * AR9380, STA mode Modified: head/sys/dev/ath/ath_hal/ah.c head/sys/dev/ath/ath_hal/ah.h head/sys/dev/ath/ath_hal/ar5212/ar5212_reset.c head/sys/dev/ath/ath_rate/sample/sample.h head/sys/dev/ath/if_ath_beacon.c head/sys/dev/ath/if_ath_tdma.c head/sys/dev/ath/if_ath_tx.c head/sys/dev/ath/if_ath_tx_ht.c Modified: head/sys/dev/ath/ath_hal/ah.c == --- head/sys/dev/ath/ath_hal/ah.c Fri Jul 15 06:29:19 2016 (r302876) +++ head/sys/dev/ath/ath_hal/ah.c Fri Jul 15 06:39:35 2016 (r302877) @@ -284,7 +284,8 @@ ath_hal_reverseBits(uint32_t val, uint32 */ uint32_t ath_hal_pkt_txtime(struct ath_hal *ah, const HAL_RATE_TABLE *rates, uint32_t frameLen, -uint16_t rateix, HAL_BOOL isht40, HAL_BOOL shortPreamble) +uint16_t rateix, HAL_BOOL isht40, HAL_BOOL shortPreamble, +HAL_BOOL includeSifs) { uint8_t rc; int numStreams; @@ -293,7 +294,8 @@ ath_hal_pkt_txtime(struct ath_hal *ah, c /* Legacy rate? Return the old way */ if (! IS_HT_RATE(rc)) - return ath_hal_computetxtime(ah, rates, frameLen, rateix, shortPreamble); + return ath_hal_computetxtime(ah, rates, frameLen, rateix, + shortPreamble, includeSifs); /* 11n frame - extract out the number of spatial streams */ numStreams = HT_RC_2_STREAMS(rc); @@ -301,7 +303,9 @@ ath_hal_pkt_txtime(struct ath_hal *ah, c ("number of spatial streams needs to be 1..3: MCS rate 0x%x!", rateix)); - return ath_computedur_ht(frameLen, rc, numStreams, isht40, shortPreamble); + /* XXX TODO: Add SIFS */ + return ath_computedur_ht(frameLen, rc, numStreams, isht40, + shortPreamble); } static const uint16_t ht20_bps[32] = { @@ -350,7 +354,7 @@ ath_computedur_ht(uint32_t frameLen, uin uint16_t ath_hal_computetxtime(struct ath_hal *ah, const HAL_RATE_TABLE *rates, uint32_t frameLen, uint16_t rateix, - HAL_BOOL shortPreamble) + HAL_BOOL shortPreamble, HAL_BOOL includeSifs) { uint32_t bitsPerSymbol, numBits, numSymbols, phyTime, txTime; uint32_t kbps; @@ -373,8 +377,10 @@ ath_hal_computetxtime(struct ath_hal *ah if (shortPreamble && rates->info[rateix].shortPreamble) phyTime >>= 1; numBits = frameLen << 3; - txTime = CCK_SIFS_TIME + phyTime + txTime = phyTime + ((numBits * 1000)/kbps); + if (includeSifs) + txTime += CCK_SIFS_TIME; break; case IEEE80211_T_OFDM: bitsPerSymbol = (kbps * OFDM_SYMBOL_TIME) / 1000; @@ -382,9 +388,10 @@ ath_hal_computetxtime(struct ath_hal *ah numBits = OFDM_PLCP_BITS + (frameLen << 3); numSymbols = howmany(numBits, bitsPerSymbol); - txTime = OFDM_SIFS_TIME - + OFDM_PREAMBLE_TIME + txTime = OFDM_PREAMBLE_TIME + (numSymbols * OFDM_SYMBOL_TIME); + if (includeSifs) + txTime += OFDM_SIFS_TIME; break; case IEEE80211_T_OFDM_HALF: bitsPerSymbol = (kbps * OFDM_HALF_SYMBOL_TIME) / 1000; @@ -392,9 +399,10 @@ ath_hal_computetxtime(struct ath_hal *ah
svn commit: r302878 - in head/sys/dev/hyperv: include storvsc vmbus
Author: sephe Date: Fri Jul 15 06:40:59 2016 New Revision: 302878 URL: https://svnweb.freebsd.org/changeset/base/302878 Log: hyeprv/vmbus: Rework prplist sending. MFC after:1 week Sponsored by: Microsoft OSTC Differential Revision:https://reviews.freebsd.org/D7175 Modified: head/sys/dev/hyperv/include/hyperv.h head/sys/dev/hyperv/include/vmbus.h head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c head/sys/dev/hyperv/vmbus/hv_channel.c head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h head/sys/dev/hyperv/vmbus/vmbus_reg.h Modified: head/sys/dev/hyperv/include/hyperv.h == --- head/sys/dev/hyperv/include/hyperv.hFri Jul 15 06:39:35 2016 (r302877) +++ head/sys/dev/hyperv/include/hyperv.hFri Jul 15 06:40:59 2016 (r302878) @@ -82,18 +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) -#define HV_MAX_MULTIPAGE_BUFFER_COUNT 32 - -#define HV_ALIGN_UP(value, align) \ - (((value) & (align-1)) ?\ - (((value) + (align-1)) & ~(align-1) ) : (value)) - -#define HV_ALIGN_DOWN(value, align) ( (value) & ~(align-1) ) - -#define HV_NUM_PAGES_SPANNED(addr, len) \ - ((HV_ALIGN_UP(addr+len, PAGE_SIZE) -\ - HV_ALIGN_DOWN(addr, PAGE_SIZE)) >> PAGE_SHIFT ) - struct hyperv_guid { uint8_t hv_guid[16]; } __packed; @@ -224,12 +212,6 @@ typedef struct { } __packed hv_vmbus_ring_buffer; typedef struct { - int length; - int offset; - uint64_tpfn_array[HV_MAX_MULTIPAGE_BUFFER_COUNT]; -} __packed hv_vmbus_multipage_buffer; - -typedef struct { hv_vmbus_ring_buffer* ring_buffer; struct mtx ring_lock; uint32_tring_data_size; /* ring_size */ @@ -368,13 +350,6 @@ inthv_vmbus_channel_send_packet( hv_vmbus_packet_typetype, uint32_tflags); -inthv_vmbus_channel_send_packet_multipagebuffer( - hv_vmbus_channel* channel, - hv_vmbus_multipage_buffer* multi_page_buffer, - void* buffer, - uint32_tbuffer_len, - uint64_trequest_id); - inthv_vmbus_channel_establish_gpadl( hv_vmbus_channel* channel, /* must be phys and virt contiguous */ Modified: head/sys/dev/hyperv/include/vmbus.h == --- head/sys/dev/hyperv/include/vmbus.h Fri Jul 15 06:39:35 2016 (r302877) +++ head/sys/dev/hyperv/include/vmbus.h Fri Jul 15 06:40:59 2016 (r302878) @@ -31,6 +31,15 @@ #include +/* + * GPA stuffs. + */ +struct vmbus_gpa_range { + uint32_tgpa_len; + uint32_tgpa_ofs; + uint64_tgpa_page[0]; +} __packed; + /* This is actually vmbus_gpa_range.gpa_page[1] */ struct vmbus_gpa { uint32_tgpa_len; @@ -39,11 +48,15 @@ struct vmbus_gpa { } __packed; #define VMBUS_CHAN_SGLIST_MAX 32 +#define VMBUS_CHAN_PRPLIST_MAX 32 struct hv_vmbus_channel; intvmbus_chan_send_sglist(struct hv_vmbus_channel *chan, struct vmbus_gpa sg[], int sglen, void *data, int dlen, uint64_t xactid); +intvmbus_chan_send_prplist(struct hv_vmbus_channel *chan, + struct vmbus_gpa_range *prp, int prp_cnt, void *data, int dlen, + uint64_t xactid); #endif /* !_VMBUS_H_ */ Modified: head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c == --- head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.cFri Jul 15 06:39:35 2016(r302877) +++ head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.cFri Jul 15 06:40:59 2016(r302878) @@ -72,6 +72,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include "hv_vstorage.h" #include "vmbus_if.h" @@ -100,7 +101,7 @@ struct hv_sgl_page_pool{ boolean_tis_init; } g_hv_sgl_page_pool; -#define STORVSC_MAX_SG_PAGE_CNT STORVSC_MAX_IO_REQUESTS * HV_MAX_MULTIPAGE_BUFFER_COUNT +#define STORVSC_MAX_SG_PAGE_CNT STORVSC_MAX_IO_REQUESTS * VMBUS_CHAN_PRPLIST_MAX enum storvsc_request_type { WRITE_TYPE, @@ -108,10 +109,16 @@ enum storvsc_request_type { UNKNOWN_TYPE }; +struct hvs_gpa_range { + struct vmbus_gpa_range gpa_ran
svn commit: r302879 - in head/sys/dev/hyperv: include netvsc storvsc vmbus
Author: sephe Date: Fri Jul 15 06:49:45 2016 New Revision: 302879 URL: https://svnweb.freebsd.org/changeset/base/302879 Log: hyperv/vmbus: Move channel packet flags definition to vmbus.h MFC after:1 week Sponsored by: Microsoft OSTC Differential Revision:https://reviews.freebsd.org/D7176 Modified: head/sys/dev/hyperv/include/hyperv.h head/sys/dev/hyperv/include/vmbus.h head/sys/dev/hyperv/netvsc/hv_net_vsc.c head/sys/dev/hyperv/netvsc/hv_rndis_filter.c head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c 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 06:40:59 2016 (r302878) +++ head/sys/dev/hyperv/include/hyperv.hFri Jul 15 06:49:45 2016 (r302879) @@ -129,8 +129,6 @@ typedef enum { HV_VMBUS_PACKET_TYPE_ADDITIONAL_DATA = 0xd } hv_vmbus_packet_type; -#define HV_VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED1 - #define HW_MACADDR_LEN 6 /* Modified: head/sys/dev/hyperv/include/vmbus.h == --- head/sys/dev/hyperv/include/vmbus.h Fri Jul 15 06:40:59 2016 (r302878) +++ head/sys/dev/hyperv/include/vmbus.h Fri Jul 15 06:49:45 2016 (r302879) @@ -47,6 +47,8 @@ struct vmbus_gpa { uint64_tgpa_page; } __packed; +#define VMBUS_CHANPKT_FLAG_RC 0x0001 /* report completion */ + #define VMBUS_CHAN_SGLIST_MAX 32 #define VMBUS_CHAN_PRPLIST_MAX 32 Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.c == --- head/sys/dev/hyperv/netvsc/hv_net_vsc.c Fri Jul 15 06:40:59 2016 (r302878) +++ head/sys/dev/hyperv/netvsc/hv_net_vsc.c Fri Jul 15 06:49:45 2016 (r302879) @@ -185,8 +185,7 @@ hv_nv_init_rx_buffer_with_net_vsp(struct ret = hv_vmbus_channel_send_packet(sc->hn_prichan, init_pkt, sizeof(nvsp_msg), (uint64_t)(uintptr_t)init_pkt, - HV_VMBUS_PACKET_TYPE_DATA_IN_BAND, - HV_VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED); + HV_VMBUS_PACKET_TYPE_DATA_IN_BAND, VMBUS_CHANPKT_FLAG_RC); if (ret != 0) { goto cleanup; } @@ -279,8 +278,7 @@ hv_nv_init_send_buffer_with_net_vsp(stru ret = hv_vmbus_channel_send_packet(sc->hn_prichan, init_pkt, sizeof(nvsp_msg), (uint64_t)init_pkt, - HV_VMBUS_PACKET_TYPE_DATA_IN_BAND, - HV_VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED); + HV_VMBUS_PACKET_TYPE_DATA_IN_BAND, VMBUS_CHANPKT_FLAG_RC); if (ret != 0) { goto cleanup; } @@ -474,8 +472,7 @@ hv_nv_negotiate_nvsp_protocol(struct hn_ /* Send the init request */ ret = hv_vmbus_channel_send_packet(sc->hn_prichan, init_pkt, sizeof(nvsp_msg), (uint64_t)(uintptr_t)init_pkt, - HV_VMBUS_PACKET_TYPE_DATA_IN_BAND, - HV_VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED); + HV_VMBUS_PACKET_TYPE_DATA_IN_BAND, VMBUS_CHANPKT_FLAG_RC); if (ret != 0) return (-1); @@ -604,8 +601,7 @@ hv_nv_connect_to_vsp(struct hn_softc *sc /* * TODO: BUGBUG - We have to wait for the above msg since the netvsp * uses KMCL which acknowledges packet (completion packet) -* since our Vmbus always set the -* HV_VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED flag +* since our Vmbus always set the VMBUS_CHANPKT_FLAG_RC flag */ /* sema_wait(&NetVscChannel->channel_init_sema); */ @@ -822,8 +818,7 @@ hv_nv_on_send(struct hv_vmbus_channel *c } else { ret = hv_vmbus_channel_send_packet(chan, &send_msg, sizeof(nvsp_msg), (uint64_t)(uintptr_t)pkt, - HV_VMBUS_PACKET_TYPE_DATA_IN_BAND, - HV_VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED); + HV_VMBUS_PACKET_TYPE_DATA_IN_BAND, VMBUS_CHANPKT_FLAG_RC); } return (ret); Modified: head/sys/dev/hyperv/netvsc/hv_rndis_filter.c == --- head/sys/dev/hyperv/netvsc/hv_rndis_filter.cFri Jul 15 06:40:59 2016(r302878) +++ head/sys/dev/hyperv/netvsc/hv_rndis_filter.cFri Jul 15 06:49:45 2016(r302879) @@ -1168,8 +1168,7 @@ hv_rf_on_device_add(struct hn_softc *sc, ret = hv_vmbus_channel_send_packet(sc->hn_prichan, init_pkt, sizeof(nvsp_msg), (uint64_t)(uintptr_t)init_pkt, - HV_VMBUS_PACKET_TYPE_DATA_IN_BAND, - HV_VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED); + HV_VMBUS_PACKET_TYPE_DATA_IN_BAND, VMBUS_CHANPKT_FLAG_RC); if (ret != 0) { device_printf(dev, "Fail to allocate subchannel\n"); goto out; Modified
Re: svn commit: r302324 - head/lib/libc/locale
On 07/15/16 02:22 AM, Kubilay Kocak wrote: > On 15/07/2016 4:19 PM, Jung-uk Kim wrote: >> On 07/03/16 11:00 AM, Baptiste Daroussin wrote: >>> Author: bapt >>> Date: Sun Jul 3 15:00:12 2016 >>> New Revision: 302324 >>> URL: https://svnweb.freebsd.org/changeset/base/302324 >>> >>> Log: >>> Fix a bad test resulting in a segfault with ISO-8859-5 locales >>> >>> Reported by: Lauri Tirkkonen from Illumos >>> Approved by: re@ (gjb) >>> >>> Modified: >>> head/lib/libc/locale/collate.c >>> >>> Modified: head/lib/libc/locale/collate.c >>> == >>> --- head/lib/libc/locale/collate.c Sun Jul 3 11:45:54 2016 >>> (r302323) >>> +++ head/lib/libc/locale/collate.c Sun Jul 3 15:00:12 2016 >>> (r302324) >>> @@ -310,7 +310,7 @@ _collate_lookup(struct xlocale_collate * >>> if ((sptr = *state) != NULL) { >>> *pri = *sptr; >>> sptr++; >>> - if ((sptr == *state) || (sptr == NULL)) >>> + if ((sptr == *state) || (*sptr == 0)) >>> *state = NULL; >>> else >>> *state = sptr; >> >> I had a serious regression with ko_KR.UTF-8 locale after this commit. >> MATE is unusable because mate-panel is busy looping and eating 100% CPU. >> GNOME 3 does not start at all, i.e., nothing but mouse cursor on black >> screen. After reverting this commit, everything is back to normal. >> Please investigate. IMHO, this must be fixed before 11.0-BETA2 build. >> >> Thanks, >> >> Jung-uk Kim >> > > Please report a bug so it can be tracked and not forgotten: > > Add re@ and original committer to cc > Set mfc-stable11 to ? > Add keyword: regression Done: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=211135 Jung-uk Kim signature.asc Description: OpenPGP digital signature
svn commit: r302880 - in head/sys/dev/hyperv: include netvsc storvsc utilities vmbus
Author: sephe Date: Fri Jul 15 06:58:21 2016 New Revision: 302880 URL: https://svnweb.freebsd.org/changeset/base/302880 Log: hyperv/vmbus: Move channel packet types definition to vmbus.h MFC after:1 week Sponsored by: Microsoft OSTC Differential Revision:https://reviews.freebsd.org/D7177 Modified: head/sys/dev/hyperv/include/hyperv.h head/sys/dev/hyperv/include/vmbus.h head/sys/dev/hyperv/netvsc/hv_net_vsc.c head/sys/dev/hyperv/netvsc/hv_rndis_filter.c head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c head/sys/dev/hyperv/utilities/hv_heartbeat.c head/sys/dev/hyperv/utilities/hv_kvp.c head/sys/dev/hyperv/utilities/hv_shutdown.c head/sys/dev/hyperv/utilities/hv_timesync.c head/sys/dev/hyperv/vmbus/hv_channel.c Modified: head/sys/dev/hyperv/include/hyperv.h == --- head/sys/dev/hyperv/include/hyperv.hFri Jul 15 06:49:45 2016 (r302879) +++ head/sys/dev/hyperv/include/hyperv.hFri Jul 15 06:58:21 2016 (r302880) @@ -112,23 +112,6 @@ typedef struct { hv_vm_transfer_page ranges[1]; } __packed hv_vm_transfer_page_packet_header; -typedef enum { - HV_VMBUS_PACKET_TYPE_INVALID= 0x0, - HV_VMBUS_PACKET_TYPES_SYNCH = 0x1, - HV_VMBUS_PACKET_TYPE_ADD_TRANSFER_PAGE_SET = 0x2, - HV_VMBUS_PACKET_TYPE_REMOVE_TRANSFER_PAGE_SET = 0x3, - HV_VMBUS_PACKET_TYPE_ESTABLISH_GPADL= 0x4, - HV_VMBUS_PACKET_TYPE_TEAR_DOWN_GPADL= 0x5, - HV_VMBUS_PACKET_TYPE_DATA_IN_BAND = 0x6, - HV_VMBUS_PACKET_TYPE_DATA_USING_TRANSFER_PAGES = 0x7, - HV_VMBUS_PACKET_TYPE_DATA_USING_GPADL = 0x8, - HV_VMBUS_PACKET_TYPE_DATA_USING_GPA_DIRECT = 0x9, - HV_VMBUS_PACKET_TYPE_CANCEL_REQUEST = 0xa, - HV_VMBUS_PACKET_TYPE_COMPLETION = 0xb, - HV_VMBUS_PACKET_TYPE_DATA_USING_ADDITIONAL_PACKETS = 0xc, - HV_VMBUS_PACKET_TYPE_ADDITIONAL_DATA = 0xd -} hv_vmbus_packet_type; - #define HW_MACADDR_LEN 6 /* @@ -345,8 +328,8 @@ int hv_vmbus_channel_send_packet( void* buffer, uint32_tbuffer_len, uint64_trequest_id, - hv_vmbus_packet_typetype, - uint32_tflags); + uint16_ttype, + uint16_tflags); inthv_vmbus_channel_establish_gpadl( hv_vmbus_channel* channel, Modified: head/sys/dev/hyperv/include/vmbus.h == --- head/sys/dev/hyperv/include/vmbus.h Fri Jul 15 06:49:45 2016 (r302879) +++ head/sys/dev/hyperv/include/vmbus.h Fri Jul 15 06:58:21 2016 (r302880) @@ -47,10 +47,15 @@ struct vmbus_gpa { uint64_tgpa_page; } __packed; -#define VMBUS_CHANPKT_FLAG_RC 0x0001 /* report completion */ +#define VMBUS_CHANPKT_TYPE_INBAND 0x0006 +#define VMBUS_CHANPKT_TYPE_RXBUF 0x0007 +#define VMBUS_CHANPKT_TYPE_GPA 0x0009 +#define VMBUS_CHANPKT_TYPE_COMP0x000b -#define VMBUS_CHAN_SGLIST_MAX 32 -#define VMBUS_CHAN_PRPLIST_MAX 32 +#define VMBUS_CHANPKT_FLAG_RC 0x0001 /* report completion */ + +#define VMBUS_CHAN_SGLIST_MAX 32 +#define VMBUS_CHAN_PRPLIST_MAX 32 struct hv_vmbus_channel; Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.c == --- head/sys/dev/hyperv/netvsc/hv_net_vsc.c Fri Jul 15 06:49:45 2016 (r302879) +++ head/sys/dev/hyperv/netvsc/hv_net_vsc.c Fri Jul 15 06:58:21 2016 (r302880) @@ -185,7 +185,7 @@ hv_nv_init_rx_buffer_with_net_vsp(struct ret = hv_vmbus_channel_send_packet(sc->hn_prichan, init_pkt, sizeof(nvsp_msg), (uint64_t)(uintptr_t)init_pkt, - HV_VMBUS_PACKET_TYPE_DATA_IN_BAND, VMBUS_CHANPKT_FLAG_RC); + VMBUS_CHANPKT_TYPE_INBAND, VMBUS_CHANPKT_FLAG_RC); if (ret != 0) { goto cleanup; } @@ -278,7 +278,7 @@ hv_nv_init_send_buffer_with_net_vsp(stru ret = hv_vmbus_channel_send_packet(sc->hn_prichan, init_pkt, sizeof(nvsp_msg), (uint64_t)init_pkt, - HV_VMBUS_PACKET_TYPE_DATA_IN_BAND, VMBUS_CHANPKT_FLAG_RC); + VMBUS_CHANPKT_TYPE_INBAND, VMBUS_CHANPKT_FLAG_RC); if (ret != 0) { goto cleanup; } @@ -338,7 +338,7 @@ hv_nv_destroy_rx_buffer(netvsc_dev *net_ ret = hv_vmbus_channel_send_packet(net_dev->sc->hn_p