Re: svn commit: r326733 - head/usr.sbin/acpi/acpiconf
On Sat, 9 Dec 2017, Niclas Zeising wrote: Log: Improve options and error handling. Improve options handling and error out if multiple mutually exclusive options are passed to acpiconf. Switch from using atoi() to strtol() for argument parsing, and add error checking and handling, instead of blindly trusting that the integer conversion is OK. Cange err() to errx() in once case, the errno value was garbage there. This has the usual bugs in strtol() handling, making it little better than atoi(). It adds manu new bugs. Modified: head/usr.sbin/acpi/acpiconf/acpiconf.c == --- head/usr.sbin/acpi/acpiconf/acpiconf.c Sat Dec 9 15:47:26 2017 (r326732) +++ head/usr.sbin/acpi/acpiconf/acpiconf.c Sat Dec 9 15:59:10 2017 (r326733) @@ -205,8 +205,9 @@ usage(const char* prog) int main(int argc, char *argv[]) { - char*prog; - int c, sleep_type; + char*prog, *end; + int c, sleep_type, battery, ack; + int iflag = 0, kflag = 0, sflag = 0; prog = argv[0]; if (argc < 2) @@ -218,16 +219,24 @@ main(int argc, char *argv[]) while ((c = getopt(argc, argv, "hi:k:s:")) != -1) { switch (c) { case 'i': - acpi_battinfo(atoi(optarg)); + iflag = 1; + battery = strtol(optarg, &end, 10); First, errno is not set before starting, making it impossible to detect overflow properly. Second, the value is blindly assigned to a variable of type int, just like for atoi(). This gives implementation-defined behaviour. For atoi(), the behaviour is is undefined on any overflow, but for (int)strtol() the behaviour on other overflows is defined for strtol() and the behaviour on this overflow is only implementation-defined, so the combined behaviour is not undefined. Good luck finding an implementation that documents its behaviour. Third, forcing base 10 preserves the bug that only decimal values are supported. This is good enough for acpiconf, but still a gratuitous restriction. POSIX might have ths restriction for all integer args on the command line. It is also unclear if POSIX accepts args not representable by the int type. Any such restrictions are bugs in POSIX. Portability requires not using anything except small decimal integers for args. Good luck finding a utility that documents the form of integer args that it accepts. For acpiconf -s, it was clear that the arg must be one of the characters [1-4], but this commit breaks that (see below). For acpi -i battery, no form is documented, so it is unclear if the arg should be a number, name, or either. -i foobar used to work to give battery number 0 by ignoring errors in atoi(). Almost any error handling for strtol() tends to break this. + if ((size_t)(end - optarg) != strlen(optarg)) + errx(EX_USAGE, "invalid battery"); break; Here is the "almost any" error handling for strtol(). It is very incomplete, but much larger than needed or usual. All it does is check that there is no garbage after the end of the parsed part of the string. This is normally written as: if (*end != '\0') but is written as: if ((size_t)(end - optarg) != strlen(optarg)) Both see "foobar" as garbage after the end, so as an error. The following error checks are still missing: - null args. Best written as another test of 'end' in the same expression: if (end == optarg || *end != '\0') errx(... /* better error message than above */) POSIX requires errno to be set to EINVAL if end == optarg and for some other errors. This is unportable and should not be used. But sloppy code uses it to combine some tests into a single tests of errno and then print a non-specific error message. acpiconf already has the non-specific error message. - overflow in strtol(). Best written as: long bnum; /* must be long to hold result */ ... errno = 0; bnum = strtol(optarg, &end, 0); if (errno == ERANGE) errx(... /* better error message than above */) Another usual error is checking if the result is LONG_MIN or LONG_MAX. These values are returned on overflow errors but also for no errors. errno must be used as above to distinguish, but then checking these values just breaks support for this values. However, if these values are out of the range of subsequent range checks and a specific error message for overflow is not done, then the errno check and checks for the these values are redundant. Sloppy code gets minor simplifications from this with the minor sloppiness of non-speficic erro
svn commit: r326739 - head/sys/powerpc/booke
Author: jhibbits Date: Sun Dec 10 04:43:27 2017 New Revision: 326739 URL: https://svnweb.freebsd.org/changeset/base/326739 Log: Retrieve the page outside of holding locks pmap_track_page() only works with physical memory pages, which have a constant vm_page_t address. Microoptimize pmap_track_page() to perform one less operation under the lock. Modified: head/sys/powerpc/booke/pmap.c Modified: head/sys/powerpc/booke/pmap.c == --- head/sys/powerpc/booke/pmap.c Sat Dec 9 23:34:00 2017 (r326738) +++ head/sys/powerpc/booke/pmap.c Sun Dec 10 04:43:27 2017 (r326739) @@ -4224,10 +4224,10 @@ pmap_track_page(pmap_t pmap, vm_offset_t va) va = trunc_page(va); pa = pmap_kextract(va); + page = PHYS_TO_VM_PAGE(pa); rw_wlock(&pvh_global_lock); PMAP_LOCK(pmap); - page = PHYS_TO_VM_PAGE(pa); TAILQ_FOREACH(pve, &page->md.pv_list, pv_link) { if ((pmap == pve->pv_pmap) && (va == pve->pv_va)) { ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r326731 - head/sys/ufs/ffs
On Sat, Dec 09, 2017 at 07:36:59PM -0700, Warner Losh wrote: > On Sat, Dec 9, 2017 at 11:03 AM, Andriy Gapon wrote: > > > On 09/12/2017 17:44, Mark Johnston wrote: > > > Some GEOMs do not appear to handle BIO_ORDERED correctly, meaning that > > the > > > barrier write may not work as intended. > > > There's a few places we send down a BIO_ORDERED BIO_FLUSH command > (see softdep_synchronize for one). Will those matter? Some classes have separate handling for BIO_FLUSH, so it depends. I think gmirror's handling is buggy independent of BIO_ORDERED: g_mirror_start() sends BIO_FLUSH commands directly to the mirrors, while reads and writes are queued for handling by the gmirror worker thread. So as far as I can tell, a BIO_WRITE which arrives at the gmirror provider before a BIO_FLUSH might be sent to the mirrors after that BIO_FLUSH. I would expect BIO_FLUSH to implicitly have something like release semantics, i.e., a BIO_FLUSH shouldn't be reordered with a BIO_WRITE that preceded it. But I might be misunderstanding. > As I've noted elsewhere: I'd really like to kill BIO_ORDERED since it has > too many icky effects (and BIO_FLUSH + BIO_ORDERED isn't guaranteed to do, > well, anything since it can turn into a NOP in a number of places. Plus > many of the implementations of BIO_ORDERED assume the drive is like SCSI > and you just set the right tag to make it 'ordered'. For ATA we issue a non > NCQ command, which is a full drain of outstanding commands, send this > command, then start them again which really shuts down the parallelism we > implemented NCQ for :(. We do similar for NVME which is even worse. There > we have multiple submission queues in the hardware. To simulated it, we do > a similar drain, but that's going to get in the way as we move to NUMA and > systems where we try to do the I/O entirely on one CPU (both submission and > completion) and ordered I/O is guaranteed lock contention. Independent of this, it doesn't really look like we have any way of handling write errors when dependencies are enforced using BIO_ORDERED. In the case of the babarrierwrite() consumer in FFS, what happens if the inode block write fails due to a transient error, but the following CG update succeeds? ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r326731 - head/sys/ufs/ffs
On Sat, Dec 9, 2017 at 11:03 AM, Andriy Gapon wrote: > On 09/12/2017 17:44, Mark Johnston wrote: > > Some GEOMs do not appear to handle BIO_ORDERED correctly, meaning that > the > > barrier write may not work as intended. There's a few places we send down a BIO_ORDERED BIO_FLUSH command (see softdep_synchronize for one). Will those matter? As I've noted elsewhere: I'd really like to kill BIO_ORDERED since it has too many icky effects (and BIO_FLUSH + BIO_ORDERED isn't guaranteed to do, well, anything since it can turn into a NOP in a number of places. Plus many of the implementations of BIO_ORDERED assume the drive is like SCSI and you just set the right tag to make it 'ordered'. For ATA we issue a non NCQ command, which is a full drain of outstanding commands, send this command, then start them again which really shuts down the parallelism we implemented NCQ for :(. We do similar for NVME which is even worse. There we have multiple submission queues in the hardware. To simulated it, we do a similar drain, but that's going to get in the way as we move to NUMA and systems where we try to do the I/O entirely on one CPU (both submission and completion) and ordered I/O is guaranteed lock contention. Warner ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r326731 - head/sys/ufs/ffs
On Sat, Dec 9, 2017 at 5:17 PM, Poul-Henning Kamp wrote: > > In message p...@mail.gmail.com>, Warner Losh writes: > > >That would be strange given that BIO_ORDERED is @gibbs baby ? > > > >Nah... I wrote the iosched code... and I find the concept somewhat flawed > >since it is at the disk level, not the partition level, so it winds up > >interfering with mixed traffic. And it really only makes sense for writes, > >but it affects reads. And it is a poor fit to Ata semantics, and not a lot > >better for scsi. And for nvme it creates a bottleneck in hardware > carefully > >designed to be free of bottlenecks... > > Don't take my comment as an endorsement of BIO_ORDERED... > > I think ordering is strictly a consumer responsibility for exactly > (and then some) of the reasons you mention. > > "End to end principle in systems design" and all that... Yes. I'd like to kill it completely... It's not needed and fosters the notion that there's more determinism in the ordering of events in the I/O stack than has existed since tagged queueing was a thing in the 90's. But there's no such thing as barriers in I/O devices today: that's handled in software by draining the queue, doing the one I/O, then starting the queue back up again So I'm with you that it's the client's job to wait for write X to complete before scheduling writes that depend on X to the I/O system. Warner ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r326731 - head/sys/ufs/ffs
In message , Warner Losh writes: >That would be strange given that BIO_ORDERED is @gibbs baby ? > >Nah... I wrote the iosched code... and I find the concept somewhat flawed >since it is at the disk level, not the partition level, so it winds up >interfering with mixed traffic. And it really only makes sense for writes, >but it affects reads. And it is a poor fit to Ata semantics, and not a lot >better for scsi. And for nvme it creates a bottleneck in hardware carefully >designed to be free of bottlenecks... Don't take my comment as an endorsement of BIO_ORDERED... I think ordering is strictly a consumer responsibility for exactly (and then some) of the reasons you mention. "End to end principle in systems design" and all that... -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 p...@freebsd.org | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence. ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r326738 - head/usr.sbin/pw
10.12.2017 6:34, Eugene Grosbein пишет: > Author: eugen > Date: Sat Dec 9 23:34:00 2017 > New Revision: 326738 > URL: https://svnweb.freebsd.org/changeset/base/326738 > > Log: > pw(8): correct expiration period handling and command line overrides > to preconfigured values for -e, -p and -w flags. > > Use non-negative symbols instead of magic values > in passwd_val/pw_password functions. > > PR: 223431 > Submitted by: Yuri Pankov (in part, patch for the manual) > Reported by:mav (mentor) Oh... Of course, it should be "Approved by: mav (mentor)". Mea culpa. ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r326731 - head/sys/ufs/ffs
On Dec 9, 2017 4:27 PM, "Poul-Henning Kamp" wrote: In message , Warner Losh writes: >I also noticed that gsched doesn't take BIO_ORDERED into account when >sorting requests. Isilon has an I/O scheduler which has this problem >too > >I think the cam iosched ignores it too. That would be strange given that BIO_ORDERED is @gibbs baby ? Nah... I wrote the iosched code... and I find the concept somewhat flawed since it is at the disk level, not the partition level, so it winds up interfering with mixed traffic. And it really only makes sense for writes, but it affects reads. And it is a poor fit to Ata semantics, and not a lot better for scsi. And for nvme it creates a bottleneck in hardware carefully designed to be free of bottlenecks... Warner Warner -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 p...@freebsd.org | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence. ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r326738 - head/usr.sbin/pw
Author: eugen Date: Sat Dec 9 23:34:00 2017 New Revision: 326738 URL: https://svnweb.freebsd.org/changeset/base/326738 Log: pw(8): correct expiration period handling and command line overrides to preconfigured values for -e, -p and -w flags. Use non-negative symbols instead of magic values in passwd_val/pw_password functions. PR: 223431 Submitted by: Yuri Pankov (in part, patch for the manual) Reported by: mav (mentor) MFC after:3 days Relnotes: yes Modified: head/usr.sbin/pw/psdate.c head/usr.sbin/pw/psdate.h head/usr.sbin/pw/pw.8 head/usr.sbin/pw/pw.h head/usr.sbin/pw/pw_conf.c head/usr.sbin/pw/pw_user.c Modified: head/usr.sbin/pw/psdate.c == --- head/usr.sbin/pw/psdate.c Sat Dec 9 23:16:02 2017(r326737) +++ head/usr.sbin/pw/psdate.c Sat Dec 9 23:34:00 2017(r326738) @@ -40,7 +40,7 @@ static const char rcsid[] = #include "psdate.h" -static int +int numerics(char const * str) { Modified: head/usr.sbin/pw/psdate.h == --- head/usr.sbin/pw/psdate.h Sat Dec 9 23:16:02 2017(r326737) +++ head/usr.sbin/pw/psdate.h Sat Dec 9 23:34:00 2017(r326738) @@ -35,6 +35,7 @@ #include __BEGIN_DECLS +int numerics(char const * str); time_t parse_date(time_t dt, char const * str); void print_date(char *buf, time_t t, int dotime); __END_DECLS Modified: head/usr.sbin/pw/pw.8 == --- head/usr.sbin/pw/pw.8 Sat Dec 9 23:16:02 2017(r326737) +++ head/usr.sbin/pw/pw.8 Sat Dec 9 23:34:00 2017(r326738) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 12, 2016 +.Dd December 10, 2017 .Dt PW 8 .Os .Sh NAME @@ -611,6 +611,14 @@ that the account expires. A value of 0 suppresses automatic calculation of the expiry date. .It Fl p Ar days Set the default password expiration period in days. +When +.Fl D +is used, the +.Ar days +argument is interpreted differently. +It must be numeric and represents the number of days after creation +that the account expires. +A value of 0 suppresses automatic calculation of the expiry date. .It Fl g Ar group Set the default group for new users. If a blank group is specified using Modified: head/usr.sbin/pw/pw.h == --- head/usr.sbin/pw/pw.h Sat Dec 9 23:16:02 2017(r326737) +++ head/usr.sbin/pw/pw.h Sat Dec 9 23:34:00 2017(r326738) @@ -48,6 +48,14 @@ enum _mode M_NUM }; +enum _passmode +{ + P_NO, + P_NONE, + P_RANDOM, + P_YES +}; + enum _which { W_USER, Modified: head/usr.sbin/pw/pw_conf.c == --- head/usr.sbin/pw/pw_conf.c Sat Dec 9 23:16:02 2017(r326737) +++ head/usr.sbin/pw/pw_conf.c Sat Dec 9 23:34:00 2017(r326738) @@ -200,18 +200,18 @@ passwd_val(char const * str, int dflt) for (i = 0; booltrue[i]; i++) if (strcmp(str, booltrue[i]) == 0) - return 1; + return P_YES; for (i = 0; boolfalse[i]; i++) if (strcmp(str, boolfalse[i]) == 0) - return 0; + return P_NO; /* * Special cases for defaultpassword */ if (strcmp(str, "random") == 0) - return -1; + return P_RANDOM; if (strcmp(str, "none") == 0) - return -2; + return P_NONE; errx(1, "Invalid value for default password"); } Modified: head/usr.sbin/pw/pw_user.c == --- head/usr.sbin/pw/pw_user.c Sat Dec 9 23:16:02 2017(r326737) +++ head/usr.sbin/pw/pw_user.c Sat Dec 9 23:34:00 2017(r326738) @@ -517,7 +517,9 @@ pw_password(struct userconf * cnf, char const * user, charpwbuf[32]; switch (cnf->default_password) { - case -1:/* Random password */ + case P_NONE:/* No password at all! */ + return ""; + case P_RANDOM: /* Random password */ l = (arc4random() % 8 + 8); /* 8 - 16 chars */ for (i = 0; i < l; i++) pwbuf[i] = chars[arc4random_uniform(sizeof(chars)-1)]; @@ -533,17 +535,13 @@ pw_password(struct userconf * cnf, char const * user, fflush(stdout); } break; - - case -2:/* No password at all! */ -
Re: svn commit: r326731 - head/sys/ufs/ffs
In message , Warner Losh writes: >I also noticed that gsched doesn't take BIO_ORDERED into account when >sorting requests. Isilon has an I/O scheduler which has this problem >too > >I think the cam iosched ignores it too. That would be strange given that BIO_ORDERED is @gibbs baby ? -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 p...@freebsd.org | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence. ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r326731 - head/sys/ufs/ffs
On Dec 9, 2017 3:37 PM, "Mark Johnston" wrote: On Sat, Dec 09, 2017 at 08:03:37PM +0200, Andriy Gapon wrote: > On 09/12/2017 17:44, Mark Johnston wrote: > > Some GEOMs do not appear to handle BIO_ORDERED correctly, meaning that the > > Nitpick: this should be "geoms" or, even better, "GEOM classes" :-) Ok. :) > > barrier write may not work as intended. > Could the loss of BIO_ORDERED in g_duplicate_bio() contribute to the problem > with those GEOM classes? It does look like a bug that g_duplicate_bio() doesn't preserve that flag. However, the issue I was looking at was in gmirror: when a mirror is being synchronized, gmirror will delay writes that collide with an active synchronization request. However, subsequent writes which do not collide are passed directly to the mirrors, so an ordering violation is possible. I plan to fix this. I haven't checked, but graid might have a similar issue. I also noticed that gsched doesn't take BIO_ORDERED into account when sorting requests. Isilon has an I/O scheduler which has this problem too I think the cam iosched ignores it too. It's really a Pita. And what do you do with multiple streams setting these sorts of bios. It's a relic of the single threaded days... Warner ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r326737 - head/sys/net80211
Author: adrian Date: Sat Dec 9 23:16:02 2017 New Revision: 326737 URL: https://svnweb.freebsd.org/changeset/base/326737 Log: [net80211] add a method for checking if a VAP WME AC has a NOACK policy or not. A subsequent set of commits will introduce this instead of a whole lot of gymnastics to check the WME category. Modified: head/sys/net80211/ieee80211_proto.c head/sys/net80211/ieee80211_proto.h Modified: head/sys/net80211/ieee80211_proto.c == --- head/sys/net80211/ieee80211_proto.c Sat Dec 9 21:55:19 2017 (r326736) +++ head/sys/net80211/ieee80211_proto.c Sat Dec 9 23:16:02 2017 (r326737) @@ -1308,6 +1308,12 @@ ieee80211_wme_updateparams(struct ieee80211vap *vap) } } +/* + * Fetch the WME parameters for the given VAP. + * + * When net80211 grows p2p, etc support, this may return different + * parameters for each VAP. + */ void ieee80211_wme_vap_getparams(struct ieee80211vap *vap, struct chanAccParams *wp) { @@ -1315,11 +1321,37 @@ ieee80211_wme_vap_getparams(struct ieee80211vap *vap, memcpy(wp, &vap->iv_ic->ic_wme.wme_chanParams, sizeof(*wp)); } +/* + * For NICs which only support one set of WME paramaters (ie, softmac NICs) + * there may be different VAP WME parameters but only one is "active". + * This returns the "NIC" WME parameters for the currently active + * context. + */ void ieee80211_wme_ic_getparams(struct ieee80211com *ic, struct chanAccParams *wp) { memcpy(wp, &ic->ic_wme.wme_chanParams, sizeof(*wp)); +} + +/* + * Return whether to use QoS on a given WME queue. + * + * This is intended to be called from the transmit path of softmac drivers + * which are setting NoAck bits in transmit descriptors. + * + * Ideally this would be set in some transmit field before the packet is + * queued to the driver but net80211 isn't quite there yet. + */ +int +ieee80211_wme_vap_ac_is_noack(struct ieee80211vap *vap, int ac) +{ + /* Bounds/sanity check */ + if (ac < 0 || ac >= WME_NUM_AC) + return (0); + + /* Again, there's only one global context for now */ + return (!! vap->iv_ic->ic_wme.wme_chanParams.cap_wmeParams[ac].wmep_noackPolicy); } static void Modified: head/sys/net80211/ieee80211_proto.h == --- head/sys/net80211/ieee80211_proto.h Sat Dec 9 21:55:19 2017 (r326736) +++ head/sys/net80211/ieee80211_proto.h Sat Dec 9 23:16:02 2017 (r326737) @@ -298,6 +298,7 @@ voidieee80211_wme_vap_getparams(struct ieee80211vap * struct chanAccParams *); void ieee80211_wme_ic_getparams(struct ieee80211com *ic, struct chanAccParams *); +intieee80211_wme_vap_ac_is_noack(struct ieee80211vap *vap, int ac); /* * Return the WME TID from a QoS frame. If no TID ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r326731 - head/sys/ufs/ffs
On Sat, Dec 09, 2017 at 08:03:37PM +0200, Andriy Gapon wrote: > On 09/12/2017 17:44, Mark Johnston wrote: > > Some GEOMs do not appear to handle BIO_ORDERED correctly, meaning that the > > Nitpick: this should be "geoms" or, even better, "GEOM classes" :-) Ok. :) > > barrier write may not work as intended. > Could the loss of BIO_ORDERED in g_duplicate_bio() contribute to the problem > with those GEOM classes? It does look like a bug that g_duplicate_bio() doesn't preserve that flag. However, the issue I was looking at was in gmirror: when a mirror is being synchronized, gmirror will delay writes that collide with an active synchronization request. However, subsequent writes which do not collide are passed directly to the mirrors, so an ordering violation is possible. I plan to fix this. I haven't checked, but graid might have a similar issue. I also noticed that gsched doesn't take BIO_ORDERED into account when sorting requests. Isilon has an I/O scheduler which has this problem too. ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r326736 - head/usr.bin/wc
Author: cem Date: Sat Dec 9 21:55:19 2017 New Revision: 326736 URL: https://svnweb.freebsd.org/changeset/base/326736 Log: wc(1): Extend non-controversial optimizations to '-c' mode wc(1)'s slow path for counting words or multibyte characters requires conversion of the 8-bit input stream to wide characters. However, a faster path can be used for counting only lines ('-l' -- newlines have the same representation in all supported encodings) or bytes ('-c'). The existing line count optimization was not used if the input was the implicit stdin. Additionally, it wasn't used if only byte counting was requested. This change expands the fast path to both of these scenarios. Expanding the buffer size from 64 kB helps reduce the number of read(2) calls needed, but exactly what impact that change has and what size to expand the buffer to are still under discussion. PR: 224160 Tested by:wosch (earlier version) Sponsored by: Dell EMC Isilon Modified: head/usr.bin/wc/wc.c Modified: head/usr.bin/wc/wc.c == --- head/usr.bin/wc/wc.cSat Dec 9 21:04:56 2017(r326735) +++ head/usr.bin/wc/wc.cSat Dec 9 21:55:19 2017(r326736) @@ -206,30 +206,30 @@ cnt(const char *file) linect = wordct = charct = llct = tmpll = 0; if (file == NULL) fd = STDIN_FILENO; - else { - if ((fd = open(file, O_RDONLY, 0)) < 0) { - xo_warn("%s: open", file); - return (1); - } - if (doword || (domulti && MB_CUR_MAX != 1)) - goto word; - /* -* Line counting is split out because it's a lot faster to get -* lines than to get words, since the word count requires some -* logic. -*/ - if (doline) { - while ((len = read(fd, buf, MAXBSIZE))) { - if (len == -1) { - xo_warn("%s: read", file); - (void)close(fd); - return (1); - } - if (siginfo) { - show_cnt(file, linect, wordct, charct, - llct); - } - charct += len; + else if ((fd = open(file, O_RDONLY, 0)) < 0) { + xo_warn("%s: open", file); + return (1); + } + if (doword || (domulti && MB_CUR_MAX != 1)) + goto word; + /* +* Line counting is split out because it's a lot faster to get +* lines than to get words, since the word count requires some +* logic. +*/ + if (doline || dochar) { + while ((len = read(fd, buf, MAXBSIZE))) { + if (len == -1) { + xo_warn("%s: read", file); + (void)close(fd); + return (1); + } + if (siginfo) { + show_cnt(file, linect, wordct, charct, + llct); + } + charct += len; + if (doline) { for (p = buf; len--; ++p) if (*p == '\n') { if (tmpll > llct) @@ -239,36 +239,37 @@ cnt(const char *file) } else tmpll++; } - reset_siginfo(); + } + reset_siginfo(); + if (doline) tlinect += linect; - if (dochar) - tcharct += charct; - if (dolongline) { - if (llct > tlongline) - tlongline = llct; - } + if (dochar) + tcharct += charct; + if (dolongline) { + if (llct > tlongline) + tlongline = llct; + } + show_cnt(file, linect, wordct, charct, llct); + (void)close(fd); + return (0); + } + /* +* If all we need is the number of characters and it's a +* regular file, just stat the puppy. +*/ + if (dochar || domulti) { + if (fstat(fd, &sb)) { + xo_warn("%s: fstat", file); + (void)close(fd); + return (1); +
svn commit: r326735 - head/sys/fs/nfs
Author: rmacklem Date: Sat Dec 9 21:04:56 2017 New Revision: 326735 URL: https://svnweb.freebsd.org/changeset/base/326735 Log: Define macros used by the pNFS server code. This commit defines some macros used by the pNFS server code. They will not be used until the main pNFS server code merge occurs, which will probably be in April 2018. Modified: head/sys/fs/nfs/nfsport.h Modified: head/sys/fs/nfs/nfsport.h == --- head/sys/fs/nfs/nfsport.h Sat Dec 9 17:27:36 2017(r326734) +++ head/sys/fs/nfs/nfsport.h Sat Dec 9 21:04:56 2017(r326735) @@ -711,6 +711,25 @@ void nfsrvd_rcv(struct socket *, void *, int); #defineNFSSESSIONMUTEXPTR(s) (&((s)->mtx)) #defineNFSLOCKSESSION(s) mtx_lock(&((s)->mtx)) #defineNFSUNLOCKSESSION(s) mtx_unlock(&((s)->mtx)) +#defineNFSLOCKLAYOUT(l)mtx_lock(&((l)->mtx)) +#defineNFSUNLOCKLAYOUT(l) mtx_unlock(&((l)->mtx)) +#defineNFSDDSLOCK()mtx_lock(&nfsrv_dslock_mtx) +#defineNFSDDSUNLOCK() mtx_unlock(&nfsrv_dslock_mtx) +#defineNFSDSCLOCKMUTEXPTR (&nfsrv_dsclock_mtx) +#defineNFSDSCLOCK()mtx_lock(&nfsrv_dsclock_mtx) +#defineNFSDSCUNLOCK() mtx_unlock(&nfsrv_dsclock_mtx) +#defineNFSDSRMLOCKMUTEXPTR (&nfsrv_dsrmlock_mtx) +#defineNFSDSRMLOCK() mtx_lock(&nfsrv_dsrmlock_mtx) +#defineNFSDSRMUNLOCK() mtx_unlock(&nfsrv_dsrmlock_mtx) +#defineNFSDWRPCLOCKMUTEXPTR(&nfsrv_dwrpclock_mtx) +#defineNFSDWRPCLOCK() mtx_lock(&nfsrv_dwrpclock_mtx) +#defineNFSDWRPCUNLOCK()mtx_unlock(&nfsrv_dwrpclock_mtx) +#defineNFSDSRPCLOCKMUTEXPTR(&nfsrv_dsrpclock_mtx) +#defineNFSDSRPCLOCK() mtx_lock(&nfsrv_dsrpclock_mtx) +#defineNFSDSRPCUNLOCK()mtx_unlock(&nfsrv_dsrpclock_mtx) +#defineNFSDARPCLOCKMUTEXPTR(&nfsrv_darpclock_mtx) +#defineNFSDARPCLOCK() mtx_lock(&nfsrv_darpclock_mtx) +#defineNFSDARPCUNLOCK()mtx_unlock(&nfsrv_darpclock_mtx) /* * Use these macros to initialize/free a mutex. ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r326731 - head/sys/ufs/ffs
On 09/12/2017 17:44, Mark Johnston wrote: > Some GEOMs do not appear to handle BIO_ORDERED correctly, meaning that the Nitpick: this should be "geoms" or, even better, "GEOM classes" :-) > barrier write may not work as intended. Could the loss of BIO_ORDERED in g_duplicate_bio() contribute to the problem with those GEOM classes? -- Andriy Gapon ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r326734 - head/share/man/man5
Author: karels Date: Sat Dec 9 17:27:36 2017 New Revision: 326734 URL: https://svnweb.freebsd.org/changeset/base/326734 Log: gifconfig_gif0 no longer works, document replacement rc.conf(5) documents the gifconfig_ keyword, which is no longer implemented. Document the replacement, which works with cloned_interfaces as well. Reviewed by: dab Group Reviwers: manpages MFC after:3 days Differential Revision:https://reviews.freebsd.org/D13130 Modified: head/share/man/man5/rc.conf.5 Modified: head/share/man/man5/rc.conf.5 == --- head/share/man/man5/rc.conf.5 Sat Dec 9 15:59:10 2017 (r326733) +++ head/share/man/man5/rc.conf.5 Sat Dec 9 17:27:36 2017 (r326734) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 24, 2017 +.Dd December 9, 2017 .Dt RC.CONF 5 .Os .Sh NAME @@ -1816,21 +1816,40 @@ This variable is deprecated in favor of Set to the list of .Xr gif 4 tunnel interfaces to configure on this host. -A -.Va gifconfig_ Ns Aq Ar interface -variable is assumed to exist for each value of -.Ar interface . +For each +.Xr gif +tunnel interface, set a variable named +.Va ifconfig_ Ns Aq Ar interface +with the parameters for the +.Xr ifconfig 8 +command to configure the link level for +.Ar interface +with the +.Cm tunnel +option. The value of this variable is used to configure the link layer of the -tunnel according to the syntax of the +tunnel using the .Cm tunnel option to -.Xr ifconfig 8 . +.Xr ifconfig . +For example, configure two +.Xr gif +interfaces with: +.Bd -literal -offset indent +gif_interfaces="gif0 gif1" +ifconfig_gif0="tunnel src_addr0 dst_addr0" +ifconfig_gif1="tunnel src_addr1 dst_addr1" +.Ed +.Pp Additionally, this option ensures that each listed interface is created via the .Cm create option to -.Xr ifconfig 8 -before attempting to configure it. +.Xr ifconfig . +This example also works with +.Va cloned_interfaces +instead of +.Va gif_interfaces . .It Va sppp_interfaces .Pq Vt str Set to the list of ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r326614 - in head: etc/mtree usr.bin usr.bin/sponge usr.bin/tee
That isn't what was asked for. Conrad On Sat, Dec 9, 2017 at 12:22 AM, Eitan Adler wrote: > On 8 December 2017 at 20:23, Conrad Meyer wrote: >> On Fri, Dec 8, 2017 at 6:07 PM, Eitan Adler wrote: >> Great. Please re-apply the change with something like that in the >> commit message, when you get a chance. It shouldn't take more than a >> minute or two. > > r326729 > > Once again, sorry about the noise. > > > > -- > Eitan Adler > Source, Ports, Doc committer > Bugmeister, Ports Security teams ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r326733 - head/usr.sbin/acpi/acpiconf
Author: zeising (doc,ports committer) Date: Sat Dec 9 15:59:10 2017 New Revision: 326733 URL: https://svnweb.freebsd.org/changeset/base/326733 Log: Improve options and error handling. Improve options handling and error out if multiple mutually exclusive options are passed to acpiconf. Switch from using atoi() to strtol() for argument parsing, and add error checking and handling, instead of blindly trusting that the integer conversion is OK. Cange err() to errx() in once case, the errno value was garbage there. Reviewed by: emaste Approved by: emaste Differential Revision:D13430 Modified: head/usr.sbin/acpi/acpiconf/acpiconf.c Modified: head/usr.sbin/acpi/acpiconf/acpiconf.c == --- head/usr.sbin/acpi/acpiconf/acpiconf.c Sat Dec 9 15:47:26 2017 (r326732) +++ head/usr.sbin/acpi/acpiconf/acpiconf.c Sat Dec 9 15:59:10 2017 (r326733) @@ -92,7 +92,7 @@ acpi_battinfo(int num) uint32_t volt; if (num < 0 || num > 64) - err(EX_USAGE, "invalid battery %d", num); + errx(EX_USAGE, "invalid battery %d", num); /* Print battery design information. */ battio.unit = num; @@ -205,8 +205,9 @@ usage(const char* prog) int main(int argc, char *argv[]) { - char*prog; - int c, sleep_type; + char*prog, *end; + int c, sleep_type, battery, ack; + int iflag = 0, kflag = 0, sflag = 0; prog = argv[0]; if (argc < 2) @@ -218,16 +219,24 @@ main(int argc, char *argv[]) while ((c = getopt(argc, argv, "hi:k:s:")) != -1) { switch (c) { case 'i': - acpi_battinfo(atoi(optarg)); + iflag = 1; + battery = strtol(optarg, &end, 10); + if ((size_t)(end - optarg) != strlen(optarg)) + errx(EX_USAGE, "invalid battery"); break; case 'k': - acpi_sleep_ack(atoi(optarg)); + kflag = 1; + ack = strtol(optarg, &end, 10); + if ((size_t)(end - optarg) != strlen(optarg)) + errx(EX_USAGE, "invalid ack argument"); break; case 's': + sflag = 1; if (optarg[0] == 'S') - sleep_type = optarg[1] - '0'; - else - sleep_type = optarg[0] - '0'; + optarg++; + sleep_type = strtol(optarg, &end, 10); + if ((size_t)(end - optarg) != strlen(optarg)) + errx(EX_USAGE, "invalid sleep type"); if (sleep_type < 1 || sleep_type > 4) errx(EX_USAGE, "invalid sleep type (%d)", sleep_type); @@ -241,7 +250,25 @@ main(int argc, char *argv[]) argc -= optind; argv += optind; - if (sleep_type != -1) + if (iflag != 0 && kflag != 0 && sflag != 0) + errx(EX_USAGE, "-i, -k and -s are mutually exclusive"); + + if (iflag != 0) { + if (kflag != 0) + errx(EX_USAGE, "-i and -k are mutually exclusive"); + if (sflag != 0) + errx(EX_USAGE, "-i and -s are mutually exclusive"); + acpi_battinfo(battery); + } + + if (kflag != 0) { + if (sflag != 0) + errx(EX_USAGE, "-k and -s are mutually exclusive"); + acpi_sleep_ack(ack); + } + + + if (sflag != 0) acpi_sleep(sleep_type); close(acpifd); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r326732 - head/sys/vm
Author: markj Date: Sat Dec 9 15:47:26 2017 New Revision: 326732 URL: https://svnweb.freebsd.org/changeset/base/326732 Log: Fix the act_scan_laundry_weight mechanism. r292392 modified the active queue scan to weigh clean pages differently from dirty pages when attempting to meet the inactive queue target. When r306706 was merged into the PQ_LAUNDRY branch, this mechanism was broken. Fix it by scalaing the correct page shortage variable. Reviewed by: alc, kib MFC after:1 week Differential Revision:https://reviews.freebsd.org/D13423 Modified: head/sys/vm/vm_pageout.c Modified: head/sys/vm/vm_pageout.c == --- head/sys/vm/vm_pageout.cSat Dec 9 15:44:30 2017(r326731) +++ head/sys/vm/vm_pageout.cSat Dec 9 15:47:26 2017(r326732) @@ -1393,7 +1393,7 @@ drop_page: inactq_shortage = vm_cnt.v_inactive_target - (vm_cnt.v_inactive_count + vm_cnt.v_laundry_count / act_scan_laundry_weight) + vm_paging_target() + deficit + addl_page_shortage; - page_shortage *= act_scan_laundry_weight; + inactq_shortage *= act_scan_laundry_weight; pq = &vmd->vmd_pagequeues[PQ_ACTIVE]; vm_pagequeue_lock(pq); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r326731 - head/sys/ufs/ffs
Author: markj Date: Sat Dec 9 15:44:30 2017 New Revision: 326731 URL: https://svnweb.freebsd.org/changeset/base/326731 Log: Provide a sysctl to force synchronous initialization of inode blocks. FFS performs asynchronous inode initialization, using a barrier write to ensure that the inode block is written before the corresponding cylinder group header update. Some GEOMs do not appear to handle BIO_ORDERED correctly, meaning that the barrier write may not work as intended. The sysctl allows one to work around this problem at the cost of expensive file creation on new filesystems. The default behaviour is unchanged. Reviewed by: kib, mckusick MFC after:1 weeks Sponsored by: Dell EMC Isilon Differential Revision:https://reviews.freebsd.org/D13428 Modified: head/sys/ufs/ffs/ffs_alloc.c Modified: head/sys/ufs/ffs/ffs_alloc.c == --- head/sys/ufs/ffs/ffs_alloc.cSat Dec 9 15:34:40 2017 (r326730) +++ head/sys/ufs/ffs/ffs_alloc.cSat Dec 9 15:44:30 2017 (r326731) @@ -1958,6 +1958,16 @@ getinobuf(struct inode *ip, u_int cg, u_int32_t cginob } /* + * Synchronous inode initialization is needed only when barrier writes do not + * work as advertised, and will impose a heavy cost on file creation in a newly + * created filesystem. + */ +static int doasyncinodeinit = 1; +SYSCTL_INT(_vfs_ffs, OID_AUTO, doasyncinodeinit, CTLFLAG_RWTUN, +&doasyncinodeinit, 0, +"Perform inode block initialization using asynchronous writes"); + +/* * Determine whether an inode can be allocated. * * Check to see if an inode is available, and if it is, @@ -2065,6 +2075,7 @@ gotit: dp2->di_gen = arc4random(); dp2++; } + /* * Rather than adding a soft updates dependency to ensure * that the new inode block is written before it is claimed @@ -2074,7 +2085,10 @@ gotit: * written. The barrier write should only slow down bulk * loading of newly created filesystems. */ - babarrierwrite(ibp); + if (doasyncinodeinit) + babarrierwrite(ibp); + else + bwrite(ibp); /* * After the inode block is written, try to update the ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r326730 - head/sys/dev/iscsi
Author: trasz Date: Sat Dec 9 15:34:40 2017 New Revision: 326730 URL: https://svnweb.freebsd.org/changeset/base/326730 Log: Move the DIAGNOSTIC check for lost iSCSI PDUs from icl_conn_close() to icl_conn_free(). It's perfectly valid for the counter to be non-zero in the former. MFC after:2 weeks Sponsored by: playkey.net Modified: head/sys/dev/iscsi/icl_soft.c Modified: head/sys/dev/iscsi/icl_soft.c == --- head/sys/dev/iscsi/icl_soft.c Sat Dec 9 08:21:29 2017 (r326729) +++ head/sys/dev/iscsi/icl_soft.c Sat Dec 9 15:34:40 2017 (r326730) @@ -1170,6 +1170,11 @@ void icl_soft_conn_free(struct icl_conn *ic) { +#ifdef DIAGNOSTIC + KASSERT(ic->ic_outstanding_pdus == 0, + ("destroying session with %d outstanding PDUs", +ic->ic_outstanding_pdus)); +#endif cv_destroy(&ic->ic_send_cv); cv_destroy(&ic->ic_receive_cv); kobj_delete((struct kobj *)ic, M_ICL_SOFT); @@ -1410,11 +1415,6 @@ icl_soft_conn_close(struct icl_conn *ic) KASSERT(STAILQ_EMPTY(&ic->ic_to_send), ("destroying session with non-empty send queue")); -#ifdef DIAGNOSTIC - KASSERT(ic->ic_outstanding_pdus == 0, - ("destroying session with %d outstanding PDUs", -ic->ic_outstanding_pdus)); -#endif ICL_CONN_UNLOCK(ic); } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r326729 - head
[ Charset UTF-8 unsupported, converting... ] > Author: eadler > Date: Sat Dec 9 08:21:29 2017 > New Revision: 326729 > URL: https://svnweb.freebsd.org/changeset/base/326729 > > Log: > arc lint: Explain linting explain > > shell scripts in scripts don't need > to be chmod +x to work. In fact most are not. > Of the tests I found from a simple search: > 65 are chmod +x > 84 are chmod -x > > simply disable the check for test shell scripts. > > Modified: > head/.arclint > > Modified: head/.arclint > == > --- head/.arclint Sat Dec 9 07:44:00 2017(r326728) > +++ head/.arclint Sat Dec 9 08:21:29 2017(r326729) > @@ -24,3 +24,4 @@ > } >} > } > + This is not how you revert and commit a correct log fix, the log yet again does not match the commit. Please, revert this and revert the other and apply the log with the diff so that things match correctly. -- Rod Grimes rgri...@freebsd.org ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r326614 - in head: etc/mtree usr.bin usr.bin/sponge usr.bin/tee
On 8 December 2017 at 20:23, Conrad Meyer wrote: > On Fri, Dec 8, 2017 at 6:07 PM, Eitan Adler wrote: > Great. Please re-apply the change with something like that in the > commit message, when you get a chance. It shouldn't take more than a > minute or two. r326729 Once again, sorry about the noise. -- Eitan Adler Source, Ports, Doc committer Bugmeister, Ports Security teams ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r326729 - head
Author: eadler Date: Sat Dec 9 08:21:29 2017 New Revision: 326729 URL: https://svnweb.freebsd.org/changeset/base/326729 Log: arc lint: Explain linting explain shell scripts in scripts don't need to be chmod +x to work. In fact most are not. Of the tests I found from a simple search: 65 are chmod +x 84 are chmod -x simply disable the check for test shell scripts. Modified: head/.arclint Modified: head/.arclint == --- head/.arclint Sat Dec 9 07:44:00 2017(r326728) +++ head/.arclint Sat Dec 9 08:21:29 2017(r326729) @@ -24,3 +24,4 @@ } } } + ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"