svn commit: r312664 - head/usr.bin/mail
Author: delphij Date: Mon Jan 23 07:32:47 2017 New Revision: 312664 URL: https://svnweb.freebsd.org/changeset/base/312664 Log: Always initialize 'c'. MFC after:2 weeks Modified: head/usr.bin/mail/send.c Modified: head/usr.bin/mail/send.c == --- head/usr.bin/mail/send.cMon Jan 23 06:04:43 2017(r312663) +++ head/usr.bin/mail/send.cMon Jan 23 07:32:47 2017(r312664) @@ -59,7 +59,7 @@ sendmessage(struct message *mp, FILE *ob FILE *ibuf; char *cp, *cp2, line[LINESIZE]; int ishead, infld, ignoring, dostat, firstline; - int c, length, prefixlen; + int c = 0, length, prefixlen; /* * Compute the prefix string, without trailing whitespace ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r312663 - head/usr.bin/mail
Author: delphij Date: Mon Jan 23 06:04:43 2017 New Revision: 312663 URL: https://svnweb.freebsd.org/changeset/base/312663 Log: When creating record file, use umask 077 instead of the default. MFC after:2 weeks Modified: head/usr.bin/mail/send.c Modified: head/usr.bin/mail/send.c == --- head/usr.bin/mail/send.cMon Jan 23 04:47:38 2017(r312662) +++ head/usr.bin/mail/send.cMon Jan 23 06:04:43 2017(r312663) @@ -566,8 +566,13 @@ savemail(char name[], FILE *fi) char buf[BUFSIZ]; int i; time_t now; + mode_t saved_umask; - if ((fo = Fopen(name, "a")) == NULL) { + saved_umask = umask(077); + fo = Fopen(name, "a"); + umask(saved_umask); + + if (fo == NULL) { warn("%s", name); return (-1); } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r312662 - head/sys/dev/ath
Author: adrian Date: Mon Jan 23 04:47:38 2017 New Revision: 312662 URL: https://svnweb.freebsd.org/changeset/base/312662 Log: [ath] modify cabq and per-node packet usage limits. * limit cabq to 64 - in practice if this stays at ath_txbuf then all buffers can be tied up by a very busy broadcast domain (eg ARP storm, way too much MDNS/NETBIOS). It's been like this in the freebsd-wifi-build AP project for the longest time. * Now that I figured out the hilarity inherent in aggregate forming and AR9380 EDMA work, change the per-node to 64 frames by default. I'll do some more work to shorten the queue latency introduced when doing data so TCP isn't so terrible, but it's now no longer /always/ tens of milliseconds of extra latency when doing active iperf tests. Notes: The reason for the extra latency is partly tx/rx taskqueue handling and scheduling, and partly due to a lack of airtime/QoS awareness of per-node traffic. Ideally we'd have different limits/priorities on the QoS/TID levels per node so say, voice/video data got a better share of buffer allocations over best effort/bulk data, but we currently don't implement that. It's not /hard/ to do, I just need to do it. Tested: * AR9380 (STA), AR9580 (hostap) - both with the relevant changes. TCP is now at around 180mbit with rate control and RTS protection enabled. UDP stays at 355mbit at MCS23, no HT protection. Modified: head/sys/dev/ath/if_ath.c Modified: head/sys/dev/ath/if_ath.c == --- head/sys/dev/ath/if_ath.c Mon Jan 23 04:30:08 2017(r312661) +++ head/sys/dev/ath/if_ath.c Mon Jan 23 04:47:38 2017(r312662) @@ -1028,12 +1028,16 @@ ath_attach(u_int16_t devid, struct ath_s * otherwise) to be transmitted. */ sc->sc_txq_data_minfree = 10; + /* -* Leave this as default to maintain legacy behaviour. -* Shortening the cabq/mcastq may end up causing some -* undesirable behaviour. +* Shorten this to 64 packets, or 1/4 ath_txbuf, whichever +* is smaller. +* +* Anything bigger can potentially see the cabq consume +* almost all buffers, starving everything else, only to +* see most fail to transmit in the given beacon interval. */ - sc->sc_txq_mcastq_maxdepth = ath_txbuf; + sc->sc_txq_mcastq_maxdepth = MIN(64, ath_txbuf / 4); /* * How deep can the node software TX queue get whilst it's asleep. @@ -1041,11 +1045,10 @@ ath_attach(u_int16_t devid, struct ath_s sc->sc_txq_node_psq_maxdepth = 16; /* -* Default the maximum queue depth for a given node -* to 1/4'th the TX buffers, or 64, whichever -* is larger. +* Default the maximum queue to to 1/4'th the TX buffers, or +* 64, whichever is smaller. */ - sc->sc_txq_node_maxdepth = MAX(64, ath_txbuf / 4); + sc->sc_txq_node_maxdepth = MIN(64, ath_txbuf / 4); /* Enable CABQ by default */ sc->sc_cabq_enable = 1; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r286700 - in head: sbin/ifconfig sys/net
It's been a long while since we looked at this. We have moved along to other projects. I am sorry, I cannot be of much help now. Regards LN On Sat, Jan 21, 2017 at 8:07 AM, Ravi Pokalawrote: > -Original Message- > > From: on behalf of Hiren Panchasara < > hi...@freebsd.org> > > Date: 2017-01-18, Wednesday at 14:38 > > To: Alan Somers , , > , > > Cc: "src-committ...@freebsd.org" , " > svn-src-...@freebsd.org" , " > svn-src-head@freebsd.org" > > Subject: Re: svn commit: r286700 - in head: sbin/ifconfig sys/net > > > > Adding the submitter and other reviewers for their comments. > > > > On 01/18/17 at 03:03P, Alan Somers wrote: > >> Is the change to lacp_port_create correct? The comment indicates that > >> fast is configurable, but it's actually constant. Later on, there's > >> some dead code that depends on the value of fast (it was dead before > >> this commit, too). > >> > >> CID: 1305734 > >> CID: 1305692 > > You're right that in lacp_port_create(), "fast" (and "active") are both > constant. I think the comment intended to indicate that "fast" could be > changed via ioctl *after create*. > > It seems to me that the right thing to do would be to remove both "fast" > and "active" from lacp_port_create(), and have it unconditionally set > "lp->lp_state" to LACP_STATE_ACTIVITY. That would eliminate the unclear > comments and fix both Coverity issues, without changing any behavior. > > -Ravi (rpokala@) > > >> -Alan > >> > >> On Wed, Aug 12, 2015 at 2:21 PM, Hiren Panchasara > wrote: > >>> Author: hiren > >>> Date: Wed Aug 12 20:21:04 2015 > >>> New Revision: 286700 > >>> URL: https://svnweb.freebsd.org/changeset/base/286700 > >>> > >>> Log: > >>> Make LAG LACP fast timeout tunable through IOCTL. > >>> > >>> Differential Revision:D3300 > >>> Submitted by: LN Sundararajan > >>> Reviewed by: wblock, smh, gnn, hiren, rpokala at panasas > >>> MFC after:2 weeks > >>> Sponsored by: Panasas > >>> > >>> Modified: > >>> head/sbin/ifconfig/ifconfig.8 > >>> head/sbin/ifconfig/iflagg.c > >>> head/sys/net/ieee8023ad_lacp.c > >>> head/sys/net/ieee8023ad_lacp.h > >>> head/sys/net/if_lagg.c > >>> head/sys/net/if_lagg.h > >>> > >>> Modified: head/sbin/ifconfig/ifconfig.8 > >>> > == > >>> --- head/sbin/ifconfig/ifconfig.8 Wed Aug 12 20:16:13 2015 > (r286699) > >>> +++ head/sbin/ifconfig/ifconfig.8 Wed Aug 12 20:21:04 2015 > (r286700) > >>> @@ -28,7 +28,7 @@ > >>> .\" From: @(#)ifconfig.8 8.3 (Berkeley) 1/5/94 > >>> .\" $FreeBSD$ > >>> .\" > >>> -.Dd May 15, 2015 > >>> +.Dd Aug 12, 2015 > >>> .Dt IFCONFIG 8 > >>> .Os > >>> .Sh NAME > >>> @@ -2396,6 +2396,10 @@ Disable local hash computation for RSS h > >>> Set a shift parameter for RSS local hash computation. > >>> Hash is calculated by using flowid bits in a packet header mbuf > >>> which are shifted by the number of this parameter. > >>> +.It Cm lacp_fast_timeout > >>> +Enable lacp fast-timeout on the interface. > >>> +.It Cm -lacp_fast_timeout > >>> +Disable lacp fast-timeout on the interface. > >>> .El > >>> .Pp > >>> The following parameters are specific to IP tunnel interfaces, > >>> > >>> Modified: head/sbin/ifconfig/iflagg.c > >>> > == > >>> --- head/sbin/ifconfig/iflagg.c Wed Aug 12 20:16:13 2015 > (r286699) > >>> +++ head/sbin/ifconfig/iflagg.c Wed Aug 12 20:21:04 2015 > (r286700) > >>> @@ -115,6 +115,8 @@ setlaggsetopt(const char *val, int d, in > >>> case -LAGG_OPT_LACP_TXTEST: > >>> case LAGG_OPT_LACP_RXTEST: > >>> case -LAGG_OPT_LACP_RXTEST: > >>> + case LAGG_OPT_LACP_TIMEOUT: > >>> + case -LAGG_OPT_LACP_TIMEOUT: > >>> break; > >>> default: > >>> err(1, "Invalid lagg option"); > >>> @@ -293,6 +295,8 @@ static struct cmd lagg_cmds[] = { > >>> DEF_CMD("-lacp_txtest", -LAGG_OPT_LACP_TXTEST, setlaggsetopt), > >>> DEF_CMD("lacp_rxtest", LAGG_OPT_LACP_RXTEST, setlaggsetopt), > >>> DEF_CMD("-lacp_rxtest", -LAGG_OPT_LACP_RXTEST, setlaggsetopt), > >>> + DEF_CMD("lacp_fast_timeout",LAGG_OPT_LACP_TIMEOUT, > setlaggsetopt), > >>> + DEF_CMD("-lacp_fast_timeout", -LAGG_OPT_LACP_TIMEOUT, > setlaggsetopt), > >>> DEF_CMD_ARG("flowid_shift", setlaggflowidshift), > >>> }; > >>> static struct afswtch af_lagg = { > >>> > >>> Modified: head/sys/net/ieee8023ad_lacp.c > >>> > == > >>> --- head/sys/net/ieee8023ad_lacp.c Wed Aug 12 20:16:13 2015 > (r286699) > >>>
svn commit: r312661 - head/sys/dev/ath
Author: adrian Date: Mon Jan 23 04:30:08 2017 New Revision: 312661 URL: https://svnweb.freebsd.org/changeset/base/312661 Log: [ath] fix thresholds for deciding to queue to the software queue and populate hardware frames This is two fixes, which establishes what I /think/ is pretty close to the theoretical PHY maximum speed on the AR9380 devices. * When doing A-MPDU on a TID, don't queue to the hardware directly if the hardware queue is busy. This gives us time to get more packets queued up (and the hardware is busy, so there's no point in queuing more to the hardware right now) to potentially form an A-MPDU. This fixes up the throughput issue I was seeing where a couple hundred single frames were being sent a second interspersed between A-MPDU frames. It just happened that the software queue had exactly one frame in it at that point. Queuing it until the hardware finishes transmitting isn't exactly costly. * When determining whether to dequeue from a software node/TID queue into the hardware queue, fix up the checks to work right for EDMA chips (ar9380 and later.) Before it was not dispatching anything until the FIFO was empty. Now we allow it to dispatch another aggregate up to the hardware aggregate limit, like I intended with the earlier work. This allows a 5GHz HT40, short-GI, "htprotmode off" test at MCS23 to achieve 357 Mbit/sec in a one-way UDP test. The stars have to be aligned /just right/ so there are no retries but it can happen. Just don't expect it to work in an OTA test if your 2yo is running around the room - MCS23 is very very sensitive to channel conditions. Tested: * AR9380 STA (test) -> AR9580 hostap TODO: * More thorough testing on pre-AR9380 chips (AR5416, AR9160, AR9280) * (Finally) teach ath_rate_sample about throughput/latency rather than air time, so I can get good transmit rates with a 2yo running around. Modified: head/sys/dev/ath/if_ath_tx.c Modified: head/sys/dev/ath/if_ath_tx.c == --- head/sys/dev/ath/if_ath_tx.cMon Jan 23 04:20:37 2017 (r312660) +++ head/sys/dev/ath/if_ath_tx.cMon Jan 23 04:30:08 2017 (r312661) @@ -3129,7 +3129,21 @@ ath_tx_swq(struct ath_softc *sc, struct ATH_TID_INSERT_TAIL(atid, bf, bf_list); /* XXX sched? */ } else if (ath_tx_ampdu_running(sc, an, tid)) { - /* AMPDU running, attempt direct dispatch if possible */ + /* +* AMPDU running, queue single-frame if the hardware queue +* isn't busy. +* +* If the hardware queue is busy, sending an aggregate frame +* then just hold off so we can queue more aggregate frames. +* +* Otherwise we may end up with single frames leaking through +* because we are dispatching them too quickly. +* +* TODO: maybe we should treat this as two policies - minimise +* latency, or maximise throughput. Then for BE/BK we can +* maximise throughput, and VO/VI (if AMPDU is enabled!) +* minimise latency. +*/ /* * Always queue the frame to the tail of the list. @@ -3138,18 +3152,18 @@ ath_tx_swq(struct ath_softc *sc, struct /* * If the hardware queue isn't busy, direct dispatch -* the head frame in the list. Don't schedule the -* TID - let it build some more frames first? +* the head frame in the list. * -* When running A-MPDU, always just check the hardware -* queue depth against the aggregate frame limit. -* We don't want to burst a large number of single frames -* out to the hardware; we want to aggressively hold back. +* Note: if we're say, configured to do ADDBA but not A-MPDU +* then maybe we want to still queue two non-aggregate frames +* to the hardware. Again with the per-TID policy +* configuration..) * * Otherwise, schedule the TID. */ /* XXX TXQ locking */ - if (txq->axq_depth + txq->fifo.axq_depth < sc->sc_hwq_limit_aggr) { + if (txq->axq_depth + txq->fifo.axq_depth == 0) { + bf = ATH_TID_FIRST(atid); ATH_TID_REMOVE(atid, bf, bf_list); @@ -5615,19 +5629,40 @@ ath_txq_sched(struct ath_softc *sc, stru ATH_TX_LOCK_ASSERT(sc); /* -* Don't schedule if the hardware queue is busy. -* This (hopefully) gives some more time to aggregate -* some packets in the aggregation
svn commit: r312660 - head/sys/dev/ath
Author: adrian Date: Mon Jan 23 04:20:37 2017 New Revision: 312660 URL: https://svnweb.freebsd.org/changeset/base/312660 Log: [ath] [ar9300] ensure the software scheduler is called to form more aggregates for EDMA chips When investigating performance on UDP TX on the AR9380 I found that the following sequence was occuring: * INTR * EINPROGRESS - nothing yet * INTR * TXSTATUS - process a TX completion for an aggregate * INTR, INTR * TXSTATUS - process a TX completion for an aggregate * TXD, TXD ... populate frames from the hardware queue and submit What should be happening is a completed TXSTATUS fires off more packets that are queued on active TIDs. What /was/ happening was after that first TXSTATUS the TX queue hardware queue was still empty, so it didn't push anything into the FIFO. Only after the second TXSTATUS did any progress get made. This is one of two commits - it ensures that the software TX queue scheduler is called /after/ TX completion, otherwise no frames from the software staging queues will be processed into the hardware queues. The second commit will fix it so it populates aggregate frames correctly when the above occurs - right now ath_txq_sched() is called, but it doesn't populate anything because its pre-check conditions are wrong. Whilst here, add/tweak debugging. Tested: * AR9380 STA (testing device) -> AR9580 hostap Modified: head/sys/dev/ath/if_ath_tx_edma.c Modified: head/sys/dev/ath/if_ath_tx_edma.c == --- head/sys/dev/ath/if_ath_tx_edma.c Mon Jan 23 04:03:12 2017 (r312659) +++ head/sys/dev/ath/if_ath_tx_edma.c Mon Jan 23 04:20:37 2017 (r312660) @@ -178,6 +178,13 @@ ath_tx_edma_push_staging_list(struct ath ATH_TXQ_LOCK_ASSERT(txq); + DPRINTF(sc, ATH_DEBUG_XMIT | ATH_DEBUG_TX_PROC, + "%s: called; TXQ=%d, fifo.depth=%d, axq_q empty=%d\n", + __func__, + txq->axq_qnum, + txq->axq_fifo_depth, + !! (TAILQ_EMPTY(>axq_q))); + /* * Don't bother doing any work if it's full. */ @@ -802,6 +809,8 @@ ath_edma_tx_processq(struct ath_softc *s uint32_t txstatus[32]; #endif + DPRINTF(sc, ATH_DEBUG_TX_PROC, "%s: called\n", __func__); + for (idx = 0; ; idx++) { bzero(, sizeof(ts)); @@ -812,8 +821,12 @@ ath_edma_tx_processq(struct ath_softc *s status = ath_hal_txprocdesc(ah, NULL, (void *) ); ATH_TXSTATUS_UNLOCK(sc); - if (status == HAL_EINPROGRESS) + if (status == HAL_EINPROGRESS) { + DPRINTF(sc, ATH_DEBUG_TX_PROC, + "%s: (%d): EINPROGRESS\n", + __func__, idx); break; + } #ifdef ATH_DEBUG if (sc->sc_debug & ATH_DEBUG_TX_PROC) @@ -1016,6 +1029,10 @@ ath_edma_tx_processq(struct ath_softc *s /* Attempt to schedule more hardware frames to the TX FIFO */ for (i = 0; i < HAL_NUM_TX_QUEUES; i++) { if (ATH_TXQ_SETUP(sc, i)) { + ATH_TX_LOCK(sc); + ath_txq_sched(sc, >sc_txq[i]); + ATH_TX_UNLOCK(sc); + ATH_TXQ_LOCK(>sc_txq[i]); ath_edma_tx_fifo_fill(sc, >sc_txq[i]); ATH_TXQ_UNLOCK(>sc_txq[i]); @@ -1024,6 +1041,8 @@ ath_edma_tx_processq(struct ath_softc *s /* Kick software scheduler */ ath_tx_swq_kick(sc); } + + DPRINTF(sc, ATH_DEBUG_TX_PROC, "%s: end\n", __func__); } static void ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r312659 - head/sys/powerpc/powerpc
Author: jhibbits Date: Mon Jan 23 04:03:12 2017 New Revision: 312659 URL: https://svnweb.freebsd.org/changeset/base/312659 Log: Avoid using non-zero argument for __builtin_frame_address(). Building kernel with devel/powerpc64-gcc (6.2.0) yields the following error: /usr/src/sys/powerpc/powerpc/db_trace.c:299:20: error: calling '__builtin_frame_address' with a nonzero argument is unsafe [-Werror=frame-address] Work around this by dereferencing the frame address manually instead. PR: 215600 Reported by: Mark Millard MFC after:2 weeks Modified: head/sys/powerpc/powerpc/db_trace.c Modified: head/sys/powerpc/powerpc/db_trace.c == --- head/sys/powerpc/powerpc/db_trace.c Mon Jan 23 02:21:06 2017 (r312658) +++ head/sys/powerpc/powerpc/db_trace.c Mon Jan 23 04:03:12 2017 (r312659) @@ -296,8 +296,12 @@ db_trace_self(void) { db_addr_t addr; - addr = (db_addr_t)__builtin_frame_address(1); - db_backtrace(curthread, addr, -1); + addr = (db_addr_t)__builtin_frame_address(0); + if (addr == 0) { + db_printf("Null frame address\n"); + return; + } + db_backtrace(curthread, *(db_addr_t *)addr, -1); } int ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r312658 - in head/sys/cddl: contrib/opensolaris/uts/common/dtrace contrib/opensolaris/uts/common/sys dev/dtrace
Author: markj Date: Mon Jan 23 02:21:06 2017 New Revision: 312658 URL: https://svnweb.freebsd.org/changeset/base/312658 Log: Remove the DTRACEHIOC_ADD ioctl. This ioctl has been considered legacy by upstream since the DTrace code was first imported, and is unused. The removal also allows some simplification of dtrace_helper_slurp(). Also remove a bogus copyout in the DTRACEHIOC_ADDDOF handler. Due to a bug, it would overwrite an in-memory copy of the DOF header rather than the passed-in DOF helper. Moreover, DTRACEHIOC_ADDDOF already copies the helper back out automatically since its argument has the IOC_OUT attribute. Modified: head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c head/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h head/sys/cddl/dev/dtrace/dtrace_ioctl.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c == --- head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.cMon Jan 23 01:21:39 2017(r312657) +++ head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.cMon Jan 23 02:21:06 2017(r312658) @@ -16255,18 +16255,11 @@ dtrace_helper_provider_validate(dof_hdr_ } static int -#ifdef __FreeBSD__ dtrace_helper_slurp(dof_hdr_t *dof, dof_helper_t *dhp, struct proc *p) -#else -dtrace_helper_slurp(dof_hdr_t *dof, dof_helper_t *dhp) -#endif { dtrace_helpers_t *help; dtrace_vstate_t *vstate; dtrace_enabling_t *enab = NULL; -#ifndef __FreeBSD__ - proc_t *p = curproc; -#endif int i, gen, rv, nhelpers = 0, nprovs = 0, destroy = 1; uintptr_t daddr = (uintptr_t)dof; @@ -16277,8 +16270,8 @@ dtrace_helper_slurp(dof_hdr_t *dof, dof_ vstate = >dthps_vstate; - if ((rv = dtrace_dof_slurp(dof, vstate, NULL, , - dhp != NULL ? dhp->dofhp_addr : 0, B_FALSE)) != 0) { + if ((rv = dtrace_dof_slurp(dof, vstate, NULL, , dhp->dofhp_addr, + B_FALSE)) != 0) { dtrace_dof_destroy(dof); return (rv); } @@ -16286,22 +16279,20 @@ dtrace_helper_slurp(dof_hdr_t *dof, dof_ /* * Look for helper providers and validate their descriptions. */ - if (dhp != NULL) { - for (i = 0; i < dof->dofh_secnum; i++) { - dof_sec_t *sec = (dof_sec_t *)(uintptr_t)(daddr + - dof->dofh_secoff + i * dof->dofh_secsize); - - if (sec->dofs_type != DOF_SECT_PROVIDER) - continue; + for (i = 0; i < dof->dofh_secnum; i++) { + dof_sec_t *sec = (dof_sec_t *)(uintptr_t)(daddr + + dof->dofh_secoff + i * dof->dofh_secsize); - if (dtrace_helper_provider_validate(dof, sec) != 0) { - dtrace_enabling_destroy(enab); - dtrace_dof_destroy(dof); - return (-1); - } + if (sec->dofs_type != DOF_SECT_PROVIDER) + continue; - nprovs++; + if (dtrace_helper_provider_validate(dof, sec) != 0) { + dtrace_enabling_destroy(enab); + dtrace_dof_destroy(dof); + return (-1); } + + nprovs++; } /* @@ -16342,7 +16333,7 @@ dtrace_helper_slurp(dof_hdr_t *dof, dof_ gen = help->dthps_generation++; dtrace_enabling_destroy(enab); - if (dhp != NULL && nprovs > 0) { + if (nprovs > 0) { /* * Now that this is in-kernel, we change the sense of the * members: dofhp_dof denotes the in-kernel copy of the DOF Modified: head/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h == --- head/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h Mon Jan 23 01:21:39 2017(r312657) +++ head/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h Mon Jan 23 02:21:06 2017(r312658) @@ -1410,7 +1410,6 @@ typedef struct { #defineDTRACEHIOC_REMOVE (DTRACEHIOC | 2)/* remove helper */ #defineDTRACEHIOC_ADDDOF (DTRACEHIOC | 3)/* add helper DOF */ #else -#defineDTRACEHIOC_ADD _IOWR('z', 1, dof_hdr_t)/* add helper */ #defineDTRACEHIOC_REMOVE _IOW('z', 2, int) /* remove helper */ #defineDTRACEHIOC_ADDDOF _IOWR('z', 3, dof_helper_t)/* add helper DOF */ #endif Modified: head/sys/cddl/dev/dtrace/dtrace_ioctl.c == --- head/sys/cddl/dev/dtrace/dtrace_ioctl.c Mon Jan 23 01:21:39 2017 (r312657) +++ head/sys/cddl/dev/dtrace/dtrace_ioctl.c Mon Jan 23
svn commit: r312655 - head/sys/net80211
Author: avos Date: Sun Jan 22 23:45:59 2017 New Revision: 312655 URL: https://svnweb.freebsd.org/changeset/base/312655 Log: net80211: fix flags setup for HT40 5GHz channels. Modified: head/sys/net80211/ieee80211.c Modified: head/sys/net80211/ieee80211.c == --- head/sys/net80211/ieee80211.c Sun Jan 22 21:34:26 2017 (r312654) +++ head/sys/net80211/ieee80211.c Sun Jan 22 23:45:59 2017 (r312655) @@ -1317,6 +1317,7 @@ getflags_5ghz(const uint8_t bands[], uin if (isset(bands, IEEE80211_MODE_VHT_5GHZ)) { flags[nmodes++] = IEEE80211_CHAN_A | IEEE80211_CHAN_HT20 | IEEE80211_CHAN_VHT20; + } /* 40MHz */ if (ht40) { @@ -1340,7 +1341,6 @@ getflags_5ghz(const uint8_t bands[], uin IEEE80211_CHAN_HT40U | IEEE80211_CHAN_VHT80; flags[nmodes++] = IEEE80211_CHAN_A | IEEE80211_CHAN_HT40D | IEEE80211_CHAN_VHT80; - } } /* XXX VHT80+80 */ ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r312652 - head/usr.bin/iscsictl
Author: trasz Date: Sun Jan 22 20:11:24 2017 New Revision: 312652 URL: https://svnweb.freebsd.org/changeset/base/312652 Log: Move values displayed by "iscsictl -v" one character to the right, to line up output from "iscsictl -v" with "ctladm islist -v". MFC after:2 weeks Modified: head/usr.bin/iscsictl/iscsictl.c Modified: head/usr.bin/iscsictl/iscsictl.c == --- head/usr.bin/iscsictl/iscsictl.cSun Jan 22 20:06:15 2017 (r312651) +++ head/usr.bin/iscsictl/iscsictl.cSun Jan 22 20:11:24 2017 (r312652) @@ -514,74 +514,74 @@ kernel_list(int iscsi_fd, const struct t * Display-only modifier as this information * is also present within the 'session' container */ - xo_emit("{L:/%-25s}{V:sessionId/%u}\n", + xo_emit("{L:/%-26s}{V:sessionId/%u}\n", "Session ID:", state->iss_id); xo_open_container("initiator"); - xo_emit("{L:/%-25s}{V:name/%s}\n", + xo_emit("{L:/%-26s}{V:name/%s}\n", "Initiator name:", conf->isc_initiator); - xo_emit("{L:/%-25s}{V:portal/%s}\n", + xo_emit("{L:/%-26s}{V:portal/%s}\n", "Initiator portal:", conf->isc_initiator_addr); - xo_emit("{L:/%-25s}{V:alias/%s}\n", + xo_emit("{L:/%-26s}{V:alias/%s}\n", "Initiator alias:", conf->isc_initiator_alias); xo_close_container("initiator"); xo_open_container("target"); - xo_emit("{L:/%-25s}{V:name/%s}\n", + xo_emit("{L:/%-26s}{V:name/%s}\n", "Target name:", conf->isc_target); - xo_emit("{L:/%-25s}{V:portal/%s}\n", + xo_emit("{L:/%-26s}{V:portal/%s}\n", "Target portal:", conf->isc_target_addr); - xo_emit("{L:/%-25s}{V:alias/%s}\n", + xo_emit("{L:/%-26s}{V:alias/%s}\n", "Target alias:", state->iss_target_alias); xo_close_container("target"); xo_open_container("auth"); - xo_emit("{L:/%-25s}{V:user/%s}\n", + xo_emit("{L:/%-26s}{V:user/%s}\n", "User:", conf->isc_user); - xo_emit("{L:/%-25s}{V:secret/%s}\n", + xo_emit("{L:/%-26s}{V:secret/%s}\n", "Secret:", conf->isc_secret); - xo_emit("{L:/%-25s}{V:mutualUser/%s}\n", + xo_emit("{L:/%-26s}{V:mutualUser/%s}\n", "Mutual user:", conf->isc_mutual_user); - xo_emit("{L:/%-25s}{V:mutualSecret/%s}\n", + xo_emit("{L:/%-26s}{V:mutualSecret/%s}\n", "Mutual secret:", conf->isc_mutual_secret); xo_close_container("auth"); - xo_emit("{L:/%-25s}{V:type/%s}\n", + xo_emit("{L:/%-26s}{V:type/%s}\n", "Session type:", conf->isc_discovery ? "Discovery" : "Normal"); - xo_emit("{L:/%-25s}{V:enable/%s}\n", + xo_emit("{L:/%-26s}{V:enable/%s}\n", "Enable:", conf->isc_enable ? "Yes" : "No"); - xo_emit("{L:/%-25s}{V:state/%s}\n", + xo_emit("{L:/%-26s}{V:state/%s}\n", "Session state:", state->iss_connected ? "Connected" : "Disconnected"); - xo_emit("{L:/%-25s}{V:failureReason/%s}\n", + xo_emit("{L:/%-26s}{V:failureReason/%s}\n", "Failure reason:", state->iss_reason); - xo_emit("{L:/%-25s}{V:headerDigest/%s}\n", + xo_emit("{L:/%-26s}{V:headerDigest/%s}\n", "Header digest:", state->iss_header_digest == ISCSI_DIGEST_CRC32C ? "CRC32C" : "None"); - xo_emit("{L:/%-25s}{V:dataDigest/%s}\n", + xo_emit("{L:/%-26s}{V:dataDigest/%s}\n", "Data digest:", state->iss_data_digest == ISCSI_DIGEST_CRC32C ? "CRC32C" : "None"); - xo_emit("{L:/%-25s}{V:recvDataSegmentLen/%d}\n", + xo_emit("{L:/%-26s}{V:recvDataSegmentLen/%d}\n", "MaxRecvDataSegmentLength:",
Re: svn commit: r312650 - in head/usr.sbin/pw: . tests
On Sun, Jan 22, 2017 at 08:03:19PM +, Baptiste Daroussin wrote: > Author: bapt > Date: Sun Jan 22 20:03:18 2017 > New Revision: 312650 > URL: https://svnweb.freebsd.org/changeset/base/312650 > > Log: > Really restore the old behaviour for pw usermod -m > > It again reinstall missing skel files without overwriting changed one > Add a regression test about it > > Reported by:ae > MFC after: 3 days > > Modified: > head/usr.sbin/pw/psdate.c > head/usr.sbin/pw/pw_user.c > head/usr.sbin/pw/tests/pw_usermod.sh > > Modified: head/usr.sbin/pw/psdate.c > == > --- head/usr.sbin/pw/psdate.c Sun Jan 22 19:50:23 2017(r312649) > +++ head/usr.sbin/pw/psdate.c Sun Jan 22 20:03:18 2017(r312650) > @@ -41,12 +41,8 @@ static const char rcsid[] = > static int > numerics(char const * str) > { > - int rc = isdigit((unsigned char)*str); > > - if (rc) > - while (isdigit((unsigned char)*str) || *str == 'x') > - ++str; > - return rc && !*str; > + return (str[strspn(str, "0123456789x")] == '\0'); > } Oups that wasn't supposed to be there but anyway it is in now Bapt signature.asc Description: PGP signature
svn commit: r312651 - head/sys/cam/ctl
Author: trasz Date: Sun Jan 22 20:06:15 2017 New Revision: 312651 URL: https://svnweb.freebsd.org/changeset/base/312651 Log: Remove max_targets and max_target_id CTL port variables; they were unused. This changes the CTL frontend ABI and thus shouldn't be MFC-ed. Reviewed by: mav@ Modified: head/sys/cam/ctl/ctl_frontend.h head/sys/cam/ctl/ctl_frontend_cam_sim.c head/sys/cam/ctl/ctl_frontend_ioctl.c head/sys/cam/ctl/ctl_frontend_iscsi.c head/sys/cam/ctl/ctl_tpc_local.c head/sys/cam/ctl/scsi_ctl.c Modified: head/sys/cam/ctl/ctl_frontend.h == --- head/sys/cam/ctl/ctl_frontend.h Sun Jan 22 20:03:18 2017 (r312650) +++ head/sys/cam/ctl/ctl_frontend.h Sun Jan 22 20:06:15 2017 (r312651) @@ -120,7 +120,6 @@ struct ctl_wwpn_iid { * port_name:A string describing the FETD. e.g. "LSI 1030T U320" * or whatever you want to use to describe the driver. * - * * physical_port:This is the physical port number of this * particular port within the driver/hardware. This * number is hardware/driver specific. @@ -179,11 +178,6 @@ struct ctl_wwpn_iid { * to request a dump of any debugging information or * state to the console. * - * max_targets: The maximum number of targets that we can create - * per-port. - * - * max_target_id:The highest target ID that we can use. - * * targ_port:The CTL layer assigns a "port number" to every * FETD. This port number should be passed back in * in the header of every ctl_io that is queued to @@ -234,8 +228,6 @@ struct ctl_port { void*targ_lun_arg; /* passed to CTL */ void(*fe_datamove)(union ctl_io *io); /* passed to CTL */ void(*fe_done)(union ctl_io *io); /* passed to CTL */ - int max_targets;/* passed to CTL */ - int max_target_id; /* passed to CTL */ int32_t targ_port; /* passed back to FETD */ void*ctl_pool_ref; /* passed back to FETD */ uint32_tmax_initiators; /* passed back to FETD */ Modified: head/sys/cam/ctl/ctl_frontend_cam_sim.c == --- head/sys/cam/ctl/ctl_frontend_cam_sim.c Sun Jan 22 20:03:18 2017 (r312650) +++ head/sys/cam/ctl/ctl_frontend_cam_sim.c Sun Jan 22 20:06:15 2017 (r312651) @@ -147,11 +147,6 @@ cfcs_init(void) port->onoff_arg = softc; port->fe_datamove = cfcs_datamove; port->fe_done = cfcs_done; - - /* XXX KDM what should we report here? */ - /* XXX These should probably be fetched from CTL. */ - port->max_targets = 1; - port->max_target_id = 15; port->targ_port = -1; retval = ctl_port_register(port); Modified: head/sys/cam/ctl/ctl_frontend_ioctl.c == --- head/sys/cam/ctl/ctl_frontend_ioctl.c Sun Jan 22 20:03:18 2017 (r312650) +++ head/sys/cam/ctl/ctl_frontend_ioctl.c Sun Jan 22 20:06:15 2017 (r312651) @@ -104,8 +104,6 @@ cfi_init(void) port->port_name = "ioctl"; port->fe_datamove = cfi_datamove; port->fe_done = cfi_done; - port->max_targets = 1; - port->max_target_id = 0; port->targ_port = -1; port->max_initiators = 1; Modified: head/sys/cam/ctl/ctl_frontend_iscsi.c == --- head/sys/cam/ctl/ctl_frontend_iscsi.c Sun Jan 22 20:03:18 2017 (r312650) +++ head/sys/cam/ctl/ctl_frontend_iscsi.c Sun Jan 22 20:06:15 2017 (r312651) @@ -2127,11 +2127,6 @@ cfiscsi_ioctl_port_create(struct ctl_req port->onoff_arg = ct; port->fe_datamove = cfiscsi_datamove; port->fe_done = cfiscsi_done; - - /* XXX KDM what should we report here? */ - /* XXX These should probably be fetched from CTL. */ - port->max_targets = 1; - port->max_target_id = 15; port->targ_port = -1; port->options = opts; Modified: head/sys/cam/ctl/ctl_tpc_local.c == --- head/sys/cam/ctl/ctl_tpc_local.cSun Jan 22 20:03:18 2017 (r312650) +++ head/sys/cam/ctl/ctl_tpc_local.cSun Jan 22 20:06:15 2017 (r312651) @@ -95,8 +95,6 @@ tpcl_init(void) port->port_name = "tpc"; port->fe_datamove = tpcl_datamove; port->fe_done = tpcl_done; - port->max_targets = 1; - port->max_target_id = 0; port->targ_port = -1;
svn commit: r312650 - in head/usr.sbin/pw: . tests
Author: bapt Date: Sun Jan 22 20:03:18 2017 New Revision: 312650 URL: https://svnweb.freebsd.org/changeset/base/312650 Log: Really restore the old behaviour for pw usermod -m It again reinstall missing skel files without overwriting changed one Add a regression test about it Reported by: ae MFC after:3 days Modified: head/usr.sbin/pw/psdate.c head/usr.sbin/pw/pw_user.c head/usr.sbin/pw/tests/pw_usermod.sh Modified: head/usr.sbin/pw/psdate.c == --- head/usr.sbin/pw/psdate.c Sun Jan 22 19:50:23 2017(r312649) +++ head/usr.sbin/pw/psdate.c Sun Jan 22 20:03:18 2017(r312650) @@ -41,12 +41,8 @@ static const char rcsid[] = static int numerics(char const * str) { - int rc = isdigit((unsigned char)*str); - if (rc) - while (isdigit((unsigned char)*str) || *str == 'x') - ++str; - return rc && !*str; + return (str[strspn(str, "0123456789x")] == '\0'); } static int Modified: head/usr.sbin/pw/pw_user.c == --- head/usr.sbin/pw/pw_user.c Sun Jan 22 19:50:23 2017(r312649) +++ head/usr.sbin/pw/pw_user.c Sun Jan 22 20:03:18 2017(r312650) @@ -1493,7 +1493,7 @@ pw_user_mod(int argc, char **argv, char intmax_t id = -1; int ch, fd = -1; size_t i, j; - bool quiet, createhome, pretty, dryrun, nis, edited, docreatehome; + bool quiet, createhome, pretty, dryrun, nis, edited; bool precrypted; mode_t homemode = 0; time_t expire_days, password_days, now; @@ -1503,7 +1503,7 @@ pw_user_mod(int argc, char **argv, char passwd = NULL; class = nispasswd = NULL; quiet = createhome = pretty = dryrun = nis = precrypted = false; - edited = docreatehome = false; + edited = false; if (arg1 != NULL) { if (arg1[strspn(arg1, "0123456789")] == '\0') @@ -1697,10 +1697,6 @@ pw_user_mod(int argc, char **argv, char edited = true; } - if (createhome && fstatat(conf.rootfd, pwd->pw_dir, , 0) == -1) { - docreatehome = true; - } - if (homedir && strcmp(pwd->pw_dir, homedir) != 0) { pwd->pw_dir = homedir; edited = true; @@ -1708,8 +1704,6 @@ pw_user_mod(int argc, char **argv, char if (!createhome) warnx("WARNING: home `%s' does not exist", pwd->pw_dir); - else - docreatehome = true; } else if (!S_ISDIR(st.st_mode)) { warnx("WARNING: home `%s' is not a directory", pwd->pw_dir); @@ -1801,7 +1795,7 @@ pw_user_mod(int argc, char **argv, char * that this also `works' for editing users if -m is used, but * existing files will *not* be overwritten. */ - if (PWALTDIR() != PWF_ALT && docreatehome && pwd->pw_dir && + if (PWALTDIR() != PWF_ALT && createhome && pwd->pw_dir && *pwd->pw_dir == '/' && pwd->pw_dir[1]) { if (!skel) skel = cnf->dotdir; Modified: head/usr.sbin/pw/tests/pw_usermod.sh == --- head/usr.sbin/pw/tests/pw_usermod.shSun Jan 22 19:50:23 2017 (r312649) +++ head/usr.sbin/pw/tests/pw_usermod.shSun Jan 22 20:03:18 2017 (r312650) @@ -253,6 +253,26 @@ user_mod_w_yes_body() { $(atf_get_srcdir)/crypt $passhash "foo" } +atf_test_case user_mod_m +user_mod_m_body() { + populate_root_etc_skel + + mkdir -p ${HOME}/home + mkdir -p ${HOME}/skel + echo "entry" > ${HOME}/skel/.file + atf_check -s exit:0 ${RPW} useradd foo + ! test -d ${HOME}/home/foo || atf_fail "Directory should not have been created" + atf_check -s exit:0 ${RPW} usermod foo -m -k /skel + test -d ${HOME}/home/foo || atf_fail "Directory should have been created" + test -f ${HOME}/home/foo/.file || atf_fail "Skell files not added" + echo "entry" > ${HOME}/skel/.file2 + atf_check -s exit:0 ${RPW} usermod foo -m -k /skel + test -f ${HOME}/home/foo/.file2 || atf_fail "Skell files not added" + echo > ${HOME}/home/foo/.file2 + atf_check -s exit:0 ${RPW} usermod foo -m -k /skel + atf_check -s exit:0 -o inline:"\n" cat ${HOME}/home/foo/.file2 +} + atf_init_test_cases() { atf_add_test_case user_mod @@ -275,4 +295,5 @@ atf_init_test_cases() { atf_add_test_case user_mod_w_none atf_add_test_case user_mod_w_random atf_add_test_case user_mod_w_yes + atf_add_test_case user_mod_m } ___ svn-src-head@freebsd.org
svn commit: r312649 - head/share/man/man5
Author: kib Date: Sun Jan 22 19:50:23 2017 New Revision: 312649 URL: https://svnweb.freebsd.org/changeset/base/312649 Log: Document mount option "nonc" for tmpfs. Sponsored by: The FreeBSD Foundation MFC after:2 weeks Differential revision:https://reviews.freebsd.org/D9258 Modified: head/share/man/man5/tmpfs.5 Modified: head/share/man/man5/tmpfs.5 == --- head/share/man/man5/tmpfs.5 Sun Jan 22 19:46:14 2017(r312648) +++ head/share/man/man5/tmpfs.5 Sun Jan 22 19:50:23 2017(r312649) @@ -54,7 +54,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 17, 2017 +.Dd January 20, 2017 .Dt TMPFS 5 .Os .Sh NAME @@ -120,6 +120,10 @@ Defaults to the mount point's UID. .It Cm mode Specifies the mode (in octal notation) of the root inode of the file system. Defaults to the mount point's mode. +.It Cm nonc +Do not use namecache to resolve names to files for the created mount. +This saves memory, but currently might impair scalability for highly +used mounts on large machines. .It Cm inodes Specifies the maximum number of nodes available to the file system. If not specified, the file system chooses a reasonable maximum based on ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r312648 - head/share/man/man5
Author: kib Date: Sun Jan 22 19:46:14 2017 New Revision: 312648 URL: https://svnweb.freebsd.org/changeset/base/312648 Log: Editing and clarifications for tmpfs(5). Submitted by: wblock Sponsored by: The FreeBSD Foundation MFC after:1 week Differential revision:https://reviews.freebsd.org/D9211 Modified: head/share/man/man5/tmpfs.5 Modified: head/share/man/man5/tmpfs.5 == --- head/share/man/man5/tmpfs.5 Sun Jan 22 19:41:42 2017(r312647) +++ head/share/man/man5/tmpfs.5 Sun Jan 22 19:46:14 2017(r312648) @@ -77,7 +77,7 @@ tmpfs_load="YES" .Sh DESCRIPTION The .Nm -driver implements in-memory, or +driver implements an in-memory, or .Tn tmpfs file system. The filesystem stores both file metadata and data in main memory. @@ -85,22 +85,22 @@ This allows very fast and low latency ac The data is volatile. An umount or system reboot invalidates it. These properties make the filesystem's mounts suitable for fast -scratch storage, e.g. +scratch storage, like .Pa /tmp . .Pp If the system becomes low on memory and swap is configured (see .Xr swapon 8 ), -file data may be written to the swap space, freeing memory +the system can transfer file data to swap space, freeing memory for other needs. -The current implementation never swaps out metadata, including -the directory content. +Metadata, including the directory content, is never swapped out by the +current implementation. Keep this in mind when planning the mount limits, especially when expecting to place many small files on a tmpfs mount. .Pp -When a file from a tmpfs mount is mmaped (see -.Xr mmap 2 ) -into the process address space, the swap VM object which manages the file -pages is used to implement mapping and to avoid double-copying of +When +.Xr mmap 2 +is used on a file from a tmpfs mount, the swap VM object managing the +file pages is used to implement mapping and avoid double-copying of the file data. This quirk causes process inspection tools, like .Xr procstat 1 , ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r312647 - head/sys/kern
Author: kib Date: Sun Jan 22 19:41:42 2017 New Revision: 312647 URL: https://svnweb.freebsd.org/changeset/base/312647 Log: Add comments explaining unobvious td_critnest adjustments in critical_exit(). Based on the discussion with: jhb Reviewed by: imp Sponsored by: The FreeBSD Foundation Differential revision:D9276 MFC after:1 week Modified: head/sys/kern/kern_switch.c Modified: head/sys/kern/kern_switch.c == --- head/sys/kern/kern_switch.c Sun Jan 22 19:38:45 2017(r312646) +++ head/sys/kern/kern_switch.c Sun Jan 22 19:41:42 2017(r312647) @@ -206,7 +206,22 @@ critical_exit(void) if (td->td_critnest == 1) { td->td_critnest = 0; + + /* +* Interrupt handlers execute critical_exit() on +* leave, and td_owepreempt may be left set by an +* interrupt handler only when td_critnest > 0. If we +* are decrementing td_critnest from 1 to 0, read +* td_owepreempt after decrementing, to not miss the +* preempt. Disallow compiler to reorder operations. +*/ + __compiler_membar(); if (td->td_owepreempt && !kdb_active) { + /* +* Microoptimization: we committed to switch, +* disable preemption in interrupt handlers +* while spinning for the thread lock. +*/ td->td_critnest = 1; thread_lock(td); td->td_critnest--; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r312646 - head/sys/kern
Author: kib Date: Sun Jan 22 19:38:45 2017 New Revision: 312646 URL: https://svnweb.freebsd.org/changeset/base/312646 Log: More style cleanup. Use ANSI C definition for vn_closefile(). Switch to VNASSERT in _vn_lock(), simplify messages. Sponsored by: The FreeBSD Foundation X-MFC with: r312600, r312601, r312602, r312606 Modified: head/sys/kern/vfs_vnops.c Modified: head/sys/kern/vfs_vnops.c == --- head/sys/kern/vfs_vnops.c Sun Jan 22 19:36:02 2017(r312645) +++ head/sys/kern/vfs_vnops.c Sun Jan 22 19:38:45 2017(r312646) @@ -1538,27 +1538,21 @@ _vn_lock(struct vnode *vp, int flags, ch int error; VNASSERT((flags & LK_TYPE_MASK) != 0, vp, - ("vn_lock called with no locktype.")); -#ifdef DEBUG_VFS_LOCKS - KASSERT(vp->v_holdcnt != 0, - ("vn_lock %p: zero hold count", vp)); -#endif + ("vn_lock: no locktype")); + VNASSERT(vp->v_holdcnt != 0, vp, ("vn_lock: zero hold count")); retry: error = VOP_LOCK1(vp, flags, file, line); flags &= ~LK_INTERLOCK; /* Interlock is always dropped. */ KASSERT((flags & LK_RETRY) == 0 || error == 0, - ("LK_RETRY set with incompatible flags (0x%x) or " - " an error occurred (%d)", flags, error)); + ("vn_lock: error %d incompatible with flags %#x", error, flags)); if ((flags & LK_RETRY) == 0) { - if (error == 0 && vp->v_iflag & VI_DOOMED) { + if (error == 0 && (vp->v_iflag & VI_DOOMED) != 0) { VOP_UNLOCK(vp, 0); error = ENOENT; } - } else { - if (error != 0) - goto retry; - } + } else if (error != 0) + goto retry; return (error); } @@ -1566,9 +1560,7 @@ retry: * File table vnode close routine. */ static int -vn_closefile(fp, td) - struct file *fp; - struct thread *td; +vn_closefile(struct file *fp, struct thread *td) { struct vnode *vp; struct flock lf; @@ -1577,12 +1569,14 @@ vn_closefile(fp, td) vp = fp->f_vnode; fp->f_ops = - if (__predict_false(fp->f_flag & FHASLOCK) && fp->f_type == DTYPE_VNODE) + if (__predict_false((fp->f_flag & FHASLOCK) != 0) && + fp->f_type == DTYPE_VNODE) vrefact(vp); error = vn_close(vp, fp->f_flag, fp->f_cred, td); - if (__predict_false(fp->f_flag & FHASLOCK) && fp->f_type == DTYPE_VNODE) { + if (__predict_false((fp->f_flag & FHASLOCK) != 0) && + fp->f_type == DTYPE_VNODE) { lf.l_whence = SEEK_SET; lf.l_start = 0; lf.l_len = 0; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r312645 - head/sys/kern
Author: kib Date: Sun Jan 22 19:36:02 2017 New Revision: 312645 URL: https://svnweb.freebsd.org/changeset/base/312645 Log: Provide fallback VOP methods for crossmp vnode. In particular, crossmp vnode might leak into rename code. PR: 216380 Reported by: fn...@protonmail.com Sponsored by: The FreeBSD Foundation X-MFC with: r309425 Modified: head/sys/kern/vfs_lookup.c Modified: head/sys/kern/vfs_lookup.c == --- head/sys/kern/vfs_lookup.c Sun Jan 22 18:55:01 2017(r312644) +++ head/sys/kern/vfs_lookup.c Sun Jan 22 19:36:02 2017(r312645) @@ -132,6 +132,7 @@ crossmp_vop_unlock(struct vop_unlock_arg } static struct vop_vector crossmp_vnodeops = { + .vop_default = _vnodeops, .vop_islocked = crossmp_vop_islocked, .vop_lock1 =crossmp_vop_lock1, .vop_unlock = crossmp_vop_unlock, ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r312644 - head/usr.sbin/pw
Author: bapt Date: Sun Jan 22 18:55:01 2017 New Revision: 312644 URL: https://svnweb.freebsd.org/changeset/base/312644 Log: Readd a feature lost in pw(8) refactoring pw usermod foo -m It used to be able to (re)create the home directory if it didn't exists PR: 216224 Reported by: ae MFC after:3 days Modified: head/usr.sbin/pw/pw_user.c Modified: head/usr.sbin/pw/pw_user.c == --- head/usr.sbin/pw/pw_user.c Sun Jan 22 18:31:49 2017(r312643) +++ head/usr.sbin/pw/pw_user.c Sun Jan 22 18:55:01 2017(r312644) @@ -1697,6 +1697,10 @@ pw_user_mod(int argc, char **argv, char edited = true; } + if (createhome && fstatat(conf.rootfd, pwd->pw_dir, , 0) == -1) { + docreatehome = true; + } + if (homedir && strcmp(pwd->pw_dir, homedir) != 0) { pwd->pw_dir = homedir; edited = true; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r312426 - head/sys/kern
On 01/19/2017 12:46, Andriy Gapon wrote: Author: avg Date: Thu Jan 19 18:46:41 2017 New Revision: 312426 URL: https://svnweb.freebsd.org/changeset/base/312426 Log: fix a thread preemption regression in schedulers introduced in r270423 Commit r270423 fixed a regression in sched_yield() that was introduced in earlier changes. Unfortunately, at the same time it introduced an new regression. Pointy hat to: vangyzen, 2.5 years later... Eric ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r312641 - head/sys/dev/e1000
Author: sbruno Date: Sun Jan 22 18:04:57 2017 New Revision: 312641 URL: https://svnweb.freebsd.org/changeset/base/312641 Log: igb(4) enable WOL features for this class of devices. PR: 208343 Submitted by: Kaho TashikazuModified: head/sys/dev/e1000/if_em.c Modified: head/sys/dev/e1000/if_em.c == --- head/sys/dev/e1000/if_em.c Sun Jan 22 18:04:41 2017(r312640) +++ head/sys/dev/e1000/if_em.c Sun Jan 22 18:04:57 2017(r312641) @@ -1738,7 +1738,7 @@ em_if_stop(if_ctx_t ctx) e1000_reset_hw(>hw); if (adapter->hw.mac.type >= e1000_82544) - E1000_WRITE_REG(>hw, E1000_WUC, 0); + E1000_WRITE_REG(>hw, E1000_WUFC, 0); e1000_led_off(>hw); e1000_cleanup_led(>hw); @@ -2313,7 +2313,7 @@ em_reset(if_ctx_t ctx) /* Issue a global reset */ e1000_reset_hw(hw); - E1000_WRITE_REG(hw, E1000_WUC, 0); + E1000_WRITE_REG(hw, E1000_WUFC, 0); em_disable_aspm(adapter); /* and a re-init */ if (e1000_init_hw(hw) < 0) { @@ -2514,9 +2514,12 @@ em_setup_interface(if_ctx_t ctx) /* Enable only WOL MAGIC by default */ if (adapter->wol) { - if_setcapabilitiesbit(ifp, IFCAP_WOL, 0); - if_setcapenablebit(ifp, IFCAP_WOL_MAGIC, 0); - } + if_setcapenablebit(ifp, IFCAP_WOL_MAGIC, +IFCAP_WOL_MCAST| IFCAP_WOL_UCAST); + } else { + if_setcapenablebit(ifp, 0, IFCAP_WOL_MAGIC | +IFCAP_WOL_MCAST| IFCAP_WOL_UCAST); + } /* * Specify the media types supported by this adapter and register @@ -3314,6 +3317,15 @@ em_get_wakeup(if_ctx_t ctx) case e1000_pch2lan: case e1000_pch_lpt: case e1000_pch_spt: + case e1000_82575: /* listing all igb devices */ + case e1000_82576: + case e1000_82580: + case e1000_i350: + case e1000_i354: + case e1000_i210: + case e1000_i211: + case e1000_vfadapt: + case e1000_vfadapt_i350: apme_mask = E1000_WUC_APME; adapter->has_amt = TRUE; eeprom_data = E1000_READ_REG(>hw, E1000_WUC); @@ -3393,7 +3405,7 @@ em_enable_wakeup(if_ctx_t ctx) ctrl |= (E1000_CTRL_SWDPIN2 | E1000_CTRL_SWDPIN3); E1000_WRITE_REG(>hw, E1000_CTRL, ctrl); wuc = E1000_READ_REG(>hw, E1000_WUC); - wuc |= E1000_WUC_PME_EN ; + wuc |= (E1000_WUC_PME_EN | E1000_WUC_APME); E1000_WRITE_REG(>hw, E1000_WUC, wuc); if ((adapter->hw.mac.type == e1000_ich8lan) || @@ -3417,6 +3429,9 @@ em_enable_wakeup(if_ctx_t ctx) if ((if_getcapenable(ifp) & IFCAP_WOL_MAGIC) == 0) adapter->wol &= ~E1000_WUFC_MAG; + if ((if_getcapenable(ifp) & IFCAP_WOL_UCAST) == 0) + adapter->wol &= ~E1000_WUFC_EX; + if ((if_getcapenable(ifp) & IFCAP_WOL_MCAST) == 0) adapter->wol &= ~E1000_WUFC_MC; else { @@ -3425,10 +3440,7 @@ em_enable_wakeup(if_ctx_t ctx) E1000_WRITE_REG(>hw, E1000_RCTL, rctl); } - if ((adapter->hw.mac.type == e1000_pchlan) || - (adapter->hw.mac.type == e1000_pch2lan) || - (adapter->hw.mac.type == e1000_pch_lpt) || - (adapter->hw.mac.type == e1000_pch_spt)) { + if ( adapter->hw.mac.type >= e1000_pchlan) { if (em_enable_phy_wakeup(adapter)) return; } else { @@ -3493,7 +3505,7 @@ em_enable_phy_wakeup(struct adapter *ada /* enable PHY wakeup in MAC register */ E1000_WRITE_REG(hw, E1000_WUC, - E1000_WUC_PHY_WAKE | E1000_WUC_PME_EN); + E1000_WUC_PHY_WAKE | E1000_WUC_PME_EN | E1000_WUC_APME); E1000_WRITE_REG(hw, E1000_WUFC, adapter->wol); /* configure and enable PHY wakeup in PHY registers */ ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r312638 - head/sbin/restore
Author: mckusick Date: Sun Jan 22 17:49:14 2017 New Revision: 312638 URL: https://svnweb.freebsd.org/changeset/base/312638 Log: By default, when doing incremental restores the restore program overwrites an existing file rather than removing it and creating a new file. If the old and new version of the file both have extended attributes and the extended attributes of the two versions of the file are different, the result is that the new file ends up with the union of the extended attributes of the old and new files. To get the behavior of replacing the extended attributes rather than augmenting them requires explicitly removing the old attributes and then adding the new ones. To get this behavior, the old file must be unlinked (which clears out the old extended attributes). Then the new file of the same name must be created and the new extended attributes added to it. This behavior can be obtained by specifying the -u flag when running restore. Rather than defaulting the -u option to on and possibly breaking existing scripts using restore, this change simply notes in the restore.8 manual page that the -u flag is recommended when using restore on filesystems that contain extended attributes. PR: 216127 Reported by:dewayne at heuristicsystems.com.au Differential Revision: https://reviews.freebsd.org/D9208 Modified: head/sbin/restore/restore.8 Modified: head/sbin/restore/restore.8 == --- head/sbin/restore/restore.8 Sun Jan 22 17:24:00 2017(r312637) +++ head/sbin/restore/restore.8 Sun Jan 22 17:49:14 2017(r312638) @@ -349,6 +349,8 @@ To prevent this, the .Fl u (unlink) flag causes restore to remove old entries before attempting to create new ones. +This flag is recommended when using extended attributes +to avoid improperly accumulating attributes on pre-existing files. .It Fl v Normally .Nm ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r312637 - head/sys/arm/ti/cpsw
Author: loos Date: Sun Jan 22 17:24:00 2017 New Revision: 312637 URL: https://svnweb.freebsd.org/changeset/base/312637 Log: Be a little more pedantic here, the TRM says the hardware is supposed to only clean the OWNER bit on SOP descriptors. MFC after:3 days Sponsored by: Rubicon Communications, LLC (Netgate) Modified: head/sys/arm/ti/cpsw/if_cpsw.c Modified: head/sys/arm/ti/cpsw/if_cpsw.c == --- head/sys/arm/ti/cpsw/if_cpsw.c Sun Jan 22 17:07:37 2017 (r312636) +++ head/sys/arm/ti/cpsw/if_cpsw.c Sun Jan 22 17:24:00 2017 (r312637) @@ -1981,7 +1981,8 @@ cpsw_tx_dequeue(struct cpsw_softc *sc) sc->tx.teardown = 1; } - if ((flags & CPDMA_BD_OWNER) != 0 && sc->tx.teardown == 0) + if ((flags & (CPDMA_BD_SOP | CPDMA_BD_OWNER)) == + (CPDMA_BD_SOP | CPDMA_BD_OWNER) && sc->tx.teardown == 0) break; /* Hardware is still using this packet. */ bus_dmamap_sync(sc->mbuf_dtag, slot->dmamap, BUS_DMASYNC_POSTWRITE); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r312600 - head/sys/kern
On Mon, Jan 23, 2017 at 04:00:19AM +1100, Bruce Evans wrote: > On Sun, 22 Jan 2017, Konstantin Belousov wrote: > > > On Sun, Jan 22, 2017 at 11:41:09PM +1100, Bruce Evans wrote: > >> On Sun, 22 Jan 2017, Mateusz Guzik wrote: > >>> ... > >>> I have to disagree about the usefulness remark. If you check generated > >>> assembly for amd64 (included below), you will see the uncommon code is > >>> moved out of the way and in particular there are no forward jumps in the > >>> common case. > >> > >> Check benchmarks. A few cycles here and there are in the noise. Kernel > >> code has very few possibilities for useful optimizations since it doesn't > >> have many inner loops. > >> > >>> With __predict_false: > >>> > >>> [snip prologue] > >>> 0x8084ecaf <+31>: mov0x24(%rbx),%eax > >>> 0x8084ecb2 <+34>: test $0x40,%ah > >>> 0x8084ecb5 <+37>: jne0x8084ece2 > >>>> >> > >> All that this does is as you say -- invert the condition to jump to the > >> uncommon code. This made more of a difference on old CPUs (possiblly > >> still on low end/non-x86). Now branch predictors are too good for the > >> slow case to be much slower. > >> > >> I think x86 branch predictors initially predict forward branches as not > >> taken and backward branches as taken. So this branch was initially > >> mispredicted, and the change fixes this. But the first branch doesn't > >> really matter. Starting up takes hundreds or thousands of cycles for > >> cache misses. > > This is only true if branch predictor memory is large enough to keep the > > state for the given branch between exercising it. Even if the predictor > > state could be attached to every byte in the icache, or more likely, > > every line in the icache or uop cache, it still probably too small to > > survive between user->kernel transitions for syscalls. Might be there is > > performance counter which shows branch predictor mis-predictions. > > > > In other words, I suspect that there almost all cases might be > > mis-predictions without manual hint, and mis-predictions together with > > the full pipeline flush on VFS-intensive load very well might give tens > > percents of the total cycles on the modern cores. > > > > Just speculation. > > Check benchmarks. > > I looked at the mis-prediction counts mainly for a networking micro-benchmark > alsmost 10 years ago. They seemed to be among the least of the performance > problems (the main ones were general bloat and cache misses). I think the > branch-predictor caches on even 10-year old x86 are quite large, enough to > hold tens or hundreds of syscalls. Otherwise performance would be lower > than it is. > > Testing shows that the cache size is about 2048 on Athlon-XP. I might be > measuring just the size of the L1 Icache interacting with the branch > predictor: > > The program is for i386 and needs some editing: > > X int > X main(void) > X { > X asm(" \n\ > X pushal \n\ > X movl$192105,%edi\n\ > > Set this to $(sysctl -n machdep.tsc_freq) / 1 to count cycles easily. > > X 1: \n\ > X # beware of clobbering in padding \n\ > X pushal \n\ > X xorl%eax,%eax \n\ > X # repeat next many times, e.g., 2047 times on Athlon-xp \n\ > X jz 2f; .p2align 3; 2: \n\ > > With up to 2048 branches, each branch takes 2 cycles on Athlon-XP. > After that, each branch takes 10.8 cycles. > > I don't understand why the alignment is needed, but without it each branch > takes 9 cycles instead of 2 starting with just 2 jz's. My guess this is the predictor graining issue I alluded to earlier. E.g. Agner Fog' manuals state that for K8/K10, == The branch prediction mechanism allows no more than three taken branches for every aligned 16-byte block of code. == The benchmark does not check the cost of misprediction, since the test consists only of the thread of branches, there is no speculative state to unwind. > > "jmp" branches are not predicted any better than the always-taken "jz" > braches. Alignment is needed similarly. > > Change "jz" to "jnz" to see the speed with branches never taken. This > takes 2 cycles for any number of branches up to 8K when the L1 Icache > runs out. Now the default prediction of not-taken is correct, so there > are no mispredictions. > > The alignment costs 0.5 cycles with a small number of jnz's and 0.03 > cycles with a large number of jz's or jmp's. It helps with a large > number of jnz's. > > X popal \n\ > X decl%edi\n\ > X jne 1b \n\ > X popal \n\ > X "); > X return (0); > X } > > Timing on Haswell: > - Haswell only benefits slightly from the
Re: svn commit: r312600 - head/sys/kern
On Sun, 22 Jan 2017, Konstantin Belousov wrote: On Sun, Jan 22, 2017 at 11:41:09PM +1100, Bruce Evans wrote: On Sun, 22 Jan 2017, Mateusz Guzik wrote: ... I have to disagree about the usefulness remark. If you check generated assembly for amd64 (included below), you will see the uncommon code is moved out of the way and in particular there are no forward jumps in the common case. Check benchmarks. A few cycles here and there are in the noise. Kernel code has very few possibilities for useful optimizations since it doesn't have many inner loops. With __predict_false: [snip prologue] 0x8084ecaf <+31>: mov0x24(%rbx),%eax 0x8084ecb2 <+34>: test $0x40,%ah 0x8084ecb5 <+37>: jne0x8084ece2All that this does is as you say -- invert the condition to jump to the uncommon code. This made more of a difference on old CPUs (possiblly still on low end/non-x86). Now branch predictors are too good for the slow case to be much slower. I think x86 branch predictors initially predict forward branches as not taken and backward branches as taken. So this branch was initially mispredicted, and the change fixes this. But the first branch doesn't really matter. Starting up takes hundreds or thousands of cycles for cache misses. This is only true if branch predictor memory is large enough to keep the state for the given branch between exercising it. Even if the predictor state could be attached to every byte in the icache, or more likely, every line in the icache or uop cache, it still probably too small to survive between user->kernel transitions for syscalls. Might be there is performance counter which shows branch predictor mis-predictions. In other words, I suspect that there almost all cases might be mis-predictions without manual hint, and mis-predictions together with the full pipeline flush on VFS-intensive load very well might give tens percents of the total cycles on the modern cores. Just speculation. Check benchmarks. I looked at the mis-prediction counts mainly for a networking micro-benchmark alsmost 10 years ago. They seemed to be among the least of the performance problems (the main ones were general bloat and cache misses). I think the branch-predictor caches on even 10-year old x86 are quite large, enough to hold tens or hundreds of syscalls. Otherwise performance would be lower than it is. Testing shows that the cache size is about 2048 on Athlon-XP. I might be measuring just the size of the L1 Icache interacting with the branch predictor: The program is for i386 and needs some editing: X int X main(void) X { X asm(" \n\ X pushal \n\ X movl$192105,%edi\n\ Set this to $(sysctl -n machdep.tsc_freq) / 1 to count cycles easily. X 1:\n\ X # beware of clobbering in padding \n\ X pushal \n\ X xorl%eax,%eax \n\ X # repeat next many times, e.g., 2047 times on Athlon-xp \n\ X jz 2f; .p2align 3; 2: \n\ With up to 2048 branches, each branch takes 2 cycles on Athlon-XP. After that, each branch takes 10.8 cycles. I don't understand why the alignment is needed, but without it each branch takes 9 cycles instead of 2 starting with just 2 jz's. "jmp" branches are not predicted any better than the always-taken "jz" braches. Alignment is needed similarly. Change "jz" to "jnz" to see the speed with branches never taken. This takes 2 cycles for any number of branches up to 8K when the L1 Icache runs out. Now the default prediction of not-taken is correct, so there are no mispredictions. The alignment costs 0.5 cycles with a small number of jnz's and 0.03 cycles with a large number of jz's or jmp's. It helps with a large number of jnz's. X popal \n\ X decl%edi\n\ X jne 1b \n\ X popal \n\ X "); X return (0); X } Timing on Haswell: - Haswell only benefits slightly from the alignment and reaches full speed with ".p2align 2" - 1 cycle instead of 2 for branch-not-taken - 2.1 cycles instead of 2 minimum for branch-taken - predictor cache size 4K instead of 2K - 12 cycles instead of 10.8 for branches mispredicted by the default for more than 4K jz's. Bruce ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r312623 - head/sys/kern
Author: trasz Date: Sun Jan 22 15:35:51 2017 New Revision: 312623 URL: https://svnweb.freebsd.org/changeset/base/312623 Log: Remove redundant KASSERT. Modified: head/sys/kern/kern_racct.c Modified: head/sys/kern/kern_racct.c == --- head/sys/kern/kern_racct.c Sun Jan 22 15:32:17 2017(r312622) +++ head/sys/kern/kern_racct.c Sun Jan 22 15:35:51 2017(r312623) @@ -443,12 +443,8 @@ racct_sub_racct(struct racct *dest, cons } if (RACCT_CAN_DROP(i)) { dest->r_resources[i] -= src->r_resources[i]; - if (dest->r_resources[i] < 0) { - KASSERT(RACCT_IS_SLOPPY(i) || - RACCT_IS_DECAYING(i), - ("%s: resource %d usage < 0", __func__, i)); + if (dest->r_resources[i] < 0) dest->r_resources[i] = 0; - } } } } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r312622 - head/sys/cam/ctl
Author: trasz Date: Sun Jan 22 15:32:17 2017 New Revision: 312622 URL: https://svnweb.freebsd.org/changeset/base/312622 Log: Add SCSI descriptors for USB Mass Storage. MFC after:2 weeks Sponsored by: The FreeBSD Foundation Modified: head/sys/cam/ctl/ctl.c head/sys/cam/ctl/ctl.h Modified: head/sys/cam/ctl/ctl.c == --- head/sys/cam/ctl/ctl.c Sun Jan 22 15:27:14 2017(r312621) +++ head/sys/cam/ctl/ctl.c Sun Jan 22 15:32:17 2017(r312622) @@ -10103,6 +10103,9 @@ ctl_inquiry_std(struct ctl_scsiio *ctsio } else if (port_type == CTL_PORT_SAS) { /* SAS (no version claimed) */ scsi_ulto2b(0x0BE0, inq_ptr->version3); + } else if (port_type == CTL_PORT_UMASS) { + /* USB Mass Storage Class Bulk-Only Transport, Revision 1.0 */ + scsi_ulto2b(0x1730, inq_ptr->version3); } if (lun == NULL) { Modified: head/sys/cam/ctl/ctl.h == --- head/sys/cam/ctl/ctl.h Sun Jan 22 15:27:14 2017(r312621) +++ head/sys/cam/ctl/ctl.h Sun Jan 22 15:32:17 2017(r312622) @@ -53,6 +53,7 @@ typedef enum { CTL_PORT_INTERNAL = 0x08, CTL_PORT_ISCSI = 0x10, CTL_PORT_SAS= 0x20, + CTL_PORT_UMASS = 0x40, CTL_PORT_ALL= 0xff, CTL_PORT_ISC= 0x100 // FC port for inter-shelf communication } ctl_port_type; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r312621 - head/sys/kern
Author: trasz Date: Sun Jan 22 15:27:14 2017 New Revision: 312621 URL: https://svnweb.freebsd.org/changeset/base/312621 Log: Improve debugging printf. Modified: head/sys/kern/vfs_subr.c Modified: head/sys/kern/vfs_subr.c == --- head/sys/kern/vfs_subr.cSun Jan 22 13:21:19 2017(r312620) +++ head/sys/kern/vfs_subr.cSun Jan 22 15:27:14 2017(r312621) @@ -1491,7 +1491,7 @@ alloc: vp->v_bufobj.bo_ops = _ops_bio; #ifdef DIAGNOSTIC if (mp == NULL && vops != _vnodeops) - printf("NULL mp in getnewvnode()\n"); + printf("NULL mp in getnewvnode(9), tag %s\n", tag); #endif #ifdef MAC mac_vnode_init(vp); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r312600 - head/sys/kern
On Sun, Jan 22, 2017 at 11:41:09PM +1100, Bruce Evans wrote: > On Sun, 22 Jan 2017, Mateusz Guzik wrote: > > > On Sun, Jan 22, 2017 at 12:07:56PM +1100, Bruce Evans wrote: > > ... > >> Later commits further unimproved style by adding __predict_ugly() and > >> long lines from blind substitution of that. __predict_ugly() is almost > >> as useful as 'register', but more invasive. > > > > There were no __predict changes to this function. > > > > I did add some to vn_closefile in r312602. > > > > Indeed, one line is now 82 chars and arguably could be modified to fit > > the limit. > > > > I have to disagree about the usefulness remark. If you check generated > > assembly for amd64 (included below), you will see the uncommon code is > > moved out of the way and in particular there are no forward jumps in the > > common case. > > Check benchmarks. A few cycles here and there are in the noise. Kernel > code has very few possibilities for useful optimizations since it doesn't > have many inner loops. > > > With __predict_false: > > > > [snip prologue] > > 0x8084ecaf <+31>: mov0x24(%rbx),%eax > > 0x8084ecb2 <+34>: test $0x40,%ah > > 0x8084ecb5 <+37>: jne0x8084ece2> > All that this does is as you say -- invert the condition to jump to the > uncommon code. This made more of a difference on old CPUs (possiblly > still on low end/non-x86). Now branch predictors are too good for the > slow case to be much slower. > > I think x86 branch predictors initially predict forward branches as not > taken and backward branches as taken. So this branch was initially > mispredicted, and the change fixes this. But the first branch doesn't > really matter. Starting up takes hundreds or thousands of cycles for > cache misses. This is only true if branch predictor memory is large enough to keep the state for the given branch between exercising it. Even if the predictor state could be attached to every byte in the icache, or more likely, every line in the icache or uop cache, it still probably too small to survive between user->kernel transitions for syscalls. Might be there is performance counter which shows branch predictor mis-predictions. In other words, I suspect that there almost all cases might be mis-predictions without manual hint, and mis-predictions together with the full pipeline flush on VFS-intensive load very well might give tens percents of the total cycles on the modern cores. Just speculation. > > Moving the uncommon code out of the way reduces Icache pressure a bit. > I've never been able to measure a significant difference from this. > > However, I usually compile with -Os to reduce Icache pressure. This > is almost as good for speed as -O (typically at most 5% slower than > -O2 for kernels). The other day, I tried compiling with -O2 > -march=highest-supported and found that on a network microbenchmark > which was supposed to benefit from this, it was significantly slower. > It was with a very old version of gcc. I think this is because -O2 > rearranges the code a lot, and since at least the old version of gcc > doesn't understand caches at all, the arrangement accidentally ended > up much worse and caused more cache misses. With another compiler and > NIC, -O2 gave the expected speeding. > > > 0x8084ecb7 <+39>: mov0x24(%rbx),%esi > > 0x8084ecba <+42>: mov0x10(%rbx),%rdx > > 0x8084ecbe <+46>: mov%r14,%rdi > > 0x8084ecc1 <+49>: mov%r15,%rcx > > 0x8084ecc4 <+52>: callq 0x8085 > > 0x8084ecc9 <+57>: mov%eax,%r15d > > 0x8084eccc <+60>: mov0x24(%rbx),%eax > > 0x8084eccf <+63>: test $0x40,%ah > > 0x8084ecd2 <+66>: jne0x8084ecf5 > > [snip cleanup] > > 0x8084ece1 <+81>: retq > > The code for he uncommon case is now here (not shown). It will be no > smaller (actually slightly larger for a branch back) unless it can be > shared. > > > > > Without __predict_false: > > [snip prologue] > > 0x8084ecaf <+31>: mov0x24(%rbx),%eax > > 0x8084ecb2 <+34>: test $0x40,%ah > > 0x8084ecb5 <+37>: je 0x8084ecc8 > > The branch is not very far away, so perhaps the optimization from the move > is null. > > > 0x8084ecb7 <+39>: movzwl 0x20(%rbx),%eax > > 0x8084ecbb <+43>: cmp$0x1,%eax > > 0x8084ecbe <+46>: jne0x8084ecc8 > > 0x8084ecc0 <+48>: mov%r14,%rdi > > 0x8084ecc3 <+51>: callq 0x8083e270 > > The branch was to here <+56>. The function is not very well aligned. It > has address 0x90 mod 0x100, so starts 0x10 into a 64-bit cache line (is that > still the line size for all modern x86?). So 48 bytes are in a line, but > this +56 is in the next line. > > But aligning functions and branches to cache line boundaries works
Re: svn commit: r312600 - head/sys/kern
On Sun, 22 Jan 2017, Mateusz Guzik wrote: On Sun, Jan 22, 2017 at 12:07:56PM +1100, Bruce Evans wrote: ... Later commits further unimproved style by adding __predict_ugly() and long lines from blind substitution of that. __predict_ugly() is almost as useful as 'register', but more invasive. There were no __predict changes to this function. I did add some to vn_closefile in r312602. Indeed, one line is now 82 chars and arguably could be modified to fit the limit. I have to disagree about the usefulness remark. If you check generated assembly for amd64 (included below), you will see the uncommon code is moved out of the way and in particular there are no forward jumps in the common case. Check benchmarks. A few cycles here and there are in the noise. Kernel code has very few possibilities for useful optimizations since it doesn't have many inner loops. With __predict_false: [snip prologue] 0x8084ecaf <+31>: mov0x24(%rbx),%eax 0x8084ecb2 <+34>: test $0x40,%ah 0x8084ecb5 <+37>: jne0x8084ece2All that this does is as you say -- invert the condition to jump to the uncommon code. This made more of a difference on old CPUs (possiblly still on low end/non-x86). Now branch predictors are too good for the slow case to be much slower. I think x86 branch predictors initially predict forward branches as not taken and backward branches as taken. So this branch was initially mispredicted, and the change fixes this. But the first branch doesn't really matter. Starting up takes hundreds or thousands of cycles for cache misses. Moving the uncommon code out of the way reduces Icache pressure a bit. I've never been able to measure a significant difference from this. However, I usually compile with -Os to reduce Icache pressure. This is almost as good for speed as -O (typically at most 5% slower than -O2 for kernels). The other day, I tried compiling with -O2 -march=highest-supported and found that on a network microbenchmark which was supposed to benefit from this, it was significantly slower. It was with a very old version of gcc. I think this is because -O2 rearranges the code a lot, and since at least the old version of gcc doesn't understand caches at all, the arrangement accidentally ended up much worse and caused more cache misses. With another compiler and NIC, -O2 gave the expected speeding. 0x8084ecb7 <+39>: mov0x24(%rbx),%esi 0x8084ecba <+42>: mov0x10(%rbx),%rdx 0x8084ecbe <+46>: mov%r14,%rdi 0x8084ecc1 <+49>: mov%r15,%rcx 0x8084ecc4 <+52>: callq 0x8085 0x8084ecc9 <+57>: mov%eax,%r15d 0x8084eccc <+60>: mov0x24(%rbx),%eax 0x8084eccf <+63>: test $0x40,%ah 0x8084ecd2 <+66>: jne0x8084ecf5 [snip cleanup] 0x8084ece1 <+81>: retq The code for he uncommon case is now here (not shown). It will be no smaller (actually slightly larger for a branch back) unless it can be shared. Without __predict_false: [snip prologue] 0x8084ecaf <+31>: mov0x24(%rbx),%eax 0x8084ecb2 <+34>: test $0x40,%ah 0x8084ecb5 <+37>: je 0x8084ecc8 The branch is not very far away, so perhaps the optimization from the move is null. 0x8084ecb7 <+39>: movzwl 0x20(%rbx),%eax 0x8084ecbb <+43>: cmp$0x1,%eax 0x8084ecbe <+46>: jne0x8084ecc8 0x8084ecc0 <+48>: mov%r14,%rdi 0x8084ecc3 <+51>: callq 0x8083e270 The branch was to here <+56>. The function is not very well aligned. It has address 0x90 mod 0x100, so starts 0x10 into a 64-bit cache line (is that still the line size for all modern x86?). So 48 bytes are in a line, but this +56 is in the next line. But aligning functions and branches to cache line boundaries works poorly in general. It wastes Icache in another way. -march affects this a lot, and -march=higher is often worse since the compiler doesn't really understand this and does more or less alignment than is good. Here it didn't bother aligning even 1 of the branch targets. 0x8084ecc8 <+56>: mov0x24(%rbx),%esi 0x8084eccb <+59>: mov0x10(%rbx),%rdx 0x8084eccf <+63>: mov%r14,%rdi 0x8084ecd2 <+66>: mov%r15,%rcx The main code ends up just +17 later at <+69>. Fitting it all below <+64> would be better but is not necessary if the instructions are slow enough to all the instruction fetch to run ahead. This depends on good prediction to not start too many instructions in paths that won't be followed. 0x8084ecd5 <+69>: callq 0x8085 0x8084ecda <+74>: mov%eax,%r15d
Re: svn commit: r312600 - head/sys/kern
On Sun, Jan 22, 2017 at 12:07:56PM +1100, Bruce Evans wrote: > On Sat, 21 Jan 2017, Konstantin Belousov wrote: > > >On Sat, Jan 21, 2017 at 06:38:17PM +, Mateusz Guzik wrote: > >>... > >>Log: > >> vfs: refactor _vn_lock > >> > >> Stop testing for LK_RETRY and error multiple times. Also postpone the > >> VI_DOOMED until after LK_RETRY was seen as it reads from the vnode. > >> > >> No functional changes. > > Many style bugs. > Indeed, the commit was weirdly bad. > >>+ flags &= ~LK_INTERLOCK; /* Interlock is always dropped. */ > >>+ KASSERT((flags & LK_RETRY) == 0 || error == 0, > >>+ ("LK_RETRY set with incompatible flags (0x%x) or an > >>error occurred (%d)", > >>+flags, error)); > > This is even more grossly misreformatted than the other KASSERT(). The new > style bugs are: > - random first contuation indent (it happens to be 2 tabs) > - long line longer than before (further messed up by the indentation) > - random second contuation indent (it actually lines up with the first, > except it uses gnu-style lining up parentheses instead of KNF) > There was a subsequent commit addressing it, see r312601. > >>+ if (flags & LK_RETRY) { > >Stylish test is > > if ((flags & LK_RETRY) != 0) { > >>+ if ((error != 0)) > >Too many (). > > > >>+ goto retry; > >>+ if ((vp->v_iflag & VI_DOOMED)) { > >Too many braces again, or missed != 0. > >>VOP_UNLOCK(vp, 0); > >>error = ENOENT; > >>- break; > >Also, this does the functional change, it seems to completely break LK_RERY > >logic. If LK_RETRY is specified, VI_DOOMED must not result in ENOENT. > > Later commits further unimproved style by adding __predict_ugly() and > long lines from blind substitution of that. __predict_ugly() is almost > as useful as 'register', but more invasive. > There were no __predict changes to this function. I did add some to vn_closefile in r312602. Indeed, one line is now 82 chars and arguably could be modified to fit the limit. I have to disagree about the usefulness remark. If you check generated assembly for amd64 (included below), you will see the uncommon code is moved out of the way and in particular there are no forward jumps in the common case. With __predict_false: [snip prologue] 0x8084ecaf <+31>:mov0x24(%rbx),%eax 0x8084ecb2 <+34>:test $0x40,%ah 0x8084ecb5 <+37>:jne0x8084ece20x8084ecb7 <+39>:mov0x24(%rbx),%esi 0x8084ecba <+42>:mov0x10(%rbx),%rdx 0x8084ecbe <+46>:mov%r14,%rdi 0x8084ecc1 <+49>:mov%r15,%rcx 0x8084ecc4 <+52>:callq 0x8085 0x8084ecc9 <+57>:mov%eax,%r15d 0x8084eccc <+60>:mov0x24(%rbx),%eax 0x8084eccf <+63>:test $0x40,%ah 0x8084ecd2 <+66>:jne0x8084ecf5 [snip cleanup] 0x8084ece1 <+81>:retq Without __predict_false: [snip prologue] 0x8084ecaf <+31>:mov0x24(%rbx),%eax 0x8084ecb2 <+34>:test $0x40,%ah 0x8084ecb5 <+37>:je 0x8084ecc8 0x8084ecb7 <+39>:movzwl 0x20(%rbx),%eax 0x8084ecbb <+43>:cmp$0x1,%eax 0x8084ecbe <+46>:jne0x8084ecc8 0x8084ecc0 <+48>:mov%r14,%rdi 0x8084ecc3 <+51>:callq 0x8083e270 0x8084ecc8 <+56>:mov0x24(%rbx),%esi 0x8084eccb <+59>:mov0x10(%rbx),%rdx 0x8084eccf <+63>:mov%r14,%rdi 0x8084ecd2 <+66>:mov%r15,%rcx 0x8084ecd5 <+69>:callq 0x8085 0x8084ecda <+74>:mov%eax,%r15d 0x8084ecdd <+77>:mov0x24(%rbx),%eax 0x8084ece0 <+80>:test $0x40,%ah 0x8084ece3 <+83>:je 0x8084ed45 0x8084ece5 <+85>:movzwl 0x20(%rbx),%eax 0x8084ece9 <+89>:cmp$0x1,%eax 0x8084ecec <+92>:jne0x8084ed45 0x8084ecee <+94>:movw $0x0,-0x22(%rbp) [skip some parts, +181 marks the beginning of cleanup] 0x8084ed52 <+194>: retq -- Mateusz Guzik ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"