svn commit: r302992 - vendor-sys/illumos/dist/uts/common/fs/zfs
Author: avg Date: Mon Jul 18 06:58:39 2016 New Revision: 302992 URL: https://svnweb.freebsd.org/changeset/base/302992 Log: 7071 lzc_snapshot does not fill in errlist on ENOENT illumos/illumos-gate@25f7d993adbfb3452ac4625b3791670746d35ae3 https://github.com/illumos/illumos-gate/commit/25f7d993adbfb3452ac4625b3791670746d35ae3 https://www.illumos.org/issues/7071 upstream DLPX-40482 lzc_snapshot does not fill in errlist on ENOENT Reviewed by: Igor Kozhukhov Reviewed by: George Wilson Reviewed by: Dan Kimmel Approved by: Robert Mustacchi Author: Matthew Ahrens Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_ioctl.c Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_ioctl.c == --- vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_ioctl.c Mon Jul 18 06:57:24 2016(r302991) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_ioctl.c Mon Jul 18 06:58:39 2016(r302992) @@ -491,6 +491,14 @@ zfs_secpolicy_write_perms(const char *na dsl_dataset_t *ds; dsl_pool_t *dp; + /* +* First do a quick check for root in the global zone, which +* is allowed to do all write_perms. This ensures that zfs_ioc_* +* will get to handle nonexistent datasets. +*/ + if (INGLOBALZONE(curproc) && secpolicy_zfs(cr) == 0) + return (0); + error = dsl_pool_hold(name, FTAG, &dp); if (error != 0) return (error); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r302991 - vendor-sys/illumos/dist/uts/common/fs/zfs vendor-sys/illumos/dist/uts/common/fs/zfs/sys vendor/illumos/dist/cmd/zdb vendor/illumos/dist/cmd/ztest
Author: avg Date: Mon Jul 18 06:57:24 2016 New Revision: 302991 URL: https://svnweb.freebsd.org/changeset/base/302991 Log: 6950 ARC should cache compressed data illumos/illumos-gate@dcbf3bd6a1f1360fc1afcee9e22c6dcff7844bf2 https://github.com/illumos/illumos-gate/commit/dcbf3bd6a1f1360fc1afcee9e22c6dcff7844bf2 https://www.illumos.org/issues/6950 When reading compressed data from disk, the ARC should keep the compressed block cached and only decompress it when consumers access the block. The uncompressed data should be short-lived allowing the ARC to cache a much larger amount of data. The DMU would also maintain a smaller cache of uncompressed blocks to minimize the impact of decompressing frequently accessed blocks. Reviewed by: Prakash Surya Reviewed by: Dan Kimmel Reviewed by: Matt Ahrens Reviewed by: Paul Dagnelie Reviewed by: Don Brady Reviewed by: Richard Elling Approved by: Richard Lowe Author: George Wilson Modified: vendor/illumos/dist/cmd/zdb/zdb.c vendor/illumos/dist/cmd/ztest/ztest.c Changes in other areas also in this revision: Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/arc.c vendor-sys/illumos/dist/uts/common/fs/zfs/dbuf.c vendor-sys/illumos/dist/uts/common/fs/zfs/dmu.c vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_diff.c vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_objset.c vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_send.c vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_traverse.c vendor-sys/illumos/dist/uts/common/fs/zfs/dnode.c vendor-sys/illumos/dist/uts/common/fs/zfs/dnode_sync.c vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_scan.c vendor-sys/illumos/dist/uts/common/fs/zfs/refcount.c vendor-sys/illumos/dist/uts/common/fs/zfs/sys/arc.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dbuf.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/refcount.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/spa.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zio.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zio_checksum.h vendor-sys/illumos/dist/uts/common/fs/zfs/zil.c vendor-sys/illumos/dist/uts/common/fs/zfs/zio.c vendor-sys/illumos/dist/uts/common/fs/zfs/zio_checksum.c Modified: vendor/illumos/dist/cmd/zdb/zdb.c == --- vendor/illumos/dist/cmd/zdb/zdb.c Mon Jul 18 06:47:08 2016 (r302990) +++ vendor/illumos/dist/cmd/zdb/zdb.c Mon Jul 18 06:57:24 2016 (r302991) @@ -1262,7 +1262,7 @@ visit_indirect(spa_t *spa, const dnode_p } if (!err) ASSERT3U(fill, ==, BP_GET_FILL(bp)); - (void) arc_buf_remove_ref(buf, &buf); + arc_buf_destroy(buf, &buf); } return (err); Modified: vendor/illumos/dist/cmd/ztest/ztest.c == --- vendor/illumos/dist/cmd/ztest/ztest.c Mon Jul 18 06:47:08 2016 (r302990) +++ vendor/illumos/dist/cmd/ztest/ztest.c Mon Jul 18 06:57:24 2016 (r302991) @@ -187,6 +187,7 @@ extern uint64_t metaslab_gang_bang; extern uint64_t metaslab_df_alloc_threshold; extern uint64_t zfs_deadman_synctime_ms; extern int metaslab_preload_limit; +extern boolean_t zfs_compressed_arc_enabled; static ztest_shared_opts_t *ztest_shared_opts; static ztest_shared_opts_t ztest_opts; @@ -5353,6 +5354,12 @@ ztest_resume_thread(void *arg) if (spa_suspended(spa)) ztest_resume(spa); (void) poll(NULL, 0, 100); + + /* +* Periodically change the zfs_compressed_arc_enabled setting. +*/ + if (ztest_random(10) == 0) + zfs_compressed_arc_enabled = ztest_random(2); } return (NULL); } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r302991 - vendor-sys/illumos/dist/uts/common/fs/zfs vendor-sys/illumos/dist/uts/common/fs/zfs/sys vendor/illumos/dist/cmd/zdb vendor/illumos/dist/cmd/ztest
Author: avg Date: Mon Jul 18 06:57:24 2016 New Revision: 302991 URL: https://svnweb.freebsd.org/changeset/base/302991 Log: 6950 ARC should cache compressed data illumos/illumos-gate@dcbf3bd6a1f1360fc1afcee9e22c6dcff7844bf2 https://github.com/illumos/illumos-gate/commit/dcbf3bd6a1f1360fc1afcee9e22c6dcff7844bf2 https://www.illumos.org/issues/6950 When reading compressed data from disk, the ARC should keep the compressed block cached and only decompress it when consumers access the block. The uncompressed data should be short-lived allowing the ARC to cache a much larger amount of data. The DMU would also maintain a smaller cache of uncompressed blocks to minimize the impact of decompressing frequently accessed blocks. Reviewed by: Prakash Surya Reviewed by: Dan Kimmel Reviewed by: Matt Ahrens Reviewed by: Paul Dagnelie Reviewed by: Don Brady Reviewed by: Richard Elling Approved by: Richard Lowe Author: George Wilson Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/arc.c vendor-sys/illumos/dist/uts/common/fs/zfs/dbuf.c vendor-sys/illumos/dist/uts/common/fs/zfs/dmu.c vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_diff.c vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_objset.c vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_send.c vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_traverse.c vendor-sys/illumos/dist/uts/common/fs/zfs/dnode.c vendor-sys/illumos/dist/uts/common/fs/zfs/dnode_sync.c vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_scan.c vendor-sys/illumos/dist/uts/common/fs/zfs/refcount.c vendor-sys/illumos/dist/uts/common/fs/zfs/sys/arc.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dbuf.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/refcount.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/spa.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zio.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zio_checksum.h vendor-sys/illumos/dist/uts/common/fs/zfs/zil.c vendor-sys/illumos/dist/uts/common/fs/zfs/zio.c vendor-sys/illumos/dist/uts/common/fs/zfs/zio_checksum.c Changes in other areas also in this revision: Modified: vendor/illumos/dist/cmd/zdb/zdb.c vendor/illumos/dist/cmd/ztest/ztest.c Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/arc.c == --- vendor-sys/illumos/dist/uts/common/fs/zfs/arc.c Mon Jul 18 06:47:08 2016(r302990) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/arc.c Mon Jul 18 06:57:24 2016(r302991) @@ -120,9 +120,134 @@ * - ARC header release, as it removes from L2ARC buflists */ +/* + * ARC operation: + * + * Every block that is in the ARC is tracked by an arc_buf_hdr_t structure. + * This structure can point either to a block that is still in the cache or to + * one that is only accessible in an L2 ARC device, or it can provide + * information about a block that was recently evicted. If a block is + * only accessible in the L2ARC, then the arc_buf_hdr_t only has enough + * information to retrieve it from the L2ARC device. This information is + * stored in the l2arc_buf_hdr_t sub-structure of the arc_buf_hdr_t. A block + * that is in this state cannot access the data directly. + * + * Blocks that are actively being referenced or have not been evicted + * are cached in the L1ARC. The L1ARC (l1arc_buf_hdr_t) is a structure within + * the arc_buf_hdr_t that will point to the data block in memory. A block can + * only be read by a consumer if it has an l1arc_buf_hdr_t. The L1ARC + * caches data in two ways -- in a list of arc buffers (arc_buf_t) and + * also in the arc_buf_hdr_t's private physical data block pointer (b_pdata). + * Each arc buffer (arc_buf_t) is being actively accessed by a specific ARC + * consumer, and always contains uncompressed data. The ARC will provide + * references to this data and will keep it cached until it is no longer in + * use. Typically, the arc will try to cache only the L1ARC's physical data + * block and will aggressively evict any arc_buf_t that is no longer referenced. + * The amount of memory consumed by the arc_buf_t's can be seen via the + * "overhead_size" kstat. + * + * + *arc_buf_hdr_t + *+---+ + *| | + *| | + *| | + *+---+ + * l2arc_buf_hdr_t| | + *| | + *+---+ + * l1arc_buf_hdr_t| | + *| | arc_buf_t + *|b_buf +>+-+ arc_buf_t + *| | |b_next +>+-+ + *| b_pdata +-+ |-| |b_next +-->NULL + *+---+ | | | +-+ + * | |b_data +-+ | | + *
svn commit: r302990 - stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
Author: avg Date: Mon Jul 18 06:47:08 2016 New Revision: 302990 URL: https://svnweb.freebsd.org/changeset/base/302990 Log: MFC r302772: re-apply r299908: zfsctl_snapdir_lookup: clear VV_ROOT of snapshot's root Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c == --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c Mon Jul 18 06:46:49 2016(r302989) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c Mon Jul 18 06:47:08 2016(r302990) @@ -1125,6 +1125,7 @@ domount: */ ASSERT(VTOZ(*vpp)->z_zfsvfs != zfsvfs); VTOZ(*vpp)->z_zfsvfs->z_parent = zfsvfs; + (*vpp)->v_flag &= ~VROOT; } ZFS_EXIT(zfsvfs); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r302989 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
Author: avg Date: Mon Jul 18 06:46:49 2016 New Revision: 302989 URL: https://svnweb.freebsd.org/changeset/base/302989 Log: MFC r302772: re-apply r299908: zfsctl_snapdir_lookup: clear VV_ROOT of snapshot's root Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c == --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c Mon Jul 18 06:35:40 2016(r302988) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c Mon Jul 18 06:46:49 2016(r302989) @@ -1125,6 +1125,7 @@ domount: */ ASSERT(VTOZ(*vpp)->z_zfsvfs != zfsvfs); VTOZ(*vpp)->z_zfsvfs->z_parent = zfsvfs; + (*vpp)->v_flag &= ~VROOT; } ZFS_EXIT(zfsvfs); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r302988 - head/sys/arm/ti/am335x
Author: loos Date: Mon Jul 18 06:35:40 2016 New Revision: 302988 URL: https://svnweb.freebsd.org/changeset/base/302988 Log: Fix a random memory overwrite at boot time, simplebus_init() and simplebus_add_device() expect a simplebus_softc structure associated with the device. Add the simplebus_softc as first member in am335x_pwmss_softc structure. Sponsored by: Rubicon Communications (Netgate) Modified: head/sys/arm/ti/am335x/am335x_pwmss.c Modified: head/sys/arm/ti/am335x/am335x_pwmss.c == --- head/sys/arm/ti/am335x/am335x_pwmss.c Mon Jul 18 06:09:52 2016 (r302987) +++ head/sys/arm/ti/am335x/am335x_pwmss.c Mon Jul 18 06:35:40 2016 (r302988) @@ -65,6 +65,7 @@ static device_attach_t am335x_pwmss_atta static device_detach_t am335x_pwmss_detach; struct am335x_pwmss_softc { + struct simplebus_softc sc_simplebus; device_tsc_dev; clk_ident_t sc_clk; }; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r302987 - stable/10/sys/netpfil/ipfw
Author: truckman Date: Mon Jul 18 06:09:52 2016 New Revision: 302987 URL: https://svnweb.freebsd.org/changeset/base/302987 Log: MFC r302667 Fix problems in the FQ-PIE AQM cleanup code that could leak memory or cause a crash. Because dummynet calls pie_cleanup() while holding a mutex, pie_cleanup() is not able to use callout_drain() to make sure that all callouts are finished before it returns, and callout_stop() is not sufficient to make that guarantee. After pie_cleanup() returns, dummynet will free a structure that any remaining callouts will want to access. Fix these problems by allocating a separate structure to contain the data used by the callouts. In pie_cleanup(), call callout_reset_sbt() to replace the normal callout with a cleanup callout that does the cleanup work for each sub-queue. The instance of the cleanup callout that destroys the last flow will also free the extra allocated block of memory. Protect the reference count manipulation in the cleanup callout with DN_BH_WLOCK() to be consistent with all of the other usage of the reference count where this lock is held by the dummynet code. Submitted by: Rasool Al-Saadi Differential Revision:https://reviews.freebsd.org/D7174 Modified: stable/10/sys/netpfil/ipfw/dn_sched_fq_pie.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/netpfil/ipfw/dn_sched_fq_pie.c == --- stable/10/sys/netpfil/ipfw/dn_sched_fq_pie.cMon Jul 18 05:36:31 2016(r302986) +++ stable/10/sys/netpfil/ipfw/dn_sched_fq_pie.cMon Jul 18 06:09:52 2016(r302987) @@ -111,7 +111,7 @@ struct fq_pie_flow { int deficit; int active; /* 1: flow is active (in a list) */ struct pie_status pst; /* pie status variables */ - struct fq_pie_si *psi; /* parent scheduler instance */ + struct fq_pie_si_extra *psi_extra; STAILQ_ENTRY(fq_pie_flow) flowchain; }; @@ -120,23 +120,30 @@ struct fq_pie_schk { struct dn_sch_fq_pie_parms cfg; }; + +/* fq_pie scheduler instance extra state vars. + * The purpose of separation this structure is to preserve number of active + * sub-queues and the flows array pointer even after the scheduler instance + * is destroyed. + * Preserving these varaiables allows freeing the allocated memory by + * fqpie_callout_cleanup() independently from fq_pie_free_sched(). + */ +struct fq_pie_si_extra { + uint32_t nr_active_q; /* number of active queues */ + struct fq_pie_flow *flows; /* array of flows (queues) */ + }; + /* fq_pie scheduler instance */ struct fq_pie_si { - struct dn_sch_inst _si; /* standard scheduler instance */ + struct dn_sch_inst _si; /* standard scheduler instance. SHOULD BE FIRST */ struct dn_queue main_q; /* main queue is after si directly */ - uint32_t nr_active_q; - struct fq_pie_flow *flows; /* array of flows (queues) */ uint32_t perturbation; /* random value */ struct fq_pie_list newflows;/* list of new queues */ struct fq_pie_list oldflows;/* list of old queues */ + struct fq_pie_si_extra *si_extra; /* extra state vars*/ }; -struct mem_to_free { - void *mem_flows; - void *mem_callout; -}; -static struct mtx freemem_mtx; static struct dn_alg fq_pie_desc; /* Default FQ-PIE parameters including PIE */ @@ -371,22 +378,6 @@ fq_calculate_drop_prob(void *x) int64_t p, prob, oldprob; aqm_time_t now; - /* dealing with race condition */ - if (callout_pending(&pst->aqm_pie_callout)) { - /* callout was reset */ - mtx_unlock(&pst->lock_mtx); - return; - } - - if (!callout_active(&pst->aqm_pie_callout)) { - /* callout was stopped */ - mtx_unlock(&pst->lock_mtx); - mtx_destroy(&pst->lock_mtx); - q->psi->nr_active_q--; - return; - } - callout_deactivate(&pst->aqm_pie_callout); - now = AQM_UNOW; pprms = pst->parms; prob = pst->drop_prob; @@ -524,20 +515,17 @@ fq_deactivate_pie(struct pie_status *pst * Initialize PIE for sub-queue 'q' */ static int -pie_init(struct fq_pie_flow *q) +pie_init(struct fq_pie_flow *q, struct fq_pie_schk *fqpie_schk) { struct pie_status *pst=&q->pst; struct dn_aqm_pie_parms *pprms = pst->parms; - struct fq_pie_schk *fqpie_schk; - - fqpie_schk = (struct fq_pie_schk *)(q->psi->_si.sched+1); - int err = 0; + int err = 0; if (!pprms){ D("AQM_PIE is not configured"); err = EINVAL; } else { - q->psi->nr_active_q++; + q->psi_extra->nr_active_q++; /* For speed optimization, we caculate 1/3 queue size once here */
Re: svn commit: r302985 - head/sys/geom/label
On 18.07.16 08:00, Maxim Sobolev wrote: > Author: sobomax > Date: Mon Jul 18 05:00:01 2016 > New Revision: 302985 > URL: https://svnweb.freebsd.org/changeset/base/302985 > > Log: > Relax checking if the privider size matches size recorded in the > superblock, allowing provider to be bit bigger, i.e. have some > extra padding after the FS image. That in some cases might be > a side-effect of using CLOOP format which enforces certain block > size and trying to compress image that is not exactly the number > of those blocks in size. The UFS itself does not have any issues > mounting such padded file systems, so it's what GEOM_LABEL should > do. While you are thinking this is good fix, I expect that this change will break many installations. This is not first time when this check was changed. -- WBR, Andrey V. Elsukov signature.asc Description: OpenPGP digital signature
svn commit: r302986 - in head/sys/dev/hyperv: include vmbus
Author: sephe Date: Mon Jul 18 05:36:31 2016 New Revision: 302986 URL: https://svnweb.freebsd.org/changeset/base/302986 Log: hyperv/vmbus: Cosmetic vmbus channel open cleanup MFC after:1 week Sponsored by: Microsoft OSTC Differential Revision:https://reviews.freebsd.org/D7217 Modified: head/sys/dev/hyperv/include/hyperv.h head/sys/dev/hyperv/vmbus/hv_channel.c head/sys/dev/hyperv/vmbus/vmbus_reg.h Modified: head/sys/dev/hyperv/include/hyperv.h == --- head/sys/dev/hyperv/include/hyperv.hMon Jul 18 05:00:01 2016 (r302985) +++ head/sys/dev/hyperv/include/hyperv.hMon Jul 18 05:36:31 2016 (r302986) @@ -276,15 +276,9 @@ hv_set_channel_read_state(hv_vmbus_chann channel->ch_flags |= VMBUS_CHAN_FLAG_BATCHREAD; } -inthv_vmbus_channel_open( - hv_vmbus_channel* channel, - uint32_tsend_ring_buffer_size, - uint32_trecv_ring_buffer_size, - void* user_data, - uint32_tuser_data_len, - vmbus_chan_callback_t cb, - void*cbarg); - +inthv_vmbus_channel_open(struct hv_vmbus_channel *chan, + int txbr_size, int rxbr_size, const void *udata, int udlen, + vmbus_chan_callback_t cb, void *cbarg); void hv_vmbus_channel_close(hv_vmbus_channel *channel); struct hv_vmbus_channel* vmbus_select_outgoing_channel(struct hv_vmbus_channel *promary); Modified: head/sys/dev/hyperv/vmbus/hv_channel.c == --- head/sys/dev/hyperv/vmbus/hv_channel.c Mon Jul 18 05:00:01 2016 (r302985) +++ head/sys/dev/hyperv/vmbus/hv_channel.c Mon Jul 18 05:36:31 2016 (r302986) @@ -201,93 +201,75 @@ vmbus_chan_sysctl_create(struct hv_vmbus } } -/** - * @brief Open the specified channel - */ int -hv_vmbus_channel_open( - hv_vmbus_channel* new_channel, - uint32_tsend_ring_buffer_size, - uint32_trecv_ring_buffer_size, - void* user_data, - uint32_tuser_data_len, - vmbus_chan_callback_t cb, - void*cbarg) +hv_vmbus_channel_open(struct hv_vmbus_channel *chan, +int txbr_size, int rxbr_size, const void *udata, int udlen, +vmbus_chan_callback_t cb, void *cbarg) { - struct vmbus_softc *sc = new_channel->vmbus_sc; + struct vmbus_softc *sc = chan->vmbus_sc; const struct vmbus_chanmsg_chopen_resp *resp; const struct vmbus_message *msg; struct vmbus_chanmsg_chopen *req; struct vmbus_msghc *mh; uint32_t status; - int ret = 0; + int error; uint8_t *br; - if (user_data_len > VMBUS_CHANMSG_CHOPEN_UDATA_SIZE) { + if (udlen > VMBUS_CHANMSG_CHOPEN_UDATA_SIZE) { device_printf(sc->vmbus_dev, - "invalid udata len %u for chan%u\n", - user_data_len, new_channel->ch_id); + "invalid udata len %d for chan%u\n", udlen, chan->ch_id); return EINVAL; } - KASSERT((send_ring_buffer_size & PAGE_MASK) == 0, + KASSERT((txbr_size & PAGE_MASK) == 0, ("send bufring size is not multiple page")); - KASSERT((recv_ring_buffer_size & PAGE_MASK) == 0, + KASSERT((rxbr_size & PAGE_MASK) == 0, ("recv bufring size is not multiple page")); - if (atomic_testandset_int(&new_channel->ch_stflags, + if (atomic_testandset_int(&chan->ch_stflags, VMBUS_CHAN_ST_OPENED_SHIFT)) - panic("double-open chan%u", new_channel->ch_id); + panic("double-open chan%u", chan->ch_id); - new_channel->ch_cb = cb; - new_channel->ch_cbarg = cbarg; + chan->ch_cb = cb; + chan->ch_cbarg = cbarg; - vmbus_chan_update_evtflagcnt(sc, new_channel); + vmbus_chan_update_evtflagcnt(sc, chan); - 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->ch_task, 0, vmbus_chan_task, - new_channel); - } else { - TASK_INIT(&new_channel->ch_task, 0, vmbus_chan_task_nobatch, - new_channel); - } + chan->ch_tq = VMBUS_PCPU_GET(chan->vmbus_sc, event_tq, chan->ch_cpuid); + if (chan->ch_flags & VMBUS_CHAN_FLAG_BATCHREAD) + TASK_INIT(&chan->ch_task, 0, vmbus_chan_task, chan);
svn commit: r302985 - head/sys/geom/label
Author: sobomax Date: Mon Jul 18 05:00:01 2016 New Revision: 302985 URL: https://svnweb.freebsd.org/changeset/base/302985 Log: Relax checking if the privider size matches size recorded in the superblock, allowing provider to be bit bigger, i.e. have some extra padding after the FS image. That in some cases might be a side-effect of using CLOOP format which enforces certain block size and trying to compress image that is not exactly the number of those blocks in size. The UFS itself does not have any issues mounting such padded file systems, so it's what GEOM_LABEL should do. Submitted by: @mizhka_gmail.com Differential Revision:https://reviews.freebsd.org/D6208 Modified: head/sys/geom/label/g_label_ufs.c Modified: head/sys/geom/label/g_label_ufs.c == --- head/sys/geom/label/g_label_ufs.c Mon Jul 18 04:36:18 2016 (r302984) +++ head/sys/geom/label/g_label_ufs.c Mon Jul 18 05:00:01 2016 (r302985) @@ -45,6 +45,15 @@ __FBSDID("$FreeBSD$"); #defineG_LABEL_UFS_VOLUME 0 #defineG_LABEL_UFS_ID 1 +/* + * G_LABEL_UFS_CMP returns true if difference between provider mediasize + * and filesystem size is less than G_LABEL_UFS_MAXDIFF sectors + */ +#defineG_LABEL_UFS_CMP(prov, fsys, size) \ + ( abs( ((fsys)->size) - ( (prov)->mediasize / (fsys)->fs_fsize )) \ + < G_LABEL_UFS_MAXDIFF ) +#defineG_LABEL_UFS_MAXDIFF 0x100 + static const int superblocks[] = SBLOCKSEARCH; static void @@ -82,18 +91,35 @@ g_label_ufs_taste_common(struct g_consum if (fs == NULL) continue; /* -* Check for magic. We also need to check if file system size is equal -* to providers size, because sysinstall(8) used to bogusly put first -* partition at offset 0 instead of 16, and glabel/ufs would find file -* system on slice instead of partition. +* Check for magic. We also need to check if file system size +* is almost equal to providers size, because sysinstall(8) +* used to bogusly put first partition at offset 0 +* instead of 16, and glabel/ufs would find file system on slice +* instead of partition. +* +* In addition, media size can be a bit bigger than file system +* size. For instance, mkuzip can append bytes to align data +* to large sector size (it improves compression rates). */ + switch (fs->fs_magic){ + case FS_UFS1_MAGIC: + case FS_UFS2_MAGIC: + G_LABEL_DEBUG(1, "%s %s params: %jd, %d, %d, %jd\n", + fs->fs_magic == FS_UFS1_MAGIC ? "UFS1" : "UFS2", + pp->name, pp->mediasize, fs->fs_fsize, + fs->fs_old_size, fs->fs_providersize); + break; + default: + break; + } + if (fs->fs_magic == FS_UFS1_MAGIC && fs->fs_fsize > 0 && - ((pp->mediasize / fs->fs_fsize == fs->fs_old_size) || - (pp->mediasize / fs->fs_fsize == fs->fs_providersize))) { + ( G_LABEL_UFS_CMP(pp, fs, fs_old_size) + || G_LABEL_UFS_CMP(pp, fs, fs_providersize))) { /* Valid UFS1. */ } else if (fs->fs_magic == FS_UFS2_MAGIC && fs->fs_fsize > 0 && - ((pp->mediasize / fs->fs_fsize == fs->fs_size) || - (pp->mediasize / fs->fs_fsize == fs->fs_providersize))) { + ( G_LABEL_UFS_CMP(pp, fs, fs_size) + || G_LABEL_UFS_CMP(pp, fs, fs_providersize))) { /* Valid UFS2. */ } else { g_free(fs); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r302984 - stable/9/sys/i386/i386
Author: kib Date: Mon Jul 18 04:36:18 2016 New Revision: 302984 URL: https://svnweb.freebsd.org/changeset/base/302984 Log: MFC r302573: Fill tf_trapno for trap frames created for syscall. Modified: stable/9/sys/i386/i386/exception.s Directory Properties: stable/9/ (props changed) stable/9/sys/ (props changed) Modified: stable/9/sys/i386/i386/exception.s == --- stable/9/sys/i386/i386/exception.s Mon Jul 18 04:34:42 2016 (r302983) +++ stable/9/sys/i386/i386/exception.s Mon Jul 18 04:36:18 2016 (r302984) @@ -235,7 +235,7 @@ IDTVEC(lcall_syscall) pushfl /* save eflags */ popl8(%esp) /* shuffle into tf_eflags */ pushl $7 /* sizeof "lcall 7,0" */ - subl$4,%esp /* skip over tf_trapno */ + pushl $0 /* tf_trapno */ pushal pushl $0 movw%ds,(%esp) @@ -264,7 +264,7 @@ IDTVEC(lcall_syscall) SUPERALIGN_TEXT IDTVEC(int0x80_syscall) pushl $2 /* sizeof "int 0x80" */ - subl$4,%esp /* skip over tf_trapno */ + pushl $0 /* tf_trapno */ pushal pushl $0 movw%ds,(%esp) ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r302983 - stable/10/sys/i386/i386
Author: kib Date: Mon Jul 18 04:34:42 2016 New Revision: 302983 URL: https://svnweb.freebsd.org/changeset/base/302983 Log: MFC r302573: Fill tf_trapno for trap frames created for syscall. Modified: stable/10/sys/i386/i386/exception.s Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/i386/i386/exception.s == --- stable/10/sys/i386/i386/exception.s Mon Jul 18 04:33:12 2016 (r302982) +++ stable/10/sys/i386/i386/exception.s Mon Jul 18 04:34:42 2016 (r302983) @@ -235,7 +235,7 @@ IDTVEC(lcall_syscall) pushfl /* save eflags */ popl8(%esp) /* shuffle into tf_eflags */ pushl $7 /* sizeof "lcall 7,0" */ - subl$4,%esp /* skip over tf_trapno */ + pushl $0 /* tf_trapno */ pushal pushl $0 movw%ds,(%esp) @@ -264,7 +264,7 @@ IDTVEC(lcall_syscall) SUPERALIGN_TEXT IDTVEC(int0x80_syscall) pushl $2 /* sizeof "int 0x80" */ - subl$4,%esp /* skip over tf_trapno */ + pushl $0 /* tf_trapno */ pushal pushl $0 movw%ds,(%esp) ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r302982 - stable/11/sys/i386/i386
Author: kib Date: Mon Jul 18 04:33:12 2016 New Revision: 302982 URL: https://svnweb.freebsd.org/changeset/base/302982 Log: MFC r302573: Fill tf_trapno for trap frames created for syscall. Approved by: re (gjb) Modified: stable/11/sys/i386/i386/exception.s Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/i386/i386/exception.s == --- stable/11/sys/i386/i386/exception.s Mon Jul 18 04:30:34 2016 (r302981) +++ stable/11/sys/i386/i386/exception.s Mon Jul 18 04:33:12 2016 (r302982) @@ -234,7 +234,7 @@ IDTVEC(lcall_syscall) pushfl /* save eflags */ popl8(%esp) /* shuffle into tf_eflags */ pushl $7 /* sizeof "lcall 7,0" */ - subl$4,%esp /* skip over tf_trapno */ + pushl $0 /* tf_trapno */ pushal pushl $0 movw%ds,(%esp) @@ -263,7 +263,7 @@ IDTVEC(lcall_syscall) SUPERALIGN_TEXT IDTVEC(int0x80_syscall) pushl $2 /* sizeof "int 0x80" */ - subl$4,%esp /* skip over tf_trapno */ + pushl $0 /* tf_trapno */ pushal pushl $0 movw%ds,(%esp) ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r302981 - head/sys/kern
Author: kib Date: Mon Jul 18 04:30:34 2016 New Revision: 302981 URL: https://svnweb.freebsd.org/changeset/base/302981 Log: Fix another bug after r302350. Reported and tested by: pho PR: 210884 Sponsored by: The FreeBSD Foundation MFC after:3 days Modified: head/sys/kern/kern_exit.c Modified: head/sys/kern/kern_exit.c == --- head/sys/kern/kern_exit.c Mon Jul 18 04:20:26 2016(r302980) +++ head/sys/kern/kern_exit.c Mon Jul 18 04:30:34 2016(r302981) @@ -345,7 +345,7 @@ exit1(struct thread *td, int rval, int s * executing, prevent it from rearming itself and let it finish. */ if (timevalisset(&p->p_realtimer.it_value) && - callout_stop(&p->p_itcallout) == 0) { + _callout_stop_safe(&p->p_itcallout, CS_EXECUTING, NULL) == 0) { timevalclear(&p->p_realtimer.it_interval); msleep(&p->p_itcallout, &p->p_mtx, PWAIT, "ritwait", 0); KASSERT(!timevalisset(&p->p_realtimer.it_value), ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r302980 - head/sys/vm
Author: alc Date: Mon Jul 18 04:20:26 2016 New Revision: 302980 URL: https://svnweb.freebsd.org/changeset/base/302980 Log: Break up vm_fault()'s implementation of the read-ahead and delete-behind optimizations into two distinct pieces. The first piece consists of the code that should only be performed once per page fault and requires the map to be locked. The second piece consists of the code that should be performed each time a pager is called on an object in the shadow chain. (This second piece expects the map to be unlocked.) Previously, the entire implementation could be executed multiple times. Moreover, the second and subsequent executions would occur with the map unlocked. Usually, the ensuing unsynchronized accesses to the map were harmless because the map was not changing. Nonetheless, it was possible for a use-after-free error to occur, where vm_fault() wrote to a freed map entry. This change corrects that problem. Reported by: avg Reviewed by: kib MFC after:3 days Sponsored by: EMC / Isilon Storage Division Modified: head/sys/vm/vm_fault.c Modified: head/sys/vm/vm_fault.c == --- head/sys/vm/vm_fault.c Mon Jul 18 04:16:53 2016(r302979) +++ head/sys/vm/vm_fault.c Mon Jul 18 04:20:26 2016(r302980) @@ -291,14 +291,17 @@ vm_fault_hold(vm_map_t map, vm_offset_t int hardfault; struct faultstate fs; struct vnode *vp; + vm_offset_t e_end, e_start; vm_page_t m; - int ahead, behind, cluster_offset, error, locked; + int ahead, behind, cluster_offset, error, locked, rv; + u_char behavior; hardfault = 0; growstack = TRUE; PCPU_INC(cnt.v_vm_faults); fs.vp = NULL; faultcount = 0; + nera = -1; RetryFault:; @@ -549,29 +552,25 @@ fast_failed: readrest: /* -* We have either allocated a new page or found an existing -* page that is only partially valid. -* -* Attempt to fault-in the page if there is a chance that the -* pager has it, and potentially fault in additional pages -* at the same time. +* If the pager for the current object might have the page, +* then determine the number of additional pages to read and +* potentially reprioritize previously read pages for earlier +* reclamation. These operations should only be performed +* once per page fault. Even if the current pager doesn't +* have the page, the number of additional pages to read will +* apply to subsequent objects in the shadow chain. */ - if (fs.object->type != OBJT_DEFAULT) { - int rv; - u_char behavior = vm_map_entry_behavior(fs.entry); - + if (fs.object->type != OBJT_DEFAULT && nera == -1 && + !P_KILLED(curproc)) { + KASSERT(fs.lookup_still_valid, ("map unlocked")); era = fs.entry->read_ahead; - if (behavior == MAP_ENTRY_BEHAV_RANDOM || - P_KILLED(curproc)) { - behind = 0; + behavior = vm_map_entry_behavior(fs.entry); + if (behavior == MAP_ENTRY_BEHAV_RANDOM) { nera = 0; - ahead = 0; } else if (behavior == MAP_ENTRY_BEHAV_SEQUENTIAL) { - behind = 0; nera = VM_FAULT_READ_AHEAD_MAX; - ahead = nera; if (vaddr == fs.entry->next_read) - vm_fault_dontneed(&fs, vaddr, ahead); + vm_fault_dontneed(&fs, vaddr, nera); } else if (vaddr == fs.entry->next_read) { /* * This is a sequential fault. Arithmetically @@ -580,42 +579,51 @@ readrest: * number of pages is "# of sequential faults * x (read ahead min + 1) + read ahead min" */ - behind = 0; nera = VM_FAULT_READ_AHEAD_MIN; if (era > 0) { nera += era + 1; if (nera > VM_FAULT_READ_AHEAD_MAX) nera = VM_FAULT_READ_AHEAD_MAX; } - ahead = nera; if (era == VM_FAULT_READ_AHEAD_MAX) -
svn commit: r302979 - stable/11/sbin/ipfw
Author: ae Date: Mon Jul 18 04:16:53 2016 New Revision: 302979 URL: https://svnweb.freebsd.org/changeset/base/302979 Log: MFC r302561,302565: Flush buffer after output. This fixes adding new data to already printed flows. PR: 210882 Approved by: re (kib) Modified: stable/11/sbin/ipfw/dummynet.c stable/11/sbin/ipfw/ipfw2.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/ipfw/dummynet.c == --- stable/11/sbin/ipfw/dummynet.c Mon Jul 18 03:59:03 2016 (r302978) +++ stable/11/sbin/ipfw/dummynet.c Mon Jul 18 04:16:53 2016 (r302979) @@ -612,6 +612,7 @@ list_pipes(struct dn_id *oid, struct dn_ } list_flow(&bp, (struct dn_flow *)oid); printf("%s\n", bp.buf); + bp_flush(&bp); break; case DN_LINK: { Modified: stable/11/sbin/ipfw/ipfw2.h == --- stable/11/sbin/ipfw/ipfw2.h Mon Jul 18 03:59:03 2016(r302978) +++ stable/11/sbin/ipfw/ipfw2.h Mon Jul 18 04:16:53 2016(r302979) @@ -371,6 +371,9 @@ void fill_unreach6_code(u_short *codep, void fill_icmp6types(struct _ipfw_insn_icmp6 *cmd, char *av, int cblen); int fill_ext6hdr(struct _ipfw_insn *cmd, char *av); +/* ipfw2.c */ +void bp_flush(struct buf_pr *b); + /* tables.c */ struct _ipfw_obj_ctlv; int table_check_name(const char *tablename); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r302978 - head/sys/x86/x86
Author: sobomax Date: Mon Jul 18 03:59:03 2016 New Revision: 302978 URL: https://svnweb.freebsd.org/changeset/base/302978 Log: Don't print same value twice, one in decimal once in hex. This makes output more cryptic than it needs to be and wastes cpu cycles and console bandwidth. Modified: head/sys/x86/x86/mp_x86.c Modified: head/sys/x86/x86/mp_x86.c == --- head/sys/x86/x86/mp_x86.c Mon Jul 18 02:13:57 2016(r302977) +++ head/sys/x86/x86/mp_x86.c Mon Jul 18 03:59:03 2016(r302978) @@ -649,12 +649,10 @@ cpu_mp_announce(void) TOPO_FOREACH(node, &topo_root) { switch (node->type) { case TOPO_TYPE_PKG: - printf("Package HW ID = %u (%#x)\n", - node->hwid, node->hwid); + printf("Package HW ID = %u\n", node->hwid); break; case TOPO_TYPE_CORE: - printf("\tCore HW ID = %u (%#x)\n", - node->hwid, node->hwid); + printf("\tCore HW ID = %u\n", node->hwid); break; case TOPO_TYPE_PU: if (cpu_info[node->hwid].cpu_hyperthread) @@ -663,16 +661,14 @@ cpu_mp_announce(void) hyperthread = ""; if (node->subtype == 0) - printf("\t\tCPU (AP%s): APIC ID: %u (%#x)" - "(disabled)\n", hyperthread, node->hwid, - node->hwid); + printf("\t\tCPU (AP%s): APIC ID: %u" + "(disabled)\n", hyperthread, node->hwid); else if (node->id == 0) - printf("\t\tCPU0 (BSP): APIC ID: %u (%#x)\n", - node->hwid, node->hwid); - else - printf("\t\tCPU%u (AP%s): APIC ID: %u (%#x)\n", - node->id, hyperthread, node->hwid, + printf("\t\tCPU0 (BSP): APIC ID: %u\n", node->hwid); + else + printf("\t\tCPU%u (AP%s): APIC ID: %u\n", + node->id, hyperthread, node->hwid); break; default: /* ignored */ ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r302977 - head/tools/build
Author: will Date: Mon Jul 18 02:13:57 2016 New Revision: 302977 URL: https://svnweb.freebsd.org/changeset/base/302977 Log: Add my beinstall script. This is meant to install a new BE (boot environment) given a fully built world/kernel. In addition to installing world and kernel in the new BE, it also automatically performs /etc updates (using etcupdate or mergemaster) and package updates (using pkg). Because this process is performed in a new BE, it reduces the need for a second reboot. It also means a reboot into a partially updated system (due to install or hardware failure) can't happen. Inspired by and similar in function to Solaris/illumos-style upgrades. Added: head/tools/build/beinstall.sh (contents, props changed) Added: head/tools/build/beinstall.sh == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/build/beinstall.sh Mon Jul 18 02:13:57 2016 (r302977) @@ -0,0 +1,153 @@ +#!/bin/sh +# +# Copyright (c) 2016 Will Andrews +# 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, this list of conditions and the following disclaimer +#in this position and unchanged. +# 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$ +# +## +# Install a boot environment using the current FreeBSD source tree. +# Requires a fully built world & kernel. +# +# Non-base tools required: beadm, pkg +# +# In a sandbox for the new boot environment, this script also runs etcupdate +# and pkg upgrade automatically in the sandbox. Upon successful completion, +# the system will be ready to boot into the new boot environment. Upon +# failure, the target boot environment will be destroyed. In all cases, the +# running system is left untouched. +# +## Usage: +# beinstall [optional world/kernel flags e.g. KERNCONF] +# +## User modifiable variables - set these in the environment if desired. +# If not empty, 'pkg upgrade' will be skipped. +NO_PKG_UPGRADE="${NO_PKG_UPGRADE:-""}" +# Config updater - 'etcupdate' and 'mergemaster' are supported. Set to an +# empty string to skip. +CONFIG_UPDATER="${CONFIG_UPDATER:-"etcupdate"}" +# Flags for etcupdate if used. +ETCUPDATE_FLAGS="${ETCUPDATE_FLAGS:-"-F"}" +# Flags for mergemaster if used. +MERGEMASTER_FLAGS="${MERGEMASTER_FLAGS:-"-iFU"}" + + + +## Constants +ETCUPDATE_CMD="etcupdate" +MERGEMASTER_CMD="mergemaster" + +## Functions +cleanup() { + [ -z "${cleanup_commands}" ] && return + echo "Cleaning up ..." + for command in ${cleanup_commands}; do + ${command} + done +} + +errx() { + cleanup + echo "error: $*" + exit 1 +} + +rmdir_be() { + chflags -R noschg ${BE_MNTPT} + rm -rf ${BE_MNTPT} +} + +cleanup_be() { + beadm destroy -F ${BENAME} +} + +update_mergemaster() { + mergemaster -m $(pwd) -D ${BE_MNTPT} -t ${BE_MM_ROOT} ${MERGEMASTER_FLAGS} +} + +update_etcupdate() { + etcupdate -s $(pwd) -D ${BE_MNTPT} ${ETCUPDATE_FLAGS} || return $? + etcupdate resolve -D ${BE_MNTPT} +} + + +cleanup_commands="" +trap 'errx "Interrupt caught"' HUP INT TERM + +[ "$(whoami)" != "root" ] && errx "Must be run as root" + +[ ! -f "Makefile.inc1" ] && errx "Must be in FreeBSD source tree" +objdir=$(make -V .OBJDIR 2>/dev/null) +[ ! -d "${objdir}" ] && errx "Must have built FreeBSD from source tree" + +if [ -d .git ] ; then +commit_time=$(git show --format='%ct' 2>/dev/null | head -1) +[ $? -ne 0 ] && errx "Can't lookup git commit timestamp" +commit_ts=$(date -r ${commit_time} '+%Y%m%d.%H%M%S') +elif [ -d .svn ] ; then +commit_ts=$( svn info | awk '/Last Changed Date/ {print $4 "." $5}' | tr -d :- ) +[ $? -ne 0 ] && errx "Can't lookup Subversion commit timestamp"
svn commit: r302976 - head/lib/libkvm
Author: will Date: Mon Jul 18 01:55:25 2016 New Revision: 302976 URL: https://svnweb.freebsd.org/changeset/base/302976 Log: libkvm: Improve physical address lookup scaling. Instead of using a hash table to convert physical page addresses to offsets in the sparse page array, cache the number of bits set for each 4MB chunk of physical pages. Upon lookup, find the nearest cached population count, then add/subtract the number of bits from that point to the page's PTE bit. Then multiply by page size and add to the sparse page map's base offset. This replaces O(n) worst-case lookup with O(1) (plus a small number of bits to scan in the bitmap). Also, for a 128GB system, a typical kernel core of about 8GB will now only require ~4.5MB of RAM for this approach instead of ~48MB as with the hash table. More concretely, /usr/sbin/crashinfo against the same core improves from a max RSS of 188MB and wall time of 43.72s (33.25 user 2.94 sys) to 135MB and 9.43s (2.58 user 1.47 sys). Running "thread apply all bt" in kgdb has a similar RSS improvement, and wall time drops from 4.44s to 1.93s. Reviewed by: jhb Sponsored by: Backtrace I/O Modified: head/lib/libkvm/kvm.c head/lib/libkvm/kvm_minidump_aarch64.c head/lib/libkvm/kvm_minidump_amd64.c head/lib/libkvm/kvm_minidump_arm.c head/lib/libkvm/kvm_minidump_i386.c head/lib/libkvm/kvm_minidump_mips.c head/lib/libkvm/kvm_private.c head/lib/libkvm/kvm_private.h Modified: head/lib/libkvm/kvm.c == --- head/lib/libkvm/kvm.c Mon Jul 18 01:03:39 2016(r302975) +++ head/lib/libkvm/kvm.c Mon Jul 18 01:55:25 2016(r302976) @@ -283,6 +283,8 @@ kvm_close(kvm_t *kd) free((void *) kd->argspc); if (kd->argv != 0) free((void *)kd->argv); + if (kd->pt_map != NULL) + free(kd->pt_map); free((void *)kd); return (0); Modified: head/lib/libkvm/kvm_minidump_aarch64.c == --- head/lib/libkvm/kvm_minidump_aarch64.c Mon Jul 18 01:03:39 2016 (r302975) +++ head/lib/libkvm/kvm_minidump_aarch64.c Mon Jul 18 01:55:25 2016 (r302976) @@ -50,7 +50,6 @@ __FBSDID("$FreeBSD$"); struct vmstate { struct minidumphdr hdr; - struct hpt hpt; uint64_t *page_map; }; @@ -67,7 +66,6 @@ _aarch64_minidump_freevtop(kvm_t *kd) { struct vmstate *vm = kd->vmst; - _kvm_hpt_free(&vm->hpt); free(vm->page_map); free(vm); kd->vmst = NULL; @@ -77,8 +75,7 @@ static int _aarch64_minidump_initvtop(kvm_t *kd) { struct vmstate *vmst; - uint64_t *bitmap; - off_t off; + off_t off, sparse_off; vmst = _kvm_malloc(kd, sizeof(*vmst)); if (vmst == NULL) { @@ -114,19 +111,12 @@ _aarch64_minidump_initvtop(kvm_t *kd) /* Skip header and msgbuf */ off = AARCH64_PAGE_SIZE + aarch64_round_page(vmst->hdr.msgbufsize); - bitmap = _kvm_malloc(kd, vmst->hdr.bitmapsize); - if (bitmap == NULL) { - _kvm_err(kd, kd->program, - "cannot allocate %d bytes for bitmap", - vmst->hdr.bitmapsize); - return (-1); - } - if (pread(kd->pmfd, bitmap, vmst->hdr.bitmapsize, off) != - (ssize_t)vmst->hdr.bitmapsize) { - _kvm_err(kd, kd->program, - "cannot read %d bytes for page bitmap", - vmst->hdr.bitmapsize); - free(bitmap); + /* build physical address lookup table for sparse pages */ + sparse_off = off + aarch64_round_page(vmst->hdr.bitmapsize) + + aarch64_round_page(vmst->hdr.pmapsize); + if (_kvm_pt_init(kd, vmst->hdr.bitmapsize, off, sparse_off, + AARCH64_PAGE_SIZE, sizeof(uint64_t)) == -1) { + _kvm_err(kd, kd->program, "cannot load core bitmap"); return (-1); } off += aarch64_round_page(vmst->hdr.bitmapsize); @@ -136,7 +126,6 @@ _aarch64_minidump_initvtop(kvm_t *kd) _kvm_err(kd, kd->program, "cannot allocate %d bytes for page_map", vmst->hdr.pmapsize); - free(bitmap); return (-1); } /* This is the end of the dump, savecore may have truncated it. */ @@ -149,15 +138,9 @@ _aarch64_minidump_initvtop(kvm_t *kd) AARCH64_PAGE_SIZE) { _kvm_err(kd, kd->program, "cannot read %d bytes for page_map", vmst->hdr.pmapsize); - free(bitmap); return (-1); } - off += vmst->hdr.pmapsize; - - /* build physical address hash table for sparse pages */ - _kvm_hpt_init(kd, &vmst->hpt, bitmap, vmst->hdr.bitmapsize, off, - AARCH64_PAGE_SIZE, sizeof(*bitmap)); - free(bi
svn commit: r302975 - head/lib/libkvm
Author: will Date: Mon Jul 18 01:03:39 2016 New Revision: 302975 URL: https://svnweb.freebsd.org/changeset/base/302975 Log: libkvm: Bounds check (more) PTE indices. Modified: head/lib/libkvm/kvm_minidump_arm.c head/lib/libkvm/kvm_minidump_i386.c head/lib/libkvm/kvm_minidump_mips.c Modified: head/lib/libkvm/kvm_minidump_arm.c == --- head/lib/libkvm/kvm_minidump_arm.c Mon Jul 18 01:02:52 2016 (r302974) +++ head/lib/libkvm/kvm_minidump_arm.c Mon Jul 18 01:03:39 2016 (r302975) @@ -184,6 +184,8 @@ _arm_minidump_kvatop(kvm_t *kd, kvaddr_t if (va >= vm->hdr.kernbase) { pteindex = (va - vm->hdr.kernbase) >> ARM_PAGE_SHIFT; + if (pteindex >= vm->hdr.ptesize / sizeof(*ptemap)) + goto invalid; pte = _kvm32toh(kd, ptemap[pteindex]); if ((pte & ARM_L2_TYPE_MASK) == ARM_L2_TYPE_INV) { _kvm_err(kd, kd->program, Modified: head/lib/libkvm/kvm_minidump_i386.c == --- head/lib/libkvm/kvm_minidump_i386.c Mon Jul 18 01:02:52 2016 (r302974) +++ head/lib/libkvm/kvm_minidump_i386.c Mon Jul 18 01:03:39 2016 (r302975) @@ -162,6 +162,8 @@ _i386_minidump_vatop_pae(kvm_t *kd, kvad if (va >= vm->hdr.kernbase) { pteindex = (va - vm->hdr.kernbase) >> I386_PAGE_SHIFT; + if (pteindex >= vm->hdr.ptesize / sizeof(*ptemap)) + goto invalid; pte = le64toh(ptemap[pteindex]); if ((pte & I386_PG_V) == 0) { _kvm_err(kd, kd->program, @@ -207,6 +209,8 @@ _i386_minidump_vatop(kvm_t *kd, kvaddr_t if (va >= vm->hdr.kernbase) { pteindex = (va - vm->hdr.kernbase) >> I386_PAGE_SHIFT; + if (pteindex >= vm->hdr.ptesize / sizeof(*ptemap)) + goto invalid; pte = le32toh(ptemap[pteindex]); if ((pte & I386_PG_V) == 0) { _kvm_err(kd, kd->program, Modified: head/lib/libkvm/kvm_minidump_mips.c == --- head/lib/libkvm/kvm_minidump_mips.c Mon Jul 18 01:02:52 2016 (r302974) +++ head/lib/libkvm/kvm_minidump_mips.c Mon Jul 18 01:03:39 2016 (r302975) @@ -221,9 +221,13 @@ _mips_minidump_kvatop(kvm_t *kd, kvaddr_ if (va >= vm->hdr.kernbase) { pteindex = (va - vm->hdr.kernbase) >> MIPS_PAGE_SHIFT; if (vm->pte_size == 64) { + if (pteindex >= vm->hdr.ptesize / sizeof(*ptemap64)) + goto invalid; pte = _kvm64toh(kd, ptemap64[pteindex]); a = MIPS64_PTE_TO_PA(pte); } else { + if (pteindex >= vm->hdr.ptesize / sizeof(*ptemap32)) + goto invalid; pte = _kvm32toh(kd, ptemap32[pteindex]); a = MIPS32_PTE_TO_PA(pte); } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r302974 - head/lib/libkvm
Author: will Date: Mon Jul 18 01:02:52 2016 New Revision: 302974 URL: https://svnweb.freebsd.org/changeset/base/302974 Log: libkvm: Put private kvm routines in kvm_private.c. Added: head/lib/libkvm/kvm_private.c (contents, props changed) Modified: head/lib/libkvm/Makefile head/lib/libkvm/kvm.c Modified: head/lib/libkvm/Makefile == --- head/lib/libkvm/MakefileSun Jul 17 21:49:53 2016(r302973) +++ head/lib/libkvm/MakefileMon Jul 18 01:02:52 2016(r302974) @@ -11,7 +11,7 @@ CFLAGS+=-DLIBC_SCCS -I${.CURDIR} WARNS?=3 SRCS= kvm.c kvm_cptime.c kvm_getloadavg.c \ - kvm_getswapinfo.c kvm_pcpu.c kvm_proc.c kvm_vnet.c \ + kvm_getswapinfo.c kvm_pcpu.c kvm_private.c kvm_proc.c kvm_vnet.c \ kvm_minidump_aarch64.c \ kvm_amd64.c kvm_minidump_amd64.c \ kvm_arm.c kvm_minidump_arm.c \ Modified: head/lib/libkvm/kvm.c == --- head/lib/libkvm/kvm.c Sun Jul 17 21:49:53 2016(r302973) +++ head/lib/libkvm/kvm.c Mon Jul 18 01:02:52 2016(r302974) @@ -66,114 +66,12 @@ static char sccsid[] = "@(#)kvm.c 8.2 (B SET_DECLARE(kvm_arch, struct kvm_arch); -/* from src/lib/libc/gen/nlist.c */ -int __fdnlist(int, struct nlist *); - -static int -kvm_fdnlist(kvm_t *kd, struct kvm_nlist *list) -{ - kvaddr_t addr; - int error, nfail; - - if (kd->resolve_symbol == NULL) { - struct nlist *nl; - int count, i; - - for (count = 0; list[count].n_name != NULL && -list[count].n_name[0] != '\0'; count++) - ; - nl = calloc(count + 1, sizeof(*nl)); - for (i = 0; i < count; i++) - nl[i].n_name = list[i].n_name; - nfail = __fdnlist(kd->nlfd, nl); - for (i = 0; i < count; i++) { - list[i].n_type = nl[i].n_type; - list[i].n_value = nl[i].n_value; - } - free(nl); - return (nfail); - } - - nfail = 0; - while (list->n_name != NULL && list->n_name[0] != '\0') { - error = kd->resolve_symbol(list->n_name, &addr); - if (error != 0) { - nfail++; - list->n_value = 0; - list->n_type = 0; - } else { - list->n_value = addr; - list->n_type = N_DATA | N_EXT; - } - list++; - } - return (nfail); -} - char * kvm_geterr(kvm_t *kd) { return (kd->errbuf); } -#include - -/* - * Report an error using printf style arguments. "program" is kd->program - * on hard errors, and 0 on soft errors, so that under sun error emulation, - * only hard errors are printed out (otherwise, programs like gdb will - * generate tons of error messages when trying to access bogus pointers). - */ -void -_kvm_err(kvm_t *kd, const char *program, const char *fmt, ...) -{ - va_list ap; - - va_start(ap, fmt); - if (program != NULL) { - (void)fprintf(stderr, "%s: ", program); - (void)vfprintf(stderr, fmt, ap); - (void)fputc('\n', stderr); - } else - (void)vsnprintf(kd->errbuf, - sizeof(kd->errbuf), fmt, ap); - - va_end(ap); -} - -void -_kvm_syserr(kvm_t *kd, const char *program, const char *fmt, ...) -{ - va_list ap; - int n; - - va_start(ap, fmt); - if (program != NULL) { - (void)fprintf(stderr, "%s: ", program); - (void)vfprintf(stderr, fmt, ap); - (void)fprintf(stderr, ": %s\n", strerror(errno)); - } else { - char *cp = kd->errbuf; - - (void)vsnprintf(cp, sizeof(kd->errbuf), fmt, ap); - n = strlen(cp); - (void)snprintf(&cp[n], sizeof(kd->errbuf) - n, ": %s", - strerror(errno)); - } - va_end(ap); -} - -void * -_kvm_malloc(kvm_t *kd, size_t n) -{ - void *p; - - if ((p = calloc(n, sizeof(char))) == NULL) - _kvm_err(kd, kd->program, "can't allocate %zu bytes: %s", -n, strerror(errno)); - return (p); -} - static int _kvm_read_kernel_ehdr(kvm_t *kd) { @@ -210,166 +108,6 @@ _kvm_read_kernel_ehdr(kvm_t *kd) } } -int -_kvm_probe_elf_kernel(kvm_t *kd, int class, int machine) -{ - - return (kd->nlehdr.e_ident[EI_CLASS] == class && - kd->nlehdr.e_type == ET_EXEC && - kd->nlehdr.e_machine == machine); -} - -int -_kvm_is_minidump(kvm_t *kd) -{ - char minihdr[8]; - - if (kd->rawdump) - return (0); - if (pread(kd->pmfd, &minihdr, 8, 0) == 8 && - memcmp(&minihdr, "minidump", 8) == 0) -
svn commit: r302973 - head/usr.bin/sed
Author: pfg Date: Sun Jul 17 21:49:53 2016 New Revision: 302973 URL: https://svnweb.freebsd.org/changeset/base/302973 Log: sed(1): Fix off by one introduced in r299211. Detected by running the gsed tests. Submitted by: Mikhail Teterin PR: 195929 MFC after:3 days Modified: head/usr.bin/sed/process.c Modified: head/usr.bin/sed/process.c == --- head/usr.bin/sed/process.c Sun Jul 17 20:34:46 2016(r302972) +++ head/usr.bin/sed/process.c Sun Jul 17 21:49:53 2016(r302973) @@ -450,7 +450,7 @@ substitute(struct s_command *cp) regexec_e(re, ps, REG_NOTBOL, 0, le, psl)); /* Did not find the requested number of matches. */ - if (n > 1) + if (n > 0) return (0); /* Copy the trailing retained string. */ ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r302972 - head/usr.sbin/bhyve
Author: grehan Date: Sun Jul 17 20:34:46 2016 New Revision: 302972 URL: https://svnweb.freebsd.org/changeset/base/302972 Log: Disallow interrupt requests on disabled endpoints. Submitted by: Leon Dang MFC after:3 days Modified: head/usr.sbin/bhyve/pci_xhci.c Modified: head/usr.sbin/bhyve/pci_xhci.c == --- head/usr.sbin/bhyve/pci_xhci.c Sun Jul 17 19:24:28 2016 (r302971) +++ head/usr.sbin/bhyve/pci_xhci.c Sun Jul 17 20:34:46 2016 (r302972) @@ -2537,9 +2537,11 @@ static int pci_xhci_dev_intr(struct usb_hci *hci, int epctx) { struct pci_xhci_dev_emu *dev; + struct xhci_dev_ctx *dev_ctx; struct xhci_trb evtrb; struct pci_xhci_softc *sc; struct pci_xhci_portregs *p; + struct xhci_endp_ctx*ep_ctx; int error; int dir_in; int epid; @@ -2578,6 +2580,14 @@ pci_xhci_dev_intr(struct usb_hci *hci, i goto done; } + dev_ctx = dev->dev_ctx; + ep_ctx = &dev_ctx->ctx_ep[epid]; + if ((ep_ctx->dwEpCtx0 & 0x7) == XHCI_ST_EPCTX_DISABLED) { + DPRINTF(("xhci device interrupt on disabled endpoint %d\r\n", +epid)); + return (0); + } + DPRINTF(("xhci device interrupt on endpoint %d\r\n", epid)); pci_xhci_device_doorbell(sc, hci->hci_port, epid, 0); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r302971 - in head/sys/powerpc: booke include
Author: jhibbits Date: Sun Jul 17 19:24:28 2016 New Revision: 302971 URL: https://svnweb.freebsd.org/changeset/base/302971 Log: Remove booke_enable_l3_cache declaration and remaining definition. L3 cache is not defined by Book-E, so is platform specific. Since it was already moved for e500-based devices into mpc85xx in r292903, just eliminate it altogether. Any device that supports L3 cache should have its own platform means to enable it. Modified: head/sys/powerpc/booke/machdep_ppc4xx.c head/sys/powerpc/include/machdep.h Modified: head/sys/powerpc/booke/machdep_ppc4xx.c == --- head/sys/powerpc/booke/machdep_ppc4xx.c Sun Jul 17 19:19:50 2016 (r302970) +++ head/sys/powerpc/booke/machdep_ppc4xx.c Sun Jul 17 19:24:28 2016 (r302971) @@ -115,11 +115,6 @@ booke_enable_l2_cache(void) } void -booke_enable_l3_cache(void) -{ -} - -void booke_disable_l2_cache(void) { uint32_t ccr1,l2cr0; Modified: head/sys/powerpc/include/machdep.h == --- head/sys/powerpc/include/machdep.h Sun Jul 17 19:19:50 2016 (r302970) +++ head/sys/powerpc/include/machdep.h Sun Jul 17 19:24:28 2016 (r302971) @@ -32,7 +32,6 @@ void booke_disable_l2_cache(void); void booke_enable_l1_cache(void); void booke_enable_l2_cache(void); -void booke_enable_l3_cache(void); void booke_enable_bpred(void); void booke_init_tlb(vm_paddr_t); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r302970 - head/sys/powerpc/booke
Author: jhibbits Date: Sun Jul 17 19:19:50 2016 New Revision: 302970 URL: https://svnweb.freebsd.org/changeset/base/302970 Log: No need to include mpc85xx.h anymore, so remove it. Modified: head/sys/powerpc/booke/booke_machdep.c Modified: head/sys/powerpc/booke/booke_machdep.c == --- head/sys/powerpc/booke/booke_machdep.c Sun Jul 17 18:33:17 2016 (r302969) +++ head/sys/powerpc/booke/booke_machdep.c Sun Jul 17 19:19:50 2016 (r302970) @@ -142,10 +142,6 @@ __FBSDID("$FreeBSD$"); #include #include -#if defined(MPC85XX) || defined(QORIQ_DPAA) -#include -#endif - #ifdef DDB #include #endif ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r302969 - stable/9/usr.bin/mail
Author: pfg Date: Sun Jul 17 18:33:17 2016 New Revision: 302969 URL: https://svnweb.freebsd.org/changeset/base/302969 Log: MFC r302511, r302771, r302845: mail(1): check for out of memory conditions when calling calloc(3). Modified: stable/9/usr.bin/mail/cmd3.c stable/9/usr.bin/mail/vars.c Directory Properties: stable/9/usr.bin/mail/ (props changed) Modified: stable/9/usr.bin/mail/cmd3.c == --- stable/9/usr.bin/mail/cmd3.cSun Jul 17 18:32:33 2016 (r302968) +++ stable/9/usr.bin/mail/cmd3.cSun Jul 17 18:33:17 2016 (r302969) @@ -463,7 +463,8 @@ group(char **argv) gname = *argv; h = hash(gname); if ((gh = findgroup(gname)) == NULL) { - gh = calloc(sizeof(*gh), 1); + if ((gh = calloc(1, sizeof(*gh))) == NULL) + err(1, "Out of memory"); gh->g_name = vcopy(gname); gh->g_list = NULL; gh->g_link = groups[h]; @@ -477,7 +478,8 @@ group(char **argv) */ for (ap = argv+1; *ap != NULL; ap++) { - gp = calloc(sizeof(*gp), 1); + if ((gp = calloc(1, sizeof(*gp))) == NULL) + err(1, "Out of memory"); gp->ge_name = vcopy(*ap); gp->ge_link = gh->g_list; gh->g_list = gp; @@ -702,7 +704,8 @@ alternates(char **namelist) } if (altnames != 0) (void)free(altnames); - altnames = calloc((unsigned)c, sizeof(char *)); + if ((altnames = calloc((unsigned)c, sizeof(char *))) == NULL) + err(1, "Out of memory"); for (ap = namelist, ap2 = altnames; *ap != NULL; ap++, ap2++) { cp = calloc((unsigned)strlen(*ap) + 1, sizeof(char)); strcpy(cp, *ap); Modified: stable/9/usr.bin/mail/vars.c == --- stable/9/usr.bin/mail/vars.cSun Jul 17 18:32:33 2016 (r302968) +++ stable/9/usr.bin/mail/vars.cSun Jul 17 18:33:17 2016 (r302969) @@ -56,7 +56,8 @@ assign(const char *name, const char *val h = hash(name); vp = lookup(name); if (vp == NULL) { - vp = calloc(sizeof(*vp), 1); + if ((vp = calloc(1, sizeof(*vp))) == NULL) + err(1, "Out of memory"); vp->v_name = vcopy(name); vp->v_link = variables[h]; variables[h] = vp; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r302968 - stable/10/usr.bin/mail
Author: pfg Date: Sun Jul 17 18:32:33 2016 New Revision: 302968 URL: https://svnweb.freebsd.org/changeset/base/302968 Log: MFC r302511, r302771, r302845: mail(1): check for out of memory conditions when calling calloc(3). Modified: stable/10/usr.bin/mail/cmd3.c stable/10/usr.bin/mail/vars.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.bin/mail/cmd3.c == --- stable/10/usr.bin/mail/cmd3.c Sun Jul 17 18:23:20 2016 (r302967) +++ stable/10/usr.bin/mail/cmd3.c Sun Jul 17 18:32:33 2016 (r302968) @@ -463,7 +463,8 @@ group(char **argv) gname = *argv; h = hash(gname); if ((gh = findgroup(gname)) == NULL) { - gh = calloc(sizeof(*gh), 1); + if ((gh = calloc(1, sizeof(*gh))) == NULL) + err(1, "Out of memory"); gh->g_name = vcopy(gname); gh->g_list = NULL; gh->g_link = groups[h]; @@ -477,7 +478,8 @@ group(char **argv) */ for (ap = argv+1; *ap != NULL; ap++) { - gp = calloc(sizeof(*gp), 1); + if ((gp = calloc(1, sizeof(*gp))) == NULL) + err(1, "Out of memory"); gp->ge_name = vcopy(*ap); gp->ge_link = gh->g_list; gh->g_list = gp; @@ -702,7 +704,8 @@ alternates(char **namelist) } if (altnames != 0) (void)free(altnames); - altnames = calloc((unsigned)c, sizeof(char *)); + if ((altnames = calloc((unsigned)c, sizeof(char *))) == NULL) + err(1, "Out of memory"); for (ap = namelist, ap2 = altnames; *ap != NULL; ap++, ap2++) { cp = calloc((unsigned)strlen(*ap) + 1, sizeof(char)); strcpy(cp, *ap); Modified: stable/10/usr.bin/mail/vars.c == --- stable/10/usr.bin/mail/vars.c Sun Jul 17 18:23:20 2016 (r302967) +++ stable/10/usr.bin/mail/vars.c Sun Jul 17 18:32:33 2016 (r302968) @@ -56,7 +56,8 @@ assign(const char *name, const char *val h = hash(name); vp = lookup(name); if (vp == NULL) { - vp = calloc(sizeof(*vp), 1); + if ((vp = calloc(1, sizeof(*vp))) == NULL) + err(1, "Out of memory"); vp->v_name = vcopy(name); vp->v_link = variables[h]; variables[h] = vp; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r302967 - stable/11/usr.bin/mail
Author: pfg Date: Sun Jul 17 18:23:20 2016 New Revision: 302967 URL: https://svnweb.freebsd.org/changeset/base/302967 Log: MFC r302511, r302771, r302845: mail(1): check for out of memory conditions when calling calloc(3). Approved by: re (gjb) Modified: stable/11/usr.bin/mail/cmd3.c stable/11/usr.bin/mail/vars.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/mail/cmd3.c == --- stable/11/usr.bin/mail/cmd3.c Sun Jul 17 15:36:02 2016 (r302966) +++ stable/11/usr.bin/mail/cmd3.c Sun Jul 17 18:23:20 2016 (r302967) @@ -463,7 +463,8 @@ group(char **argv) gname = *argv; h = hash(gname); if ((gh = findgroup(gname)) == NULL) { - gh = calloc(sizeof(*gh), 1); + if ((gh = calloc(1, sizeof(*gh))) == NULL) + err(1, "Out of memory"); gh->g_name = vcopy(gname); gh->g_list = NULL; gh->g_link = groups[h]; @@ -477,7 +478,8 @@ group(char **argv) */ for (ap = argv+1; *ap != NULL; ap++) { - gp = calloc(sizeof(*gp), 1); + if ((gp = calloc(1, sizeof(*gp))) == NULL) + err(1, "Out of memory"); gp->ge_name = vcopy(*ap); gp->ge_link = gh->g_list; gh->g_list = gp; @@ -702,7 +704,8 @@ alternates(char **namelist) } if (altnames != 0) (void)free(altnames); - altnames = calloc((unsigned)c, sizeof(char *)); + if ((altnames = calloc((unsigned)c, sizeof(char *))) == NULL) + err(1, "Out of memory"); for (ap = namelist, ap2 = altnames; *ap != NULL; ap++, ap2++) { cp = calloc((unsigned)strlen(*ap) + 1, sizeof(char)); strcpy(cp, *ap); Modified: stable/11/usr.bin/mail/vars.c == --- stable/11/usr.bin/mail/vars.c Sun Jul 17 15:36:02 2016 (r302966) +++ stable/11/usr.bin/mail/vars.c Sun Jul 17 18:23:20 2016 (r302967) @@ -56,7 +56,8 @@ assign(const char *name, const char *val h = hash(name); vp = lookup(name); if (vp == NULL) { - vp = calloc(sizeof(*vp), 1); + if ((vp = calloc(1, sizeof(*vp))) == NULL) + err(1, "Out of memory"); vp->v_name = vcopy(name); vp->v_link = variables[h]; variables[h] = vp; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r302966 - head/sys/contrib/libnv
Author: oshogbo Date: Sun Jul 17 15:36:02 2016 New Revision: 302966 URL: https://svnweb.freebsd.org/changeset/base/302966 Log: Fix nvlist array memory leak. When we change nvl_array_next to NULL it means that we want to destroy or take nvlist_array. The nvpair, which stores next nvlist of nvlist_array element is no longer needed and can be freed. Submitted by: Adam Starak MFC after:1 week Modified: head/sys/contrib/libnv/nvlist.c Modified: head/sys/contrib/libnv/nvlist.c == --- head/sys/contrib/libnv/nvlist.c Sun Jul 17 15:29:31 2016 (r302965) +++ head/sys/contrib/libnv/nvlist.c Sun Jul 17 15:36:02 2016 (r302966) @@ -236,10 +236,12 @@ nvlist_set_array_next(nvlist_t *nvl, nvp NVLIST_ASSERT(nvl); - if (ele != NULL) + if (ele != NULL) { nvl->nvl_flags |= NV_FLAG_IN_ARRAY; - else + } else { nvl->nvl_flags &= ~NV_FLAG_IN_ARRAY; + nv_free(nvl->nvl_array_next); + } nvl->nvl_array_next = ele; } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r302965 - head/sys/contrib/libnv
Author: oshogbo Date: Sun Jul 17 15:29:31 2016 New Revision: 302965 URL: https://svnweb.freebsd.org/changeset/base/302965 Log: Fix memory leak in the nvlist string array. Submitted by: Adam Starak MFC after:1 week Modified: head/sys/contrib/libnv/nvpair.c Modified: head/sys/contrib/libnv/nvpair.c == --- head/sys/contrib/libnv/nvpair.c Sun Jul 17 15:23:32 2016 (r302964) +++ head/sys/contrib/libnv/nvpair.c Sun Jul 17 15:29:31 2016 (r302965) @@ -1945,6 +1945,7 @@ nvpair_free(nvpair_t *nvp) case NV_TYPE_STRING_ARRAY: for (i = 0; i < nvp->nvp_nitems; i++) nv_free(((char **)(intptr_t)nvp->nvp_data)[i]); + nv_free((char **)(intptr_t)nvp->nvp_data); break; } nv_free(nvp); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r302964 - in stable/10/sys: amd64/linux amd64/linux32 compat/linux conf i386/linux modules/linux modules/linux_common
Author: dchagin Date: Sun Jul 17 15:23:32 2016 New Revision: 302964 URL: https://svnweb.freebsd.org/changeset/base/302964 Log: MFC r302517: Fix a copy/paste bug introduced during X86_64 Linuxulator work. FreeBSD support NX bit on X86_64 processors out of the box, for i386 emulation use READ_IMPLIES_EXEC flag, introduced in r302515. While here move common part of mmap() and mprotect() code to the files in compat/linux to reduce code dupcliation between Linuxulator's. MFC r302518, r302626: Add linux_mmap.c to the appropriate conf/files. Added: stable/10/sys/compat/linux/linux_mmap.c - copied, changed from r302517, head/sys/compat/linux/linux_mmap.c stable/10/sys/compat/linux/linux_mmap.h - copied unchanged from r302517, head/sys/compat/linux/linux_mmap.h Modified: stable/10/sys/amd64/linux/linux.h stable/10/sys/amd64/linux/linux_machdep.c stable/10/sys/amd64/linux32/linux.h stable/10/sys/amd64/linux32/linux32_machdep.c stable/10/sys/conf/files.amd64 stable/10/sys/conf/files.i386 stable/10/sys/conf/files.pc98 stable/10/sys/i386/linux/linux.h stable/10/sys/i386/linux/linux_machdep.c stable/10/sys/modules/linux/Makefile stable/10/sys/modules/linux_common/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/amd64/linux/linux.h == --- stable/10/sys/amd64/linux/linux.h Sun Jul 17 15:11:23 2016 (r302963) +++ stable/10/sys/amd64/linux/linux.h Sun Jul 17 15:23:32 2016 (r302964) @@ -139,13 +139,6 @@ struct l_rlimit { l_ulong rlim_max; }; -/* mmap options */ -#defineLINUX_MAP_SHARED0x0001 -#defineLINUX_MAP_PRIVATE 0x0002 -#defineLINUX_MAP_FIXED 0x0010 -#defineLINUX_MAP_ANON 0x0020 -#defineLINUX_MAP_GROWSDOWN 0x0100 - /* * stat family of syscalls */ Modified: stable/10/sys/amd64/linux/linux_machdep.c == --- stable/10/sys/amd64/linux/linux_machdep.c Sun Jul 17 15:11:23 2016 (r302963) +++ stable/10/sys/amd64/linux/linux_machdep.c Sun Jul 17 15:23:32 2016 (r302964) @@ -83,6 +83,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -122,181 +123,19 @@ linux_set_upcall_kse(struct thread *td, return (0); } -#define STACK_SIZE (2 * 1024 * 1024) -#define GUARD_SIZE (4 * PAGE_SIZE) - int linux_mmap2(struct thread *td, struct linux_mmap2_args *args) { - struct proc *p = td->td_proc; - struct mmap_args /* { - caddr_t addr; - size_t len; - int prot; - int flags; - int fd; - long pad; - off_t pos; - } */ bsd_args; - int error; - struct file *fp; - cap_rights_t rights; - - LINUX_CTR6(mmap2, "0x%lx, %ld, %ld, 0x%08lx, %ld, 0x%lx", - args->addr, args->len, args->prot, - args->flags, args->fd, args->pgoff); - - error = 0; - bsd_args.flags = 0; - fp = NULL; - - /* -* Linux mmap(2): -* You must specify exactly one of MAP_SHARED and MAP_PRIVATE -*/ - if (! ((args->flags & LINUX_MAP_SHARED) ^ - (args->flags & LINUX_MAP_PRIVATE))) - return (EINVAL); - - if (args->flags & LINUX_MAP_SHARED) - bsd_args.flags |= MAP_SHARED; - if (args->flags & LINUX_MAP_PRIVATE) - bsd_args.flags |= MAP_PRIVATE; - if (args->flags & LINUX_MAP_FIXED) - bsd_args.flags |= MAP_FIXED; - if (args->flags & LINUX_MAP_ANON) - bsd_args.flags |= MAP_ANON; - else - bsd_args.flags |= MAP_NOSYNC; - if (args->flags & LINUX_MAP_GROWSDOWN) - bsd_args.flags |= MAP_STACK; - - /* -* PROT_READ, PROT_WRITE, or PROT_EXEC implies PROT_READ and PROT_EXEC -* on Linux/i386. We do this to ensure maximum compatibility. -* Linux/ia64 does the same in i386 emulation mode. -*/ - bsd_args.prot = args->prot; - if (bsd_args.prot & (PROT_READ | PROT_WRITE | PROT_EXEC)) - bsd_args.prot |= PROT_READ | PROT_EXEC; - - /* Linux does not check file descriptor when MAP_ANONYMOUS is set. */ - bsd_args.fd = (bsd_args.flags & MAP_ANON) ? -1 : args->fd; - if (bsd_args.fd != -1) { - /* -* Linux follows Solaris mmap(2) description: -* The file descriptor fildes is opened with -* read permission, regardless of the -* protection options specified. -*/ - - error = fget(td, bsd_args.fd, - cap_rights_init(&rights, CAP_MMAP), &fp); - if (error != 0 ) - return (error); -
svn commit: r302963 - in stable/10/sys: amd64/linux amd64/linux32 i386/linux
Author: dchagin Date: Sun Jul 17 15:11:23 2016 New Revision: 302963 URL: https://svnweb.freebsd.org/changeset/base/302963 Log: Regen for r302962 (Linux personality), record mergeinfo for r320516. Modified: stable/10/sys/amd64/linux/linux_proto.h stable/10/sys/amd64/linux/linux_syscall.h stable/10/sys/amd64/linux/linux_syscalls.c stable/10/sys/amd64/linux/linux_sysent.c stable/10/sys/amd64/linux/linux_systrace_args.c stable/10/sys/amd64/linux32/linux32_proto.h stable/10/sys/amd64/linux32/linux32_syscall.h stable/10/sys/amd64/linux32/linux32_syscalls.c stable/10/sys/amd64/linux32/linux32_sysent.c stable/10/sys/amd64/linux32/linux32_systrace_args.c stable/10/sys/i386/linux/linux_proto.h stable/10/sys/i386/linux/linux_syscall.h stable/10/sys/i386/linux/linux_syscalls.c stable/10/sys/i386/linux/linux_sysent.c stable/10/sys/i386/linux/linux_systrace_args.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/amd64/linux/linux_proto.h == --- stable/10/sys/amd64/linux/linux_proto.h Sun Jul 17 15:07:33 2016 (r302962) +++ stable/10/sys/amd64/linux/linux_proto.h Sun Jul 17 15:11:23 2016 (r302963) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: stable/10/sys/amd64/linux/syscalls.master 294368 2016-01-20 01:09:53Z jhb + * created from FreeBSD: stable/10/sys/amd64/linux/syscalls.master 302962 2016-07-17 15:07:33Z dchagin */ #ifndef _LINUX_SYSPROTO_H_ @@ -499,7 +499,7 @@ struct linux_mknod_args { char dev_l_[PADL_(l_dev_t)]; l_dev_t dev; char dev_r_[PADR_(l_dev_t)]; }; struct linux_personality_args { - char per_l_[PADL_(l_ulong)]; l_ulong per; char per_r_[PADR_(l_ulong)]; + char per_l_[PADL_(l_uint)]; l_uint per; char per_r_[PADR_(l_uint)]; }; struct linux_ustat_args { char dev_l_[PADL_(l_dev_t)]; l_dev_t dev; char dev_r_[PADR_(l_dev_t)]; Modified: stable/10/sys/amd64/linux/linux_syscall.h == --- stable/10/sys/amd64/linux/linux_syscall.h Sun Jul 17 15:07:33 2016 (r302962) +++ stable/10/sys/amd64/linux/linux_syscall.h Sun Jul 17 15:11:23 2016 (r302963) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: stable/10/sys/amd64/linux/syscalls.master 294368 2016-01-20 01:09:53Z jhb + * created from FreeBSD: stable/10/sys/amd64/linux/syscalls.master 302962 2016-07-17 15:07:33Z dchagin */ #defineLINUX_SYS_read 0 Modified: stable/10/sys/amd64/linux/linux_syscalls.c == --- stable/10/sys/amd64/linux/linux_syscalls.c Sun Jul 17 15:07:33 2016 (r302962) +++ stable/10/sys/amd64/linux/linux_syscalls.c Sun Jul 17 15:11:23 2016 (r302963) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: stable/10/sys/amd64/linux/syscalls.master 294368 2016-01-20 01:09:53Z jhb + * created from FreeBSD: stable/10/sys/amd64/linux/syscalls.master 302962 2016-07-17 15:07:33Z dchagin */ const char *linux_syscallnames[] = { Modified: stable/10/sys/amd64/linux/linux_sysent.c == --- stable/10/sys/amd64/linux/linux_sysent.cSun Jul 17 15:07:33 2016 (r302962) +++ stable/10/sys/amd64/linux/linux_sysent.cSun Jul 17 15:11:23 2016 (r302963) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: stable/10/sys/amd64/linux/syscalls.master 294368 2016-01-20 01:09:53Z jhb + * created from FreeBSD: stable/10/sys/amd64/linux/syscalls.master 302962 2016-07-17 15:07:33Z dchagin */ #include Modified: stable/10/sys/amd64/linux/linux_systrace_args.c == --- stable/10/sys/amd64/linux/linux_systrace_args.c Sun Jul 17 15:07:33 2016(r302962) +++ stable/10/sys/amd64/linux/linux_systrace_args.c Sun Jul 17 15:11:23 2016(r302963) @@ -1120,7 +1120,7 @@ systrace_args(int sysnum, void *params, /* linux_personality */ case 135: { struct linux_personality_args *p = params; - iarg[0] = p->per; /* l_ulong */ + iarg[0] = p->per; /* l_uint */ *n_args = 1; break; } @@ -4112,7 +4112,7 @@ systrace_entry_setargdesc(int sysnum, in case 135: switch(ndx) { case 0: - p = "l_ulong"; + p = "l_uint"; break; default: break; Modified: stable/10/sys/amd64/linux32/linux32_proto.h
svn commit: r302962 - in stable/10/sys: amd64/linux amd64/linux32 compat/linux i386/linux
Author: dchagin Date: Sun Jul 17 15:07:33 2016 New Revision: 302962 URL: https://svnweb.freebsd.org/changeset/base/302962 Log: MFC r302515: Implement Linux personality() system call mainly due to READ_IMPLIES_EXEC flag. In Linux if this flag is set, PROT_READ implies PROT_EXEC for mmap(). Linux/i386 set this flag automatically if the binary requires executable stack. READ_IMPLIES_EXEC flag will be used in the next Linux mmap() commit. Added: stable/10/sys/compat/linux/linux_persona.h - copied unchanged from r302515, head/sys/compat/linux/linux_persona.h Modified: stable/10/sys/amd64/linux/syscalls.master stable/10/sys/amd64/linux32/syscalls.master stable/10/sys/compat/linux/linux_emul.c stable/10/sys/compat/linux/linux_emul.h stable/10/sys/compat/linux/linux_misc.c stable/10/sys/i386/linux/syscalls.master Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/amd64/linux/syscalls.master == --- stable/10/sys/amd64/linux/syscalls.master Sun Jul 17 14:45:15 2016 (r302961) +++ stable/10/sys/amd64/linux/syscalls.master Sun Jul 17 15:07:33 2016 (r302962) @@ -270,7 +270,7 @@ 133AUE_MKNOD STD { int linux_mknod(char *path, l_int mode, \ l_dev_t dev); } 134AUE_USELIB UNIMPL uselib -135AUE_PERSONALITY STD { int linux_personality(l_ulong per); } +135AUE_PERSONALITY STD { int linux_personality(l_uint per); } 136AUE_NULLSTD { int linux_ustat(l_dev_t dev, \ struct l_ustat *ubuf); } 137AUE_STATFS STD { int linux_statfs(char *path, \ Modified: stable/10/sys/amd64/linux32/syscalls.master == --- stable/10/sys/amd64/linux32/syscalls.master Sun Jul 17 14:45:15 2016 (r302961) +++ stable/10/sys/amd64/linux32/syscalls.master Sun Jul 17 15:07:33 2016 (r302962) @@ -238,7 +238,7 @@ 134AUE_BDFLUSH STD { int linux_bdflush(void); } 135AUE_NULLSTD { int linux_sysfs(l_int option, \ l_ulong arg1, l_ulong arg2); } -136AUE_PERSONALITY STD { int linux_personality(l_ulong per); } +136AUE_PERSONALITY STD { int linux_personality(l_uint per); } 137AUE_NULLUNIMPL afs_syscall 138AUE_SETFSUIDSTD { int linux_setfsuid16(l_uid16_t uid); } 139AUE_SETFSGIDSTD { int linux_setfsgid16(l_gid16_t gid); } Modified: stable/10/sys/compat/linux/linux_emul.c == --- stable/10/sys/compat/linux/linux_emul.c Sun Jul 17 14:45:15 2016 (r302961) +++ stable/10/sys/compat/linux/linux_emul.c Sun Jul 17 15:07:33 2016 (r302962) @@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include @@ -127,7 +128,7 @@ linux_proc_init(struct thread *td, struc /* epoll should be destroyed in a case of exec. */ pem = pem_find(p); KASSERT(pem != NULL, ("proc_exit: proc emuldata not found.\n")); - + pem->persona = 0; if (pem->epoll != NULL) { emd = pem->epoll; pem->epoll = NULL; @@ -220,6 +221,9 @@ linux_proc_exec(void *arg __unused, stru { struct thread *td = curthread; struct thread *othertd; +#if defined(__amd64__) + struct linux_pemuldata *pem; +#endif /* * In a case of execing from linux binary properly detach @@ -243,6 +247,17 @@ linux_proc_exec(void *arg __unused, stru linux_proc_init(td, NULL, 0); else linux_proc_init(td, td, 0); +#if defined(__amd64__) + /* +* An IA32 executable which has executable stack will have the +* READ_IMPLIES_EXEC personality flag set automatically. +*/ + if (SV_PROC_FLAG(td->td_proc, SV_ILP32) && + imgp->stack_prot & VM_PROT_EXECUTE) { + pem = pem_find(p); + pem->persona |= LINUX_READ_IMPLIES_EXEC; + } +#endif } } Modified: stable/10/sys/compat/linux/linux_emul.h == --- stable/10/sys/compat/linux/linux_emul.h Sun Jul 17 14:45:15 2016 (r302961) +++ stable/10/sys/compat/linux/linux_emul.h Sun Jul 17 15:07:33 2016 (r302962) @@ -67,6 +67,7 @@ struct linux_pemuldata { uint32_tflags; /* process emuldata flags */ struct sx pem_sx; /* lock for this struct */ void*epoll; /* epoll data */ + uint32_tpersona;/* process execution domain */ }; #d
svn commit: r302961 - head/sys/arm/nvidia
Author: mmel Date: Sun Jul 17 14:45:15 2016 New Revision: 302961 URL: https://svnweb.freebsd.org/changeset/base/302961 Log: TEGRA: Subclass Tegra PCIE driver from ofw_pci base driver. Remove now redundant code. Modified: head/sys/arm/nvidia/tegra_pcie.c Modified: head/sys/arm/nvidia/tegra_pcie.c == --- head/sys/arm/nvidia/tegra_pcie.cSun Jul 17 14:17:58 2016 (r302960) +++ head/sys/arm/nvidia/tegra_pcie.cSun Jul 17 14:45:15 2016 (r302961) @@ -57,6 +57,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -64,100 +65,13 @@ __FBSDID("$FreeBSD$"); #include #include -#include "ofw_bus_if.h" -#include "pcib_if.h" - #include -/* --- Move to ofw_pci.c/.h --- */ - -struct tegra_pci_range { - /* parsed phys.hi */ - int nonrelocatable; - int prefetchable; - int aliased; - int space_code; /* In native format (not shifted)*/ - int bus; - int device; - int function; - int reg; - pci_addr_t pci_addr; /* PCI Address */ - bus_addr_t host_addr; /* Host bus address*/ - bus_size_t size; /* Range size */ -}; - -static int -tegra_pci_get_ranges(phandle_t node, struct tegra_pci_range **ranges) -{ - int host_address_cells, pci_address_cells, size_cells; - cell_t *base_ranges; - ssize_t nbase_ranges; - int nranges; - int i, j, k; - uint32_t flags; - uint64_t tmp; - - host_address_cells = 1; - pci_address_cells = 3; - size_cells = 2; - OF_getencprop(OF_parent(node), "#address-cells", &host_address_cells, - sizeof(host_address_cells)); - OF_getencprop(node, "#address-cells", &pci_address_cells, - sizeof(pci_address_cells)); - OF_getencprop(node, "#size-cells", &size_cells, sizeof(size_cells)); - - nbase_ranges = OF_getproplen(node, "ranges"); - if (nbase_ranges <= 0) - return (-1); - nranges = nbase_ranges / sizeof(cell_t) / - (pci_address_cells + host_address_cells + size_cells); - - *ranges = malloc(nranges * sizeof(struct tegra_pci_range), - M_DEVBUF, M_WAITOK); - base_ranges = malloc(nbase_ranges, M_DEVBUF, M_WAITOK); - OF_getencprop(node, "ranges", base_ranges, nbase_ranges); - - for (i = 0, j = 0; i < nranges; i++) { - flags = base_ranges[j++]; - (*ranges)[i].nonrelocatable = - flags & OFW_PCI_PHYS_HI_NONRELOCATABLE ? 1 : 0; - (*ranges)[i].prefetchable = - flags & OFW_PCI_PHYS_HI_PREFETCHABLE ? 1 : 0; - (*ranges)[i].aliased = - flags & OFW_PCI_PHYS_HI_ALIASED ? 1 : 0; - (*ranges)[i].space_code = flags & OFW_PCI_PHYS_HI_SPACEMASK; - (*ranges)[i].bus = OFW_PCI_PHYS_HI_BUS(flags); - (*ranges)[i].device = OFW_PCI_PHYS_HI_DEVICE(flags); - (*ranges)[i].function = OFW_PCI_PHYS_HI_FUNCTION(flags); - (*ranges)[i].reg = flags & OFW_PCI_PHYS_HI_REGISTERMASK; - - tmp = 0; - for (k = 0; k < pci_address_cells - 1; k++) { - tmp <<= 32; - tmp |= base_ranges[j++]; - } - (*ranges)[i].pci_addr = (pci_addr_t)tmp; - - tmp = 0; - for (k = 0; k < host_address_cells; k++) { - tmp <<= 32; - tmp |= base_ranges[j++]; - } - (*ranges)[i].host_addr = (bus_addr_t)tmp; - tmp = 0; +#include "ofw_bus_if.h" +#include "pcib_if.h" - for (k = 0; k < size_cells; k++) { - tmp <<= 32; - tmp |= base_ranges[j++]; - } - (*ranges)[i].size = (bus_size_t)tmp; - } - free(base_ranges, M_DEVBUF); - return (nranges); -} -/* -- */ #defineAFI_AXI_BAR0_SZ 0x000 #defineAFI_AXI_BAR1_SZ 0x004 #defineAFI_AXI_BAR2_SZ 0x008 @@ -358,12 +272,9 @@ struct tegra_pcib_port { #defineTEGRA_PCIB_MAX_PORTS3 struct tegra_pcib_softc { + struct ofw_pci_softcofw_pci; device_tdev; struct mtx mtx; - struct ofw_bus_iinfopci_iinfo; - struct rman pref_mem_rman; - struct rman mem_rman; - struct rman io_rman; struct resource *pads_mem_res; struct resource *afi_mem_res; struct resource *cfg_mem_res; @@
svn commit: r302960 - head/sys/cam/ata
Author: mav Date: Sun Jul 17 14:17:58 2016 New Revision: 302960 URL: https://svnweb.freebsd.org/changeset/base/302960 Log: Restore PIM_ATA_EXT flag handling, lost at r300207. This re-enables NCQ TRIM usage on capable hardware (bhyve). Modified: head/sys/cam/ata/ata_da.c Modified: head/sys/cam/ata/ata_da.c == --- head/sys/cam/ata/ata_da.c Sun Jul 17 14:16:21 2016(r302959) +++ head/sys/cam/ata/ata_da.c Sun Jul 17 14:17:58 2016(r302960) @@ -1774,6 +1774,8 @@ adaregister(struct cam_periph *periph, v softc->disk->d_flags |= DISKFLAG_UNMAPPED_BIO; softc->unmappedio = 1; } + if (cpi.hba_misc & PIM_ATA_EXT) + softc->flags |= ADA_FLAG_PIM_ATA_EXT; strlcpy(softc->disk->d_descr, cgd->ident_data.model, MIN(sizeof(softc->disk->d_descr), sizeof(cgd->ident_data.model))); strlcpy(softc->disk->d_ident, cgd->ident_data.serial, ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r302959 - stable/10/etc/rc.d
Author: jamie Date: Sun Jul 17 14:16:21 2016 New Revision: 302959 URL: https://svnweb.freebsd.org/changeset/base/302959 Log: MFC r302857: 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 Modified: stable/10/etc/rc.d/jail Directory Properties: stable/10/ (props changed) Modified: stable/10/etc/rc.d/jail == --- stable/10/etc/rc.d/jail Sun Jul 17 14:15:08 2016(r302958) +++ stable/10/etc/rc.d/jail Sun Jul 17 14:16:21 2016(r302959) @@ -433,6 +433,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 @@ -440,7 +443,7 @@ jail_start() echo $_id > /var/run/jail_${_name}.id done else - tail -1 $_tmp + cat $_tmp fi rm -f $_tmp echo '.' @@ -527,7 +530,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 @@ -550,7 +553,7 @@ jail_stop() _tmp=`mktemp -t jail` || exit 3 $command -q -f $_conf -r $_j >> $_tmp 2>&1 if $jail_jls -j $_j > /dev/null 2>&1; then - tail -1 $_tmp + cat $_tmp else rm -f /var/run/jail_${_j}.id fi ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r302958 - stable/10/usr.sbin/jail
Author: jamie Date: Sun Jul 17 14:15:08 2016 New Revision: 302958 URL: https://svnweb.freebsd.org/changeset/base/302958 Log: MFC r302856: 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 Modified: stable/10/usr.sbin/jail/command.c stable/10/usr.sbin/jail/jailp.h stable/10/usr.sbin/jail/state.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/jail/command.c == --- stable/10/usr.sbin/jail/command.c Sun Jul 17 14:13:47 2016 (r302957) +++ stable/10/usr.sbin/jail/command.c Sun Jul 17 14:15:08 2016 (r302958) @@ -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: stable/10/usr.sbin/jail/jailp.h == --- stable/10/usr.sbin/jail/jailp.h Sun Jul 17 14:13:47 2016 (r302957) +++ stable/10/usr.sbin/jail/jailp.h Sun Jul 17 14:15:08 2016 (r302958) @@ -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: stable/10/usr.sbin/jail/state.c == --- stable/10/usr.sbin/jail/state.c Sun Jul 17 14:13:47 2016 (r302957) +++ stable/10/usr.sbin/jail/state.c Sun Jul 17 14:15:08 2016 (r302958) @@ -398,6 +398,14 @@ requeue(struct cfjail *j, struct cfjails } } +void +requeue_head(struct cfjail *j, struct cfjails *queue) +{ +TAILQ_REMOVE(j->queue, j, tq); +TAILQ_INSERT_HEAD(queue, j, tq); +j->queue = queue; +} + /* * Add a dependency edge between two jails. */ ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r302957 - head/usr.sbin/bhyve
Author: mav Date: Sun Jul 17 14:13:47 2016 New Revision: 302957 URL: https://svnweb.freebsd.org/changeset/base/302957 Log: Fix NCQ TRIM emulation. When this code was written, there was no guests using it to test. Modified: head/usr.sbin/bhyve/pci_ahci.c Modified: head/usr.sbin/bhyve/pci_ahci.c == --- head/usr.sbin/bhyve/pci_ahci.c Sun Jul 17 14:12:34 2016 (r302956) +++ head/usr.sbin/bhyve/pci_ahci.c Sun Jul 17 14:13:47 2016 (r302957) @@ -837,7 +837,15 @@ next: done += 8; if (elen == 0) { if (done >= len) { - ahci_write_fis_d2h(p, slot, cfis, ATA_S_READY | ATA_S_DSC); + if (ncq) { + if (first) + ahci_write_fis_d2h_ncq(p, slot); + ahci_write_fis_sdb(p, slot, cfis, + ATA_S_READY | ATA_S_DSC); + } else { + ahci_write_fis_d2h(p, slot, cfis, + ATA_S_READY | ATA_S_DSC); + } p->pending &= ~(1 << slot); ahci_check_stopped(p); if (!first) @@ -1718,7 +1726,7 @@ ahci_handle_cmd(struct ahci_port *p, int case ATA_SEND_FPDMA_QUEUED: if ((cfis[13] & 0x1f) == ATA_SFPDMA_DSM && cfis[17] == 0 && cfis[16] == ATA_DSM_TRIM && - cfis[11] == 0 && cfis[13] == 1) { + cfis[11] == 0 && cfis[3] == 1) { ahci_handle_dsm_trim(p, slot, cfis, 0); break; } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r302956 - stable/10/etc/rc.d
Author: jamie Date: Sun Jul 17 14:12:34 2016 New Revision: 302956 URL: https://svnweb.freebsd.org/changeset/base/302956 Log: MFC r302855: 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: stable/10/etc/rc.d/jail Directory Properties: stable/10/ (props changed) Modified: stable/10/etc/rc.d/jail == --- stable/10/etc/rc.d/jail Sun Jul 17 14:07:51 2016(r302955) +++ stable/10/etc/rc.d/jail Sun Jul 17 14:12:34 2016(r302956) @@ -422,7 +422,7 @@ jail_status() jail_start() { - local _j _jv _jid _jl _id _name + local _j _jv _jid _id _name if [ $# = 0 ]; then return @@ -452,29 +452,30 @@ jail_start() # Start jails in parallel and then check jail id when # jail_parallel_start is YES. # - _jl= for _j in $@; do _j=$(echo $_j | tr /. _) _jv=$(echo -n $_j | tr -c '[:alnum:]' _) parse_options $_j $_jv || continue - _jl="$_jl $_j" eval rc_flags=\${jail_${_jv}_flags:-$jail_flags} eval command=\${jail_${_jv}_program:-$jail_program} command_args="-i -f $_conf -c $_j" - $command $rc_flags $command_args \ - >/dev/null 2>&1 /var/run/jail_${_j}.id - else - echo " cannot start jail " \ - "\"${_hostname:-${_j}}\": " - fi + ( + _tmp=`mktemp -t jail_${_j}` || exit 3 + if $command $rc_flags $command_args \ + >> $_tmp 2>&1 /var/run/jail_${_j}.id + else + echo " cannot start jail " \ + "\"${_hostname:-${_j}}\": " + cat $_tmp + fi + rm -f $_tmp + ) & done + wait else # # Start jails one-by-one when jail_parallel_start is NO. ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r302955 - stable/11/etc/rc.d
Author: jamie Date: Sun Jul 17 14:07:51 2016 New Revision: 302955 URL: https://svnweb.freebsd.org/changeset/base/302955 Log: MFC r302857: 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 Approved by: re (gjb) Modified: stable/11/etc/rc.d/jail Directory Properties: stable/11/ (props changed) Modified: stable/11/etc/rc.d/jail == --- stable/11/etc/rc.d/jail Sun Jul 17 14:06:17 2016(r302954) +++ stable/11/etc/rc.d/jail Sun Jul 17 14:07:51 2016(r302955) @@ -451,6 +451,9 @@ jail_start() command=$jail_program rc_flags=$jail_flags command_args="-f $jail_conf -c" + if ! checkyesno jail_parallel_start; then + command_args="$command_args -p1" + fi _tmp=`mktemp -t jail` || exit 3 if $command $rc_flags $command_args >> $_tmp 2>&1; then $jail_jls jid name | while read _id _name; do @@ -458,7 +461,7 @@ jail_start() echo $_id > /var/run/jail_${_name}.id done else - tail -1 $_tmp + cat $_tmp fi rm -f $_tmp echo '.' @@ -545,7 +548,7 @@ jail_stop() _tmp=`mktemp -t jail` || exit 3 $command $rc_flags $command_args $_j >> $_tmp 2>&1 if $jail_jls -j $_j > /dev/null 2>&1; then - tail -1 $_tmp + cat $_tmp else rm -f /var/run/jail_${_j}.id fi @@ -568,7 +571,7 @@ jail_stop() _tmp=`mktemp -t jail` || exit 3 $command -q -f $_conf -r $_j >> $_tmp 2>&1 if $jail_jls -j $_j > /dev/null 2>&1; then - tail -1 $_tmp + cat $_tmp else rm -f /var/run/jail_${_j}.id fi ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r302954 - stable/11/usr.sbin/jail
Author: jamie Date: Sun Jul 17 14:06:17 2016 New Revision: 302954 URL: https://svnweb.freebsd.org/changeset/base/302954 Log: MFC r302856: 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 Approved by: re (gjb) Modified: stable/11/usr.sbin/jail/command.c stable/11/usr.sbin/jail/jailp.h stable/11/usr.sbin/jail/state.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/jail/command.c == --- stable/11/usr.sbin/jail/command.c Sun Jul 17 14:05:11 2016 (r302953) +++ stable/11/usr.sbin/jail/command.c Sun Jul 17 14:06:17 2016 (r302954) @@ -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: stable/11/usr.sbin/jail/jailp.h == --- stable/11/usr.sbin/jail/jailp.h Sun Jul 17 14:05:11 2016 (r302953) +++ stable/11/usr.sbin/jail/jailp.h Sun Jul 17 14:06:17 2016 (r302954) @@ -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: stable/11/usr.sbin/jail/state.c == --- stable/11/usr.sbin/jail/state.c Sun Jul 17 14:05:11 2016 (r302953) +++ stable/11/usr.sbin/jail/state.c Sun Jul 17 14:06:17 2016 (r302954) @@ -397,6 +397,14 @@ requeue(struct cfjail *j, struct cfjails } } +void +requeue_head(struct cfjail *j, struct cfjails *queue) +{ +TAILQ_REMOVE(j->queue, j, tq); +TAILQ_INSERT_HEAD(queue, j, tq); +j->queue = queue; +} + /* * Add a dependency edge between two jails. */ ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r302953 - stable/11/etc/rc.d
Author: jamie Date: Sun Jul 17 14:05:11 2016 New Revision: 302953 URL: https://svnweb.freebsd.org/changeset/base/302953 Log: MFC r302855: 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 Approved by: re (gjb) Modified: stable/11/etc/rc.d/jail Directory Properties: stable/11/ (props changed) Modified: stable/11/etc/rc.d/jail == --- stable/11/etc/rc.d/jail Sun Jul 17 13:43:46 2016(r302952) +++ stable/11/etc/rc.d/jail Sun Jul 17 14:05:11 2016(r302953) @@ -440,7 +440,7 @@ jail_status() jail_start() { - local _j _jv _jid _jl _id _name + local _j _jv _jid _id _name if [ $# = 0 ]; then return @@ -470,29 +470,30 @@ jail_start() # Start jails in parallel and then check jail id when # jail_parallel_start is YES. # - _jl= for _j in $@; do _j=$(echo $_j | tr /. _) _jv=$(echo -n $_j | tr -c '[:alnum:]' _) parse_options $_j $_jv || continue - _jl="$_jl $_j" eval rc_flags=\${jail_${_jv}_flags:-$jail_flags} eval command=\${jail_${_jv}_program:-$jail_program} command_args="-i -f $_conf -c $_j" - $command $rc_flags $command_args \ - >/dev/null 2>&1 /var/run/jail_${_j}.id - else - echo " cannot start jail " \ - "\"${_hostname:-${_j}}\": " - fi + ( + _tmp=`mktemp -t jail_${_j}` || exit 3 + if $command $rc_flags $command_args \ + >> $_tmp 2>&1 /var/run/jail_${_j}.id + else + echo " cannot start jail " \ + "\"${_hostname:-${_j}}\": " + cat $_tmp + fi + rm -f $_tmp + ) & done + wait else # # Start jails one-by-one when jail_parallel_start is NO. ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r302952 - head/sys/dev/ofw
Author: mmel Date: Sun Jul 17 13:43:46 2016 New Revision: 302952 URL: https://svnweb.freebsd.org/changeset/base/302952 Log: OFWPCI: Add support for NEW_PCIB. MFC after: 3 weeks Modified: head/sys/dev/ofw/ofwpci.c head/sys/dev/ofw/ofwpci.h Modified: head/sys/dev/ofw/ofwpci.c == --- head/sys/dev/ofw/ofwpci.c Sun Jul 17 13:43:00 2016(r302951) +++ head/sys/dev/ofw/ofwpci.c Sun Jul 17 13:43:46 2016(r302952) @@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include @@ -145,6 +146,7 @@ ofw_pci_init(device_t dev) sc = device_get_softc(dev); sc->sc_initialized = 1; sc->sc_range = NULL; + sc->sc_pci_domain = device_get_unit(dev); cell_info = (struct ofw_pci_cell_info *)malloc(sizeof(*cell_info), M_DEVBUF, M_WAITOK | M_ZERO); @@ -336,7 +338,7 @@ ofw_pci_read_ivar(device_t dev, device_t switch (which) { case PCIB_IVAR_DOMAIN: - *result = device_get_unit(dev); + *result = sc->sc_pci_domain; return (0); case PCIB_IVAR_BUS: *result = sc->sc_bus; @@ -409,6 +411,13 @@ ofw_pci_alloc_resource(device_t bus, dev sc = device_get_softc(bus); +#if defined(NEW_PCIB) && defined(PCI_RES_BUS) + if (type == PCI_RES_BUS) { + return (pci_domain_alloc_bus(sc->sc_pci_domain, child, rid, + start, end, count, flags)); + } +#endif + rm = ofw_pci_get_rman(sc, type, flags); if (rm == NULL) { return (bus_generic_alloc_resource(bus, child, type, rid, @@ -447,6 +456,12 @@ ofw_pci_release_resource(device_t bus, d sc = device_get_softc(bus); +#if defined(NEW_PCIB) && defined(PCI_RES_BUS) + if (type == PCI_RES_BUS) + return (pci_domain_release_bus(sc->sc_pci_domain, child, rid, + res)); +#endif + rm = ofw_pci_get_rman(sc, type, rman_get_flags(res)); if (rm == NULL) { return (bus_generic_release_resource(bus, child, type, rid, @@ -566,6 +581,11 @@ ofw_pci_adjust_resource(device_t bus, de struct ofw_pci_softc *sc; sc = device_get_softc(bus); +#if defined(NEW_PCIB) && defined(PCI_RES_BUS) + if (type == PCI_RES_BUS) + return (pci_domain_adjust_bus(sc->sc_pci_domain, child, res, + start, end)); +#endif rm = ofw_pci_get_rman(sc, type, rman_get_flags(res)); if (rm == NULL) { Modified: head/sys/dev/ofw/ofwpci.h == --- head/sys/dev/ofw/ofwpci.h Sun Jul 17 13:43:00 2016(r302951) +++ head/sys/dev/ofw/ofwpci.h Sun Jul 17 13:43:46 2016(r302952) @@ -72,6 +72,7 @@ struct ofw_pci_softc { struct rman sc_pmem_rman; bus_space_tag_t sc_memt; bus_dma_tag_t sc_dmat; + int sc_pci_domain; struct ofw_bus_iinfosc_pci_iinfo; }; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r302951 - head/sys/dev/ofw
Author: mmel Date: Sun Jul 17 13:43:00 2016 New Revision: 302951 URL: https://svnweb.freebsd.org/changeset/base/302951 Log: OFWPCI: Improve resource handling. - add new rman for prefetchable memory. Is used only if given 'ranges' property contains prefetchable memory range. - not all ranges in 'ranges' property are subject for rman's filling. Tegra for example, have two addition records which are used for 'pci 'register' -> 'assigned-address' -> 'ranges' machinery. Add sc_ranges_mask for masking not rman related ranges. - consistently pass unknown (not managed at this level) resources allocation/release/adjust requests to parent. MFC after: 3 weeks Modified: head/sys/dev/ofw/ofwpci.c head/sys/dev/ofw/ofwpci.h Modified: head/sys/dev/ofw/ofwpci.c == --- head/sys/dev/ofw/ofwpci.c Sun Jul 17 13:33:35 2016(r302950) +++ head/sys/dev/ofw/ofwpci.c Sun Jul 17 13:43:00 2016(r302951) @@ -94,6 +94,7 @@ static phandle_t ofw_pci_get_node(device * local methods */ static int ofw_pci_fill_ranges(phandle_t, struct ofw_pci_range *); +static struct rman *ofw_pci_get_rman(struct ofw_pci_softc *, int, u_int); /* * Driver methods. @@ -137,7 +138,7 @@ ofw_pci_init(device_t dev) phandle_t node; u_int32_t busrange[2]; struct ofw_pci_range *rp; - int error; + int i, error; struct ofw_pci_cell_info *cell_info; node = ofw_bus_get_node(dev); @@ -201,17 +202,27 @@ ofw_pci_init(device_t dev) } sc->sc_mem_rman.rm_type = RMAN_ARRAY; - sc->sc_mem_rman.rm_descr = "PCI Memory"; + sc->sc_mem_rman.rm_descr = "PCI Non Prefetchable Memory"; error = rman_init(&sc->sc_mem_rman); if (error != 0) { device_printf(dev, "rman_init() failed. error = %d\n", error); goto out; } - for (rp = sc->sc_range; rp < sc->sc_range + sc->sc_nrange && - rp->pci_hi != 0; rp++) { + sc->sc_pmem_rman.rm_type = RMAN_ARRAY; + sc->sc_pmem_rman.rm_descr = "PCI Prefetchable Memory"; + error = rman_init(&sc->sc_pmem_rman); + if (error != 0) { + device_printf(dev, "rman_init() failed. error = %d\n", error); + goto out; + } + + for (i = 0; i < sc->sc_nrange; i++) { error = 0; + rp = sc->sc_range + i; + if (sc->sc_range_mask & ((uint64_t)1 << i)) + continue; switch (rp->pci_hi & OFW_PCI_PHYS_HI_SPACEMASK) { case OFW_PCI_PHYS_HI_SPACE_CONFIG: break; @@ -221,8 +232,14 @@ ofw_pci_init(device_t dev) break; case OFW_PCI_PHYS_HI_SPACE_MEM32: case OFW_PCI_PHYS_HI_SPACE_MEM64: - error = rman_manage_region(&sc->sc_mem_rman, rp->pci, - rp->pci + rp->size - 1); + if (rp->pci_hi & OFW_PCI_PHYS_HI_PREFETCHABLE) { + sc->sc_have_pmem = 1; + error = rman_manage_region(&sc->sc_pmem_rman, + rp->pci, rp->pci + rp->size - 1); + } else { + error = rman_manage_region(&sc->sc_mem_rman, + rp->pci, rp->pci + rp->size - 1); + } break; } @@ -244,6 +261,7 @@ out: free(sc->sc_range, M_DEVBUF); rman_fini(&sc->sc_io_rman); rman_fini(&sc->sc_mem_rman); + rman_fini(&sc->sc_pmem_rman); return (error); } @@ -385,28 +403,16 @@ ofw_pci_alloc_resource(device_t bus, dev struct rman *rm; int needactivate; + needactivate = flags & RF_ACTIVE; flags &= ~RF_ACTIVE; sc = device_get_softc(bus); - switch (type) { - case SYS_RES_MEMORY: - rm = &sc->sc_mem_rman; - break; - - case SYS_RES_IOPORT: - rm = &sc->sc_io_rman; - break; - - case SYS_RES_IRQ: - return (bus_alloc_resource(bus, type, rid, start, end, count, - flags)); - - default: - device_printf(bus, "unknown resource request from %s\n", - device_get_nameunit(child)); - return (NULL); + rm = ofw_pci_get_rman(sc, type, flags); + if (rm == NULL) { + return (bus_generic_alloc_resource(bus, child, type, rid, + start, end, count, flags)); } rv = rman_reserve_resource(rm, start, end, count, flags, child); @@ -435,15 +441,24 @@ static int ofw_pci_release_resource(device_t bus, device_t child, int type, int rid, struct resource *res) { + struct ofw_pci_softc *sc; + struct rman *rm; + int error;
svn commit: r302950 - head/sys/netinet
Author: tuexen Date: Sun Jul 17 13:33:35 2016 New Revision: 302950 URL: https://svnweb.freebsd.org/changeset/base/302950 Log: Add a constant required by RFC 7496. MFC after:3 days Modified: head/sys/netinet/sctp_uio.h Modified: head/sys/netinet/sctp_uio.h == --- head/sys/netinet/sctp_uio.h Sun Jul 17 13:14:51 2016(r302949) +++ head/sys/netinet/sctp_uio.h Sun Jul 17 13:33:35 2016(r302950) @@ -259,7 +259,8 @@ struct sctp_snd_all_completes { /* The lower four bits is an enumeration of PR-SCTP policies */ #define SCTP_PR_SCTP_NONE 0x/* Reliable transfer */ #define SCTP_PR_SCTP_TTL 0x0001/* Time based PR-SCTP */ -#define SCTP_PR_SCTP_BUF 0x0002/* Buffer based PR-SCTP */ +#define SCTP_PR_SCTP_PRIO 0x0002/* Buffer based PR-SCTP */ +#define SCTP_PR_SCTP_BUF SCTP_PR_SCTP_PRIO/* For backwards compatibility */ #define SCTP_PR_SCTP_RTX 0x0003/* Number of retransmissions based PR-SCTP */ #define SCTP_PR_SCTP_MAX SCTP_PR_SCTP_RTX #define SCTP_PR_SCTP_ALL 0x000f/* Used for aggregated stats */ ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r302949 - head/sys/netinet
Author: tuexen Date: Sun Jul 17 13:14:51 2016 New Revision: 302949 URL: https://svnweb.freebsd.org/changeset/base/302949 Log: Fix the PR-SCTP behaviour. This is done by rrs@. MFC after:3 days Modified: head/sys/netinet/sctp_constants.h head/sys/netinet/sctp_header.h head/sys/netinet/sctp_indata.c head/sys/netinet/sctp_output.c Modified: head/sys/netinet/sctp_constants.h == --- head/sys/netinet/sctp_constants.h Sun Jul 17 13:10:57 2016 (r302948) +++ head/sys/netinet/sctp_constants.h Sun Jul 17 13:14:51 2016 (r302949) @@ -345,6 +345,7 @@ __FBSDID("$FreeBSD$"); #define SCTP_RTT_FROM_NON_DATA 0 #define SCTP_RTT_FROM_DATA 1 +#define PR_SCTP_UNORDERED_FLAG 0x0001 /* IP hdr (20/40) + 12+2+2 (enet) + sctp common 12 */ #define SCTP_FIRST_MBUF_RESV 68 Modified: head/sys/netinet/sctp_header.h == --- head/sys/netinet/sctp_header.h Sun Jul 17 13:10:57 2016 (r302948) +++ head/sys/netinet/sctp_header.h Sun Jul 17 13:14:51 2016 (r302949) @@ -397,7 +397,7 @@ struct sctp_strseq { struct sctp_strseq_mid { uint16_t stream; - uint16_t reserved; + uint16_t flags; uint32_t msg_id; }; Modified: head/sys/netinet/sctp_indata.c == --- head/sys/netinet/sctp_indata.c Sun Jul 17 13:10:57 2016 (r302948) +++ head/sys/netinet/sctp_indata.c Sun Jul 17 13:14:51 2016 (r302949) @@ -5283,10 +5283,11 @@ sctp_kick_prsctp_reorder_queue(struct sc } } + static void sctp_flush_reassm_for_str_seq(struct sctp_tcb *stcb, struct sctp_association *asoc, -uint16_t stream, uint32_t seq) +uint16_t stream, uint32_t seq, int ordered, int old) { struct sctp_queued_to_read *control; struct sctp_stream_in *strm; @@ -5301,7 +5302,7 @@ sctp_flush_reassm_for_str_seq(struct sct * queue. */ strm = &asoc->strmin[stream]; - control = find_reasm_entry(strm, (uint32_t) seq, 0, 0); + control = find_reasm_entry(strm, (uint32_t) seq, ordered, old); if (control == NULL) { /* Not found */ return; @@ -5433,6 +5434,7 @@ sctp_handle_forward_tsn(struct sctp_tcb unsigned int num_str; uint32_t sequence; uint16_t stream; + uint16_t ordered, flags; int old; struct sctp_strseq *stseq, strseqbuf; struct sctp_strseq_mid *stseq_m, strseqbuf_m; @@ -5458,6 +5460,12 @@ sctp_handle_forward_tsn(struct sctp_tcb } stream = ntohs(stseq_m->stream); sequence = ntohl(stseq_m->msg_id); + flags = ntohs(stseq_m->flags); + if (flags & PR_SCTP_UNORDERED_FLAG) { + ordered = 0; + } else { + ordered = 1; + } } else { stseq = (struct sctp_strseq *)sctp_m_getptr(m, offset, sizeof(struct sctp_strseq), @@ -5468,6 +5476,7 @@ sctp_handle_forward_tsn(struct sctp_tcb } stream = ntohs(stseq->stream); sequence = (uint32_t) ntohs(stseq->sequence); + ordered = 1; } /* Convert */ @@ -5493,7 +5502,7 @@ sctp_handle_forward_tsn(struct sctp_tcb asoc->fragmented_delivery_inprogress = 0; } strm = &asoc->strmin[stream]; - sctp_flush_reassm_for_str_seq(stcb, asoc, stream, sequence); + sctp_flush_reassm_for_str_seq(stcb, asoc, stream, sequence, ordered, old); TAILQ_FOREACH(ctl, &stcb->sctp_ep->read_queue, next) { if ((ctl->sinfo_stream == stream) && (ctl->sinfo_ssn == sequence)) { Modified: head/sys/netinet/sctp_output.c == --- head/sys/netinet/sctp_output.c Sun Jul 17 13:10:57 2016 (r302948) +++ head/sys/netinet/sctp_output.c Sun Jul 17 13:14:51 2016 (r302949) @@ -10383,7 +10383,7 @@ sctp_fill_in_rest: /* no more to look at */ break; } - if (at->rec.data.rcv_flags & SCTP_DATA_UNORDERED) { + if ((at->rec.data.rcv_flags & SCTP_DATA_UNORDER
svn commit: r302948 - head/lib/libc/gen
Author: ache Date: Sun Jul 17 13:10:57 2016 New Revision: 302948 URL: https://svnweb.freebsd.org/changeset/base/302948 Log: Reflect pathnames sorting in collation order. Modified: head/lib/libc/gen/glob.3 Modified: head/lib/libc/gen/glob.3 == --- head/lib/libc/gen/glob.3Sun Jul 17 12:45:58 2016(r302947) +++ head/lib/libc/gen/glob.3Sun Jul 17 13:10:57 2016(r302948) @@ -194,7 +194,7 @@ If is set, backslash escaping is disabled. .It Dv GLOB_NOSORT By default, the pathnames are sorted in ascending -.Tn ASCII +collation order; this flag prevents that sorting (speeding up .Fn glob ) . ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r302947 - head/sys/dev/ahci
Author: mav Date: Sun Jul 17 12:45:58 2016 New Revision: 302947 URL: https://svnweb.freebsd.org/changeset/base/302947 Log: In AHCI_IRQ_MODE_AFTER mode do not clear interrupts below. This is probably a NOP change since IS register is not activery used for interrupts below the shared, but it looked odd to clear interrupts we did not handle. Modified: head/sys/dev/ahci/ahci.c Modified: head/sys/dev/ahci/ahci.c == --- head/sys/dev/ahci/ahci.cSun Jul 17 12:31:31 2016(r302946) +++ head/sys/dev/ahci/ahci.cSun Jul 17 12:45:58 2016(r302947) @@ -466,6 +466,7 @@ ahci_intr(void *data) } else {/* AHCI_IRQ_MODE_AFTER */ unit = irq->r_irq_rid - 1; is = ATA_INL(ctlr->r_mem, AHCI_IS); + is &= (0x << unit); } /* CCC interrupt is edge triggered. */ if (ctlr->ccc) ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r302946 - head/sys/dev/ahci
Author: mav Date: Sun Jul 17 12:31:31 2016 New Revision: 302946 URL: https://svnweb.freebsd.org/changeset/base/302946 Log: Do not consider the last interrupt shared if there are enough interrupts for all channels. Modified: head/sys/dev/ahci/ahci.c Modified: head/sys/dev/ahci/ahci.c == --- head/sys/dev/ahci/ahci.cSun Jul 17 11:43:27 2016(r302945) +++ head/sys/dev/ahci/ahci.cSun Jul 17 12:31:31 2016(r302946) @@ -416,7 +416,8 @@ ahci_setup_interrupt(device_t dev) else if (ctlr->numirqs == 1 || i >= ctlr->channels || (ctlr->ccc && i == ctlr->cccv)) ctlr->irqs[i].mode = AHCI_IRQ_MODE_ALL; - else if (i == ctlr->numirqs - 1) + else if (ctlr->channels > ctlr->numirqs && + i == ctlr->numirqs - 1) ctlr->irqs[i].mode = AHCI_IRQ_MODE_AFTER; else ctlr->irqs[i].mode = AHCI_IRQ_MODE_ONE; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r302945 - head/usr.bin/netstat
Author: tuexen Date: Sun Jul 17 11:43:27 2016 New Revision: 302945 URL: https://svnweb.freebsd.org/changeset/base/302945 Log: Don't duplicate code for SCTP, just use the ones used for UDP and TCP. This fixes a bug with link local addresses. This will require and upcoming change in the kernel to bring SCTP to the same behaviour as UDP and TCP. MFC after:3 days Modified: head/usr.bin/netstat/sctp.c Modified: head/usr.bin/netstat/sctp.c == --- head/usr.bin/netstat/sctp.c Sun Jul 17 11:25:24 2016(r302944) +++ head/usr.bin/netstat/sctp.c Sun Jul 17 11:43:27 2016(r302945) @@ -104,93 +104,14 @@ struct xraddr_entry { LIST_ENTRY(xraddr_entry) xraddr_entries; }; -/* - * Construct an Internet address representation. - * If numeric_addr has been supplied, give - * numeric value, otherwise try for symbolic name. - */ #ifdef INET -static char * -inetname(struct in_addr *inp) -{ - char *cp; - static char line[MAXHOSTNAMELEN]; - struct hostent *hp; - struct netent *np; - - cp = 0; - if (!numeric_addr && inp->s_addr != INADDR_ANY) { - int net = inet_netof(*inp); - int lna = inet_lnaof(*inp); - - if (lna == INADDR_ANY) { - np = getnetbyaddr(net, AF_INET); - if (np) - cp = np->n_name; - } - if (cp == NULL) { - hp = gethostbyaddr((char *)inp, sizeof (*inp), AF_INET); - if (hp) { - cp = hp->h_name; - trimdomain(cp, strlen(cp)); - } - } - } - if (inp->s_addr == INADDR_ANY) - strcpy(line, "*"); - else if (cp) { - strlcpy(line, cp, sizeof(line)); - } else { - inp->s_addr = ntohl(inp->s_addr); -#defineC(x)((u_int)((x) & 0xff)) - sprintf(line, "%u.%u.%u.%u", C(inp->s_addr >> 24), - C(inp->s_addr >> 16), C(inp->s_addr >> 8), C(inp->s_addr)); - inp->s_addr = htonl(inp->s_addr); - } - return (line); -} +char * +inetname(struct in_addr *inp); #endif #ifdef INET6 -static char ntop_buf[INET6_ADDRSTRLEN]; - -static char * -inet6name(struct in6_addr *in6p) -{ - char *cp; - static char line[50]; - struct hostent *hp; - static char domain[MAXHOSTNAMELEN]; - static int first = 1; - - if (first && !numeric_addr) { - first = 0; - if (gethostname(domain, MAXHOSTNAMELEN) == 0 && - (cp = strchr(domain, '.'))) - (void) strcpy(domain, cp + 1); - else - domain[0] = 0; - } - cp = 0; - if (!numeric_addr && !IN6_IS_ADDR_UNSPECIFIED(in6p)) { - hp = gethostbyaddr((char *)in6p, sizeof(*in6p), AF_INET6); - if (hp) { - if ((cp = strchr(hp->h_name, '.')) && - !strcmp(cp + 1, domain)) - *cp = 0; - cp = hp->h_name; - } - } - if (IN6_IS_ADDR_UNSPECIFIED(in6p)) - strcpy(line, "*"); - else if (cp) - strcpy(line, cp); - else - sprintf(line, "%s", - inet_ntop(AF_INET6, (void *)in6p, ntop_buf, - sizeof(ntop_buf))); - return (line); -} +char * +inet6name(struct in6_addr *in6p); #endif static void ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r302944 - head/lib/libc/gen
Author: ache Date: Sun Jul 17 11:25:24 2016 New Revision: 302944 URL: https://svnweb.freebsd.org/changeset/base/302944 Log: In g_Ctoc() apply CHAR() macro to *str to strip all flags. It gains nothing right now, but some architectures theoretically may 64-bit wchar_t and the code looks more correct. Modified: head/lib/libc/gen/glob.c Modified: head/lib/libc/gen/glob.c == --- head/lib/libc/gen/glob.cSun Jul 17 09:39:59 2016(r302943) +++ head/lib/libc/gen/glob.cSun Jul 17 11:25:24 2016(r302944) @@ -979,14 +979,14 @@ g_Ctoc(const Char *str, char *buf, size_ memset(&mbs, 0, sizeof(mbs)); while (len >= MB_CUR_MAX) { - clen = wcrtomb(buf, *str, &mbs); + clen = wcrtomb(buf, CHAR(*str), &mbs); if (clen == (size_t)-1) { /* XXX See initial comment #2. */ - *buf = (char)*str; + *buf = (char)CHAR(*str); clen = 1; memset(&mbs, 0, sizeof(mbs)); } - if (*buf == '\0') + if (CHAR(*str) == EOS) return (0); str++; buf += clen; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r302943 - head/lib/libc/gen
Author: ache Date: Sun Jul 17 09:39:59 2016 New Revision: 302943 URL: https://svnweb.freebsd.org/changeset/base/302943 Log: 1) This file full of direct char <-> wchar_t assignment, not converted, cut them down. This hack still remains: * 2. Illegal byte sequences in filenames are handled by treating them as *single-byte characters with a values of such bytes of the sequence *cast to wchar_t. 2) Reword the comment in the hack above to reflect implementation. 3) Protect signed wchar_t from sign extension when a signed char is assigned to it in the hack above. 3) Corresponding backward hack in g_Ctoc() was not implemented, so all pathes with illegal byte sequences are skipped as result, implement it now. 4) globtilde() forget to convert expanded user home dir from multibyte to wchar. 5) Protect globtilde() from long expansion truncation. 6) Results was not sorted according to collate as POSIX requires. Modified: head/lib/libc/gen/glob.c Modified: head/lib/libc/gen/glob.c == --- head/lib/libc/gen/glob.cSun Jul 17 08:31:21 2016(r302942) +++ head/lib/libc/gen/glob.cSun Jul 17 09:39:59 2016(r302943) @@ -71,7 +71,7 @@ __FBSDID("$FreeBSD$"); * 1. Patterns with illegal byte sequences match nothing - even if *GLOB_NOCHECK is specified. * 2. Illegal byte sequences in filenames are handled by treating them as - *single-byte characters with a value of the first byte of the sequence + *single-byte characters with a values of such bytes of the sequence *cast to wchar_t. * 3. State-dependent encodings are not currently supported. */ @@ -113,23 +113,21 @@ struct glob_limit { size_t l_string_cnt; }; -#defineDOLLAR '$' -#defineDOT '.' -#defineEOS '\0' -#defineLBRACKET'[' -#defineNOT '!' -#defineQUESTION'?' -#defineQUOTE '\\' -#defineRANGE '-' -#defineRBRACKET']' -#defineSEP '/' -#defineSTAR'*' -#defineTILDE '~' -#defineUNDERSCORE '_' -#defineLBRACE '{' -#defineRBRACE '}' -#defineSLASH '/' -#defineCOMMA ',' +#defineDOT L'.' +#defineEOS L'\0' +#defineLBRACKETL'[' +#defineNOT L'!' +#defineQUESTIONL'?' +#defineQUOTE L'\\' +#defineRANGE L'-' +#defineRBRACKETL']' +#defineSEP L'/' +#defineSTARL'*' +#defineTILDE L'~' +#defineLBRACE L'{' +#defineRBRACE L'}' +#defineSLASH L'/' +#defineCOMMA L',' #ifndef DEBUG @@ -154,12 +152,12 @@ typedef char Char; #defineCHAR(c) ((Char)((c)&M_CHAR)) #defineMETA(c) ((Char)((c)|M_QUOTE)) -#defineM_ALL META('*') -#defineM_END META(']') -#defineM_NOT META('!') -#defineM_ONE META('?') -#defineM_RNG META('-') -#defineM_SET META('[') +#defineM_ALL META(L'*') +#defineM_END META(L']') +#defineM_NOT META(L'!') +#defineM_ONE META(L'?') +#defineM_RNG META(L'-') +#defineM_SET META(L'[') #defineismeta(c) (((c)&M_QUOTE) != 0) @@ -233,8 +231,8 @@ glob(const char * __restrict pattern, in /* Protect the quoted characters. */ memset(&mbs, 0, sizeof(mbs)); while (bufend - bufnext >= MB_CUR_MAX) { - if (*patnext == QUOTE) { - if (*++patnext == EOS) { + if (*patnext == '\\') { + if (*++patnext == '\0') { *bufnext++ = QUOTE | M_PROTECT; continue; } @@ -401,9 +399,15 @@ static const Char * globtilde(const Char *pattern, Char *patbuf, size_t patbuf_len, glob_t *pglob) { struct passwd *pwd; - char *h; + char *h, *sc; const Char *p; Char *b, *eb; + wchar_t wc; + wchar_t wbuf[MAXPATHLEN]; + wchar_t *wbufend, *dc; + size_t clen; + mbstate_t mbs; + int too_long; if (*pattern != TILDE || !(pglob->gl_flags & GLOB_TILDE)) return (pattern); @@ -412,13 +416,17 @@ globtilde(const Char *pattern, Char *pat * Copy up to the end of the string or / */ eb = &patbuf[patbuf_len - 1]; - for (p = pattern + 1, h = (char *) pa
svn commit: r302942 - head/sys/netinet
Author: tuexen Date: Sun Jul 17 08:31:21 2016 New Revision: 302942 URL: https://svnweb.freebsd.org/changeset/base/302942 Log: Add missing sctps_reasmusrmsgs counter. Joint work with rrs@. MFC after:3 days Modified: head/sys/netinet/sctp_indata.c Modified: head/sys/netinet/sctp_indata.c == --- head/sys/netinet/sctp_indata.c Sat Jul 16 19:35:04 2016 (r302941) +++ head/sys/netinet/sctp_indata.c Sun Jul 17 08:31:21 2016 (r302942) @@ -823,6 +823,7 @@ restart: if (control->on_strm_q) { TAILQ_REMOVE(&strm->uno_inqueue, control, next_instrm); control->on_strm_q = 0; + SCTP_STAT_INCR_COUNTER64(sctps_reasmusrmsgs); } if (control->on_read_q == 0) { sctp_add_to_readq(stcb->sctp_ep, stcb, control, @@ -1028,6 +1029,7 @@ sctp_deliver_reasm_check(struct sctp_tcb control, control->on_strm_q); } #endif + SCTP_STAT_INCR_COUNTER64(sctps_reasmusrmsgs); TAILQ_REMOVE(&strm->uno_inqueue, control, next_instrm); control->on_strm_q = 0; } @@ -1082,6 +1084,7 @@ done_un: control, control->on_strm_q); } #endif + SCTP_STAT_INCR_COUNTER64(sctps_reasmusrmsgs); TAILQ_REMOVE(&strm->inqueue, control, next_instrm); control->on_strm_q = 0; } @@ -1127,6 +1130,7 @@ deliver_more: control, control->on_strm_q); } #endif + SCTP_STAT_INCR_COUNTER64(sctps_reasmusrmsgs); TAILQ_REMOVE(&strm->inqueue, control, next_instrm); control->on_strm_q = 0; } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"