svn commit: r303605 - head/sys/dev/hyperv/storvsc
Author: sephe Date: Mon Aug 1 05:09:11 2016 New Revision: 303605 URL: https://svnweb.freebsd.org/changeset/base/303605 Log: hyperv/storvsc: Stringent PRP list assertions MFC after:1 week Sponsored by: Microsoft Differential Revision:https://reviews.freebsd.org/D7361 Modified: head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Modified: head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c == --- head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.cMon Aug 1 04:51:31 2016(r303604) +++ head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.cMon Aug 1 05:09:11 2016(r303605) @@ -1775,13 +1775,28 @@ storvsc_xferbuf_prepare(void *arg, bus_d prplist->gpa_range.gpa_ofs = segs[0].ds_addr & PAGE_MASK; for (i = 0; i < nsegs; i++) { - prplist->gpa_page[i] = atop(segs[i].ds_addr); #ifdef INVARIANTS - if (i != 0 && i != nsegs - 1) { - KASSERT((segs[i].ds_addr & PAGE_MASK) == 0 && - segs[i].ds_len == PAGE_SIZE, ("not a full page")); + if (nsegs > 1) { + if (i == 0) { + KASSERT((segs[i].ds_addr & PAGE_MASK) + + segs[i].ds_len == PAGE_SIZE, + ("invalid 1st page, ofs 0x%jx, len %zu", +(uintmax_t)segs[i].ds_addr, +segs[i].ds_len)); + } else if (i == nsegs - 1) { + KASSERT((segs[i].ds_addr & PAGE_MASK) == 0, + ("invalid last page, ofs 0x%jx", +(uintmax_t)segs[i].ds_addr)); + } else { + KASSERT((segs[i].ds_addr & PAGE_MASK) == 0 && + segs[i].ds_len == PAGE_SIZE, + ("not a full page, ofs 0x%jx, len %zu", +(uintmax_t)segs[i].ds_addr, +segs[i].ds_len)); + } } #endif + prplist->gpa_page[i] = atop(segs[i].ds_addr); } reqp->prp_cnt = nsegs; } ___ 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: r303604 - head/sys/dev/hyperv/storvsc
Author: sephe Date: Mon Aug 1 04:51:31 2016 New Revision: 303604 URL: https://svnweb.freebsd.org/changeset/base/303604 Log: hyperv/storvsc: Set maxio to 128KB. MFC after:1 week Sponsored by: Microsoft Differential Revision:https://reviews.freebsd.org/D7360 Modified: head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Modified: head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c == --- head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.cMon Aug 1 04:26:24 2016(r303603) +++ head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.cMon Aug 1 04:51:31 2016(r303604) @@ -88,10 +88,25 @@ __FBSDID("$FreeBSD$"); #define VSTOR_PKT_SIZE (sizeof(struct vstor_packet) - vmscsi_size_delta) -#define STORVSC_DATA_SEGCNT_MAX32 +/* + * 33 segments are needed to allow 128KB maxio, in case the data + * in the first page is _not_ PAGE_SIZE aligned, e.g. + * + * |<--- 128KB --->| + * | | + * 0 2K 4K8K 16K 124K 128K 130K + * | | | | | | | | + * +--+--+-+-+...+-+--+--+ + * | | | | | | | | | DATA + * | | | | | | | | | + * +--+--+-+-+...--+--+--+ + * | | | | + * | 1|31 | 1| .. # of segments + */ +#define STORVSC_DATA_SEGCNT_MAX33 #define STORVSC_DATA_SEGSZ_MAX PAGE_SIZE #define STORVSC_DATA_SIZE_MAX \ - (STORVSC_DATA_SEGCNT_MAX * STORVSC_DATA_SEGSZ_MAX) + ((STORVSC_DATA_SEGCNT_MAX - 1) * STORVSC_DATA_SEGSZ_MAX) struct storvsc_softc; @@ -1386,6 +1401,7 @@ storvsc_action(struct cam_sim *sim, unio cpi->hba_misc = PIM_NOBUSRESET; if (hv_storvsc_use_pim_unmapped) cpi->hba_misc |= PIM_UNMAPPED; + cpi->maxio = STORVSC_DATA_SIZE_MAX; cpi->hba_eng_cnt = 0; cpi->max_target = STORVSC_MAX_TARGETS; cpi->max_lun = sc->hs_drv_props->drv_max_luns_per_target; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r303586 - head/bin/sh
On Sun, Jul 31, 2016 at 2:16 PM, Jilles Tjoelkerwrote: > On Sun, Jul 31, 2016 at 01:43:16PM +, Alexey Dokuchaev wrote: >> On Sun, Jul 31, 2016 at 01:11:34PM +, Jilles Tjoelker wrote: >> > New Revision: 303586 >> > URL: https://svnweb.freebsd.org/changeset/base/303586 > >> > Log: >> > sh: Fix a clang warning. > >> > Submitted by: bdrewery > >> > Modified: >> > head/bin/sh/expand.c > >> > Modified: head/bin/sh/expand.c >> > == >> > --- head/bin/sh/expand.cSun Jul 31 12:59:10 2016(r303585) >> > +++ head/bin/sh/expand.cSun Jul 31 13:11:34 2016(r303586) >> > @@ -473,7 +473,8 @@ expbackq(union node *cmd, int quoted, in >> > if (--in.nleft < 0) { >> > if (in.fd < 0) >> > break; >> > - while ((i = read(in.fd, buf, sizeof buf)) < 0 && errno >> > == EINTR); >> > + while ((i = read(in.fd, buf, sizeof buf)) < 0 && errno >> > == EINTR) >> > + ; > >> `continue;' would be even better; some tools might barf at stray semicolon. > > Both continue; and ; (the latter with and without comment) occur in the > source tree many times. I don't really like a continue that does nothing > because it is at the end of a loop, so I prefer to make this whitespace > change only (there are two more instances in bin/sh). I think a sole > semicolon on a line is conspicuous enough that nothing additional is > required. For humans, yes. For picky tools that warn about strange constructs, no. Clang may be happy, but there's many other tools that expect you to declare an 'empty' while loop with continue. This tradition has dated back to at least the late 80's... Warner ___ 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: r303603 - in head/sys/dev/hyperv: include netvsc storvsc vmbus
Author: sephe Date: Mon Aug 1 04:26:24 2016 New Revision: 303603 URL: https://svnweb.freebsd.org/changeset/base/303603 Log: hyperv/vmbus: Remove the artificial entry limit of SG and PRP list. Just make sure that the total channel packet size does not exceed 1/2 data size of the TX bufring. MFC after:1 week Sponsored by: Microsoft Differential Revision:https://reviews.freebsd.org/D7359 Modified: head/sys/dev/hyperv/include/vmbus.h head/sys/dev/hyperv/netvsc/hv_net_vsc.h head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c head/sys/dev/hyperv/vmbus/vmbus_brvar.h head/sys/dev/hyperv/vmbus/vmbus_chan.c Modified: head/sys/dev/hyperv/include/vmbus.h == --- head/sys/dev/hyperv/include/vmbus.h Mon Aug 1 00:36:29 2016 (r303602) +++ head/sys/dev/hyperv/include/vmbus.h Mon Aug 1 04:26:24 2016 (r303603) @@ -102,9 +102,6 @@ struct vmbus_chanpkt_rxbuf { struct vmbus_rxbuf_desc cp_rxbuf[]; } __packed; -#define VMBUS_CHAN_SGLIST_MAX 32 -#define VMBUS_CHAN_PRPLIST_MAX 32 - struct vmbus_channel; struct hyperv_guid; Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.h == --- head/sys/dev/hyperv/netvsc/hv_net_vsc.h Mon Aug 1 00:36:29 2016 (r303602) +++ head/sys/dev/hyperv/netvsc/hv_net_vsc.h Mon Aug 1 04:26:24 2016 (r303603) @@ -1088,6 +1088,7 @@ struct vmbus_channel; typedef void (*pfn_on_send_rx_completion)(struct vmbus_channel *, void *); #define NETVSC_DEVICE_RING_BUFFER_SIZE (128 * PAGE_SIZE) +#define NETVSC_PACKET_MAXPAGE 32 #define NETVSC_VLAN_PRIO_MASK 0xe000 #define NETVSC_VLAN_PRIO_SHIFT 13 @@ -1137,7 +1138,7 @@ typedef struct netvsc_packet_ { uint32_ttot_data_buf_len; void*data; uint32_tgpa_cnt; - struct vmbus_gpa gpa[VMBUS_CHAN_SGLIST_MAX]; + struct vmbus_gpa gpa[NETVSC_PACKET_MAXPAGE]; } netvsc_packet; typedef struct { Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c == --- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Mon Aug 1 00:36:29 2016(r303602) +++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Mon Aug 1 04:26:24 2016(r303603) @@ -152,7 +152,7 @@ __FBSDID("$FreeBSD$"); #define HN_TX_DATA_MAXSIZE IP_MAXPACKET #define HN_TX_DATA_SEGSIZE PAGE_SIZE #define HN_TX_DATA_SEGCNT_MAX \ -(VMBUS_CHAN_SGLIST_MAX - HV_RF_NUM_TX_RESERVED_PAGE_BUFS) +(NETVSC_PACKET_MAXPAGE - HV_RF_NUM_TX_RESERVED_PAGE_BUFS) #define HN_DIRECT_TX_SIZE_DEF 128 Modified: head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c == --- head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.cMon Aug 1 00:36:29 2016(r303602) +++ head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.cMon Aug 1 04:26:24 2016(r303603) @@ -88,7 +88,7 @@ __FBSDID("$FreeBSD$"); #define VSTOR_PKT_SIZE (sizeof(struct vstor_packet) - vmscsi_size_delta) -#define STORVSC_DATA_SEGCNT_MAXVMBUS_CHAN_PRPLIST_MAX +#define STORVSC_DATA_SEGCNT_MAX32 #define STORVSC_DATA_SEGSZ_MAX PAGE_SIZE #define STORVSC_DATA_SIZE_MAX \ (STORVSC_DATA_SEGCNT_MAX * STORVSC_DATA_SEGSZ_MAX) Modified: head/sys/dev/hyperv/vmbus/vmbus_brvar.h == --- head/sys/dev/hyperv/vmbus/vmbus_brvar.h Mon Aug 1 00:36:29 2016 (r303602) +++ head/sys/dev/hyperv/vmbus/vmbus_brvar.h Mon Aug 1 04:26:24 2016 (r303603) @@ -71,6 +71,13 @@ struct vmbus_txbr { struct sysctl_ctx_list; struct sysctl_oid; +static __inline int +vmbus_txbr_maxpktsz(const struct vmbus_txbr *tbr) +{ + /* 1/2 data size */ + return (tbr->txbr_dsize / 2); +} + void vmbus_br_sysctl_create(struct sysctl_ctx_list *ctx, struct sysctl_oid *br_tree, struct vmbus_br *br, const char *name); Modified: head/sys/dev/hyperv/vmbus/vmbus_chan.c == --- head/sys/dev/hyperv/vmbus/vmbus_chan.c Mon Aug 1 00:36:29 2016 (r303602) +++ head/sys/dev/hyperv/vmbus/vmbus_chan.c Mon Aug 1 04:26:24 2016 (r303603) @@ -610,6 +610,8 @@ vmbus_chan_send(struct vmbus_channel *ch hlen = sizeof(pkt); pktlen = hlen + dlen; pad_pktlen = VMBUS_CHANPKT_TOTLEN(pktlen); + KASSERT(pad_pktlen <= vmbus_txbr_maxpktsz(>ch_txbr), + ("invalid packet size %d", pad_pktlen)); pkt.cp_hdr.cph_type = type; pkt.cp_hdr.cph_flags
Re: svn commit: r303583 - head/sys/amd64/amd64
On Sun, 31 Jul 2016, Konstantin Belousov wrote: On Sun, Jul 31, 2016 at 11:11:25PM +1000, Bruce Evans wrote: I said that I didn't replace (sse2) pagecopy() by bcopy() on amd64 for Haswell. Actually I do, for a small improvement on makeworld. i386 doesn't have (sse*) pagecopy() except in some of my versions, so I don't need to do anything to get the same improvement on the same Haswell. On Haswell, "rep stos" takes about 25 cycles to start up, and the function call overhead is in the noise. 25 cycles is a lot. Haswell can move 32 bytes/cycle from L2 to L2, so it misses moving 800 bytes or 1/5 of a page in its startup overhead. Oops, that is for "rep movs". "rep stos" is similar. The commit message contained a probable explanation of the reason why the change demonstrated measurable improvement in non-microbenchmark load. Pagefaults give some locality, but I think not enough to explain much of the improvement or the larger negative improvements that I measure. makeworld isn't a micro-benchmark. For a tuned ~5.2 world it does about 32 million pagezero()s. makeworld does only 2728 pagefaults with warm (VMIO and buffer...) caches on i386. 24866 with cold caches. On amd64, 15% lower. Page reclaims are about 17 million on i386 and 27 million on amd64. Either page faults each touch a lot of pages (so that nontemporal stores should help in theory by avoiding busting L1 and depleting L2 on every pagefault), or there is a lot of pre-zeroing (so again nontemporal stors should help in theory). In fact, nontemporal stores help in practice on Turion2. Haswell has better caches and that is probably the main reason that nontemporal stores are slower in practice. Turion2 also benefited from the old implementation of pagezero in idle. Clearly, zeroing in idle should use nontemporal stores. But when nontemporal stores are much slower, there is less likely to be enough otherwise-idle cycles to do enough of them. Zeroing in idle works poorly now, and is turned off. On systems with HTT, idle CPUs aren't created equally and aren't really idle if using them would steal sources from another CPU. That said, the only thing I am answering and asking there is the above claim about 25 cycles overhead of rep;stosq on hsw. I am curious how the overhead was measured. Note: Agner Fog' tables state that fast mode takes <2n uops and has reciprocal throughput of 0.5n worst case and do not demostrate any setup overhead for hsw. I think the target is 0.25n best case (32 bytes/cycle only 8 bytes wide using integer instructions). ISTR that Fog says something about the latency. He does for older CPUs. I've never noticed latency for x86 string instructions being below about 15 cycles, and the fast string operations have to do more setup so it would be surprising if they had lower latency. To measure latency, just time bcopy() and bzero() with different sizes in a loop and take differences. Use small sizes to stay in L1 and avoid cache misses (except for preemption). I get the following times for amd64 on Haswell @ 4.080 GHz. (These times also disprove my claim that bzero() is just as good as a specialized function -- latency makes it significantly slower except for unusually large sizes.): size 4096size 8192 0.25n throughput:130.56 130.56 rep movsb alone in a function:96.5110.9 (speeds in 1e9 B/s) 45+0.25n: 96.6111.0 memcpy (rep movsq in libc): 72.5 92.9 102+0.25n:72.7 93.4 rep stosq alone in function: 105.8116.7 31+0.25n:105.1116.9 25 is about right for rep stosq inline -- the function call adds about 5, and that is in the fastest possible case with the call in a loop. libc memcpy must be doing something very stupid to take 102 cycles. Note that Haswell can't get very near 0+0.25n because sizes slightly larger than 2*8192. Haswell's L1 is too small to get very near to amortising the startup overhead. The fastest speed I could find for rep movsb in a function was 115.4 for size 13K. Larger sizes are slower because they don't fit in L1 (2 * 14K fits in 32K L1 but is still slower for some reason). Latency for non-rep string functions is also interesting. I think it is almost as high, making these instructions useless for all purposes except saving space on all CPUs and saving time on CPUs almost as old as the 8088 (on the 8088, instruction fetch was very slow, so it was faster to use 1-byte instructions if possible). Bruce ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r303602 - head/sys/dev/ath
Author: adrian Date: Mon Aug 1 00:36:29 2016 New Revision: 303602 URL: https://svnweb.freebsd.org/changeset/base/303602 Log: [ath] update comments. Modified: head/sys/dev/ath/if_athioctl.h Modified: head/sys/dev/ath/if_athioctl.h == --- head/sys/dev/ath/if_athioctl.h Sun Jul 31 21:43:43 2016 (r303601) +++ head/sys/dev/ath/if_athioctl.h Mon Aug 1 00:36:29 2016 (r303602) @@ -303,8 +303,8 @@ struct ath_radiotap_vendor_hdr {/* 30 /* At this point it should be 4 byte aligned */ uint32_tevm[ATH_RADIOTAP_MAX_EVM]; /* 5 * 4 = 20 */ - uint8_t rssi_ctl[ATH_RADIOTAP_MAX_CHAINS]; /* 4 */ - uint8_t rssi_ext[ATH_RADIOTAP_MAX_CHAINS]; /* 4 */ + uint8_t rssi_ctl[ATH_RADIOTAP_MAX_CHAINS]; /* 4 * 4 = 16 */ + uint8_t rssi_ext[ATH_RADIOTAP_MAX_CHAINS]; /* 4 * 4 = 16 */ uint8_t vh_phyerr_code; /* Phy error code, or 0xff */ uint8_t vh_rs_status; /* RX status */ ___ 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: r303601 - head/usr.bin/indent
Author: pfg Date: Sun Jul 31 21:43:43 2016 New Revision: 303601 URL: https://svnweb.freebsd.org/changeset/base/303601 Log: indent(1): Rearrange option parsing code to squelch clang's static analyzer. clang-analyzer complained that eqin() sets file-scoped pointer param_start to point into char buffer defined in scan_profile(), and once scan_profile() exits, param_start is a "dangling reference". param_start was never used afterwards, but it's cleaner to move it to set_option() which is the only branch where param_start is needed. Reference: https://github.com/pstef/freebsd_indent/commit/ab0e44e5da3ff0fa4b62e451e4bbc3ea1ec7f365 Differential Revision: https://reviews.freebsd.org/D6966 (Partial) Submitted by: Piotr Stefaniak Modified: head/usr.bin/indent/args.c Modified: head/usr.bin/indent/args.c == --- head/usr.bin/indent/args.c Sun Jul 31 21:36:40 2016(r303600) +++ head/usr.bin/indent/args.c Sun Jul 31 21:43:43 2016(r303601) @@ -223,17 +223,14 @@ scan_profile(FILE *f) } } -const char *param_start; - -static int +static const char * eqin(const char *s1, const char *s2) { while (*s1) { if (*s1++ != *s2++) - return (false); + return (NULL); } -param_start = s2; -return (true); +return (s2); } /* @@ -257,11 +254,12 @@ set_defaults(void) void set_option(char *arg) { -struct pro *p; +struct pro *p; +const char *param_start; arg++; /* ignore leading "-" */ for (p = pro; p->p_name; p++) - if (*p->p_name == *arg && eqin(p->p_name, arg)) + if (*p->p_name == *arg && (param_start = eqin(p->p_name, arg)) != NULL) goto found; errx(1, "%s: unknown parameter \"%s\"", option_source, arg - 1); found: ___ 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: r303600 - head/usr.bin/indent
Author: pfg Date: Sun Jul 31 21:36:40 2016 New Revision: 303600 URL: https://svnweb.freebsd.org/changeset/base/303600 Log: indent(1): replace function call to bzero with memset. Reference: https://github.com/pstef/freebsd_indent/commit/7422f42f80099c69d34833d7106035dc09230235 Differential Revision: https://reviews.freebsd.org/D6966 (Partial) Submitted by: Piotr Stefaniak Modified: head/usr.bin/indent/io.c Modified: head/usr.bin/indent/io.c == --- head/usr.bin/indent/io.cSun Jul 31 21:29:10 2016(r303599) +++ head/usr.bin/indent/io.cSun Jul 31 21:36:40 2016(r303600) @@ -629,7 +629,7 @@ parsefont(struct fstate *f, const char * const char *s = s0; int sizedelta = 0; -bzero(f, sizeof *f); +memset(f, 0, sizeof(struct fstate)); while (*s) { if (isdigit(*s)) f->size = f->size * 10 + *s - '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: r303599 - head/usr.bin/indent
Author: pfg Date: Sun Jul 31 21:29:10 2016 New Revision: 303599 URL: https://svnweb.freebsd.org/changeset/base/303599 Log: indent(1): Don't newline on cpp lines like #endif unless -bacc is on. Reference: https://github.com/pstef/freebsd_indent/commit/01f36f4141c71754b3a73a91886fb425bab0df3e Differential Revision: https://reviews.freebsd.org/D6966 (Partial) Submitted by: Piotr Stefaniak Modified: head/usr.bin/indent/indent.c Modified: head/usr.bin/indent/indent.c == --- head/usr.bin/indent/indent.cSun Jul 31 21:09:22 2016 (r303598) +++ head/usr.bin/indent/indent.cSun Jul 31 21:29:10 2016 (r303599) @@ -1100,13 +1100,7 @@ check_type: ps.pcase = false; } - if (strncmp(s_lab, "#if", 3) == 0) { - if (blanklines_around_conditional_compilation) { - int c; - prefix_blankline_requested++; - while ((c = getc(input)) == '\n'); - ungetc(c, input); - } + if (strncmp(s_lab, "#if", 3) == 0) { /* also ifdef, ifndef */ if ((size_t)ifdef_level < nitems(state_stack)) { match_state[ifdef_level].tos = -1; state_stack[ifdef_level++] = ps; @@ -1114,34 +1108,49 @@ check_type: else diag2(1, "#if stack overflow"); } - else if (strncmp(s_lab, "#else", 5) == 0) + else if (strncmp(s_lab, "#el", 3) == 0) { /* else, elif */ if (ifdef_level <= 0) - diag2(1, "Unmatched #else"); + diag2(1, s_lab[3] == 'i' ? "Unmatched #elif" : "Unmatched #else"); else { match_state[ifdef_level - 1] = ps; ps = state_stack[ifdef_level - 1]; } + } else if (strncmp(s_lab, "#endif", 6) == 0) { if (ifdef_level <= 0) diag2(1, "Unmatched #endif"); - else { + else ifdef_level--; - -#ifdef undef - /* -* This match needs to be more intelligent before the -* message is useful -*/ - if (match_state[ifdef_level].tos >= 0 - && bcmp(, _state[ifdef_level], sizeof ps)) - diag2(0, "Syntactically inconsistent #ifdef alternatives"); -#endif + } else { + struct directives { + int size; + const char *string; } - if (blanklines_around_conditional_compilation) { - postfix_blankline_requested++; - n_real_blanklines = 0; + recognized[] = { + {7, "include"}, + {6, "define"}, + {5, "undef"}, + {4, "line"}, + {5, "error"}, + {6, "pragma"} + }; + int d = nitems(recognized); + while (--d >= 0) + if (strncmp(s_lab + 1, recognized[d].string, recognized[d].size) == 0) + break; + if (d < 0) { + diag2(1, "Unrecognized cpp directive"); + break; } } + if (blanklines_around_conditional_compilation) { + postfix_blankline_requested++; + n_real_blanklines = 0; + } + else { + postfix_blankline_requested = 0; + prefix_blankline_requested = 0; + } break; /* subsequent processing of the newline * character will cause the line to be printed */ ___ 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: r303598 - head/usr.bin/indent
Author: pfg Date: Sun Jul 31 21:09:22 2016 New Revision: 303598 URL: https://svnweb.freebsd.org/changeset/base/303598 Log: indent(1): Untangle the connection between pr_comment.c and io.c. It's pr_comment.c that should decide whether to put a "star comment continuation" or not. This duplicates code a bit, but it simplifies pr_comment() at the same time since pr_comment() no longer has to "signal" whether a star continuation is needed or not. This change requires indent(1) to not wrap comment lines that lack a blank character, but I think it's for the better if you look at cases when that happens (mostly long URIs and file system paths, which arguably shouldn't be wrapped). It also fixes two bugs: 1. Cases where asterisk is a part of the comment's content (like in "*we* are the champions") and happens to appear at the beginning of the line, misleading dump_line() into thinking that this is part of the star comment continuation, leading to misalignment. 2. Cases where blank starred lines had three too many characters on the line when wrapped. Reference: https://github.com/pstef/freebsd_indent/commit/3b41ee78aafafc7c3e662b794835e3253218dbb3 Differential Revision: https://reviews.freebsd.org/D6966 (Partial) Submitted by: Piotr Stefaniak Modified: head/usr.bin/indent/io.c head/usr.bin/indent/pr_comment.c Modified: head/usr.bin/indent/io.c == --- head/usr.bin/indent/io.cSun Jul 31 20:13:00 2016(r303597) +++ head/usr.bin/indent/io.cSun Jul 31 21:09:22 2016(r303598) @@ -242,17 +242,8 @@ dump_line(void) while (e_com > com_st && isspace(e_com[-1])) e_com--; cur_col = pad_output(cur_col, target); - if (!ps.box_com) { - if (star_comment_cont && (com_st[1] != '*' || e_com <= com_st + 1)) { - if (com_st[1] == ' ' && com_st[0] == ' ' && e_com > com_st + 1) - com_st[1] = '*'; - else - fwrite(" * ", com_st[0] == '\t' ? 2 : com_st[0] == '*' ? 1 : 3, 1, output); - } - } fwrite(com_st, e_com - com_st, 1, output); ps.comment_delta = ps.n_comment_delta; - cur_col = count_spaces(cur_col, com_st); ++ps.com_lines; /* count lines with comments */ } } @@ -282,7 +273,7 @@ inhibit_newline: ps.dumped_decl_indent = 0; *(e_lab = s_lab) = '\0'; /* reset buffers */ *(e_code = s_code) = '\0'; -*(e_com = s_com) = '\0'; +*(e_com = s_com = combuf + 1) = '\0'; ps.ind_level = ps.i_l_follow; ps.paren_level = ps.p_l_follow; paren_target = -ps.paren_indents[ps.paren_level - 1]; Modified: head/usr.bin/indent/pr_comment.c == --- head/usr.bin/indent/pr_comment.cSun Jul 31 20:13:00 2016 (r303597) +++ head/usr.bin/indent/pr_comment.cSun Jul 31 21:09:22 2016 (r303598) @@ -179,11 +179,11 @@ pr_comment(void) if (blanklines_before_blockcomments) prefix_blankline_requested = 1; dump_line(); - e_com = t; - s_com[0] = s_com[1] = s_com[2] = ' '; + e_com = s_com = t; + if (!ps.box_com && star_comment_cont) + *e_com++ = ' ', *e_com++ = '*', *e_com++ = ' '; } -*e_com = '\0'; if (troff) adj_max_col = 80; @@ -199,10 +199,10 @@ pr_comment(void) /* fix so dump_line uses a form feed */ dump_line(); last_bl = NULL; - *e_com++ = ' '; - *e_com++ = '*'; - *e_com++ = ' '; - while (*++buf_ptr == ' ' || *buf_ptr == '\t'); + if (!ps.box_com && star_comment_cont) + *e_com++ = ' ', *e_com++ = '*', *e_com++ = ' '; + while (*++buf_ptr == ' ' || *buf_ptr == '\t') + ; } else { if (++buf_ptr >= buf_end) @@ -214,25 +214,22 @@ pr_comment(void) case '\n': if (had_eof) { /* check for unexpected eof */ printf("Unterminated comment\n"); - *e_com = '\0'; dump_line(); return; } last_bl = NULL; if (ps.box_com || ps.last_nl) { /* if this is a boxed comment, * we dont ignore the newline */ - if (s_com == e_com) { - *e_com++ = ' '; + if (s_com == e_com) *e_com++ = ' '; - } - *e_com = '\0'; if (!ps.box_com && e_com - s_com > 3) { dump_line(); - CHECK_SIZE_COM; - *e_com++ =
Re: svn commit: r303586 - head/bin/sh
On Sun, Jul 31, 2016 at 01:43:16PM +, Alexey Dokuchaev wrote: > On Sun, Jul 31, 2016 at 01:11:34PM +, Jilles Tjoelker wrote: > > New Revision: 303586 > > URL: https://svnweb.freebsd.org/changeset/base/303586 > > Log: > > sh: Fix a clang warning. > > Submitted by: bdrewery > > Modified: > > head/bin/sh/expand.c > > Modified: head/bin/sh/expand.c > > == > > --- head/bin/sh/expand.cSun Jul 31 12:59:10 2016(r303585) > > +++ head/bin/sh/expand.cSun Jul 31 13:11:34 2016(r303586) > > @@ -473,7 +473,8 @@ expbackq(union node *cmd, int quoted, in > > if (--in.nleft < 0) { > > if (in.fd < 0) > > break; > > - while ((i = read(in.fd, buf, sizeof buf)) < 0 && errno > > == EINTR); > > + while ((i = read(in.fd, buf, sizeof buf)) < 0 && errno > > == EINTR) > > + ; > `continue;' would be even better; some tools might barf at stray semicolon. Both continue; and ; (the latter with and without comment) occur in the source tree many times. I don't really like a continue that does nothing because it is at the end of a loop, so I prefer to make this whitespace change only (there are two more instances in bin/sh). I think a sole semicolon on a line is conspicuous enough that nothing additional is required. -- Jilles Tjoelker ___ 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: r303597 - head/usr.bin/indent
Author: pfg Date: Sun Jul 31 20:13:00 2016 New Revision: 303597 URL: https://svnweb.freebsd.org/changeset/base/303597 Log: indent(1): Fix wrapping of some lines in comments. After a blank line was printed (to separate paragraphs in comments), the next line was sometimes wrapped to the column at which the previous non-empty line ended. The fix is to reset the last blank pointer (last_bl) on newline. References: https://github.com/pstef/freebsd_indent/commit/345663c07af0758fd10433bde14722dfd900f85c Differential Revision: https://reviews.freebsd.org/D6966 (Partial) Submitted by: Piotr Stefaniak Modified: head/usr.bin/indent/pr_comment.c Modified: head/usr.bin/indent/pr_comment.c == --- head/usr.bin/indent/pr_comment.cSun Jul 31 20:04:18 2016 (r303596) +++ head/usr.bin/indent/pr_comment.cSun Jul 31 20:13:00 2016 (r303597) @@ -218,6 +218,7 @@ pr_comment(void) dump_line(); return; } + last_bl = NULL; if (ps.box_com || ps.last_nl) { /* if this is a boxed comment, * we dont ignore the newline */ if (s_com == e_com) { ___ 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: r303596 - head/usr.bin/indent
Author: pfg Date: Sun Jul 31 20:04:18 2016 New Revision: 303596 URL: https://svnweb.freebsd.org/changeset/base/303596 Log: indent(1): Simplify pr_comment(). Modify count_spaces() to take a third parameter "end" that will make the function return when the end is reached. This lets the caller pass a pointer to non nul-terminated sequence of characters. Rename count_spaces() to count_spaces_until() and reinstate count_spaces(), this time based on count_spaces_until(). Use count_spaces_until() to recalculate current column when going through a comment just before the fragment which decides if current line of the comment should be wrapped. This move simplifies this code by eliminating the need for keeping the column counter up to date every time e_com is advanced and also reduces spread of code that has to know how many columns a tab will produce. Deduplicate code that decided if a comment needs a blank line at the top. References: https://github.com/pstef/freebsd_indent/commit/d9fa3b481532a448095f8ddd14fd0797ce59230c https://github.com/pstef/freebsd_indent/commit/27185b4b336b0e2108a3d96aee6df80cced94192 Differential Revision: https://reviews.freebsd.org/D6966 (Partial) Submitted by: Piotr Stefaniak Modified: head/usr.bin/indent/indent.h head/usr.bin/indent/io.c head/usr.bin/indent/pr_comment.c Modified: head/usr.bin/indent/indent.h == --- head/usr.bin/indent/indent.hSun Jul 31 19:02:19 2016 (r303595) +++ head/usr.bin/indent/indent.hSun Jul 31 20:04:18 2016 (r303596) @@ -32,6 +32,7 @@ void addkey(char *, int); intcompute_code_target(void); intcompute_label_target(void); intcount_spaces(int, char *); +intcount_spaces_until(int, char *, char *); intlexi(void); void diag2(int, const char *); void diag3(int, const char *, int); Modified: head/usr.bin/indent/io.c == --- head/usr.bin/indent/io.cSun Jul 31 19:02:19 2016(r303595) +++ head/usr.bin/indent/io.cSun Jul 31 20:04:18 2016(r303596) @@ -506,18 +506,15 @@ pad_output(int current, int target) * */ int -count_spaces(int current, char *buffer) +count_spaces_until(int cur, char *buffer, char *end) /* * this routine figures out where the character position will be after * printing the text in buffer starting at column "current" */ { char *buf; /* used to look thru buffer */ -int cur; /* current character counter */ -cur = current; - -for (buf = buffer; *buf != '\0'; ++buf) { +for (buf = buffer; *buf != '\0' && buf != end; ++buf) { switch (*buf) { case '\n': @@ -541,6 +538,12 @@ count_spaces(int current, char *buffer) return (cur); } +int +count_spaces(int cur, char *buffer) +{ +return (count_spaces_until(cur, buffer, NULL)); +} + void diag4(int level, const char *msg, int a, int b) { Modified: head/usr.bin/indent/pr_comment.c == --- head/usr.bin/indent/pr_comment.cSun Jul 31 19:02:19 2016 (r303595) +++ head/usr.bin/indent/pr_comment.cSun Jul 31 20:04:18 2016 (r303596) @@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include "indent_globs.h" #include "indent.h" /* @@ -89,11 +90,6 @@ pr_comment(void) char *t_ptr; /* used for moving string */ int break_delim = comment_delimiter_on_blankline; int l_just_saw_decl = ps.just_saw_decl; -/* - * int ps.last_nl = 0; true iff the last significant thing - * weve seen is a newline - */ -int one_liner = 1; /* true iff this comment is a one-liner */ adj_max_col = max_col; ps.just_saw_decl = 0; last_bl = NULL;/* no blanks found so far */ @@ -107,6 +103,7 @@ pr_comment(void) if (ps.col_1 && !format_col1_comments) { /* if comment starts in column * 1 it should not be touched */ ps.box_com = true; + break_delim = false; ps.com_col = 1; } else { @@ -119,7 +116,7 @@ pr_comment(void) * be a block comment and is treated as a * box comment unless format_block_comments * is nonzero (the default). */ - break_delim = 0; + break_delim = false; } if ( /* ps.bl_line && */ (s_lab == e_lab) && (s_code == e_code)) { /* klg: check only if this line is blank */ @@ -134,7 +131,7 @@ pr_comment(void) } else { int target_col; - break_delim = 0; + break_delim = false; if (s_code != e_code) target_col =
svn commit: r303595 - head/usr.bin/nl
Author: bapt Date: Sun Jul 31 19:02:19 2016 New Revision: 303595 URL: https://svnweb.freebsd.org/changeset/base/303595 Log: Remove another occurence of _WITH_GETLINE Modified: head/usr.bin/nl/nl.c Modified: head/usr.bin/nl/nl.c == --- head/usr.bin/nl/nl.cSun Jul 31 18:58:20 2016(r303594) +++ head/usr.bin/nl/nl.cSun Jul 31 19:02:19 2016(r303595) @@ -35,7 +35,6 @@ __COPYRIGHT( __RCSID("$FreeBSD$"); #endif -#define_WITH_GETLINE #include #include ___ 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: r303594 - head/sys/arm64/include
Author: andrew Date: Sun Jul 31 18:58:20 2016 New Revision: 303594 URL: https://svnweb.freebsd.org/changeset/base/303594 Log: Add the Data Fault Status Code values to the ESR_ELx registers for when the fault code is a Data Abort. Obtained from:AT Systems Ltd MFC after:1 month Sponsored by: The FreeBSD Foundation Modified: head/sys/arm64/include/armreg.h Modified: head/sys/arm64/include/armreg.h == --- head/sys/arm64/include/armreg.h Sun Jul 31 18:14:42 2016 (r303593) +++ head/sys/arm64/include/armreg.h Sun Jul 31 18:58:20 2016 (r303594) @@ -90,6 +90,32 @@ #define ISS_INSN_S1PTW (0x01 << 7) #define ISS_DATa_WnR (0x01 << 6) #define ISS_DATA_DFSC_MASK (0x1f << 0) +#define ISS_DATA_DFSC_ASF_L0 (0x00 << 0) +#define ISS_DATA_DFSC_ASF_L1 (0x01 << 0) +#define ISS_DATA_DFSC_ASF_L2 (0x02 << 0) +#define ISS_DATA_DFSC_ASF_L3 (0x03 << 0) +#define ISS_DATA_DFSC_TF_L0(0x04 << 0) +#define ISS_DATA_DFSC_TF_L1(0x05 << 0) +#define ISS_DATA_DFSC_TF_L2(0x06 << 0) +#define ISS_DATA_DFSC_TF_L3(0x07 << 0) +#define ISS_DATA_DFSC_AFF_L1 (0x09 << 0) +#define ISS_DATA_DFSC_AFF_L2 (0x0a << 0) +#define ISS_DATA_DFSC_AFF_L3 (0x0b << 0) +#define ISS_DATA_DFSC_PF_L1(0x0d << 0) +#define ISS_DATA_DFSC_PF_L2(0x0e << 0) +#define ISS_DATA_DFSC_PF_L3(0x0f << 0) +#define ISS_DATA_DFSC_EXT (0x10 << 0) +#define ISS_DATA_DFSC_EXT_L0 (0x14 << 0) +#define ISS_DATA_DFSC_EXT_L1 (0x15 << 0) +#define ISS_DATA_DFSC_EXT_L2 (0x16 << 0) +#define ISS_DATA_DFSC_EXT_L3 (0x17 << 0) +#define ISS_DATA_DFSC_ECC (0x18 << 0) +#define ISS_DATA_DFSC_ECC_L0 (0x1c << 0) +#define ISS_DATA_DFSC_ECC_L1 (0x1d << 0) +#define ISS_DATA_DFSC_ECC_L2 (0x1e << 0) +#define ISS_DATA_DFSC_ECC_L3 (0x1f << 0) +#define ISS_DATA_DFSC_ALIGN(0x21 << 0) +#define ISS_DATA_DFSC_TLB_CONFLICT (0x28 << 0) #defineESR_ELx_IL (0x01 << 25) #defineESR_ELx_EC_SHIFT26 #defineESR_ELx_EC_MASK (0x3f << 26) ___ 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: r303593 - head/sbin/resolvconf
Author: pfg Date: Sun Jul 31 18:14:42 2016 New Revision: 303593 URL: https://svnweb.freebsd.org/changeset/base/303593 Log: resolvconf(8) now needs an additional @RESTARTCMD@ replacement when installing. After r303062, which brought openresolv 3.8.1, we need to replace an additional @RESTARTCMD@ in resolvconf. Apply a read fix this time. Submitted by: Guy Yur X-MFC with: r303062 Modified: head/sbin/resolvconf/Makefile Modified: head/sbin/resolvconf/Makefile == --- head/sbin/resolvconf/Makefile Sun Jul 31 17:53:09 2016 (r303592) +++ head/sbin/resolvconf/Makefile Sun Jul 31 18:14:42 2016 (r303593) @@ -19,9 +19,12 @@ VARDIR= /var/run/resolvconf # We don't assume to restart the services in /sbin. So, though # our service(8) is in /usr/sbin, we can use it, here. -CMD1= \1 onestatus >/dev/null 2>\&1 -CMD2= \1 restart -RESTARTCMD=/usr/sbin/service ${CMD1} \&\& /usr/sbin/service ${CMD2} +CMD1_WITH_ARG= \1 onestatus >/dev/null 2>\&1 +CMD2_WITH_ARG= \1 restart +RESTARTCMD_WITH_ARG= /usr/sbin/service ${CMD1_WITH_ARG} \&\& /usr/sbin/service ${CMD2_WITH_ARG} +CMD1= \\$$1 onestatus >/dev/null 2>\&1 +CMD2= \\$$1 restart +RESTARTCMD="/usr/sbin/service ${CMD1} \&\& /usr/sbin/service ${CMD2}" .for f in ${SCRIPTS} ${FILES} ${MAN} ${f}: ${f}.in @@ -29,8 +32,8 @@ ${f}: ${f}.in -e 's:@SYSCONFDIR@:${SYSCONFDIR}:g' \ -e 's:@LIBEXECDIR@:${FILESDIR}:g' \ -e 's:@VARDIR@:${VARDIR}:g' \ - -e 's:@RESTARTCMD \(.*\)@:${RESTARTCMD}:g' \ - -e 's:@RESTARTCMD@:${RESTARTCMD_}:g' \ + -e 's:@RESTARTCMD \(.*\)@:${RESTARTCMD_WITH_ARG}:g' \ + -e 's:@RESTARTCMD@:${RESTARTCMD}:g' \ -e 's:@RCDIR@:${RCDIR}:g' \ -e 's: vpn : ng[0-9]*&:g' \ ${DIST}/$@.in > $@ ___ 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: r303592 - head/sys/arm64/arm64
Author: andrew Date: Sun Jul 31 17:53:09 2016 New Revision: 303592 URL: https://svnweb.freebsd.org/changeset/base/303592 Log: Extract the common parts of pmap_kenter_device to a new function. This will be used when superpage support is added. Obtained from:ABT Systems Ltd MFC after:1 month Sponsored by: The FreeBSD Foundation Modified: head/sys/arm64/arm64/pmap.c Modified: head/sys/arm64/arm64/pmap.c == --- head/sys/arm64/arm64/pmap.c Sun Jul 31 15:15:27 2016(r303591) +++ head/sys/arm64/arm64/pmap.c Sun Jul 31 17:53:09 2016(r303592) @@ -1037,8 +1037,8 @@ pmap_kextract(vm_offset_t va) * Low level mapping routines. ***/ -void -pmap_kenter_device(vm_offset_t sva, vm_size_t size, vm_paddr_t pa) +static void +pmap_kenter(vm_offset_t sva, vm_size_t size, vm_paddr_t pa, int mode) { pd_entry_t *pde; pt_entry_t *pte; @@ -1046,23 +1046,22 @@ pmap_kenter_device(vm_offset_t sva, vm_s int lvl; KASSERT((pa & L3_OFFSET) == 0, - ("pmap_kenter_device: Invalid physical address")); + ("pmap_kenter: Invalid physical address")); KASSERT((sva & L3_OFFSET) == 0, - ("pmap_kenter_device: Invalid virtual address")); + ("pmap_kenter: Invalid virtual address")); KASSERT((size & PAGE_MASK) == 0, - ("pmap_kenter_device: Mapping is not page-sized")); + ("pmap_kenter: Mapping is not page-sized")); va = sva; while (size != 0) { pde = pmap_pde(kernel_pmap, va, ); KASSERT(pde != NULL, - ("pmap_kenter_device: Invalid page entry, va: 0x%lx", va)); - KASSERT(lvl == 2, - ("pmap_kenter_device: Invalid level %d", lvl)); + ("pmap_kenter: Invalid page entry, va: 0x%lx", va)); + KASSERT(lvl == 2, ("pmap_kenter: Invalid level %d", lvl)); pte = pmap_l2_to_l3(pde, va); pmap_load_store(pte, (pa & ~L3_OFFSET) | ATTR_DEFAULT | - ATTR_IDX(DEVICE_MEMORY) | L3_PAGE); + ATTR_IDX(mode) | L3_PAGE); PTE_SYNC(pte); va += PAGE_SIZE; @@ -1072,6 +1071,13 @@ pmap_kenter_device(vm_offset_t sva, vm_s pmap_invalidate_range(kernel_pmap, sva, va); } +void +pmap_kenter_device(vm_offset_t sva, vm_size_t size, vm_paddr_t pa) +{ + + pmap_kenter(sva, size, pa, DEVICE_MEMORY); +} + /* * Remove a page from the kernel pagetables. */ ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r303583 - head/sys/amd64/amd64
On Sun, Jul 31, 2016 at 11:11:25PM +1000, Bruce Evans wrote: > On Haswell, "rep stos" takes about 25 cycles to start up, and the function > call overhead is in the noise. 25 cycles is a lot. Haswell can move > 32 bytes/cycle from L2 to L2, so it misses moving 800 bytes or 1/5 of a > page in its startup overhead. Oops, that is for "rep movs". "rep stos" > is similar. > The commit message contained a probable explanation of the reason why the change demonstrated measurable improvement in non-microbenchmark load. That said, the only thing I am answering and asking there is the above claim about 25 cycles overhead of rep;stosq on hsw. I am curious how the overhead was measured. Note: Agner Fog' tables state that fast mode takes <2n uops and has reciprocal throughput of 0.5n worst case and do not demostrate any setup overhead for hsw. ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r303583 - head/sys/amd64/amd64
On Sun, Jul 31, 2016 at 06:26:29PM +0300, Slawa Olhovchenkov wrote: > On Mon, Aug 01, 2016 at 12:30:14AM +1000, Bruce Evans wrote: > > > On Sun, 31 Jul 2016, Slawa Olhovchenkov wrote: > > > > > On Sun, Jul 31, 2016 at 11:11:25PM +1000, Bruce Evans wrote: > > > > > >> Misalignment of this loop made it almost twice as slow on old Turion2 > > >> with > > >> slow DDR2 memory. It made no difference on Haswell. I added an extra > > >> movnti, but that makes little or no differences. 2 more movnti's > > >> wouldn't > > >> fit in a 16-byte cache line so are slower unless even more care is taken > > >> with alignment (or with less care, 4 with misalignment are not less than > > >> twice as slow as 1 with alignment). > > >> > > >> I thought that alignment and unrolling didn't matter here, because movnti > > >> has to wait for memory and almost any loop runs fast enough to keep up. > > >> The timing on my old system is something like: CPUs at 2 GHz; main memory > > >> at 4 GB/sec; movnti is only 4 bytes wide on i386 (so this problem > > >> only affects i386, at least with slow memory). So sustaining 4 GB/sec > > >> requires 1 G movnti's/sec, so the loop needs to run at 2 cycles/iteration > > >> to keep up. But when it is misaligned, it runs at 3-4 cycles/iteration. > > >> Alignment makes it take about 2, and the extra movnti is for safety and > > >> to work with faster memory. > > >> > > >> On Haswell with CPUs at 4 GHz, 2 cycles/iteration gives 8 GB/sec on > > >> i386 and 16 GB/sec on amd64 with wider movnti. IIRC, 16 GB/sec is about > > >> the main memory speed so nothing better is possible but just 1 extra > > >> movnti gives more with faster memory. This is just worse than bzero() > > > > > > What about modern system with 120 GB/sec main memory speed? > > > > Is there such a system? It would have main memory almost twice as fast > > as Haswell L2 and almost half as fast as Haswell L1. > > http://ark.intel.com/products/family/93797/Intel-Xeon-Processor-E7-v4-Family#@Server > > 102 GB/s (sorry, 120 is misprint) > > > My fastest memory actually does 20001 MB/s according to old memtest > > and that is about right according to other tests. > > Some short time I am have free 1650v4 > http://ark.intel.com/products/92994/Intel-Xeon-Processor-E5-1650-v4-15M-Cache-3_60-GHz > with up to 76.8 GB/s (by datasheet, at DDR4-2400). > With installed DDR4-2133 -- up to 68.2 GB/s (teoretical) > After short time system put into production. > > I am unable to boot UEFI Memtest86 7.0, old version (4.3.7) show 15 GB/s. Here http://wccftech.com/intel-broadwell-ep-xeon-e5-2698-v4-processor/ some benchmark show 110 GB/s write speed. ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r303583 - head/sys/amd64/amd64
On Mon, Aug 01, 2016 at 12:30:14AM +1000, Bruce Evans wrote: > On Sun, 31 Jul 2016, Slawa Olhovchenkov wrote: > > > On Sun, Jul 31, 2016 at 11:11:25PM +1000, Bruce Evans wrote: > > > >> Misalignment of this loop made it almost twice as slow on old Turion2 with > >> slow DDR2 memory. It made no difference on Haswell. I added an extra > >> movnti, but that makes little or no differences. 2 more movnti's wouldn't > >> fit in a 16-byte cache line so are slower unless even more care is taken > >> with alignment (or with less care, 4 with misalignment are not less than > >> twice as slow as 1 with alignment). > >> > >> I thought that alignment and unrolling didn't matter here, because movnti > >> has to wait for memory and almost any loop runs fast enough to keep up. > >> The timing on my old system is something like: CPUs at 2 GHz; main memory > >> at 4 GB/sec; movnti is only 4 bytes wide on i386 (so this problem > >> only affects i386, at least with slow memory). So sustaining 4 GB/sec > >> requires 1 G movnti's/sec, so the loop needs to run at 2 cycles/iteration > >> to keep up. But when it is misaligned, it runs at 3-4 cycles/iteration. > >> Alignment makes it take about 2, and the extra movnti is for safety and > >> to work with faster memory. > >> > >> On Haswell with CPUs at 4 GHz, 2 cycles/iteration gives 8 GB/sec on > >> i386 and 16 GB/sec on amd64 with wider movnti. IIRC, 16 GB/sec is about > >> the main memory speed so nothing better is possible but just 1 extra > >> movnti gives more with faster memory. This is just worse than bzero() > > > > What about modern system with 120 GB/sec main memory speed? > > Is there such a system? It would have main memory almost twice as fast > as Haswell L2 and almost half as fast as Haswell L1. http://ark.intel.com/products/family/93797/Intel-Xeon-Processor-E7-v4-Family#@Server 102 GB/s (sorry, 120 is misprint) > My fastest memory actually does 20001 MB/s according to old memtest > and that is about right according to other tests. Some short time I am have free 1650v4 http://ark.intel.com/products/92994/Intel-Xeon-Processor-E5-1650-v4-15M-Cache-3_60-GHz with up to 76.8 GB/s (by datasheet, at DDR4-2400). With installed DDR4-2133 -- up to 68.2 GB/s (teoretical) After short time system put into production. I am unable to boot UEFI Memtest86 7.0, old version (4.3.7) show 15 GB/s. # ramspeed -b 18 -p 4 RAMspeed/SMP (FreeBSD) v3.5.0 by Rhett M. Hollander and Paul V. Bolotoff, 2002-09 8Gb per pass mode, 4 processes SSE (nt) Copy: 54176.91 MB/s [NTA prefetch] SSE (nt) Scale: 54241.98 MB/s [NTA prefetch] SSE (nt) Add: 48945.60 MB/s [T0 prefetch] SSE (nt) Triad: 50102.80 MB/s [T0 prefetch] --- SSE (nt) AVERAGE: 51866.82 MB/s # ramspeed -b 16 -p 4 RAMspeed/SMP (FreeBSD) v3.5.0 by Rhett M. Hollander and Paul V. Bolotoff, 2002-09 8Gb per pass mode, 4 processes SSE & WRITING (nt)1 Kb block: 55913.18 MB/s SSE & WRITING (nt)2 Kb block: 60819.02 MB/s SSE & WRITING (nt)4 Kb block: 58662.37 MB/s SSE & WRITING (nt)8 Kb block: 57165.14 MB/s SSE & WRITING (nt) 16 Kb block: 56310.22 MB/s SSE & WRITING (nt) 32 Kb block: 56407.22 MB/s SSE & WRITING (nt) 64 Kb block: 58200.44 MB/s SSE & WRITING (nt) 128 Kb block: 59213.49 MB/s SSE & WRITING (nt) 256 Kb block: 59047.57 MB/s SSE & WRITING (nt) 512 Kb block: 59158.01 MB/s SSE & WRITING (nt) 1024 Kb block: 59140.03 MB/s SSE & WRITING (nt) 2048 Kb block: 59165.49 MB/s SSE & WRITING (nt) 4096 Kb block: 59714.68 MB/s SSE & WRITING (nt) 8192 Kb block: 59926.68 MB/s SSE & WRITING (nt)16384 Kb block: 59100.03 MB/s SSE & WRITING (nt)32768 Kb block: 58268.52 MB/s # ramspeed -b 16 -p 2 RAMspeed/SMP (FreeBSD) v3.5.0 by Rhett M. Hollander and Paul V. Bolotoff, 2002-09 8Gb per pass mode, 2 processes SSE & WRITING (nt)1 Kb block: 32131.03 MB/s SSE & WRITING (nt)2 Kb block: 41851.23 MB/s SSE & WRITING (nt)4 Kb block: 41848.02 MB/s SSE & WRITING (nt)8 Kb block: 41640.80 MB/s SSE & WRITING (nt) 16 Kb block: 41640.60 MB/s SSE & WRITING (nt) 32 Kb block: 41639.89 MB/s SSE & WRITING (nt) 64 Kb block: 41849.65 MB/s SSE & WRITING (nt) 128 Kb block: 41848.74 MB/s SSE & WRITING (nt) 256 Kb block: 41847.87 MB/s SSE & WRITING (nt) 512 Kb block: 41846.14 MB/s SSE & WRITING (nt) 1024 Kb block: 41835.69 MB/s SSE & WRITING (nt) 2048 Kb block: 41815.94 MB/s SSE & WRITING (nt) 4096 Kb block: 41717.39 MB/s SSE & WRITING (nt) 8192 Kb block: 41575.85 MB/s SSE & WRITING (nt)16384 Kb block: 41295.03 MB/s SSE & WRITING (nt)32768 Kb block: 40735.83 MB/s ___ 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: r303591 - stable/10/sys/sys
Author: kib Date: Sun Jul 31 15:15:27 2016 New Revision: 303591 URL: https://svnweb.freebsd.org/changeset/base/303591 Log: MFC r303424: Fix typo in comment. Modified: stable/10/sys/sys/proc.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/sys/proc.h == --- stable/10/sys/sys/proc.hSun Jul 31 15:13:51 2016(r303590) +++ stable/10/sys/sys/proc.hSun Jul 31 15:15:27 2016(r303591) @@ -701,7 +701,7 @@ struct proc { #defineSW_TYPE_MASK0xff/* First 8 bits are switch type */ #defineSWT_NONE0 /* Unspecified switch. */ #defineSWT_PREEMPT 1 /* Switching due to preemption. */ -#defineSWT_OWEPREEMPT 2 /* Switching due to opepreempt. */ +#defineSWT_OWEPREEMPT 2 /* Switching due to owepreempt. */ #defineSWT_TURNSTILE 3 /* Turnstile contention. */ #defineSWT_SLEEPQ 4 /* Sleepq wait. */ #defineSWT_SLEEPQTIMO 5 /* Sleepq timeout wait. */ ___ 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: r303590 - stable/11/sys/sys
Author: kib Date: Sun Jul 31 15:13:51 2016 New Revision: 303590 URL: https://svnweb.freebsd.org/changeset/base/303590 Log: MFC r303424: Fix typo in comment. Approved by: re (gjb) Modified: stable/11/sys/sys/proc.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/sys/proc.h == --- stable/11/sys/sys/proc.hSun Jul 31 15:03:31 2016(r303589) +++ stable/11/sys/sys/proc.hSun Jul 31 15:13:51 2016(r303590) @@ -739,7 +739,7 @@ struct proc { #defineSW_TYPE_MASK0xff/* First 8 bits are switch type */ #defineSWT_NONE0 /* Unspecified switch. */ #defineSWT_PREEMPT 1 /* Switching due to preemption. */ -#defineSWT_OWEPREEMPT 2 /* Switching due to opepreempt. */ +#defineSWT_OWEPREEMPT 2 /* Switching due to owepreempt. */ #defineSWT_TURNSTILE 3 /* Turnstile contention. */ #defineSWT_SLEEPQ 4 /* Sleepq wait. */ #defineSWT_SLEEPQTIMO 5 /* Sleepq timeout wait. */ ___ 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: r303589 - stable/11
Author: dim Date: Sun Jul 31 15:03:31 2016 New Revision: 303589 URL: https://svnweb.freebsd.org/changeset/base/303589 Log: MFC r303456: Add tblgen to ObsoleteFiles.inc, as it was renamed to llvm-tblgen. Approved by: re (kib) Noticed by: pluknet Modified: stable/11/ObsoleteFiles.inc Directory Properties: stable/11/ (props changed) Modified: stable/11/ObsoleteFiles.inc == --- stable/11/ObsoleteFiles.inc Sun Jul 31 15:02:53 2016(r303588) +++ stable/11/ObsoleteFiles.inc Sun Jul 31 15:03:31 2016(r303589) @@ -229,6 +229,7 @@ OLD_LIBS+=usr/lib/libdevinfo.so.5 OLD_LIBS+=usr/lib32/libdevinfo.so.5 # 20160305: new clang import which bumps version from 3.7.1 to 3.8.0. OLD_FILES+=usr/bin/macho-dump +OLD_FILES+=usr/bin/tblgen OLD_FILES+=usr/lib/clang/3.7.1/include/sanitizer/allocator_interface.h OLD_FILES+=usr/lib/clang/3.7.1/include/sanitizer/asan_interface.h OLD_FILES+=usr/lib/clang/3.7.1/include/sanitizer/common_interface_defs.h ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r303588 - head/usr.bin/indent
Author: pfg Date: Sun Jul 31 15:02:53 2016 New Revision: 303588 URL: https://svnweb.freebsd.org/changeset/base/303588 Log: indent(1): Remove dead code relating to unix-style comments. The original indent(1) described unix-style comments as similar to box comments, except the first non-blank character on each line is lined up with the '*' of the "/*" which appears on a line by itself. The code has been turned off for ages and -sc/-nsc make it even less relevant. Reference: https://github.com/pstef/freebsd_indent/commit/89c5fe2c56742d96975bb3ea6b99f28baf9d82f6 Differential Revision: https://reviews.freebsd.org/D6966 (Partial) Submitted by: Piotr Stefaniak Modified: head/usr.bin/indent/pr_comment.c Modified: head/usr.bin/indent/pr_comment.c == --- head/usr.bin/indent/pr_comment.cSun Jul 31 14:59:44 2016 (r303587) +++ head/usr.bin/indent/pr_comment.cSun Jul 31 15:02:53 2016 (r303588) @@ -87,10 +87,6 @@ pr_comment(void) char *last_bl; /* points to the last blank in the output * buffer */ char *t_ptr; /* used for moving string */ -int unix_comment; /* tri-state variable used to decide if it is -* a unix-style comment. 0 means only blanks -* since /+*, 1 means regular style comment, 2 -* means unix style comment */ int break_delim = comment_delimiter_on_blankline; int l_just_saw_decl = ps.just_saw_decl; /* @@ -105,9 +101,6 @@ pr_comment(void) * a boxed comment or some other * comment that should not be touched */ ++ps.out_coms; /* keep track of number of comments */ -unix_comment = 1; /* set flag to let us figure out if there is a -* unix-style comment ** DISABLED: use 0 to -* reenable this hack! */ /* Figure where to align and how to treat the comment */ @@ -247,34 +240,6 @@ pr_comment(void) } else { ps.last_nl = 1; - if (unix_comment != 1) {/* we not are in unix_style -* comment */ - if (unix_comment == 0 && s_code == e_code) { - /* -* if it is a UNIX-style comment, ignore the -* requirement that previous line be blank for -* unindention -*/ - ps.com_col = (ps.ind_level - ps.unindent_displace) * ps.ind_size + 1; - if (ps.com_col <= 1) - ps.com_col = 2; - } - unix_comment = 2; /* permanently remember that we are in -* this type of comment */ - dump_line(); - ++line_no; - now_col = ps.com_col; - *e_com++ = ' '; - /* -* fix so that the star at the start of the line will line -* up -*/ - do /* flush leading white space */ - if (++buf_ptr >= buf_end) - fill_buffer(); - while (*buf_ptr == ' ' || *buf_ptr == '\t'); - break; - } if (*(e_com - 1) == ' ' || *(e_com - 1) == '\t') last_bl = e_com - 1; /* @@ -312,10 +277,6 @@ pr_comment(void) if (++buf_ptr >= buf_end) /* get to next char after * */ fill_buffer(); - if (unix_comment == 0) /* set flag to show we are not in -* unix-style comment */ - unix_comment = 1; - if (*buf_ptr == '/') { /* it is the end!!! */ end_of_comment: if (++buf_ptr >= buf_end) @@ -357,9 +318,6 @@ pr_comment(void) } break; default:/* we have a random char */ - if (unix_comment == 0 && *buf_ptr != ' ' && *buf_ptr != '\t') - unix_comment = 1; /* we are not in unix-style comment */ - *e_com = *buf_ptr++; if (buf_ptr >= buf_end) fill_buffer(); @@ -376,7 +334,7 @@ pr_comment(void) /* remember we saw a blank */ ++e_com; - if (now_col > adj_max_col && !ps.box_com && unix_comment == 1 && e_com[-1] > ' ') { + if (now_col > adj_max_col && !ps.box_com && e_com[-1] > ' ') { /* * the comment is too long, it must be broken up
svn commit: r303587 - head/sys/arm64/arm64
Author: andrew Date: Sun Jul 31 14:59:44 2016 New Revision: 303587 URL: https://svnweb.freebsd.org/changeset/base/303587 Log: Fix the comment above pmap_invalidate_page. tlbi will invalidate the tlb on all CPUs. Obtained from:ABT Systems Ltd MFC after:1 month Sponsored by: The FreeBSD Foundation Modified: head/sys/arm64/arm64/pmap.c Modified: head/sys/arm64/arm64/pmap.c == --- head/sys/arm64/arm64/pmap.c Sun Jul 31 13:11:34 2016(r303586) +++ head/sys/arm64/arm64/pmap.c Sun Jul 31 14:59:44 2016(r303587) @@ -856,8 +856,7 @@ pmap_init(void) } /* - * Normal, non-SMP, invalidation functions. - * We inline these within pmap.c for speed. + * Invalidate a single TLB entry. */ PMAP_INLINE void pmap_invalidate_page(pmap_t pmap, vm_offset_t va) ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r303583 - head/sys/amd64/amd64
On Sun, 31 Jul 2016, Slawa Olhovchenkov wrote: On Sun, Jul 31, 2016 at 11:11:25PM +1000, Bruce Evans wrote: Misalignment of this loop made it almost twice as slow on old Turion2 with slow DDR2 memory. It made no difference on Haswell. I added an extra movnti, but that makes little or no differences. 2 more movnti's wouldn't fit in a 16-byte cache line so are slower unless even more care is taken with alignment (or with less care, 4 with misalignment are not less than twice as slow as 1 with alignment). I thought that alignment and unrolling didn't matter here, because movnti has to wait for memory and almost any loop runs fast enough to keep up. The timing on my old system is something like: CPUs at 2 GHz; main memory at 4 GB/sec; movnti is only 4 bytes wide on i386 (so this problem only affects i386, at least with slow memory). So sustaining 4 GB/sec requires 1 G movnti's/sec, so the loop needs to run at 2 cycles/iteration to keep up. But when it is misaligned, it runs at 3-4 cycles/iteration. Alignment makes it take about 2, and the extra movnti is for safety and to work with faster memory. On Haswell with CPUs at 4 GHz, 2 cycles/iteration gives 8 GB/sec on i386 and 16 GB/sec on amd64 with wider movnti. IIRC, 16 GB/sec is about the main memory speed so nothing better is possible but just 1 extra movnti gives more with faster memory. This is just worse than bzero() What about modern system with 120 GB/sec main memory speed? Is there such a system? It would have main memory almost twice as fast as Haswell L2 and almost half as fast as Haswell L1. My fastest memory actually does 20001 MB/s according to old memtest and that is about right according to other tests. Bruce ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r303583 - head/sys/amd64/amd64
On Sun, Jul 31, 2016 at 11:11:25PM +1000, Bruce Evans wrote: > Misalignment of this loop made it almost twice as slow on old Turion2 with > slow DDR2 memory. It made no difference on Haswell. I added an extra > movnti, but that makes little or no differences. 2 more movnti's wouldn't > fit in a 16-byte cache line so are slower unless even more care is taken > with alignment (or with less care, 4 with misalignment are not less than > twice as slow as 1 with alignment). > > I thought that alignment and unrolling didn't matter here, because movnti > has to wait for memory and almost any loop runs fast enough to keep up. > The timing on my old system is something like: CPUs at 2 GHz; main memory > at 4 GB/sec; movnti is only 4 bytes wide on i386 (so this problem > only affects i386, at least with slow memory). So sustaining 4 GB/sec > requires 1 G movnti's/sec, so the loop needs to run at 2 cycles/iteration > to keep up. But when it is misaligned, it runs at 3-4 cycles/iteration. > Alignment makes it take about 2, and the extra movnti is for safety and > to work with faster memory. > > On Haswell with CPUs at 4 GHz, 2 cycles/iteration gives 8 GB/sec on > i386 and 16 GB/sec on amd64 with wider movnti. IIRC, 16 GB/sec is about > the main memory speed so nothing better is possible but just 1 extra > movnti gives more with faster memory. This is just worse than bzero() What about modern system with 120 GB/sec main memory speed? ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r303586 - head/bin/sh
On Sun, Jul 31, 2016 at 01:11:34PM +, Jilles Tjoelker wrote: > New Revision: 303586 > URL: https://svnweb.freebsd.org/changeset/base/303586 > > Log: > sh: Fix a clang warning. > > Submitted by: bdrewery > > Modified: > head/bin/sh/expand.c > > Modified: head/bin/sh/expand.c > == > --- head/bin/sh/expand.c Sun Jul 31 12:59:10 2016(r303585) > +++ head/bin/sh/expand.c Sun Jul 31 13:11:34 2016(r303586) > @@ -473,7 +473,8 @@ expbackq(union node *cmd, int quoted, in > if (--in.nleft < 0) { > if (in.fd < 0) > break; > - while ((i = read(in.fd, buf, sizeof buf)) < 0 && errno > == EINTR); > + while ((i = read(in.fd, buf, sizeof buf)) < 0 && errno > == EINTR) > + ; `continue;' would be even better; some tools might barf at stray semicolon. ./danfe ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r303583 - head/sys/amd64/amd64
On Sun, 31 Jul 2016, Mateusz Guzik wrote: Log: amd64: implement pagezero using rep stos The current implementation uses non-temporal writes. This turns out to be detrimental to performance if the page is used shortly after, which is the typical case with page faults. Switch to rep stos. Reviewed by: kib MFC after: 1 week This is very MD. Non-temporal writes are much faster on my old Turion2 amd64 system, especially when their pipelining is fixed. "rep stosb" is the best method on Haswell, but it is only slightly better so the default should remain nontemporal writes. I use sysctls to select the best function and don't have automatic speed detection. My old speed detection tests for selection of using the npx method turned out to be fragile. Modified: head/sys/amd64/amd64/support.S == --- head/sys/amd64/amd64/support.S Sun Jul 31 10:37:09 2016 (r303582) +++ head/sys/amd64/amd64/support.S Sun Jul 31 11:34:08 2016 (r303583) @@ -64,17 +64,10 @@ END(bzero) /* Address: %rdi */ ENTRY(pagezero) PUSH_FRAME_POINTER - movq$-PAGE_SIZE,%rdx - subq%rdx,%rdi + movq$PAGE_SIZE/8,%rcx xorl%eax,%eax -1: - movnti %rax,(%rdi,%rdx) - movnti %rax,8(%rdi,%rdx) - movnti %rax,16(%rdi,%rdx) - movnti %rax,24(%rdi,%rdx) - addq$32,%rdx - jne 1b - sfence + rep + stosq POP_FRAME_POINTER ret END(pagezero) This shouldn't be a special function. Just use bzero(). The compiler might inline bzero() but shouldn't since this is very MD. On Haswell, "rep stos" takes about 25 cycles to start up, and the function call overhead is in the noise. 25 cycles is a lot. Haswell can move 32 bytes/cycle from L2 to L2, so it misses moving 800 bytes or 1/5 of a page in its startup overhead. Oops, that is for "rep movs". "rep stos" is similar. Here are my patches. X diff -c2 ./amd64/amd64/pmap.c~ ./amd64/amd64/pmap.c X *** ./amd64/amd64/pmap.c~ Sat Jun 25 09:07:20 2016 X --- ./amd64/amd64/pmap.c Sat Jun 25 09:07:09 2016 X *** X *** 353,356 X --- 353,364 X _ps_enabled, 0, "Are large page mappings enabled?"); X X + static int pagecopy_memcpy; X + SYSCTL_INT(_vm_pmap, OID_AUTO, pagecopy_memcpy, CTLFLAG_RW, X + _memcpy, 0, "Use memcpy for pagecopy?"); X + X + static int pagezero_bzero; X + SYSCTL_INT(_vm_pmap, OID_AUTO, pagezero_bzero, CTLFLAG_RW, X + _bzero, 0, "Use bzero for pagezero?"); X + X #define PAT_INDEX_SIZE 8 X static int pat_index[PAT_INDEX_SIZE]; /* cache mode to PAT index conversion */ I don't enable pagecopy_memcpy because the nontemporal method is best for Haswell. X *** X *** 5154,5159 X X /* X ! * pmap_zero_page zeros the specified hardware page by mapping X ! * the page into KVM and using bzero to clear its contents. X*/ X void X --- 5162,5166 X X /* X ! * Zero the specified hardware page. X*/ X void Style fix. The comment is banal. It gave too many implementation details about another implementation. Not one applies here. The comment should be removed, but I made it just banal to minimise diffs. X *** X *** 5162,5173 X vm_offset_t va = PHYS_TO_DMAP(VM_PAGE_TO_PHYS(m)); X X ! pagezero((void *)va); X } X X /* X ! * pmap_zero_page_area zeros the specified hardware page by mapping X ! * the page into KVM and using bzero to clear its contents. X ! * X ! * off and size may not cover an area beyond a single hardware page. X*/ X void X --- 5169,5181 X vm_offset_t va = PHYS_TO_DMAP(VM_PAGE_TO_PHYS(m)); X X ! if (pagezero_bzero) X ! bzero((void *)va, PAGE_SIZE); X ! else X ! pagezero((void *)va); X } X X /* X ! * Zero an an area within a single hardware page. off and size must not X ! * cover an area beyond a single hardware page. X*/ X void X *** X *** 5208,5212 X vm_offset_t dst = PHYS_TO_DMAP(VM_PAGE_TO_PHYS(mdst)); X X ! pagecopy((void *)src, (void *)dst); X } X X --- 5216,5223 X vm_offset_t dst = PHYS_TO_DMAP(VM_PAGE_TO_PHYS(mdst)); X X ! if (pagecopy_memcpy) X ! memcpy((void *)dst, (void *)src, PAGE_SIZE); X ! else X ! pagecopy((void *)src, (void *)dst); X } X All the comments were wrong. X diff -c2 ./amd64/amd64/support.S~ ./amd64/amd64/support.S X *** ./amd64/amd64/support.S~ Wed Feb 24 22:35:30 2016 X --- ./amd64/amd64/support.S Mon Mar 28 10:43:37 2016 X *** X *** 68,71 X --- 68,73 X subq%rdx,%rdi X xorl%eax,%eax X + jmp 1f X + .p2align 5,0x90 X 1: X movnti %rax,(%rdi,%rdx) The loop was misaligned. See the i386 version for a comment in the code and more details. X diff -c2 ./i386/i386/pmap.c~ ./i386/i386/pmap.c X ***
svn commit: r303586 - head/bin/sh
Author: jilles Date: Sun Jul 31 13:11:34 2016 New Revision: 303586 URL: https://svnweb.freebsd.org/changeset/base/303586 Log: sh: Fix a clang warning. Submitted by: bdrewery Modified: head/bin/sh/expand.c Modified: head/bin/sh/expand.c == --- head/bin/sh/expand.cSun Jul 31 12:59:10 2016(r303585) +++ head/bin/sh/expand.cSun Jul 31 13:11:34 2016(r303586) @@ -473,7 +473,8 @@ expbackq(union node *cmd, int quoted, in if (--in.nleft < 0) { if (in.fd < 0) break; - while ((i = read(in.fd, buf, sizeof buf)) < 0 && errno == EINTR); + while ((i = read(in.fd, buf, sizeof buf)) < 0 && errno == EINTR) + ; TRACE(("expbackq: read returns %d\n", i)); if (i <= 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: r303585 - head/sys/arm64/arm64
Author: andrew Date: Sun Jul 31 12:59:10 2016 New Revision: 303585 URL: https://svnweb.freebsd.org/changeset/base/303585 Log: Relax the barriers around a TLB invalidation to only wait on inner-shareable memory accesses. There is no need for full system barriers. Obtained from:ABT Systems Ltd MFC after:1 month Sponsored by: The FreeBSD Foundation Modified: head/sys/arm64/arm64/pmap.c Modified: head/sys/arm64/arm64/pmap.c == --- head/sys/arm64/arm64/pmap.c Sun Jul 31 12:11:55 2016(r303584) +++ head/sys/arm64/arm64/pmap.c Sun Jul 31 12:59:10 2016(r303585) @@ -865,9 +865,9 @@ pmap_invalidate_page(pmap_t pmap, vm_off sched_pin(); __asm __volatile( - "dsb sy\n" + "dsb ishst \n" "tlbi vaae1is, %0 \n" - "dsb sy\n" + "dsb ish \n" "isb\n" : : "r"(va >> PAGE_SHIFT)); sched_unpin(); @@ -879,13 +879,13 @@ pmap_invalidate_range(pmap_t pmap, vm_of vm_offset_t addr; sched_pin(); - __asm __volatile("dsb sy"); + dsb(ishst); for (addr = sva; addr < eva; addr += PAGE_SIZE) { __asm __volatile( "tlbi vaae1is, %0" : : "r"(addr >> PAGE_SHIFT)); } __asm __volatile( - "dsb sy\n" + "dsb ish \n" "isb\n"); sched_unpin(); } @@ -896,9 +896,9 @@ pmap_invalidate_all(pmap_t pmap) sched_pin(); __asm __volatile( - "dsb sy\n" + "dsb ishst \n" "tlbi vmalle1is \n" - "dsb sy\n" + "dsb ish \n" "isb\n"); sched_unpin(); } ___ 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: r303584 - head/sys/kern
Author: mjg Date: Sun Jul 31 12:11:55 2016 New Revision: 303584 URL: https://svnweb.freebsd.org/changeset/base/303584 Log: locks: change sleep_cnt and spin_cnt types to u_int Both variables are uint64_t, but they only count spins or sleeps. All reasonable values which we can get here comfortably hit in 32-bit range. Suggested by: kib MFC after:1 week Modified: head/sys/kern/kern_mutex.c head/sys/kern/kern_rwlock.c head/sys/kern/kern_sx.c Modified: head/sys/kern/kern_mutex.c == --- head/sys/kern/kern_mutex.c Sun Jul 31 11:34:08 2016(r303583) +++ head/sys/kern/kern_mutex.c Sun Jul 31 12:11:55 2016(r303584) @@ -409,8 +409,8 @@ __mtx_lock_sleep(volatile uintptr_t *c, uint64_t waittime = 0; #endif #ifdef KDTRACE_HOOKS - uint64_t spin_cnt = 0; - uint64_t sleep_cnt = 0; + u_int spin_cnt = 0; + u_int sleep_cnt = 0; int64_t sleep_time = 0; int64_t all_time = 0; #endif Modified: head/sys/kern/kern_rwlock.c == --- head/sys/kern/kern_rwlock.c Sun Jul 31 11:34:08 2016(r303583) +++ head/sys/kern/kern_rwlock.c Sun Jul 31 12:11:55 2016(r303584) @@ -357,8 +357,8 @@ __rw_rlock(volatile uintptr_t *c, const uintptr_t v; #ifdef KDTRACE_HOOKS uintptr_t state; - uint64_t spin_cnt = 0; - uint64_t sleep_cnt = 0; + u_int spin_cnt = 0; + u_int sleep_cnt = 0; int64_t sleep_time = 0; int64_t all_time = 0; #endif @@ -742,8 +742,8 @@ __rw_wlock_hard(volatile uintptr_t *c, u #endif #ifdef KDTRACE_HOOKS uintptr_t state; - uint64_t spin_cnt = 0; - uint64_t sleep_cnt = 0; + u_int spin_cnt = 0; + u_int sleep_cnt = 0; int64_t sleep_time = 0; int64_t all_time = 0; #endif Modified: head/sys/kern/kern_sx.c == --- head/sys/kern/kern_sx.c Sun Jul 31 11:34:08 2016(r303583) +++ head/sys/kern/kern_sx.c Sun Jul 31 12:11:55 2016(r303584) @@ -515,8 +515,8 @@ _sx_xlock_hard(struct sx *sx, uintptr_t int error = 0; #ifdef KDTRACE_HOOKS uintptr_t state; - uint64_t spin_cnt = 0; - uint64_t sleep_cnt = 0; + u_int spin_cnt = 0; + u_int sleep_cnt = 0; int64_t sleep_time = 0; int64_t all_time = 0; #endif @@ -820,8 +820,8 @@ _sx_slock_hard(struct sx *sx, int opts, int error = 0; #ifdef KDTRACE_HOOKS uintptr_t state; - uint64_t spin_cnt = 0; - uint64_t sleep_cnt = 0; + u_int spin_cnt = 0; + u_int sleep_cnt = 0; int64_t sleep_time = 0; int64_t all_time = 0; #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: r303583 - head/sys/amd64/amd64
Author: mjg Date: Sun Jul 31 11:34:08 2016 New Revision: 303583 URL: https://svnweb.freebsd.org/changeset/base/303583 Log: amd64: implement pagezero using rep stos The current implementation uses non-temporal writes. This turns out to be detrimental to performance if the page is used shortly after, which is the typical case with page faults. Switch to rep stos. Reviewed by: kib MFC after:1 week Modified: head/sys/amd64/amd64/support.S Modified: head/sys/amd64/amd64/support.S == --- head/sys/amd64/amd64/support.S Sun Jul 31 10:37:09 2016 (r303582) +++ head/sys/amd64/amd64/support.S Sun Jul 31 11:34:08 2016 (r303583) @@ -64,17 +64,10 @@ END(bzero) /* Address: %rdi */ ENTRY(pagezero) PUSH_FRAME_POINTER - movq$-PAGE_SIZE,%rdx - subq%rdx,%rdi + movq$PAGE_SIZE/8,%rcx xorl%eax,%eax -1: - movnti %rax,(%rdi,%rdx) - movnti %rax,8(%rdi,%rdx) - movnti %rax,16(%rdi,%rdx) - movnti %rax,24(%rdi,%rdx) - addq$32,%rdx - jne 1b - sfence + rep + stosq POP_FRAME_POINTER ret END(pagezero) ___ 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: r303582 - in stable/10/usr.bin/calendar/calendars: ru_RU.KOI8-R ru_RU.UTF-8
Author: ache Date: Sun Jul 31 10:37:09 2016 New Revision: 303582 URL: https://svnweb.freebsd.org/changeset/base/303582 Log: Direct commit of adapted r303581. Fix date. Modified: stable/10/usr.bin/calendar/calendars/ru_RU.KOI8-R/calendar.military stable/10/usr.bin/calendar/calendars/ru_RU.UTF-8/calendar.military Modified: stable/10/usr.bin/calendar/calendars/ru_RU.KOI8-R/calendar.military == --- stable/10/usr.bin/calendar/calendars/ru_RU.KOI8-R/calendar.military Sun Jul 31 10:15:04 2016(r303581) +++ stable/10/usr.bin/calendar/calendars/ru_RU.KOI8-R/calendar.military Sun Jul 31 10:37:09 2016(r303582) @@ -20,7 +20,7 @@ LANG=ru_RU.KOI8-R 8 ��� ��� � ��� � �.�. � ��� �� (1812 ���) 11 ��� �� ��� ��� ��� � �.�. ��� ��� � �� (1790 ���) 21 ��� �� ��� �� �� � � ��� �� ��� ��� ���-�� � ��� � (1380 ���) - 7 ��� �� �� � � ��� �� �� � ��� �� �� ��� (1612 ���) + 4 ��� �� �� � � ��� �� �� � ��� �� �� ��� (1612 ���) 1 ��� �� ��� ��� ��� � �.�. ��� � � (1853 ���) 5 ��� �� � � �� ���-�� � � � ��� ��� (1941 ���) 24 ��� �� �� ��� � �.�. (1790 ���) Modified: stable/10/usr.bin/calendar/calendars/ru_RU.UTF-8/calendar.military == --- stable/10/usr.bin/calendar/calendars/ru_RU.UTF-8/calendar.military Sun Jul 31 10:15:04 2016(r303581) +++ stable/10/usr.bin/calendar/calendars/ru_RU.UTF-8/calendar.military Sun Jul 31 10:37:09 2016(r303582) @@ -20,7 +20,7 @@ LANG=ru_RU.UTF-8 8 сен День Бородинского сражения русской армии под командованием М.И. Кутузова с французской армией (1812 год) 11 сен День победы русской эскадры под командованием Ф.Ф. Ушакова над турецкой эскадрой у мыса Тендра (1790 год) 21 сен День победы русских полков во главе с великим князем Дмитрием Донским над монголо-татарскими войсками в Куликовской битве (1380 год) - 7 ноя День освобождения Москвы силами народного ополчения под руководством Кузьмы Минина и Дмитрия Пожарского от польских интервентов (1612 год) + 4 ноя День освобождения Москвы силами народного ополчения под руководством Кузьмы Минина и Дмитрия Пожарского от польских интервентов (1612 год) 1 дек День победы русской эскадры под командованием П.С. Нахимова над турецкой эскадрой у мыса Синоп (1853 год) 5 дек День начала контрнаступления советских войск против немецко-фашистских войск в битве под Москвой (1941 год) 24 дек День взятия турецкой крепости Измаил русскими войсками под командованием А.В. Суворова (1790 год) ___ 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: r303581 - in head/usr.bin/calendar/calendars: ru_RU.KOI8-R ru_RU.UTF-8
Author: ache Date: Sun Jul 31 10:15:04 2016 New Revision: 303581 URL: https://svnweb.freebsd.org/changeset/base/303581 Log: Fix date Modified: head/usr.bin/calendar/calendars/ru_RU.KOI8-R/calendar.military head/usr.bin/calendar/calendars/ru_RU.UTF-8/calendar.military Modified: head/usr.bin/calendar/calendars/ru_RU.KOI8-R/calendar.military == --- head/usr.bin/calendar/calendars/ru_RU.KOI8-R/calendar.military Sun Jul 31 08:05:15 2016(r303580) +++ head/usr.bin/calendar/calendars/ru_RU.KOI8-R/calendar.military Sun Jul 31 10:15:04 2016(r303581) @@ -20,7 +20,7 @@ LANG=ru_RU.KOI8-R 8 . ��� � ��� � �.�. � ��� �� (1812 ���) 11 . �� ��� ��� ��� � �.�. ��� ��� � �� (1790 ���) 21 . �� ��� �� �� � � ��� �� ��� ��� ���-�� � ��� � (1380 ���) - 7 . �� �� � � ��� �� �� � ��� �� �� ��� (1612 ���) + 4 . �� �� � � ��� �� �� � ��� �� �� ��� (1612 ���) 1 ���. �� ��� ��� ��� � �.�. ��� � � (1853 ���) 5 ���. �� � � �� ���-�� � � � ��� ��� (1941 ���) 24 ���. �� �� ��� � �.�. (1790 ���) Modified: head/usr.bin/calendar/calendars/ru_RU.UTF-8/calendar.military == --- head/usr.bin/calendar/calendars/ru_RU.UTF-8/calendar.military Sun Jul 31 08:05:15 2016(r303580) +++ head/usr.bin/calendar/calendars/ru_RU.UTF-8/calendar.military Sun Jul 31 10:15:04 2016(r303581) @@ -20,7 +20,7 @@ LANG=ru_RU.UTF-8 8 сент. День Бородинского сражения русской армии под командованием М.И. Кутузова с французской армией (1812 год) 11 сент. День победы русской эскадры под командованием Ф.Ф. Ушакова над турецкой эскадрой у мыса Тендра (1790 год) 21 сент. День победы русских полков во главе с великим князем Дмитрием Донским над монголо-татарскими войсками в Куликовской битве (1380 год) - 7 нояб. День освобождения Москвы силами народного ополчения под руководством Кузьмы Минина и Дмитрия Пожарского от польских интервентов (1612 год) + 4 нояб. День освобождения Москвы силами народного ополчения под руководством Кузьмы Минина и Дмитрия Пожарского от польских интервентов (1612 год) 1 дек.День победы русской эскадры под командованием П.С. Нахимова над турецкой эскадрой у мыса Синоп (1853 год) 5 дек.День начала контрнаступления советских войск против немецко-фашистских войск в битве под Москвой (1941 год) 24 дек.День взятия турецкой крепости Измаил русскими войсками под командованием А.В. Суворова (1790 год) ___ 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: r303580 - in head: include lib/libc/gen usr.sbin/pw
Author: ed Date: Sun Jul 31 08:05:15 2016 New Revision: 303580 URL: https://svnweb.freebsd.org/changeset/base/303580 Log: Fix up setgrent(3) to have a POSIX-compliant prototype. Just like with freelocale(3), I haven't been able to find any piece of code that actually makes use of this function's return value, both in base and in ports. The reason for this is that FreeBSD seems to be the only operating system to have such a prototype. This is why I'm deciding to not use symbol versioning for this. It does seem that the pw(8) utility depends on the function's typing and already had a switch in place to toggle between the FreeBSD and POSIX variant of this function. Clean this up by always expecting the POSIX variant. There is also a single port that has a couple of local declarations of setgrent(3) that need to be patched up. This is in the process of being fixed. PR: 211394 (exp-run) Modified: head/include/grp.h head/lib/libc/gen/getgrent.3 head/lib/libc/gen/getgrent.c head/usr.sbin/pw/pw_vpw.c head/usr.sbin/pw/pwupd.h Modified: head/include/grp.h == --- head/include/grp.h Sun Jul 31 06:53:50 2016(r303579) +++ head/include/grp.h Sun Jul 31 08:05:15 2016(r303580) @@ -75,8 +75,7 @@ intpwcache_groupdb(int (*)(int), void struct group * (*)(gid_t)); #endif #if __XSI_VISIBLE -/* XXX IEEE Std 1003.1, 2003 specifies `void setgrent(void)' */ -int setgrent(void); +voidsetgrent(void); #endif #if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE int getgrgid_r(gid_t, struct group *, char *, size_t, Modified: head/lib/libc/gen/getgrent.3 == --- head/lib/libc/gen/getgrent.3Sun Jul 31 06:53:50 2016 (r303579) +++ head/lib/libc/gen/getgrent.3Sun Jul 31 08:05:15 2016 (r303580) @@ -28,7 +28,7 @@ .\" From: @(#)getgrent.3 8.2 (Berkeley) 4/19/94 .\" $FreeBSD$ .\" -.Dd April 16, 2003 +.Dd July 31, 2016 .Dt GETGRENT 3 .Os .Sh NAME @@ -60,7 +60,7 @@ .Fn getgrgid_r "gid_t gid" "struct group *grp" "char *buffer" "size_t bufsize" "struct group **result" .Ft int .Fn setgroupent "int stayopen" -.Ft int +.Ft void .Fn setgrent void .Ft void .Fn endgrent void @@ -188,14 +188,13 @@ is set to .Dv NULL and the return value is 0, no matching entry exists.) .Pp -The functions +The function .Fn setgroupent -and -.Fn setgrent -return the value 1 if successful, otherwise the value +returns the value 1 if successful, otherwise the value 0 is returned. The functions -.Fn endgrent +.Fn endgrent , +.Fn setgrent and .Fn setgrfile have no return value. Modified: head/lib/libc/gen/getgrent.c == --- head/lib/libc/gen/getgrent.cSun Jul 31 06:53:50 2016 (r303579) +++ head/lib/libc/gen/getgrent.cSun Jul 31 08:05:15 2016 (r303580) @@ -533,12 +533,10 @@ out: return (rv); } -/* XXX IEEE Std 1003.1, 2003 specifies `void setgrent(void)' */ -int +void setgrent(void) { (void)_nsdispatch(NULL, setgrent_dtab, NSDB_GROUP, "setgrent", defaultsrc, 0); - return (1); } Modified: head/usr.sbin/pw/pw_vpw.c == --- head/usr.sbin/pw/pw_vpw.c Sun Jul 31 06:53:50 2016(r303579) +++ head/usr.sbin/pw/pw_vpw.c Sun Jul 31 08:05:15 2016(r303580) @@ -130,13 +130,10 @@ vendgrent(void) } } -RET_SETGRENT +void vsetgrent(void) { vendgrent(); -#if defined(__FreeBSD__) - return 0; -#endif } static struct group * Modified: head/usr.sbin/pw/pwupd.h == --- head/usr.sbin/pw/pwupd.hSun Jul 31 06:53:50 2016(r303579) +++ head/usr.sbin/pw/pwupd.hSun Jul 31 08:05:15 2016(r303580) @@ -38,12 +38,6 @@ #include #include -#if defined(__FreeBSD__) -#defineRET_SETGRENTint -#else -#defineRET_SETGRENTvoid -#endif - struct pwf { int _altdir; void (*_setpwent)(void); @@ -51,7 +45,7 @@ struct pwf { struct passwd * (*_getpwent)(void); struct passwd * (*_getpwuid)(uid_t uid); struct passwd * (*_getpwnam)(const char * nam); - RET_SETGRENT (*_setgrent)(void); + void (*_setgrent)(void); void (*_endgrent)(void); struct group * (*_getgrent)(void); struct group * (*_getgrgid)(gid_t gid); @@ -141,7 +135,7 @@ struct passwd * vgetpwnam(const char * n struct group * vgetgrent(void); struct group * vgetgrgid(gid_t gid); struct group * vgetgrnam(const char * nam); -RET_SETGRENT vsetgrent(void); +void
svn commit: r303579 - head/share/man/man4
Author: adrian Date: Sun Jul 31 06:53:50 2016 New Revision: 303579 URL: https://svnweb.freebsd.org/changeset/base/303579 Log: [gpioled] update manpage. Submitted by: Dan NelsonModified: head/share/man/man4/gpioled.4 Modified: head/share/man/man4/gpioled.4 == --- head/share/man/man4/gpioled.4 Sun Jul 31 06:52:19 2016 (r303578) +++ head/share/man/man4/gpioled.4 Sun Jul 31 06:53:50 2016 (r303579) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 14, 2014 +.Dd July 30, 2016 .Dt GPIOLED 4 .Os .Sh NAME @@ -71,6 +71,8 @@ to create for Which pin on the GPIO interface to map to this instance. Please note that this mask should only ever have one bit set (any other bits - i.e., pins - will be ignored). +.It Va hint.gpioled.%d.invert +If set to 1, the pin will be set to 0 to light the LED, and 1 to clear it. .El .Pp On a ___ 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: r303577 - head/sys/mips/atheros
Author: adrian Date: Sun Jul 31 06:51:34 2016 New Revision: 303577 URL: https://svnweb.freebsd.org/changeset/base/303577 Log: [ar71xx_gpio] handle AR934x and QCA953x GPIO OE polarity. For reasons I won't comment on, the AR934x and QCA953x GPIO_OE register value is inverted - bit set == input, bit clear == output. So, fix this in the output setting, in reading the initial state from the boot loader, and also setting any gpiofunc pins that are necessary. Modified: head/sys/mips/atheros/ar71xx_gpio.c Modified: head/sys/mips/atheros/ar71xx_gpio.c == --- head/sys/mips/atheros/ar71xx_gpio.c Sun Jul 31 06:34:49 2016 (r303576) +++ head/sys/mips/atheros/ar71xx_gpio.c Sun Jul 31 06:51:34 2016 (r303577) @@ -138,13 +138,56 @@ ar71xx_gpio_function_disable(struct ar71 GPIO_CLEAR_BITS(sc, AR71XX_GPIO_FUNCTION, mask); } +/* + * On most platforms, GPIO_OE is a bitmap where the bit set + * means "enable output." + * + * On AR934x and QCA953x, it's the opposite - the bit set means + * "input enable". + */ +static int +ar71xx_gpio_oe_is_high(void) +{ + switch (ar71xx_soc) { + case AR71XX_SOC_AR9344: + case AR71XX_SOC_QCA9533: + case AR71XX_SOC_QCA9533_V2: + return 0; + default: + return 1; + } +} + static void -ar71xx_gpio_pin_configure(struct ar71xx_gpio_softc *sc, struct gpio_pin *pin, -unsigned int flags) +ar71xx_gpio_oe_set_output(struct ar71xx_gpio_softc *sc, int b) +{ + uint32_t mask; + + mask = 1 << b; + + if (ar71xx_gpio_oe_is_high()) + GPIO_SET_BITS(sc, AR71XX_GPIO_OE, mask); + else + GPIO_CLEAR_BITS(sc, AR71XX_GPIO_OE, mask); +} + +static void +ar71xx_gpio_oe_set_input(struct ar71xx_gpio_softc *sc, int b) { uint32_t mask; - mask = 1 << pin->gp_pin; + mask = 1 << b; + + if (ar71xx_gpio_oe_is_high()) + GPIO_CLEAR_BITS(sc, AR71XX_GPIO_OE, mask); + else + GPIO_SET_BITS(sc, AR71XX_GPIO_OE, mask); +} + +static void +ar71xx_gpio_pin_configure(struct ar71xx_gpio_softc *sc, struct gpio_pin *pin, +unsigned int flags) +{ /* * Manage input/output @@ -153,11 +196,10 @@ ar71xx_gpio_pin_configure(struct ar71xx_ pin->gp_flags &= ~(GPIO_PIN_INPUT|GPIO_PIN_OUTPUT); if (flags & GPIO_PIN_OUTPUT) { pin->gp_flags |= GPIO_PIN_OUTPUT; - GPIO_SET_BITS(sc, AR71XX_GPIO_OE, mask); - } - else { + ar71xx_gpio_oe_set_output(sc, pin->gp_pin); + } else { pin->gp_flags |= GPIO_PIN_INPUT; - GPIO_CLEAR_BITS(sc, AR71XX_GPIO_OE, mask); + ar71xx_gpio_oe_set_input(sc, pin->gp_pin); } } } @@ -455,6 +497,14 @@ ar71xx_gpio_attach(device_t dev) } /* Iniatilize the GPIO pins, keep the loader settings. */ oe = GPIO_READ(sc, AR71XX_GPIO_OE); + /* +* For AR934x and QCA953x, the meaning of oe is inverted; +* so flip it the right way around so we can parse the GPIO +* state. +*/ + if (!ar71xx_gpio_oe_is_high()) + oe = ~oe; + sc->gpio_pins = malloc(sizeof(*sc->gpio_pins) * sc->gpio_npins, M_DEVBUF, M_WAITOK | M_ZERO); for (i = 0, j = 0; j <= maxpin; j++) { @@ -515,16 +565,14 @@ ar71xx_gpio_attach(device_t dev) gpiofunc, gpiomode); - /* Set output (bit == 0) */ - oe = GPIO_READ(sc, AR71XX_GPIO_OE); - oe &= ~ (1 << i); - GPIO_WRITE(sc, AR71XX_GPIO_OE, oe); - /* Set pin value = 0, so it stays low by default */ oe = GPIO_READ(sc, AR71XX_GPIO_OUT); oe &= ~ (1 << i); GPIO_WRITE(sc, AR71XX_GPIO_OUT, oe); + /* Set output */ + ar71xx_gpio_oe_set_output(sc, i); + /* Finally: Set the output config */ ar71xx_gpio_ouput_configure(i, gpiofunc); } ___ 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: r303578 - head/sys/mips/conf
Author: adrian Date: Sun Jul 31 06:52:19 2016 New Revision: 303578 URL: https://svnweb.freebsd.org/changeset/base/303578 Log: [wdr4300] invert the GPIO LED polarity. This makes them behave correctly. Submitted by: Dan NelsonModified: head/sys/mips/conf/TL-WDR4300.hints Modified: head/sys/mips/conf/TL-WDR4300.hints == --- head/sys/mips/conf/TL-WDR4300.hints Sun Jul 31 06:51:34 2016 (r303577) +++ head/sys/mips/conf/TL-WDR4300.hints Sun Jul 31 06:52:19 2016 (r303578) @@ -206,21 +206,26 @@ hint.gpio.0.func.19.gpiomode=1# output, hint.gpioled.0.at="gpiobus0" hint.gpioled.0.name="USB1" hint.gpioled.0.pins=0x0800 +hint.gpioled.0.invert=1 hint.gpioled.1.at="gpiobus0" hint.gpioled.1.name="USB2" hint.gpioled.1.pins=0x1000 +hint.gpioled.1.invert=1 hint.gpioled.2.at="gpiobus0" hint.gpioled.2.name="WLAN2G" hint.gpioled.2.pins=0x2000 +hint.gpioled.2.invert=1 hint.gpioled.3.at="gpiobus0" hint.gpioled.3.name="SYSTEM" hint.gpioled.3.pins=0x4000 +hint.gpioled.3.invert=1 hint.gpioled.4.at="gpiobus0" hint.gpioled.4.name="QSS" hint.gpioled.4.pins=0x8000 +hint.gpioled.4.invert=1 # XXX TODO: WPS/RFKILL switch ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r303342 - in head: include lib/libc/stdlib
Hi Antoine, 2016-07-31 8:37 GMT+02:00 Antoine Brodin: > This change broke a few games in the ports tree: > > http://beefy4.nyi.freebsd.org/data/head-amd64-default/p419204_s303419/logs/errors/falconseye-1.9.3_11.log > http://beefy4.nyi.freebsd.org/data/head-amd64-default/p419204_s303419/logs/errors/nethack34-3.4.3_9.log > http://beefy4.nyi.freebsd.org/data/head-amd64-default/p419204_s303419/logs/errors/nethack36-3.6.0.log Will take care of those. Thanks for letting me know! -- Ed Schouten Nuxi, 's-Hertogenbosch, the Netherlands KvK-nr.: 62051717 ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r303575 - in head/tools/regression/zfs/zpool: add create
> On Jul 30, 2016, at 23:28, Garrett Cooperwrote: > > Author: ngie > Date: Sun Jul 31 06:28:40 2016 > New Revision: 303575 > URL: https://svnweb.freebsd.org/changeset/base/303575 > > Log: > Remove calls to `die` added for associated bugs > > Panics are no longer hit with ^/head@r303573 on amd64 > > PR: 194586, 194587, 194589 > Sponsored by: EMC / Isilon Storage Division MFC after: 1 week signature.asc Description: Message signed with OpenPGP using GPGMail
Re: svn commit: r303342 - in head: include lib/libc/stdlib
On Tue, Jul 26, 2016 at 11:41 PM, Ed Schoutenwrote: > Hi Pedro, Benjamin, > > 2016-07-26 22:35 GMT+02:00 Pedro Giffuni : >> On 07/26/16 15:14, Benjamin Kaduk wrote: >>> Is a __FreeBSD_version bump planned? (Third-party software might want >>> to be warning-clean.) >> >> Third party software should already follow standards ;). > > Not only that. This change only changes arguments from one integer > type to the other. As far as I know, such a change would not cause a > compiler to generate (substantially) different diagnostics. > > If it turns out I'm mistaken I'll reconsider, but for now this should do. :-) Hi, This change broke a few games in the ports tree: http://beefy4.nyi.freebsd.org/data/head-amd64-default/p419204_s303419/logs/errors/falconseye-1.9.3_11.log http://beefy4.nyi.freebsd.org/data/head-amd64-default/p419204_s303419/logs/errors/nethack34-3.4.3_9.log http://beefy4.nyi.freebsd.org/data/head-amd64-default/p419204_s303419/logs/errors/nethack36-3.6.0.log Cheers, Antoine ___ 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: r303576 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
Author: ngie Date: Sun Jul 31 06:34:49 2016 New Revision: 303576 URL: https://svnweb.freebsd.org/changeset/base/303576 Log: Conditionalize code which defines sysctls per _KERNEL #ifdef guard This resolves several issues when compiling libzpool (userspace library), i.e. -Wimplicit-function-declaration and -Wmissing-declarations issues. MFC after:2 weeks Reported by: clang Tested with: clang 3.8.1, gcc 4.2.1, gcc 5.3.0 Sponsored by: EMC / Isilon Storage Division Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_mirror.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_mirror.c == --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_mirror.c Sun Jul 31 06:28:40 2016(r303575) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_mirror.c Sun Jul 31 06:34:49 2016(r303576) @@ -58,9 +58,11 @@ typedef struct mirror_map { static int vdev_mirror_shift = 21; +#ifdef _KERNEL SYSCTL_DECL(_vfs_zfs_vdev); static SYSCTL_NODE(_vfs_zfs_vdev, OID_AUTO, mirror, CTLFLAG_RD, 0, "ZFS VDEV Mirror"); +#endif /* * The load configuration settings below are tuned by default for @@ -74,28 +76,38 @@ static SYSCTL_NODE(_vfs_zfs_vdev, OID_AU /* Rotating media load calculation configuration. */ static int rotating_inc = 0; +#ifdef _KERNEL SYSCTL_INT(_vfs_zfs_vdev_mirror, OID_AUTO, rotating_inc, CTLFLAG_RWTUN, _inc, 0, "Rotating media load increment for non-seeking I/O's"); +#endif static int rotating_seek_inc = 5; +#ifdef _KERNEL SYSCTL_INT(_vfs_zfs_vdev_mirror, OID_AUTO, rotating_seek_inc, CTLFLAG_RWTUN, _seek_inc, 0, "Rotating media load increment for seeking I/O's"); +#endif static int rotating_seek_offset = 1 * 1024 * 1024; +#ifdef _KERNEL SYSCTL_INT(_vfs_zfs_vdev_mirror, OID_AUTO, rotating_seek_offset, CTLFLAG_RWTUN, _seek_offset, 0, "Offset in bytes from the last I/O which " "triggers a reduced rotating media seek increment"); +#endif /* Non-rotating media load calculation configuration. */ static int non_rotating_inc = 0; +#ifdef _KERNEL SYSCTL_INT(_vfs_zfs_vdev_mirror, OID_AUTO, non_rotating_inc, CTLFLAG_RWTUN, _rotating_inc, 0, "Non-rotating media load increment for non-seeking I/O's"); +#endif static int non_rotating_seek_inc = 1; +#ifdef _KERNEL SYSCTL_INT(_vfs_zfs_vdev_mirror, OID_AUTO, non_rotating_seek_inc, CTLFLAG_RWTUN, _rotating_seek_inc, 0, "Non-rotating media load increment for seeking I/O's"); +#endif static inline size_t Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c == --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.cSun Jul 31 06:28:40 2016(r303575) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.cSun Jul 31 06:34:49 2016(r303576) @@ -176,6 +176,7 @@ int zfs_vdev_read_gap_limit = 32 << 10; int zfs_vdev_write_gap_limit = 4 << 10; #ifdef __FreeBSD__ +#ifdef _KERNEL SYSCTL_DECL(_vfs_zfs_vdev); static int sysctl_zfs_async_write_active_min_dirty_percent(SYSCTL_HANDLER_ARGS); @@ -271,6 +272,7 @@ sysctl_zfs_async_write_active_max_dirty_ return (0); } #endif +#endif int vdev_queue_offset_compare(const void *x1, const void *x2) ___ 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: r303575 - in head/tools/regression/zfs/zpool: add create
Author: ngie Date: Sun Jul 31 06:28:40 2016 New Revision: 303575 URL: https://svnweb.freebsd.org/changeset/base/303575 Log: Remove calls to `die` added for associated bugs Panics are no longer hit with ^/head@r303573 on amd64 PR: 194586, 194587, 194589 Sponsored by: EMC / Isilon Storage Division Modified: head/tools/regression/zfs/zpool/add/option-f_size_mismatch.t head/tools/regression/zfs/zpool/add/option-f_type_mismatch.t head/tools/regression/zfs/zpool/create/files.t Modified: head/tools/regression/zfs/zpool/add/option-f_size_mismatch.t == --- head/tools/regression/zfs/zpool/add/option-f_size_mismatch.tSun Jul 31 06:24:26 2016(r303574) +++ head/tools/regression/zfs/zpool/add/option-f_size_mismatch.tSun Jul 31 06:28:40 2016(r303575) @@ -4,8 +4,6 @@ dir=`dirname $0` . ${dir}/../../misc.sh -[ "${os}" = "FreeBSD" ] && die "panics FreeBSD; see bug # 194586" - echo "1..100" disks_create 7 Modified: head/tools/regression/zfs/zpool/add/option-f_type_mismatch.t == --- head/tools/regression/zfs/zpool/add/option-f_type_mismatch.tSun Jul 31 06:24:26 2016(r303574) +++ head/tools/regression/zfs/zpool/add/option-f_type_mismatch.tSun Jul 31 06:28:40 2016(r303575) @@ -4,8 +4,6 @@ dir=`dirname $0` . ${dir}/../../misc.sh -[ "${os}" = "FreeBSD" ] && die "panics FreeBSD; see bug # 194587" - echo "1..100" disks_create 7 Modified: head/tools/regression/zfs/zpool/create/files.t == --- head/tools/regression/zfs/zpool/create/files.t Sun Jul 31 06:24:26 2016(r303574) +++ head/tools/regression/zfs/zpool/create/files.t Sun Jul 31 06:28:40 2016(r303575) @@ -4,8 +4,6 @@ dir=`dirname $0` . ${dir}/../../misc.sh -[ "${os}" = "FreeBSD" ] && die "panics FreeBSD; see bug # 194589" - echo "1..59" files_create 5 ___ 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: r303574 - head/sys/dev/gpio
Author: adrian Date: Sun Jul 31 06:24:26 2016 New Revision: 303574 URL: https://svnweb.freebsd.org/changeset/base/303574 Log: [gpioled] add support for inverting the LED polarity. No, this isn't a star trek science joke - sometimes LEDs are wired up to be active low, so this is needed. Submitted by: Dan NelsonModified: head/sys/dev/gpio/gpioled.c Modified: head/sys/dev/gpio/gpioled.c == --- head/sys/dev/gpio/gpioled.c Sun Jul 31 06:03:27 2016(r303573) +++ head/sys/dev/gpio/gpioled.c Sun Jul 31 06:24:26 2016(r303574) @@ -66,6 +66,7 @@ struct gpioled_softc device_tsc_busdev; struct mtx sc_mtx; struct cdev *sc_leddev; + int sc_invert; }; static void gpioled_control(void *, int); @@ -82,6 +83,8 @@ gpioled_control(void *priv, int onoff) GPIOLED_LOCK(sc); if (GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, GPIOLED_PIN, GPIO_PIN_OUTPUT) == 0) { + if (sc->sc_invert) + onoff = !onoff; GPIOBUS_PIN_SET(sc->sc_busdev, sc->sc_dev, GPIOLED_PIN, onoff ? GPIO_PIN_HIGH : GPIO_PIN_LOW); } @@ -199,6 +202,8 @@ gpioled_attach(device_t dev) if (resource_string_value(device_get_name(dev), device_get_unit(dev), "name", )) name = NULL; + resource_int_value(device_get_name(dev), + device_get_unit(dev), "invert", >sc_invert); #endif sc->sc_leddev = led_create_state(gpioled_control, sc, name ? name : ___ 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: r303573 - head/cddl/contrib/opensolaris/lib/libzpool/common
Author: ngie Date: Sun Jul 31 06:03:27 2016 New Revision: 303573 URL: https://svnweb.freebsd.org/changeset/base/303573 Log: Cast result from third parameter to int instead of promoting it to size_t This resolves a -Wformat issue when the value is used as a format width precision specifier, i.e. %*s MFC after: 1 month Reported by: clang Sponsored by: EMC / Isilon Storage Division Modified: head/cddl/contrib/opensolaris/lib/libzpool/common/util.c Modified: head/cddl/contrib/opensolaris/lib/libzpool/common/util.c == --- head/cddl/contrib/opensolaris/lib/libzpool/common/util.cSun Jul 31 05:31:09 2016(r303572) +++ head/cddl/contrib/opensolaris/lib/libzpool/common/util.cSun Jul 31 06:03:27 2016(r303573) @@ -108,7 +108,7 @@ show_vdev_stats(const char *desc, const (void) printf("%*s%s%*s%*s%*s %5s %5s %5s %5s %5s %5s %5s\n", indent, "", prefix, - indent + strlen(prefix) - 25 - (vs->vs_space ? 0 : 12), + (int)(indent + strlen(prefix) - 25 - (vs->vs_space ? 0 : 12)), desc, vs->vs_space ? 6 : 0, vs->vs_space ? used : "", vs->vs_space ? 6 : 0, vs->vs_space ? avail : "", ___ 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"