svn commit: r322964 - head/sys/dev/cxgbe
Author: np Date: Mon Aug 28 07:50:54 2017 New Revision: 322964 URL: https://svnweb.freebsd.org/changeset/base/322964 Log: cxgbe(4): vi_mac_funcs should include the base Ethernet function. It is already used in the driver as if it does. MFC after:3 days Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/t4_main.c Modified: head/sys/dev/cxgbe/t4_main.c == --- head/sys/dev/cxgbe/t4_main.cMon Aug 28 06:17:04 2017 (r322963) +++ head/sys/dev/cxgbe/t4_main.cMon Aug 28 07:50:54 2017 (r322964) @@ -467,8 +467,9 @@ TUNABLE_INT("hw.cxl.write_combine", &t5_write_combine) static int t4_num_vis = 1; TUNABLE_INT("hw.cxgbe.num_vis", &t4_num_vis); -/* Functions used by extra VIs to obtain unique MAC addresses for each VI. */ +/* Functions used by VIs to obtain unique MAC addresses for each VI. */ static int vi_mac_funcs[] = { + FW_VI_FUNC_ETH, FW_VI_FUNC_OFLD, FW_VI_FUNC_IWARP, FW_VI_FUNC_OPENISCSI, @@ -2146,6 +2147,7 @@ vcxgbe_attach(device_t dev) sc = pi->adapter; index = vi - pi->vi; + MPASS(index > 0); /* This function deals with _extra_ VIs only */ KASSERT(index < nitems(vi_mac_funcs), ("%s: VI %s doesn't have a MAC func", __func__, device_get_nameunit(dev))); ___ 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: r322875 - head/sys/dev/nvme
On 2017-Aug-27, at 11:54 PM, Ed Schouten wrote: > 2017-08-25 14:53 GMT+02:00 Ed Schouten : >> 2017-08-25 9:46 GMT+02:00 Mark Millard : >>> It appears that at least 11.1-STABLE -r322807 does not handle >>> -std=c++98 styles of use of _Static_assert for g++7 in that >>> g++7 reports an error: >> >> Maybe we need to do something like this? >> >> Index: sys/sys/cdefs.h >> === >> --- sys/sys/cdefs.h (revision 322887) >> +++ sys/sys/cdefs.h (working copy) >> @@ -294,7 +294,7 @@ >> #if (defined(__cplusplus) && __cplusplus >= 201103L) || \ >> __has_extension(cxx_static_assert) >> #define _Static_assert(x, y) static_assert(x, y) >> -#elif __GNUC_PREREQ__(4,6) >> +#elif __GNUC_PREREQ__(4,6) && !defined(__cplusplus) >> /* Nothing, gcc 4.6 and higher has _Static_assert built-in */ >> #elif defined(__COUNTER__) >> #define _Static_assert(x, y) __Static_assert(x, __COUNTER__) > > Could you let me know whether this patch fixes the build for you? If > so, I'll commit it! As a variant of stable/11 -r322807 . . . buildworld and buildkernel seem to work fine. (I did not try any port [re-]builds.) Based on the same main.cc as before . . . g++7 -std=c++98 main.cc g++7 -Wpedantic -std=c++98 main.cc g++7 -std=c++03 main.cc g++7 -Wpedantic -std=c++03 main.cc no longer complain (so no error, no warning). clang++ -Wpedantic -std=c++11 main.cc clang++ -Wpedantic -std=c++98 main.cc clang++ -Wpedantic -std=c++03 main.cc each still give the warning but no error. g++7 -Wpedantic -std=c++11 main.cc g++7 -std=c++11 main.cc clang++ -std=c++11 main.cc clang++ -std=c++98 main.cc clang++ -std=c++03 main.cc are still silent, no errors, no warnings. Note that clang here is version 4 --the same as in my original report that had the g++7 rejection example. This is because of the stable/11 context that I used. (An intended MFC had been listed.) If needed I could probably try under some version of head (and so test clang version 5). === Mark Millard markmi at dsl-only.net ___ 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: r322965 - head/sys/sys
Author: ed Date: Mon Aug 28 09:35:17 2017 New Revision: 322965 URL: https://svnweb.freebsd.org/changeset/base/322965 Log: Make _Static_assert() work with GCC in older C++ standards. GCC only activates C11 keywords in C mode, not C++ mode. This means that when targeting an older C++ standard, we cannot fall back to using _Static_assert(). In this case, do define _Static_assert() as a macro that uses a typedef'ed array. Discussed in: r322875 commit thread Reported by: Mark MIllard MFC after:1 month Modified: head/sys/sys/cdefs.h Modified: head/sys/sys/cdefs.h == --- head/sys/sys/cdefs.hMon Aug 28 07:50:54 2017(r322964) +++ head/sys/sys/cdefs.hMon Aug 28 09:35:17 2017(r322965) @@ -294,7 +294,7 @@ #if (defined(__cplusplus) && __cplusplus >= 201103L) || \ __has_extension(cxx_static_assert) #define_Static_assert(x, y)static_assert(x, y) -#elif __GNUC_PREREQ__(4,6) +#elif __GNUC_PREREQ__(4,6) && !defined(__cplusplus) /* Nothing, gcc 4.6 and higher has _Static_assert built-in */ #elif defined(__COUNTER__) #define_Static_assert(x, y)__Static_assert(x, __COUNTER__) ___ 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: r322875 - head/sys/dev/nvme
2017-08-28 11:02 GMT+02:00 Mark Millard : > Based on the same main.cc as before . . . > > g++7 -std=c++98 main.cc > g++7 -Wpedantic -std=c++98 main.cc > g++7 -std=c++03 main.cc > g++7 -Wpedantic -std=c++03 main.cc > > no longer complain (so no error, no > warning). Perfect! I've committed this change as r322965. Thanks for testing! -- Ed Schouten Nuxi, 's-Hertogenbosch, the Netherlands KvK-nr.: 62051717 ___ 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: r322967 - head/sys/netinet
Author: tuexen Date: Mon Aug 28 11:41:18 2017 New Revision: 322967 URL: https://svnweb.freebsd.org/changeset/base/322967 Log: Fix blackhole detection. There were two bugs related to the blackhole detection: * The smalles size was tried more than two times. * The restored MSS was not the original one, but the second candidate. MFC after:1 week Sponsored by: Netflix, Inc. Modified: head/sys/netinet/tcp_timer.c Modified: head/sys/netinet/tcp_timer.c == --- head/sys/netinet/tcp_timer.cMon Aug 28 10:02:47 2017 (r322966) +++ head/sys/netinet/tcp_timer.cMon Aug 28 11:41:18 2017 (r322967) @@ -726,19 +726,21 @@ tcp_timer_rexmt(void * xtp) */ if (((tp->t_flags2 & (TF2_PLPMTU_PMTUD|TF2_PLPMTU_MAXSEGSNT)) == (TF2_PLPMTU_PMTUD|TF2_PLPMTU_MAXSEGSNT)) && - (tp->t_rxtshift >= 2 && tp->t_rxtshift % 2 == 0)) { + (tp->t_rxtshift >= 2 && tp->t_rxtshift < 6 && + tp->t_rxtshift % 2 == 0)) { /* * Enter Path MTU Black-hole Detection mechanism: * - Disable Path MTU Discovery (IP "DF" bit). * - Reduce MTU to lower value than what we * negotiated with peer. */ - /* Record that we may have found a black hole. */ - tp->t_flags2 |= TF2_PLPMTU_BLACKHOLE; + if ((tp->t_flags2 & TF2_PLPMTU_BLACKHOLE) == 0) { + /* Record that we may have found a black hole. */ + tp->t_flags2 |= TF2_PLPMTU_BLACKHOLE; + /* Keep track of previous MSS. */ + tp->t_pmtud_saved_maxseg = tp->t_maxseg; + } - /* Keep track of previous MSS. */ - tp->t_pmtud_saved_maxseg = tp->t_maxseg; - /* * Reduce the MSS to blackhole value or to the default * in an attempt to retransmit. @@ -796,7 +798,7 @@ tcp_timer_rexmt(void * xtp) * stage (1448, 1188, 524) 2 chances to recover. */ if ((tp->t_flags2 & TF2_PLPMTU_BLACKHOLE) && - (tp->t_rxtshift > 6)) { + (tp->t_rxtshift >= 6)) { tp->t_flags2 |= TF2_PLPMTU_PMTUD; tp->t_flags2 &= ~TF2_PLPMTU_BLACKHOLE; tp->t_maxseg = tp->t_pmtud_saved_maxseg; ___ 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: r322968 - head/release/tools
Author: gjb Date: Mon Aug 28 14:49:26 2017 New Revision: 322968 URL: https://svnweb.freebsd.org/changeset/base/322968 Log: Increase the Amazon EC2 AMI image size from 2GB to 3GB to prevent image build failures due to a full md(4)-backed filesystem. Sponsored by: The FreeBSD Foundation Modified: head/release/tools/ec2.conf Modified: head/release/tools/ec2.conf == --- head/release/tools/ec2.conf Mon Aug 28 11:41:18 2017(r322967) +++ head/release/tools/ec2.conf Mon Aug 28 14:49:26 2017(r322968) @@ -11,12 +11,12 @@ export VM_EXTRA_PACKAGES="ec2-scripts firstboot-freebs # Set to a list of third-party software to enable in rc.conf(5). export VM_RC_LIST="ec2_configinit ec2_fetchkey ec2_ephemeralswap ec2_loghostkey firstboot_freebsd_update firstboot_pkgs" -# Build with a 2 GB UFS partition; the growfs rc.d script will expand +# Build with a 3 GB UFS partition; the growfs rc.d script will expand # the partition to fill the root disk after the EC2 instance is launched. # Note that if this is set to G, we will end up with an GB disk # image since VMSIZE is the size of the UFS partition, not the disk which # it resides within. -export VMSIZE=2048M +export VMSIZE=3072M # No swap space; the ec2_ephemeralswap rc.d script will allocate swap # space on EC2 ephemeral disks. (If they exist -- the T2 low-cost instances ___ 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: r322969 - in head: sbin/mdconfig sys/dev/md sys/sys
Author: sobomax Date: Mon Aug 28 15:54:07 2017 New Revision: 322969 URL: https://svnweb.freebsd.org/changeset/base/322969 Log: Add ability to label md(4) devices. This feature comes from the fact that we rely memory-backed md(4) in our build process heavily. However, if the build goes haywire the allocated resources (i.e. swap and memory-backed md(4)'s) need to be purged. It is extremely useful to have ability to attach arbitrary labels to each of the virtual disks so that they can be identified and GC'ed if neecessary. MFC after:4 weeks Differential Revision:https://reviews.freebsd.org/D10457 Modified: head/sbin/mdconfig/mdconfig.8 head/sbin/mdconfig/mdconfig.c head/sys/dev/md/md.c head/sys/sys/mdioctl.h Modified: head/sbin/mdconfig/mdconfig.8 == --- head/sbin/mdconfig/mdconfig.8 Mon Aug 28 14:49:26 2017 (r322968) +++ head/sbin/mdconfig/mdconfig.8 Mon Aug 28 15:54:07 2017 (r322969) @@ -37,7 +37,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 10, 2015 +.Dd August 28, 2017 .Dt MDCONFIG 8 .Os .Sh NAME @@ -55,6 +55,7 @@ .Op Fl u Ar unit .Op Fl x Ar sectors/track .Op Fl y Ar heads/cylinder +.Op Fl L Ar label .Nm .Fl d .Fl u Ar unit @@ -189,6 +190,12 @@ and options can be used to specify a synthetic geometry. This is useful for constructing bootable images for later download to other devices. +.It Fl L Ar label +Associate a label (arbitrary string) with the new memory disk. +The label can then be inspected with +.Bd -literal -offset indent +.Nm Fl l v +.Ed .It Fl o Oo Cm no Oc Ns Ar option Set or reset options. .Bl -tag -width indent Modified: head/sbin/mdconfig/mdconfig.c == --- head/sbin/mdconfig/mdconfig.c Mon Aug 28 14:49:26 2017 (r322968) +++ head/sbin/mdconfig/mdconfig.c Mon Aug 28 15:54:07 2017 (r322969) @@ -79,7 +79,7 @@ usage(void) fprintf(stderr, "usage: mdconfig -a -t type [-n] [-o [no]option] ... [-f file]\n" -"[-s size] [-S sectorsize] [-u unit]\n" +"[-s size] [-S sectorsize] [-u unit] [-L label]\n" "[-x sectors/track] [-y heads/cylinder]\n" " mdconfig -d -u unit [-o [no]force]\n" " mdconfig -r -u unit -s size [-o [no]force]\n" @@ -102,15 +102,17 @@ main(int argc, char **argv) bzero(&mdio, sizeof(mdio)); mdio.md_file = malloc(PATH_MAX); - if (mdio.md_file == NULL) + mdio.md_label = malloc(PATH_MAX); + if (mdio.md_file == NULL || mdio.md_label == NULL) err(1, "could not allocate memory"); vflag = 0; bzero(mdio.md_file, PATH_MAX); + bzero(mdio.md_label, PATH_MAX); if (argc == 1) usage(); - while ((ch = getopt(argc, argv, "ab:df:lno:rs:S:t:u:vx:y:")) != -1) { + while ((ch = getopt(argc, argv, "ab:df:lno:rs:S:t:u:vx:y:L:")) != -1) { switch (ch) { case 'a': if (action != UNSET && action != ATTACH) @@ -243,6 +245,9 @@ main(int argc, char **argv) case 'y': mdio.md_fwheads = strtoul(optarg, &p, 0); break; + case 'L': + strlcpy(mdio.md_label, optarg, PATH_MAX); + break; default: usage(); } @@ -422,7 +427,8 @@ md_list(const char *units, int opt, const char *fflag) struct gclass *gcl; void *sq; int retcode, ffound, ufound; - char *type, *file, *length; + char *length; + const char *type, *file, *label; type = file = length = NULL; @@ -477,10 +483,14 @@ md_list(const char *units, int opt, const char *fflag) printf("\t%s\t", type); if (length != NULL) md_prthumanval(length); - if (file != NULL) { - printf("\t%s", file); - file = NULL; - } + if (file == NULL) + file = "-"; + printf("\t%s", file); + file = NULL; + label = geom_config_get(gc, "label"); + if (label == NULL) + label = ""; + printf("\t%s", label); } opt |= OPT_DONE; if ((opt & OPT_LIST) && !(opt & OPT_VERBOSE)) Modified: head/sys/dev/md/md.c == --- head/sys/dev/md/md.cMon Aug 28 14:
Re: svn commit: r322969 - in head: sbin/mdconfig sys/dev/md sys/sys
On Monday, August 28, 2017 03:54:08 PM Maxim Sobolev wrote: > Author: sobomax > Date: Mon Aug 28 15:54:07 2017 > New Revision: 322969 > URL: https://svnweb.freebsd.org/changeset/base/322969 > > Log: > Add ability to label md(4) devices. > > This feature comes from the fact that we rely memory-backed md(4) > in our build process heavily. However, if the build goes haywire > the allocated resources (i.e. swap and memory-backed md(4)'s) need > to be purged. It is extremely useful to have ability to attach > arbitrary labels to each of the virtual disks so that they can > be identified and GC'ed if neecessary. > > MFC after: 4 weeks > Differential Revision: https://reviews.freebsd.org/D10457 > > Modified: > head/sbin/mdconfig/mdconfig.8 > head/sbin/mdconfig/mdconfig.c > head/sys/dev/md/md.c > head/sys/sys/mdioctl.h > > Modified: head/sys/sys/mdioctl.h > == > --- head/sys/sys/mdioctl.hMon Aug 28 14:49:26 2017(r322968) > +++ head/sys/sys/mdioctl.hMon Aug 28 15:54:07 2017(r322969) > @@ -49,7 +49,7 @@ enum md_types {MD_MALLOC, MD_PRELOAD, MD_VNODE, MD_SWA > * Ioctl definitions for memory disk pseudo-device. > */ > > -#define MDNPAD 97 > +#define MDNPAD 96 > struct md_ioctl { > unsignedmd_version; /* Structure layout version */ > unsignedmd_unit;/* unit number */ > @@ -61,6 +61,7 @@ struct md_ioctl { > u_int64_t md_base;/* base address */ > int md_fwheads; /* firmware heads */ > int md_fwsectors; /* firmware sectors */ > + char*md_label; /* label of the device */ > int md_pad[MDNPAD]; /* padding for future ideas */ > }; This isn't correct on 64-bit platforms. MDNPAD needs to be 95 on those platforms. It would be really neat if one could use the label more pervasively. For example, it would be nice to do something like this: # mdconfig -a -t malloc -s 16M -L foo # newfs /dev/md/foo # mdconfig -d -L foo This would mean that labelled memory disks would not create /dev/mdX entries, but would instead create /dev/md/ nodes. The labels would also be exclusive (so only one /dev/md/foo can exist at a time). WDYT? -- John Baldwin ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r322970 - head/sys/vm
Author: alc Date: Mon Aug 28 16:55:43 2017 New Revision: 322970 URL: https://svnweb.freebsd.org/changeset/base/322970 Log: Switching from a global hash table to per-vm_object radix tries for mapping vm_object page indices to on-disk swap space (r322913) has changed the synchronization requirements for a couple swap pager functions. Whereas before a read lock on the vm object sufficed because of the global mutex on the hash table, a write lock on the vm object may now be required. In particular, calls to vm_pager_page_unswapped() now require a write lock on the vm_object. Consequently, vm_fault()'s fast path cannot call vm_pager_page_unswapped(). The swap space will have to be released at a later point. Reviewed by: kib, markj X-MFC with: r322913 Differential Revision:https://reviews.freebsd.org/D12134 Modified: head/sys/vm/vm_fault.c Modified: head/sys/vm/vm_fault.c == --- head/sys/vm/vm_fault.c Mon Aug 28 15:54:07 2017(r322969) +++ head/sys/vm/vm_fault.c Mon Aug 28 16:55:43 2017(r322970) @@ -236,14 +236,15 @@ vm_fault_dirty(vm_map_entry_t entry, vm_page_t m, vm_p * written NOW so dirty it explicitly to save on * pmap_is_modified() calls later. * -* Also tell the backing pager, if any, that it should remove -* any swap backing since the page is now dirty. +* Also, since the page is now dirty, we can possibly tell +* the pager to release any swap backing the page. Calling +* the pager requires a write lock on the object. */ if (need_dirty) vm_page_dirty(m); if (!set_wd) vm_page_unlock(m); - if (need_dirty) + else if (need_dirty) vm_pager_page_unswapped(m); } ___ 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: r322971 - head/sys/vm
Author: alc Date: Mon Aug 28 17:02:25 2017 New Revision: 322971 URL: https://svnweb.freebsd.org/changeset/base/322971 Log: Update a couple vm_object lock assertions in the swap pager to reflect the new use of the vm_object's lock to synchronize updates to a radix trie mapping per-vm object page indices to on-disk swap blocks. Fix a typo in a nearby comment. Reviewed by: kib, markj X-MFC with: r322913 Differential Revision:https://reviews.freebsd.org/D12134 Modified: head/sys/vm/swap_pager.c Modified: head/sys/vm/swap_pager.c == --- head/sys/vm/swap_pager.cMon Aug 28 16:55:43 2017(r322970) +++ head/sys/vm/swap_pager.cMon Aug 28 17:02:25 2017(r322971) @@ -1827,7 +1827,7 @@ swp_pager_meta_free(vm_object_t object, vm_pindex_t pi int i; bool empty; - VM_OBJECT_ASSERT_LOCKED(object); + VM_OBJECT_ASSERT_WLOCKED(object); if (object->type != OBJT_SWAP || count == 0) return; @@ -1909,9 +1909,13 @@ swp_pager_meta_ctl(vm_object_t object, vm_pindex_t pin daddr_t r1; int i; - VM_OBJECT_ASSERT_LOCKED(object); + if ((flags & (SWM_FREE | SWM_POP)) != 0) + VM_OBJECT_ASSERT_WLOCKED(object); + else + VM_OBJECT_ASSERT_LOCKED(object); + /* -* The meta data only exists of the object is OBJT_SWAP +* The meta data only exists if the object is OBJT_SWAP * and even then might not be allocated yet. */ if (object->type != OBJT_SWAP) ___ 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: r322258 - head/sys/kern
On Fri, Aug 25, 2017 at 9:00 PM, Bruce Evans wrote: > On Thu, 24 Aug 2017, Alan Somers wrote: > >> On Wed, Aug 9, 2017 at 1:05 AM, Bruce Evans wrote: >>> >>> On Tue, 8 Aug 2017, Alan Somers wrote: >>> ... >>> The compile-time definition of AIO_LISTIO_MAX seems to be broken. I >>> think >>> POSIX species that AIO_LISTIO_MAX shall not be defined if the value of >>> {AIO_LISTIO_MAX} varies at runtime, but it is still defined. FreeBSD >>> has this bug for many other sysconf() variables, e.g., {OPEN_MAX}. >>> Perhaps AIO_LISTIO_MAX is easier to fix since it is not hard-coded as >>> often as OPEN_MAX. >> >> >> What you describe is Linux's behavior, but the POSIX requirement is a >> bit more general. All POSIX says is that "The value returned [by >> sysconf(3)] shall not be more restrictive than the corresponding value >> described to the application when it was compiled with the >> implementation's or ". > > > No, I described the POSIX requirement. See the section on limits.h. It > says that > - {AIO_LISTIO_MAX} is a runtime invariant (so sysctls that change it are > not POSIX conformant) > - for all runtime invariant limits, the definition shall be omitted from >if it is unspecified (sic). This indetermination (sic) > might depend on the memory size. [That was not a direct quote > except for the sic words. POSIX says "indeterminate" in both places > in the 1990 and 1996 versions, but this is broken in the 2001 and 2006 > versions.] > So defining AIO_LISTIO_MAX in is not conformant if you change > it before runtime using something like a tunable. > > You quoted the section for sysconf(3). The wording there is too generic. > It covers both runtime increasable and runtime invariant limits. It > only really applies to the runtime increasable limits. For the runtime > invariant, limits it only applies vacuously. The section on > disallows defining runtime invariant limits unless they are known at > compile time. If they would be different at runtime, then they were not > known at comple time, so must not be defined then, and the requirement > that the runtime limits are larger is vacuously satisfied. > > There aren't many runtime increasable limits, and at least in the 2006 > version, only {OPEN_MAX} is allowed to vary within a process's lifetime. > {OPEN_MAX} can be decreased in practice and the 2006 version doesn't > disallow this provided OPEN_MAX is not defined in (then > {OPEN_MAX} must be a compile-time invariant). When it is not defined, > the requirement to only increase it is vacuously satisfied, so only > the special requirement for {OPEN_MAX} applies. This allows changing > it using setrlimit(). The direction of the change is not limited to > an increase, but many more paragraphs are needed to speciy what happens > when it does decrease (open files above the limit stay open, but > obviously you can't use the current limit to limit the search for these > files...). > >> ... > > >> I dug deeper and found that there wasn't any good reason for the >> aio_listio_max limit to exist in the first place. This DR eliminates >> it, which I think will satisfy most of your concerns. >> https://reviews.freebsd.org/D12120 > > > This is inconvenient for me to review. Could you please try using Phabricator? It's great; I promise. It's also the project's designated code review tool. As one of our most prolific code reviewers, you really ought to start using it. It's useful for both precommit and postcommit review, and the workflow is much better than using email alone. > > Anything that removes the compile time limit is good. Except actually > removing it from would break any applications that use it. > Applications should use the minimum for the limit if they don't care, > else sysconf(). So you're happy to leave AIO_LISTIO_MAX in limits.h as if it were a runtime increasable limit? That provides the best compatibility for legacy applications. > > The 2006 version of POSIX says in its section about profiles that most > if its limits are inadequate (so profiles should change them). I > don't know the mechanism for this. Just omitting most compile-time > limits and increasing the sysconf() limits won't help for sloppy > applications. > > Bruce ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r322969 - in head: sbin/mdconfig sys/dev/md sys/sys
Hi John, Thanks for your feedback! To address the points that you've raised: 1. I've tested on both 32 and 64 bit platforms, it seems not to be the case. See imp's comment and my reply here https://reviews.freebsd.org/D10457#216855 . Did I miss something? Can you post piece of C code that produces different sizeof(struct old) vs. sizeof(struct new) on some platform? 2. I disagree with the suggested direction, we specifically devised those to be "labels" not names. I.e. arbitrary description that may or may not be unique across the group of devices. This way we label devices linked to the build #X as such and then can bulk deallocate them if the build is found to be dead. If there is a need for some expressive symbolical id to supplement mdX with proper mapping into the /dev/md/* space that would be a separate attribute ({name,devname,nodename}?) in my view completely orthogonal to this one. Could be a nice feature on its own though, no doubt about it. -Max On Mon, Aug 28, 2017 at 9:19 AM, John Baldwin wrote: > On Monday, August 28, 2017 03:54:08 PM Maxim Sobolev wrote: > > Author: sobomax > > Date: Mon Aug 28 15:54:07 2017 > > New Revision: 322969 > > URL: https://svnweb.freebsd.org/changeset/base/322969 > > > > Log: > > Add ability to label md(4) devices. > > > > This feature comes from the fact that we rely memory-backed md(4) > > in our build process heavily. However, if the build goes haywire > > the allocated resources (i.e. swap and memory-backed md(4)'s) need > > to be purged. It is extremely useful to have ability to attach > > arbitrary labels to each of the virtual disks so that they can > > be identified and GC'ed if neecessary. > > > > MFC after: 4 weeks > > Differential Revision: https://reviews.freebsd.org/D10457 > > > > Modified: > > head/sbin/mdconfig/mdconfig.8 > > head/sbin/mdconfig/mdconfig.c > > head/sys/dev/md/md.c > > head/sys/sys/mdioctl.h > > > > Modified: head/sys/sys/mdioctl.h > > > == > > --- head/sys/sys/mdioctl.hMon Aug 28 14:49:26 2017(r322968) > > +++ head/sys/sys/mdioctl.hMon Aug 28 15:54:07 2017(r322969) > > @@ -49,7 +49,7 @@ enum md_types {MD_MALLOC, MD_PRELOAD, MD_VNODE, MD_SWA > > * Ioctl definitions for memory disk pseudo-device. > > */ > > > > -#define MDNPAD 97 > > +#define MDNPAD 96 > > struct md_ioctl { > > unsignedmd_version; /* Structure layout version */ > > unsignedmd_unit;/* unit number */ > > @@ -61,6 +61,7 @@ struct md_ioctl { > > u_int64_t md_base;/* base address */ > > int md_fwheads; /* firmware heads */ > > int md_fwsectors; /* firmware sectors */ > > + char*md_label; /* label of the device */ > > int md_pad[MDNPAD]; /* padding for future ideas */ > > }; > > This isn't correct on 64-bit platforms. MDNPAD needs to be 95 on those > platforms. > > It would be really neat if one could use the label more pervasively. For > example, it would be nice to do something like this: > > # mdconfig -a -t malloc -s 16M -L foo > # newfs /dev/md/foo > # mdconfig -d -L foo > > This would mean that labelled memory disks would not create /dev/mdX > entries, but would instead create /dev/md/ nodes. The labels would > also be exclusive (so only one /dev/md/foo can exist at a time). WDYT? > > -- > John Baldwin > > ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r322978 - head/sys/kern
Author: bdrewery Date: Mon Aug 28 19:29:51 2017 New Revision: 322978 URL: https://svnweb.freebsd.org/changeset/base/322978 Log: Allow vdrop() of a vnode not yet on the per-mount list after r306512. The old code allowed calling vdrop() before insmntque() to place the vnode back onto the freelist for later recycling. Some downstream consumers may rely on this support. Normally insmntque() failing is fine since is uses vgone() and immediately frees the vnode rather than attempting to add it to the freelist if vdrop() were used instead. Also assert that vhold() cannot be used on such a vnode. Reviewed by: kib, cem, markj Sponsored by: Dell EMC Isilon Differential Revision:https://reviews.freebsd.org/D12126 Modified: head/sys/kern/vfs_subr.c Modified: head/sys/kern/vfs_subr.c == --- head/sys/kern/vfs_subr.cMon Aug 28 19:27:33 2017(r322977) +++ head/sys/kern/vfs_subr.cMon Aug 28 19:29:51 2017(r322978) @@ -2861,6 +2861,8 @@ _vhold(struct vnode *vp, bool locked) * Remove a vnode from the free list, mark it as in use, * and put it on the active list. */ + VNASSERT(vp->v_mount != NULL, vp, + ("_vhold: vnode not on per mount vnode list")); mp = vp->v_mount; mtx_lock(&mp->mnt_listmtx); if ((vp->v_mflag & VMP_TMPMNTFREELIST) != 0) { @@ -2935,21 +2937,35 @@ _vdrop(struct vnode *vp, bool locked) if ((vp->v_iflag & VI_OWEINACT) == 0) { vp->v_iflag &= ~VI_ACTIVE; mp = vp->v_mount; - mtx_lock(&mp->mnt_listmtx); - if (active) { - TAILQ_REMOVE(&mp->mnt_activevnodelist, vp, + if (mp != NULL) { + mtx_lock(&mp->mnt_listmtx); + if (active) { + TAILQ_REMOVE(&mp->mnt_activevnodelist, + vp, v_actfreelist); + mp->mnt_activevnodelistsize--; + } + TAILQ_INSERT_TAIL(&mp->mnt_tmpfreevnodelist, + vp, v_actfreelist); + mp->mnt_tmpfreevnodelistsize++; + vp->v_iflag |= VI_FREE; + vp->v_mflag |= VMP_TMPMNTFREELIST; + VI_UNLOCK(vp); + if (mp->mnt_tmpfreevnodelistsize >= + mnt_free_list_batch) + vnlru_return_batch_locked(mp); + mtx_unlock(&mp->mnt_listmtx); + } else { + VNASSERT(active == 0, vp, + ("vdropl: active vnode not on per mount " + "vnode list")); + mtx_lock(&vnode_free_list_mtx); + TAILQ_INSERT_TAIL(&vnode_free_list, vp, v_actfreelist); - mp->mnt_activevnodelistsize--; + freevnodes++; + vp->v_iflag |= VI_FREE; + VI_UNLOCK(vp); + mtx_unlock(&vnode_free_list_mtx); } - TAILQ_INSERT_TAIL(&mp->mnt_tmpfreevnodelist, vp, - v_actfreelist); - mp->mnt_tmpfreevnodelistsize++; - vp->v_iflag |= VI_FREE; - vp->v_mflag |= VMP_TMPMNTFREELIST; - VI_UNLOCK(vp); - if (mp->mnt_tmpfreevnodelistsize >= mnt_free_list_batch) - vnlru_return_batch_locked(mp); - mtx_unlock(&mp->mnt_listmtx); } else { VI_UNLOCK(vp); counter_u64_add(free_owe_inact, 1); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r322977 - in head/sys/cam: ata nvme
Author: imp Date: Mon Aug 28 19:27:33 2017 New Revision: 322977 URL: https://svnweb.freebsd.org/changeset/base/322977 Log: Add comment about where we need to place this routine, and why. Sponsored by: Netflix Modified: head/sys/cam/ata/ata_da.c head/sys/cam/nvme/nvme_da.c Modified: head/sys/cam/ata/ata_da.c == --- head/sys/cam/ata/ata_da.c Mon Aug 28 19:25:49 2017(r322976) +++ head/sys/cam/ata/ata_da.c Mon Aug 28 19:27:33 2017(r322977) @@ -2853,6 +2853,12 @@ adadone(struct cam_periph *periph, union ccb *done_ccb if (softc->outstanding_cmds == 0) softc->flags |= ADA_FLAG_WAS_OTAG; + /* +* We need to call cam_iosched before we call biodone so that we +* don't measure any activity that happens in the completion +* routine, which in the case of sendfile can be quite +* extensive. +*/ cam_iosched_bio_complete(softc->cam_iosched, bp, done_ccb); xpt_release_ccb(done_ccb); if (state == ADA_CCB_TRIM) { Modified: head/sys/cam/nvme/nvme_da.c == --- head/sys/cam/nvme/nvme_da.c Mon Aug 28 19:25:49 2017(r322976) +++ head/sys/cam/nvme/nvme_da.c Mon Aug 28 19:27:33 2017(r322977) @@ -1021,6 +1021,12 @@ ndadone(struct cam_periph *periph, union ccb *done_ccb free(bp->bio_driver2, M_NVMEDA); softc->outstanding_cmds--; + /* +* We need to call cam_iosched before we call biodone so that we +* don't measure any activity that happens in the completion +* routine, which in the case of sendfile can be quite +* extensive. +*/ cam_iosched_bio_complete(softc->cam_iosched, bp, done_ccb); xpt_release_ccb(done_ccb); if (state == NDA_CCB_TRIM) { ___ 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: r322976 - head/sys/cam/scsi
Author: imp Date: Mon Aug 28 19:25:49 2017 New Revision: 322976 URL: https://svnweb.freebsd.org/changeset/base/322976 Log: Add comment about where we need to place this routine, and why. Sponsored by: Netflix Modified: head/sys/cam/scsi/scsi_da.c Modified: head/sys/cam/scsi/scsi_da.c == --- head/sys/cam/scsi/scsi_da.c Mon Aug 28 19:17:28 2017(r322975) +++ head/sys/cam/scsi/scsi_da.c Mon Aug 28 19:25:49 2017(r322976) @@ -4200,6 +4200,12 @@ dadone(struct cam_periph *periph, union ccb *done_ccb) if (LIST_EMPTY(&softc->pending_ccbs)) softc->flags |= DA_FLAG_WAS_OTAG; + /* +* We need to call cam_iosched before we call biodone so that we +* don't measure any activity that happens in the completion +* routine, which in the case of sendfile can be quite +* extensive. +*/ cam_iosched_bio_complete(softc->cam_iosched, bp, done_ccb); xpt_release_ccb(done_ccb); if (state == DA_CCB_DELETE) { ___ 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: r322979 - in head: share/misc usr.bin/calendar/calendars
Author: pizzamig (ports committer) Date: Mon Aug 28 19:34:39 2017 New Revision: 322979 URL: https://svnweb.freebsd.org/changeset/base/322979 Log: Adding personal information about pizzamig as port committer Approved by: olivier (mentor) Approved by: lme (mentor) Differential Revision:https://reviews.freebsd.org/D12145 Modified: head/share/misc/committers-ports.dot head/usr.bin/calendar/calendars/calendar.freebsd Modified: head/share/misc/committers-ports.dot == --- head/share/misc/committers-ports.dotMon Aug 28 19:29:51 2017 (r322978) +++ head/share/misc/committers-ports.dotMon Aug 28 19:34:39 2017 (r322979) @@ -195,6 +195,7 @@ pclin [label="Po-Chien Lin\npc...@freebsd.org\n2013/02 pgj [label="Gabor Pali\n...@freebsd.org\n2009/04/12"] pgollucci [label="Philip M. Gollucci\npgollu...@freebsd.org\n2008/07/21"] philip [label="Philip Paeps\nphi...@freebsd.org\n2005/10/19"] +pizzamig [label="Luca Pizzamiglio\npizza...@freebsd.org\n2017/08/25"] rafan [label="Rong-En Fan\nra...@freebsd.org\n2006/06/23"] rakuco [label="Raphael Kubo da Costa\nrak...@freebsd.org\n2011/08/22"] rene [label="Rene Ladan\nr...@freebsd.org\n2010/04/11"] @@ -468,6 +469,7 @@ lifanov -> ultima lioux -> pat +lme -> pizzamig lme -> tobik lwhsu -> yzlin @@ -543,6 +545,8 @@ novel -> rm obrien -> mharo obrien -> gerald + +olivier -> pizzamig osa -> vg Modified: head/usr.bin/calendar/calendars/calendar.freebsd == --- head/usr.bin/calendar/calendars/calendar.freebsdMon Aug 28 19:29:51 2017(r322978) +++ head/usr.bin/calendar/calendars/calendar.freebsdMon Aug 28 19:34:39 2017(r322979) @@ -415,6 +415,7 @@ 11/22 Frederic Culot born in Saint-Germain-En-Laye, France, 1976 11/23 Josef Lawrence Karthauser born in Pembury, Kent, United Kingdom, 1972 11/23 Sepherosa Ziehau born in Shanghai, China, 1980 +11/23 Luca Pizzamiglio born in Casalpusterlengo, Italy, 1978 11/24 Andrey Zakhvatov born in Chelyabinsk, Russian Federation, 1974 11/24 Daniel Gerzo born in Bratislava, Slovakia, 1986 11/28 Nik Clayton born in Peterborough, United Kingdom, 1973 ___ 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: r322969 - in head: sbin/mdconfig sys/dev/md sys/sys
On Mon, Aug 28, 2017 at 11:24 AM, Maxim Sobolev wrote: > Hi John, > > Thanks for your feedback! To address the points that you've raised: > > 1. I've tested on both 32 and 64 bit platforms, it seems not to be the > case. See imp's comment and my reply here > https://reviews.freebsd.org/D10457#216855 . Did I miss something? Can you > post piece of C code that produces different sizeof(struct old) vs. > sizeof(struct new) on some platform? [...] > On Mon, Aug 28, 2017 at 9:19 AM, John Baldwin wrote: > >> On Monday, August 28, 2017 03:54:08 PM Maxim Sobolev wrote: >> > Author: sobomax >> > Date: Mon Aug 28 15:54:07 2017 >> > New Revision: 322969 >> > URL: https://svnweb.freebsd.org/changeset/base/322969 >> > >> > Log: >> > Add ability to label md(4) devices. >> > >> > This feature comes from the fact that we rely memory-backed md(4) >> > in our build process heavily. However, if the build goes haywire >> > the allocated resources (i.e. swap and memory-backed md(4)'s) need >> > to be purged. It is extremely useful to have ability to attach >> > arbitrary labels to each of the virtual disks so that they can >> > be identified and GC'ed if neecessary. >> > >> > MFC after: 4 weeks >> > Differential Revision: https://reviews.freebsd.org/D10457 >> > >> > Modified: >> > head/sbin/mdconfig/mdconfig.8 >> > head/sbin/mdconfig/mdconfig.c >> > head/sys/dev/md/md.c >> > head/sys/sys/mdioctl.h >> > >> > Modified: head/sys/sys/mdioctl.h >> > >> == >> > --- head/sys/sys/mdioctl.hMon Aug 28 14:49:26 2017(r322968) >> > +++ head/sys/sys/mdioctl.hMon Aug 28 15:54:07 2017(r322969) >> > @@ -49,7 +49,7 @@ enum md_types {MD_MALLOC, MD_PRELOAD, MD_VNODE, MD_SWA >> > * Ioctl definitions for memory disk pseudo-device. >> > */ >> > >> > -#define MDNPAD 97 >> > +#define MDNPAD 96 >> > struct md_ioctl { >> > unsignedmd_version; /* Structure layout version */ >> > unsignedmd_unit;/* unit number */ >> > @@ -61,6 +61,7 @@ struct md_ioctl { >> > u_int64_t md_base;/* base address */ >> > int md_fwheads; /* firmware heads */ >> > int md_fwsectors; /* firmware sectors */ >> > + char*md_label; /* label of the device */ >> > int md_pad[MDNPAD]; /* padding for future ideas */ >> > }; >> >> This isn't correct on 64-bit platforms. MDNPAD needs to be 95 on those >> platforms. [...] Can you report sizeof(md_ioctl) before and after for 32-bit and 64-bit? I think it may be: 32-bit before: 440 32-bit after: 440 64-bit before: 448 64-bit after: 448 In other words, it looks like it used to produce different sizes on the different architectures, and still does. It also looks like 32-bit before and after and 64-bit before included some undeclared padding after md_pad, so that this would fail: CTASSERT(sizeof(md_ioctl) == offsetof(struct md_ioctl, md_pad) + sizeof(((struct md_ioctl *)NULL)->md_pad)); In any case a CTASSERT(sizeof(md_ioctl) == XXX) may increase confidence in the ABI here. ___ 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: r322980 - head/sys/dev/ntb/ntb_hw
Author: mav Date: Mon Aug 28 19:52:57 2017 New Revision: 322980 URL: https://svnweb.freebsd.org/changeset/base/322980 Log: Fix fake interrupt when set doorbell is unmasked. Since the doorbell bit is already set when interrupt handler is called, the event was not propagated to upper layer. It was working normally because present code was not using masking actively, but that is going to change. MFC after:2 weeks Sponsored by: iXsystems, Inc. Modified: head/sys/dev/ntb/ntb_hw/ntb_hw.c Modified: head/sys/dev/ntb/ntb_hw/ntb_hw.c == --- head/sys/dev/ntb/ntb_hw/ntb_hw.cMon Aug 28 19:34:39 2017 (r322979) +++ head/sys/dev/ntb/ntb_hw/ntb_hw.cMon Aug 28 19:52:57 2017 (r322980) @@ -253,7 +253,8 @@ struct ntb_softc { uint64_tdb_valid_mask; uint64_tdb_link_mask; uint64_tdb_mask; - uint64_tfake_db_bell; /* NTB_SB01BASE_LOCKUP*/ + uint64_tfake_db;/* NTB_SB01BASE_LOCKUP*/ + uint64_tforce_db; /* NTB_SB01BASE_LOCKUP*/ int last_ts;/* ticks @ last irq */ @@ -1206,10 +1207,11 @@ intel_ntb_db_clear_mask(device_t dev, uint64_t bits) (uintmax_t)ntb->db_valid_mask)); DB_MASK_LOCK(ntb); - ibits = ntb->fake_db_bell & ntb->db_mask & bits; + ibits = ntb->fake_db & ntb->db_mask & bits; ntb->db_mask &= ~bits; if (HAS_FEATURE(ntb, NTB_SB01BASE_LOCKUP)) { /* Simulate fake interrupts if unmasked DB bits are set. */ + ntb->force_db |= ibits; for (i = 0; i < XEON_NONLINK_DB_MSIX_BITS; i++) { if ((ibits & intel_ntb_db_vector_mask(dev, i)) != 0) swi_sched(ntb->int_info[i].tag, 0); @@ -1226,7 +1228,7 @@ intel_ntb_db_read(device_t dev) struct ntb_softc *ntb = device_get_softc(dev); if (HAS_FEATURE(ntb, NTB_SB01BASE_LOCKUP)) - return (ntb->fake_db_bell); + return (ntb->fake_db); return (db_ioread(ntb, ntb->self_reg->db_bell)); } @@ -1243,7 +1245,7 @@ intel_ntb_db_clear(device_t dev, uint64_t bits) if (HAS_FEATURE(ntb, NTB_SB01BASE_LOCKUP)) { DB_MASK_LOCK(ntb); - ntb->fake_db_bell &= ~bits; + ntb->fake_db &= ~bits; DB_MASK_UNLOCK(ntb); return; } @@ -1291,11 +1293,16 @@ intel_ntb_interrupt(struct ntb_softc *ntb, uint32_t ve (vec_mask & ntb->db_link_mask) == 0) { DB_MASK_LOCK(ntb); - /* Do not report same DB events again if not cleared yet. */ - vec_mask &= ~ntb->fake_db_bell; + /* +* Do not report same DB events again if not cleared yet, +* unless the mask was just cleared for them and this +* interrupt handler call can be the consequence of it. +*/ + vec_mask &= ~ntb->fake_db | ntb->force_db; + ntb->force_db &= ~vec_mask; /* Update our internal doorbell register. */ - ntb->fake_db_bell |= vec_mask; + ntb->fake_db |= vec_mask; /* Do not report masked DB events. */ vec_mask &= ~ntb->db_mask; @@ -1512,7 +1519,7 @@ intel_ntb_xeon_init_dev(struct ntb_softc *ntb) ntb->xlat_reg = &xeon_sec_xlat; if (HAS_FEATURE(ntb, NTB_SB01BASE_LOCKUP)) { - ntb->fake_db_bell = 0; + ntb->force_db = ntb->fake_db = 0; ntb->msix_mw_idx = (ntb->mw_count + g_ntb_msix_idx) % ntb->mw_count; intel_ntb_printf(2, "Setting up MSIX mw idx %d means %u\n", ___ 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: r322981 - head/sys/dev/ntb
Author: mav Date: Mon Aug 28 20:00:21 2017 New Revision: 322981 URL: https://svnweb.freebsd.org/changeset/base/322981 Log: Mask doorbells while processing them. This fixes interrupt storms on hardware using legacy level-triggered interrupts, since doorbell processing could take time after interrupt handler completion, that triggered extra interrupts in a loop. MFC after:2 weeks Sponsored by: iXsystems, Inc. Modified: head/sys/dev/ntb/ntb_transport.c Modified: head/sys/dev/ntb/ntb_transport.c == --- head/sys/dev/ntb/ntb_transport.cMon Aug 28 19:52:57 2017 (r322980) +++ head/sys/dev/ntb/ntb_transport.cMon Aug 28 20:00:21 2017 (r322981) @@ -835,6 +835,7 @@ static void ntb_transport_rxc_db(void *arg, int pending __unused) { struct ntb_transport_qp *qp = arg; + uint64_t qp_mask = 1ull << qp->qp_num; int rc; CTR0(KTR_NTB, "RX: transport_rx"); @@ -843,11 +844,13 @@ again: ; CTR1(KTR_NTB, "RX: process_rxc returned %d", rc); - if ((ntb_db_read(qp->dev) & (1ull << qp->qp_num)) != 0) { + if ((ntb_db_read(qp->dev) & qp_mask) != 0) { /* If db is set, clear it and check queue once more. */ - ntb_db_clear(qp->dev, 1ull << qp->qp_num); + ntb_db_clear(qp->dev, qp_mask); goto again; } + if (qp->link_is_up) + ntb_db_clear_mask(qp->dev, qp_mask); } static int @@ -1009,6 +1012,8 @@ ntb_transport_doorbell_callback(void *data, uint32_t v vec_mask &= nt->qp_bitmap; if ((vec_mask & (vec_mask - 1)) != 0) vec_mask &= ntb_db_read(nt->dev); + if (vec_mask != 0) + ntb_db_set_mask(nt->dev, vec_mask); while (vec_mask != 0) { qp_num = ffsll(vec_mask) - 1; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r322982 - head/sys/fs/msdosfs
Author: kib Date: Mon Aug 28 20:52:32 2017 New Revision: 322982 URL: https://svnweb.freebsd.org/changeset/base/322982 Log: Verify that the BPB media descriptor and FAT ID match. FAT specification requires that for valid FAT, FAT cluster 0 has a specific value derived from the BPB media descriptor. The lowest (little-endian) byte must be equal to bpb.bpbMedia, other bits in the cluster number must be all 1's. Implement the check to reduce the chance of the randomly corrupted FAT to pass the mount attempt. Submitted by: Siva Mahadevan MFC after:2 weeks Differential revision:https://reviews.freebsd.org/D12124 Modified: head/sys/fs/msdosfs/msdosfs_fat.c Modified: head/sys/fs/msdosfs/msdosfs_fat.c == --- head/sys/fs/msdosfs/msdosfs_fat.c Mon Aug 28 20:00:21 2017 (r322981) +++ head/sys/fs/msdosfs/msdosfs_fat.c Mon Aug 28 20:52:32 2017 (r322982) @@ -908,19 +908,17 @@ fillinusemap(struct msdosfsmount *pmp) * zero. These represent free clusters. */ pmp->pm_freeclustercount = 0; - for (cn = CLUST_FIRST; cn <= pmp->pm_maxcluster; cn++) { + for (cn = 0; cn <= pmp->pm_maxcluster; cn++) { byteoffset = FATOFS(pmp, cn); bo = byteoffset % pmp->pm_fatblocksize; - if (!bo || !bp) { + if (bo == 0) { /* Read new FAT block */ - if (bp) + if (bp != NULL) brelse(bp); fatblock(pmp, byteoffset, &bn, &bsize, NULL); error = bread(pmp->pm_devvp, bn, bsize, NOCRED, &bp); - if (error) { - brelse(bp); + if (error != 0) return (error); - } } if (FAT32(pmp)) readcn = getulong(&bp->b_data[bo]); @@ -930,7 +928,19 @@ fillinusemap(struct msdosfsmount *pmp) readcn >>= 4; readcn &= pmp->pm_fatmask; - if (readcn == CLUST_FREE) + /* +* Check if the FAT ID matches the BPB's media descriptor and +* all other bits are set to 1. +*/ + if (cn == 0 && readcn != ((pmp->pm_fatmask & 0xff00) | + pmp->pm_bpb.bpbMedia)) { +#ifdef MSDOSFS_DEBUG + printf("mountmsdosfs(): Media descriptor in BPB" + "does not match FAT ID\n"); +#endif + brelse(bp); + return (EINVAL); + } else if (readcn == CLUST_FREE) usemap_free(pmp, cn); } if (bp != NULL) ___ 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: r322984 - head/sys/fs/msdosfs
Author: kib Date: Mon Aug 28 21:04:56 2017 New Revision: 322984 URL: https://svnweb.freebsd.org/changeset/base/322984 Log: Style. Sponsored by: The FreeBSD Foundation MFC after:2 weeks Modified: head/sys/fs/msdosfs/msdosfs_fat.c Modified: head/sys/fs/msdosfs/msdosfs_fat.c == --- head/sys/fs/msdosfs/msdosfs_fat.c Mon Aug 28 20:55:13 2017 (r322983) +++ head/sys/fs/msdosfs/msdosfs_fat.c Mon Aug 28 21:04:56 2017 (r322984) @@ -888,12 +888,12 @@ freeclusterchain(struct msdosfsmount *pmp, u_long clus int fillinusemap(struct msdosfsmount *pmp) { - struct buf *bp = NULL; - u_long cn, readcn; + struct buf *bp; + u_long bn, bo, bsize, byteoffset, cn, readcn; int error; - u_long bn, bo, bsize, byteoffset; MSDOSFS_ASSERT_MP_LOCKED(pmp); + bp = NULL; /* * Mark all clusters in use, we mark the free ones in the FAT scan ___ 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: r322985 - head/sys/dev/cxgbe
Author: np Date: Mon Aug 28 21:44:25 2017 New Revision: 322985 URL: https://svnweb.freebsd.org/changeset/base/322985 Log: cxgbe(4): Maintain one ifmedia per physical port instead of one per Virtual Interface (VI). All autonomous VIs that share a port share the same media. MFC after:1 week Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/adapter.h head/sys/dev/cxgbe/t4_main.c Modified: head/sys/dev/cxgbe/adapter.h == --- head/sys/dev/cxgbe/adapter.hMon Aug 28 21:04:56 2017 (r322984) +++ head/sys/dev/cxgbe/adapter.hMon Aug 28 21:44:25 2017 (r322985) @@ -186,7 +186,6 @@ struct vi_info { struct port_info *pi; struct ifnet *ifp; - struct ifmedia media; unsigned long flags; int if_flags; @@ -288,6 +287,7 @@ struct port_info { struct link_config link_cfg; struct link_config old_link_cfg; + struct ifmedia media; struct timeval last_refreshed; struct port_stats stats; Modified: head/sys/dev/cxgbe/t4_main.c == --- head/sys/dev/cxgbe/t4_main.cMon Aug 28 21:04:56 2017 (r322984) +++ head/sys/dev/cxgbe/t4_main.cMon Aug 28 21:44:25 2017 (r322985) @@ -1047,6 +1047,10 @@ t4_attach(device_t dev) n1g++; } + /* All VIs on this port share this media. */ + ifmedia_init(&pi->media, IFM_IMASK, cxgbe_media_change, + cxgbe_media_status); + pi->dev = device_add_child(dev, sc->names->ifnet_name, -1); if (pi->dev == NULL) { device_printf(dev, @@ -1517,10 +1521,6 @@ cxgbe_vi_attach(device_t dev, struct vi_info *vi) ifp->if_hw_tsomaxsegcount = TX_SGL_SEGS; ifp->if_hw_tsomaxsegsize = 65536; - /* Initialize ifmedia for this VI */ - ifmedia_init(&vi->media, IFM_IMASK, cxgbe_media_change, - cxgbe_media_status); - vi->vlan_c = EVENTHANDLER_REGISTER(vlan_config, cxgbe_vlan_config, ifp, EVENTHANDLER_PRI_ANY); @@ -1601,7 +1601,6 @@ cxgbe_vi_detach(struct vi_info *vi) callout_drain(&vi->tick); vi_full_uninit(vi); - ifmedia_removeall(&vi->media); if_free(vi->ifp); vi->ifp = NULL; } @@ -1628,6 +1627,7 @@ cxgbe_detach(device_t dev) cxgbe_vi_detach(&pi->vi[0]); callout_drain(&pi->tick); + ifmedia_removeall(&pi->media); end_synchronized_op(sc, 0); @@ -1651,7 +1651,8 @@ cxgbe_ioctl(struct ifnet *ifp, unsigned long cmd, cadd { int rc = 0, mtu, flags, can_sleep; struct vi_info *vi = ifp->if_softc; - struct adapter *sc = vi->pi->adapter; + struct port_info *pi = vi->pi; + struct adapter *sc = pi->adapter; struct ifreq *ifr = (struct ifreq *)data; uint32_t mask; @@ -1831,7 +1832,7 @@ fail: case SIOCSIFMEDIA: case SIOCGIFMEDIA: case SIOCGIFXMEDIA: - ifmedia_ioctl(ifp, ifr, &vi->media, cmd); + ifmedia_ioctl(ifp, ifr, &pi->media, cmd); break; case SIOCGI2C: { @@ -1851,7 +1852,7 @@ fail: rc = begin_synchronized_op(sc, vi, SLEEP_OK | INTR_OK, "t4i2c"); if (rc) return (rc); - rc = -t4_i2c_rd(sc, sc->mbox, vi->pi->port_id, i2c.dev_addr, + rc = -t4_i2c_rd(sc, sc->mbox, pi->port_id, i2c.dev_addr, i2c.offset, i2c.len, &i2c.data[0]); end_synchronized_op(sc, 0); if (rc == 0) @@ -2073,14 +2074,12 @@ cxgbe_media_status(struct ifnet *ifp, struct ifmediare PORT_LOCK(pi); if (pi->up_vis == 0) { t4_update_port_info(pi); - build_medialist(pi, &vi->media); + build_medialist(pi, &pi->media); } PORT_UNLOCK(pi); end_synchronized_op(pi->adapter, 0); } - cur = vi->media.ifm_cur; - ifmr->ifm_status = IFM_AVALID; if (lc->link_ok == 0) return; @@ -2093,7 +2092,8 @@ cxgbe_media_status(struct ifnet *ifp, struct ifmediare ifmr->ifm_active |= IFM_ETH_TXPAUSE; /* active and current will differ iff current media is autoselect. */ - if (IFM_SUBTYPE(cur->ifm_media) != IFM_AUTO) + cur = pi->media.ifm_cur; + if (cur != NULL && IFM_SUBTYPE(cur->ifm_media) != IFM_AUTO) return; ifmr->ifm_active = IFM_ETHER | IFM_FDX; @@ -4271,7 +4271,7 @@ cxgbe_init_synchronized(struct vi_info *vi) PORT_LOCK(pi); if (pi->up_vis++ == 0) { t4_update_port_info(pi); - build_medialist(vi->pi, &vi->media); + build_medialis
Re: svn commit: r322969 - in head: sbin/mdconfig sys/dev/md sys/sys
On Monday, August 28, 2017 12:46:48 PM Ryan Libby wrote: > On Mon, Aug 28, 2017 at 11:24 AM, Maxim Sobolev wrote: > > Hi John, > > > > Thanks for your feedback! To address the points that you've raised: > > > > 1. I've tested on both 32 and 64 bit platforms, it seems not to be the > > case. See imp's comment and my reply here > > https://reviews.freebsd.org/D10457#216855 . Did I miss something? Can you > > post piece of C code that produces different sizeof(struct old) vs. > > sizeof(struct new) on some platform? > [...] > > On Mon, Aug 28, 2017 at 9:19 AM, John Baldwin wrote: > > > >> On Monday, August 28, 2017 03:54:08 PM Maxim Sobolev wrote: > >> > Author: sobomax > >> > Date: Mon Aug 28 15:54:07 2017 > >> > New Revision: 322969 > >> > URL: https://svnweb.freebsd.org/changeset/base/322969 > >> > > >> > Log: > >> > Add ability to label md(4) devices. > >> > > >> > This feature comes from the fact that we rely memory-backed md(4) > >> > in our build process heavily. However, if the build goes haywire > >> > the allocated resources (i.e. swap and memory-backed md(4)'s) need > >> > to be purged. It is extremely useful to have ability to attach > >> > arbitrary labels to each of the virtual disks so that they can > >> > be identified and GC'ed if neecessary. > >> > > >> > MFC after: 4 weeks > >> > Differential Revision: https://reviews.freebsd.org/D10457 > >> > > >> > Modified: > >> > head/sbin/mdconfig/mdconfig.8 > >> > head/sbin/mdconfig/mdconfig.c > >> > head/sys/dev/md/md.c > >> > head/sys/sys/mdioctl.h > >> > > >> > Modified: head/sys/sys/mdioctl.h > >> > > >> == > >> > --- head/sys/sys/mdioctl.hMon Aug 28 14:49:26 2017(r322968) > >> > +++ head/sys/sys/mdioctl.hMon Aug 28 15:54:07 2017(r322969) > >> > @@ -49,7 +49,7 @@ enum md_types {MD_MALLOC, MD_PRELOAD, MD_VNODE, MD_SWA > >> > * Ioctl definitions for memory disk pseudo-device. > >> > */ > >> > > >> > -#define MDNPAD 97 > >> > +#define MDNPAD 96 > >> > struct md_ioctl { > >> > unsignedmd_version; /* Structure layout version */ > >> > unsignedmd_unit;/* unit number */ > >> > @@ -61,6 +61,7 @@ struct md_ioctl { > >> > u_int64_t md_base;/* base address */ > >> > int md_fwheads; /* firmware heads */ > >> > int md_fwsectors; /* firmware sectors */ > >> > + char*md_label; /* label of the device */ > >> > int md_pad[MDNPAD]; /* padding for future ideas */ > >> > }; > >> > >> This isn't correct on 64-bit platforms. MDNPAD needs to be 95 on those > >> platforms. > [...] > > Can you report sizeof(md_ioctl) before and after for 32-bit and 64-bit? > I think it may be: > 32-bit before: 440 > 32-bit after: 440 > 64-bit before: 448 > 64-bit after: 448 > > In other words, it looks like it used to produce different sizes on the > different architectures, and still does. It also looks like 32-bit > before and after and 64-bit before included some undeclared padding > after md_pad, so that this would fail: > CTASSERT(sizeof(md_ioctl) == offsetof(struct md_ioctl, md_pad) + > sizeof(((struct md_ioctl *)NULL)->md_pad)); Ugh, yes. To me that means that MDNPAD is actually wrong and should be fixed to account for the implicit padding. That probably would result in requiring separate values for MDNPAD. The current change as-is certainly looks wrong (and would be wrong if the padding were accurate) so it needs to be fixed to reflect reality. -- John Baldwin ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r322986 - head/sys/dev/e1000
Author: marius Date: Mon Aug 28 22:09:12 2017 New Revision: 322986 URL: https://svnweb.freebsd.org/changeset/base/322986 Log: Don't set any WOL enabling hardware bits if WOL isn't requested according to the enabled interface capability bits. Also remove some dead code, which tried to preserve already set contents of E1000_WUC while that register is completely overwritten shortly after in all cases. Modified: head/sys/dev/e1000/if_em.c Modified: head/sys/dev/e1000/if_em.c == --- head/sys/dev/e1000/if_em.c Mon Aug 28 21:44:25 2017(r322985) +++ head/sys/dev/e1000/if_em.c Mon Aug 28 22:09:12 2017(r322986) @@ -3639,34 +3639,13 @@ em_enable_wakeup(if_ctx_t ctx) struct adapter *adapter = iflib_get_softc(ctx); device_t dev = iflib_get_dev(ctx); if_t ifp = iflib_get_ifp(ctx); - u32 pmc, ctrl, ctrl_ext, rctl, wuc; + int error = 0; + u32 pmc, ctrl, ctrl_ext, rctl; u16 status; - if ((pci_find_cap(dev, PCIY_PMG, &pmc) != 0)) + if (pci_find_cap(dev, PCIY_PMG, &pmc) != 0) return; - /* Advertise the wakeup capability */ - ctrl = E1000_READ_REG(&adapter->hw, E1000_CTRL); - ctrl |= (E1000_CTRL_SWDPIN2 | E1000_CTRL_SWDPIN3); - E1000_WRITE_REG(&adapter->hw, E1000_CTRL, ctrl); - wuc = E1000_READ_REG(&adapter->hw, E1000_WUC); - wuc |= (E1000_WUC_PME_EN | E1000_WUC_APME); - E1000_WRITE_REG(&adapter->hw, E1000_WUC, wuc); - - if ((adapter->hw.mac.type == e1000_ich8lan) || - (adapter->hw.mac.type == e1000_pchlan) || - (adapter->hw.mac.type == e1000_ich9lan) || - (adapter->hw.mac.type == e1000_ich10lan)) - e1000_suspend_workarounds_ich8lan(&adapter->hw); - - /* Keep the laser running on Fiber adapters */ - if (adapter->hw.phy.media_type == e1000_media_type_fiber || - adapter->hw.phy.media_type == e1000_media_type_internal_serdes) { - ctrl_ext = E1000_READ_REG(&adapter->hw, E1000_CTRL_EXT); - ctrl_ext |= E1000_CTRL_EXT_SDP3_DATA; - E1000_WRITE_REG(&adapter->hw, E1000_CTRL_EXT, ctrl_ext); - } - /* * Determine type of Wakeup: note that wol * is set with all bits on by default. @@ -3685,10 +3664,34 @@ em_enable_wakeup(if_ctx_t ctx) E1000_WRITE_REG(&adapter->hw, E1000_RCTL, rctl); } + if (!(adapter->wol & (E1000_WUFC_EX | E1000_WUFC_MAG | E1000_WUFC_MC))) + goto pme; + + /* Advertise the wakeup capability */ + ctrl = E1000_READ_REG(&adapter->hw, E1000_CTRL); + ctrl |= (E1000_CTRL_SWDPIN2 | E1000_CTRL_SWDPIN3); + E1000_WRITE_REG(&adapter->hw, E1000_CTRL, ctrl); + + /* Keep the laser running on Fiber adapters */ + if (adapter->hw.phy.media_type == e1000_media_type_fiber || + adapter->hw.phy.media_type == e1000_media_type_internal_serdes) { + ctrl_ext = E1000_READ_REG(&adapter->hw, E1000_CTRL_EXT); + ctrl_ext |= E1000_CTRL_EXT_SDP3_DATA; + E1000_WRITE_REG(&adapter->hw, E1000_CTRL_EXT, ctrl_ext); + } + + if ((adapter->hw.mac.type == e1000_ich8lan) || + (adapter->hw.mac.type == e1000_pchlan) || + (adapter->hw.mac.type == e1000_ich9lan) || + (adapter->hw.mac.type == e1000_ich10lan)) + e1000_suspend_workarounds_ich8lan(&adapter->hw); + if ( adapter->hw.mac.type >= e1000_pchlan) { - if (em_enable_phy_wakeup(adapter)) - return; + error = em_enable_phy_wakeup(adapter); + if (error) + goto pme; } else { + /* Enable wakeup by the MAC */ E1000_WRITE_REG(&adapter->hw, E1000_WUC, E1000_WUC_PME_EN); E1000_WRITE_REG(&adapter->hw, E1000_WUFC, adapter->wol); } @@ -3696,10 +3699,10 @@ em_enable_wakeup(if_ctx_t ctx) if (adapter->hw.phy.type == e1000_phy_igp_3) e1000_igp3_phy_powerdown_workaround_ich8lan(&adapter->hw); - /* Request PME */ +pme: status = pci_read_config(dev, pmc + PCIR_POWER_STATUS, 2); status &= ~(PCIM_PSTAT_PME | PCIM_PSTAT_PMEENABLE); - if (if_getcapenable(ifp) & IFCAP_WOL) + if (!error && (if_getcapenable(ifp) & IFCAP_WOL)) status |= PCIM_PSTAT_PME | PCIM_PSTAT_PMEENABLE; pci_write_config(dev, pmc + PCIR_POWER_STATUS, status, 2); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r322987 - head/sys/vm
Author: markj Date: Mon Aug 28 22:10:15 2017 New Revision: 322987 URL: https://svnweb.freebsd.org/changeset/base/322987 Log: Synchronize page laundering with pmap_extract_and_hold(). Before r207410, the hold count of a page in a page queue was protected by the queue lock, and, before laundering a page, the page daemon removed managed writeable mappings of the page before releasing the queue lock. This ensured that other threads could not concurrently create transient writeable mappings using pmap_extract_and_hold() on a user map, as is done for example by vmapbuf(). With that revision, however, a race can allow the creation of such a mapping, meaning that the page might be modified as it is being laundered, potentially resulting in it being marked clean when its contents do not match those given to the pager. Close the race by using the page lock to synchronize the hold count check in vm_pageout_cluster() with the removal of writeable managed mappings. Reported by: alc Reviewed by: alc, kib MFC after:1 week Differential Revision:https://reviews.freebsd.org/D12084 Modified: head/sys/vm/vm_pageout.c Modified: head/sys/vm/vm_pageout.c == --- head/sys/vm/vm_pageout.cMon Aug 28 22:09:12 2017(r322986) +++ head/sys/vm/vm_pageout.cMon Aug 28 22:10:15 2017(r322987) @@ -402,6 +402,8 @@ vm_pageout_cluster(vm_page_t m) */ vm_page_assert_unbusied(m); KASSERT(m->hold_count == 0, ("page %p is held", m)); + + pmap_remove_write(m); vm_page_unlock(m); mc[vm_pageout_page_count] = pb = ps = m; @@ -444,6 +446,7 @@ more: ib = 0; break; } + pmap_remove_write(p); vm_page_unlock(p); mc[--page_base] = pb = p; ++pageout_count; @@ -469,6 +472,7 @@ more: vm_page_unlock(p); break; } + pmap_remove_write(p); vm_page_unlock(p); mc[page_base + pageout_count] = ps = p; ++pageout_count; @@ -513,8 +517,8 @@ vm_pageout_flush(vm_page_t *mc, int count, int flags, VM_OBJECT_ASSERT_WLOCKED(object); /* -* Initiate I/O. Bump the vm_page_t->busy counter and -* mark the pages read-only. +* Initiate I/O. Mark the pages busy and verify that they're valid +* and read-only. * * We do not have to fixup the clean/dirty bits here... we can * allow the pager to do it after the I/O completes. @@ -526,8 +530,9 @@ vm_pageout_flush(vm_page_t *mc, int count, int flags, KASSERT(mc[i]->valid == VM_PAGE_BITS_ALL, ("vm_pageout_flush: partially invalid page %p index %d/%d", mc[i], i, count)); + KASSERT((mc[i]->aflags & PGA_WRITEABLE) == 0, + ("vm_pageout_flush: writeable page %p", mc[i])); vm_page_sbusy(mc[i]); - pmap_remove_write(mc[i]); } vm_object_pip_add(object, count); ___ 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: r322988 - in head/sys/dev/rtwn: . rtl8188e rtl8192c rtl8192e rtl8812a
Author: avos Date: Mon Aug 28 22:14:16 2017 New Revision: 322988 URL: https://svnweb.freebsd.org/changeset/base/322988 Log: rtwn(4): some initial preparations for (basic) VHT support. Rename RTWN_RIDX_MCS to RTWN_RIDX_HT_MCS before adding 802.11ac MCS rate indexes (they have different offset). No functional change intended. Modified: head/sys/dev/rtwn/if_rtwn_ridx.h head/sys/dev/rtwn/if_rtwn_rx.c head/sys/dev/rtwn/rtl8188e/r88e_chan.c head/sys/dev/rtwn/rtl8192c/r92c_chan.c head/sys/dev/rtwn/rtl8192c/r92c_fw.c head/sys/dev/rtwn/rtl8192c/r92c_priv.h head/sys/dev/rtwn/rtl8192c/r92c_rx.c head/sys/dev/rtwn/rtl8192c/r92c_tx.c head/sys/dev/rtwn/rtl8192e/r92e_chan.c head/sys/dev/rtwn/rtl8812a/r12a_chan.c head/sys/dev/rtwn/rtl8812a/r12a_rx.c head/sys/dev/rtwn/rtl8812a/r12a_tx.c Modified: head/sys/dev/rtwn/if_rtwn_ridx.h == --- head/sys/dev/rtwn/if_rtwn_ridx.hMon Aug 28 22:10:15 2017 (r322987) +++ head/sys/dev/rtwn/if_rtwn_ridx.hMon Aug 28 22:14:16 2017 (r322988) @@ -36,7 +36,7 @@ #define RTWN_RIDX_OFDM36 9 #define RTWN_RIDX_OFDM48 10 #define RTWN_RIDX_OFDM54 11 -#define RTWN_RIDX_MCS(i) (12 + (i)) +#define RTWN_RIDX_HT_MCS(i)(12 + (i)) #define RTWN_RIDX_COUNT28 #define RTWN_RIDX_UNKNOWN (uint8_t)-1 @@ -82,10 +82,10 @@ rtwn_ctl_mcsrate(const struct ieee80211_rate_table *rt uint8_t cix, rate; /* Check if we are using MCS rate. */ - KASSERT(ridx >= RTWN_RIDX_MCS(0) && ridx != RTWN_RIDX_UNKNOWN, + KASSERT(ridx >= RTWN_RIDX_HT_MCS(0) && ridx != RTWN_RIDX_UNKNOWN, ("bad mcs rate index %d", ridx)); - rate = (ridx - RTWN_RIDX_MCS(0)) | IEEE80211_RATE_MCS; + rate = (ridx - RTWN_RIDX_HT_MCS(0)) | IEEE80211_RATE_MCS; cix = rt->info[rt->rateCodeToIndex[rate]].ctlRateIndex; KASSERT(cix != (uint8_t)-1, ("rate %d (%d) has no info", rate, ridx)); return rt->info[cix].dot11Rate; Modified: head/sys/dev/rtwn/if_rtwn_rx.c == --- head/sys/dev/rtwn/if_rtwn_rx.c Mon Aug 28 22:10:15 2017 (r322987) +++ head/sys/dev/rtwn/if_rtwn_rx.c Mon Aug 28 22:14:16 2017 (r322988) @@ -88,7 +88,7 @@ rtwn_get_rates(struct rtwn_softc *sc, const struct iee if ((rs_ht->rs_rates[i] & 0x7f) > 0xf) continue; /* 11n rates start at index 12 */ - ridx = RTWN_RIDX_MCS((rs_ht->rs_rates[i]) & 0xf); + ridx = RTWN_RIDX_HT_MCS((rs_ht->rs_rates[i]) & 0xf); rates |= (1 << ridx); /* Guard against the rate table being oddly ordered */ Modified: head/sys/dev/rtwn/rtl8188e/r88e_chan.c == --- head/sys/dev/rtwn/rtl8188e/r88e_chan.c Mon Aug 28 22:10:15 2017 (r322987) +++ head/sys/dev/rtwn/rtl8188e/r88e_chan.c Mon Aug 28 22:14:16 2017 (r322988) @@ -101,7 +101,7 @@ r88e_get_txpower(struct rtwn_softc *sc, int chain, /* XXX net80211 regulatory */ - max_mcs = RTWN_RIDX_MCS(sc->ntxchains * 8 - 1); + max_mcs = RTWN_RIDX_HT_MCS(sc->ntxchains * 8 - 1); KASSERT(max_mcs <= RTWN_RIDX_COUNT, ("increase ridx limit\n")); memset(power, 0, max_mcs * sizeof(power[0])); @@ -121,7 +121,7 @@ r88e_get_txpower(struct rtwn_softc *sc, int chain, power[ridx] = ofdmpow; bw20pow = htpow + rt->bw20_tx_pwr_diff; - for (ridx = RTWN_RIDX_MCS(0); ridx <= max_mcs; ridx++) + for (ridx = RTWN_RIDX_HT_MCS(0); ridx <= max_mcs; ridx++) power[ridx] = bw20pow; /* Apply max limit. */ Modified: head/sys/dev/rtwn/rtl8192c/r92c_chan.c == --- head/sys/dev/rtwn/rtl8192c/r92c_chan.c Mon Aug 28 22:10:15 2017 (r322987) +++ head/sys/dev/rtwn/rtl8192c/r92c_chan.c Mon Aug 28 22:14:16 2017 (r322988) @@ -99,7 +99,7 @@ r92c_get_txpower(struct rtwn_softc *sc, int chain, /* XXX net80211 regulatory */ - max_mcs = RTWN_RIDX_MCS(sc->ntxchains * 8 - 1); + max_mcs = RTWN_RIDX_HT_MCS(sc->ntxchains * 8 - 1); KASSERT(max_mcs <= RTWN_RIDX_COUNT, ("increase ridx limit\n")); memset(power, 0, max_mcs * sizeof(power[0])); @@ -146,7 +146,7 @@ r92c_get_txpower(struct rtwn_softc *sc, int chain, diff = rt->ht20_tx_pwr_diff[chain][group]; htpow += diff; /* HT40->HT20 correction. */ } - for (ridx = RTWN_RIDX_MCS(0); ridx <= max_mcs; ridx++) + for (ridx = RTWN_RIDX_HT_MCS(0); ridx <= max_mcs; ridx++) power[ridx] += htpow; /* Apply max limit. */ @@ -195,26 +195,26 @@ r92c_write_txpower(st
svn commit: r322989 - in head/sys: amd64/include i386/include sys
Author: cem Date: Mon Aug 28 22:28:41 2017 New Revision: 322989 URL: https://svnweb.freebsd.org/changeset/base/322989 Log: Drop CACHE_LINE_SIZE to 64 bytes on x86 The actual cache line size has always been 64 bytes. The 128 number arose as an optimization for Core 2 era Intel processors. By default (configurable in BIOS), these CPUs would prefetch adjacent cache lines unintelligently. Newer CPUs prefetch more intelligently. The latest Core 2 era CPU was introduced in September 2008 (Xeon 7400 series, "Dunnington"). If you are still using one of these CPUs, especially in a multi-socket configuration, consider locating the "adjacent cache line prefetch" option in BIOS and disabling it. Reported by: mjg Reviewed by: np Discussed with: jhb Sponsored by: Dell EMC Isilon Modified: head/sys/amd64/include/param.h head/sys/i386/include/param.h head/sys/sys/param.h Modified: head/sys/amd64/include/param.h == --- head/sys/amd64/include/param.h Mon Aug 28 22:14:16 2017 (r322988) +++ head/sys/amd64/include/param.h Mon Aug 28 22:28:41 2017 (r322989) @@ -89,7 +89,7 @@ * CACHE_LINE_SIZE is the compile-time maximum cache line size for an * architecture. It should be used with appropriate caution. */ -#defineCACHE_LINE_SHIFT7 +#defineCACHE_LINE_SHIFT6 #defineCACHE_LINE_SIZE (1 << CACHE_LINE_SHIFT) /* Size of the level 1 page table units */ Modified: head/sys/i386/include/param.h == --- head/sys/i386/include/param.h Mon Aug 28 22:14:16 2017 (r322988) +++ head/sys/i386/include/param.h Mon Aug 28 22:28:41 2017 (r322989) @@ -82,7 +82,7 @@ * CACHE_LINE_SIZE is the compile-time maximum cache line size for an * architecture. It should be used with appropriate caution. */ -#defineCACHE_LINE_SHIFT7 +#defineCACHE_LINE_SHIFT6 #defineCACHE_LINE_SIZE (1 << CACHE_LINE_SHIFT) #define PAGE_SHIFT 12 /* LOG2(PAGE_SIZE) */ Modified: head/sys/sys/param.h == --- head/sys/sys/param.hMon Aug 28 22:14:16 2017(r322988) +++ head/sys/sys/param.hMon Aug 28 22:28:41 2017(r322989) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1200042 /* Master, propagated to newvers */ +#define __FreeBSD_version 1200043 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, ___ 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: r322990 - head/sys/dev/cxgbe
Author: np Date: Mon Aug 28 22:41:15 2017 New Revision: 322990 URL: https://svnweb.freebsd.org/changeset/base/322990 Log: cxgbe(4): Do not access the mailbox without appropriate locks while creating hardware VIs. This fixes a bad race on systems with hw.cxgbe.num_vis > 1. Reported by: olivier@ MFC after:1 week Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/t4_main.c Modified: head/sys/dev/cxgbe/t4_main.c == --- head/sys/dev/cxgbe/t4_main.cMon Aug 28 22:28:41 2017 (r322989) +++ head/sys/dev/cxgbe/t4_main.cMon Aug 28 22:41:15 2017 (r322990) @@ -2134,29 +2134,24 @@ vcxgbe_probe(device_t dev) } static int -vcxgbe_attach(device_t dev) +alloc_extra_vi(struct adapter *sc, struct port_info *pi, struct vi_info *vi) { - struct vi_info *vi; - struct port_info *pi; - struct adapter *sc; int func, index, rc; - u32 param, val; + uint32_t param, val; - vi = device_get_softc(dev); - pi = vi->pi; - sc = pi->adapter; + ASSERT_SYNCHRONIZED_OP(sc); index = vi - pi->vi; MPASS(index > 0); /* This function deals with _extra_ VIs only */ KASSERT(index < nitems(vi_mac_funcs), ("%s: VI %s doesn't have a MAC func", __func__, - device_get_nameunit(dev))); + device_get_nameunit(vi->dev))); func = vi_mac_funcs[index]; rc = t4_alloc_vi_func(sc, sc->mbox, pi->tx_chan, sc->pf, 0, 1, vi->hw_addr, &vi->rss_size, func, 0); if (rc < 0) { - device_printf(dev, "Failed to allocate virtual interface " - "for port %d: %d\n", pi->port_id, -rc); + device_printf(vi->dev, "failed to allocate virtual interface %d" + "for port %d: %d\n", index, pi->port_id, -rc); return (-rc); } vi->viid = rc; @@ -2165,6 +2160,19 @@ vcxgbe_attach(device_t dev) else vi->smt_idx = (rc & 0x7f); + if (vi->rss_size == 1) { + /* +* This VI didn't get a slice of the RSS table. Reduce the +* number of VIs being created (hw.cxgbe.num_vis) or modify the +* configuration file (nvi, rssnvi for this PF) if this is a +* problem. +*/ + device_printf(vi->dev, "RSS table not available.\n"); + vi->rss_base = 0x; + + return (0); + } + param = V_FW_PARAMS_MNEM(FW_PARAMS_MNEM_DEV) | V_FW_PARAMS_PARAM_X(FW_PARAMS_PARAM_DEV_RSSINFO) | V_FW_PARAMS_PARAM_YZ(vi->viid); @@ -2172,9 +2180,32 @@ vcxgbe_attach(device_t dev) if (rc) vi->rss_base = 0x; else { - /* MPASS((val >> 16) == rss_size); */ + MPASS((val >> 16) == vi->rss_size); vi->rss_base = val & 0x; } + + return (0); +} + +static int +vcxgbe_attach(device_t dev) +{ + struct vi_info *vi; + struct port_info *pi; + struct adapter *sc; + int rc; + + vi = device_get_softc(dev); + pi = vi->pi; + sc = pi->adapter; + + rc = begin_synchronized_op(sc, vi, SLEEP_OK | INTR_OK, "t4via"); + if (rc) + return (rc); + rc = alloc_extra_vi(sc, pi, vi); + end_synchronized_op(sc, 0); + if (rc) + return (rc); rc = cxgbe_vi_attach(dev, vi); if (rc) { ___ 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: r322991 - head/share/man/man4
Author: rpokala Date: Mon Aug 28 23:30:11 2017 New Revision: 322991 URL: https://svnweb.freebsd.org/changeset/base/322991 Log: Fix a day-one typo in tty.4 - the sysctls in question are "tty", not "tk" Sponsored by: Panasas, Inc. Modified: head/share/man/man4/tty.4 Modified: head/share/man/man4/tty.4 == --- head/share/man/man4/tty.4 Mon Aug 28 22:41:15 2017(r322990) +++ head/share/man/man4/tty.4 Mon Aug 28 23:30:11 2017(r322991) @@ -360,9 +360,9 @@ is cleared in the terminal. The total number of input and output bytes through all terminal devices are available via the -.Va kern.tk_nin +.Va kern.tty_nin and -.Va kern.tk_nout +.Va kern.tty_nout read-only .Xr sysctl 8 variables. ___ 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: r322969 - in head: sbin/mdconfig sys/dev/md sys/sys
John, well, this depends on how you look at it. The padding element size is "int", which when you account for the alignment has the nice property on both 32 and 64-bit arches that no matter what kind of element you add (char, short, int or void *), you only need to bring down MDNPAD by 1 to keep the structure size the same. It also has a second interesting property that number of padding elements needed stays the same no matter if sizeof(void *) is 64 or 32, otherwise you would have to have MDNPAD diverge on 32 and 64 bit arches after adding pointer which has different sizes (just like you suggested it should originally). I am not 100% sure if it was intentionally designed like this by PHK from the day one, but I found it quite interesting. I am not quite sure if having sizeof(md_ioctl) is ever been required to stay the same between 64 and 32 bit arches. I don't think there is any support for having 32-bit mdconfig run on 64-bit kernel. -Max On Mon, Aug 28, 2017 at 1:49 PM, John Baldwin wrote: > On Monday, August 28, 2017 12:46:48 PM Ryan Libby wrote: > > On Mon, Aug 28, 2017 at 11:24 AM, Maxim Sobolev > wrote: > > > Hi John, > > > > > > Thanks for your feedback! To address the points that you've raised: > > > > > > 1. I've tested on both 32 and 64 bit platforms, it seems not to be the > > > case. See imp's comment and my reply here > > > https://reviews.freebsd.org/D10457#216855 . Did I miss something? Can > you > > > post piece of C code that produces different sizeof(struct old) vs. > > > sizeof(struct new) on some platform? > > [...] > > > On Mon, Aug 28, 2017 at 9:19 AM, John Baldwin wrote: > > > > > >> On Monday, August 28, 2017 03:54:08 PM Maxim Sobolev wrote: > > >> > Author: sobomax > > >> > Date: Mon Aug 28 15:54:07 2017 > > >> > New Revision: 322969 > > >> > URL: https://svnweb.freebsd.org/changeset/base/322969 > > >> > > > >> > Log: > > >> > Add ability to label md(4) devices. > > >> > > > >> > This feature comes from the fact that we rely memory-backed md(4) > > >> > in our build process heavily. However, if the build goes haywire > > >> > the allocated resources (i.e. swap and memory-backed md(4)'s) need > > >> > to be purged. It is extremely useful to have ability to attach > > >> > arbitrary labels to each of the virtual disks so that they can > > >> > be identified and GC'ed if neecessary. > > >> > > > >> > MFC after: 4 weeks > > >> > Differential Revision: https://reviews.freebsd.org/D10457 > > >> > > > >> > Modified: > > >> > head/sbin/mdconfig/mdconfig.8 > > >> > head/sbin/mdconfig/mdconfig.c > > >> > head/sys/dev/md/md.c > > >> > head/sys/sys/mdioctl.h > > >> > > > >> > Modified: head/sys/sys/mdioctl.h > > >> > > > >> == > > >> > --- head/sys/sys/mdioctl.hMon Aug 28 14:49:26 2017 > (r322968) > > >> > +++ head/sys/sys/mdioctl.hMon Aug 28 15:54:07 2017 > (r322969) > > >> > @@ -49,7 +49,7 @@ enum md_types {MD_MALLOC, MD_PRELOAD, MD_VNODE, > MD_SWA > > >> > * Ioctl definitions for memory disk pseudo-device. > > >> > */ > > >> > > > >> > -#define MDNPAD 97 > > >> > +#define MDNPAD 96 > > >> > struct md_ioctl { > > >> > unsignedmd_version; /* Structure layout version */ > > >> > unsignedmd_unit;/* unit number */ > > >> > @@ -61,6 +61,7 @@ struct md_ioctl { > > >> > u_int64_t md_base;/* base address */ > > >> > int md_fwheads; /* firmware heads */ > > >> > int md_fwsectors; /* firmware sectors */ > > >> > + char*md_label; /* label of the device */ > > >> > int md_pad[MDNPAD]; /* padding for future ideas */ > > >> > }; > > >> > > >> This isn't correct on 64-bit platforms. MDNPAD needs to be 95 on > those > > >> platforms. > > [...] > > > > Can you report sizeof(md_ioctl) before and after for 32-bit and 64-bit? > > I think it may be: > > 32-bit before: 440 > > 32-bit after: 440 > > 64-bit before: 448 > > 64-bit after: 448 > > > > In other words, it looks like it used to produce different sizes on the > > different architectures, and still does. It also looks like 32-bit > > before and after and 64-bit before included some undeclared padding > > after md_pad, so that this would fail: > > CTASSERT(sizeof(md_ioctl) == offsetof(struct md_ioctl, md_pad) + > > sizeof(((struct md_ioctl *)NULL)->md_pad)); > > Ugh, yes. To me that means that MDNPAD is actually wrong and should be > fixed to account for the implicit padding. That probably would result in > requiring separate values for MDNPAD. The current change as-is certainly > looks wrong (and would be wrong if the padding were accurate) so it needs > to be fixed to reflect reality. > > -- > John Baldwin > > ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head
svn commit: r322992 - head/sbin/nvmecontrol
Author: imp Date: Mon Aug 28 23:54:08 2017 New Revision: 322992 URL: https://svnweb.freebsd.org/changeset/base/322992 Log: Print the controller's ID in identify. Submitted by: Matt Williams Sponsored by: Netflix Modified: head/sbin/nvmecontrol/identify.c Modified: head/sbin/nvmecontrol/identify.c == --- head/sbin/nvmecontrol/identify.cMon Aug 28 23:30:11 2017 (r322991) +++ head/sbin/nvmecontrol/identify.cMon Aug 28 23:54:08 2017 (r322992) @@ -66,8 +66,9 @@ print_controller(struct nvme_controller_data *cdata) printf("Unlimited\n"); else printf("%d\n", PAGE_SIZE * (1 << cdata->mdts)); - + printf("Controller ID: 0x%02x\n", cdata->ctrlr_id); printf("\n"); + printf("Admin Command Set Attributes\n"); printf("\n"); printf("Security Send/Receive: %s\n", ___ 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: r322994 - head/sys/dev/nvme
Author: imp Date: Mon Aug 28 23:54:20 2017 New Revision: 322994 URL: https://svnweb.freebsd.org/changeset/base/322994 Log: Set the max transactions for NVMe drives better. Provided a better estimate for the number of transactions that can be pending at one time. This will be number of queues * number of trackers / 4, as suggested by Jim Harris. This gives a better estimate of the number of transactions that CAM should queue before applying back pressure. This should be revisted when we have real multi-queue support in CAM and the upper layers of the I/O stack. Sponsored by: Netflix Modified: head/sys/dev/nvme/nvme_ctrlr.c head/sys/dev/nvme/nvme_private.h head/sys/dev/nvme/nvme_sim.c Modified: head/sys/dev/nvme/nvme_ctrlr.c == --- head/sys/dev/nvme/nvme_ctrlr.c Mon Aug 28 23:54:16 2017 (r322993) +++ head/sys/dev/nvme/nvme_ctrlr.c Mon Aug 28 23:54:20 2017 (r322994) @@ -146,6 +146,14 @@ nvme_ctrlr_construct_io_qpairs(struct nvme_controller num_trackers = min(num_trackers, (num_entries-1)); /* +* Our best estimate for the maximum number of I/Os that we should +* noramlly have in flight at one time. This should be viewed as a hint, +* not a hard limit and will need to be revisitted when the upper layers +* of the storage system grows multi-queue support. +*/ + ctrlr->max_hw_pend_io = num_trackers * ctrlr->num_io_queues / 4; + + /* * This was calculated previously when setting up interrupts, but * a controller could theoretically support fewer I/O queues than * MSI-X vectors. So calculate again here just to be safe. Modified: head/sys/dev/nvme/nvme_private.h == --- head/sys/dev/nvme/nvme_private.hMon Aug 28 23:54:16 2017 (r322993) +++ head/sys/dev/nvme/nvme_private.hMon Aug 28 23:54:20 2017 (r322994) @@ -263,6 +263,7 @@ struct nvme_controller { uint32_tnum_io_queues; uint32_tnum_cpus_per_ioq; + uint32_tmax_hw_pend_io; /* Fields for tracking progress during controller initialization. */ struct intr_config_hook config_hook; Modified: head/sys/dev/nvme/nvme_sim.c == --- head/sys/dev/nvme/nvme_sim.cMon Aug 28 23:54:16 2017 (r322993) +++ head/sys/dev/nvme/nvme_sim.cMon Aug 28 23:54:20 2017 (r322994) @@ -253,7 +253,7 @@ nvme_sim_new_controller(struct nvme_controller *ctrlr) int unit; struct nvme_sim_softc *sc = NULL; - max_trans = ctrlr->num_io_queues; + max_trans = ctrlr->max_hw_pend_io; unit = device_get_unit(ctrlr->dev); devq = cam_simq_alloc(max_trans); if (devq == NULL) ___ 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: r322993 - head/sys/modules/nvme
Author: imp Date: Mon Aug 28 23:54:16 2017 New Revision: 322993 URL: https://svnweb.freebsd.org/changeset/base/322993 Log: Add nvme_sim.c since that's not runtime switchable. Sponsored by: Netflix Modified: head/sys/modules/nvme/Makefile Modified: head/sys/modules/nvme/Makefile == --- head/sys/modules/nvme/Makefile Mon Aug 28 23:54:08 2017 (r322992) +++ head/sys/modules/nvme/Makefile Mon Aug 28 23:54:16 2017 (r322993) @@ -10,6 +10,7 @@ SRCS =nvme.c \ nvme_ns.c \ nvme_ns_cmd.c \ nvme_qpair.c\ + nvme_sim.c \ nvme_sysctl.c \ nvme_test.c \ nvme_util.c \ ___ 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: r322995 - in head/sys: conf dev/nvme
Author: imp Date: Mon Aug 28 23:54:25 2017 New Revision: 322995 URL: https://svnweb.freebsd.org/changeset/base/322995 Log: Add new compile-time option NVME_USE_NVD that sets the default value of the runtime hw.nvme.use_vnd tunable. We still default to nvd unless otherwise requested. Sponsored by: Netflix Modified: head/sys/conf/options head/sys/dev/nvme/nvme_sysctl.c Modified: head/sys/conf/options == --- head/sys/conf/options Mon Aug 28 23:54:20 2017(r322994) +++ head/sys/conf/options Mon Aug 28 23:54:25 2017(r322995) @@ -998,3 +998,6 @@ HN_DEBUGopt_hn.h MMCCAM # Encrypted kernel crash dumps EKCD opt_ekcd.h + +# NVME options +NVME_USE_NVD opt_nvme.h Modified: head/sys/dev/nvme/nvme_sysctl.c == --- head/sys/dev/nvme/nvme_sysctl.c Mon Aug 28 23:54:20 2017 (r322994) +++ head/sys/dev/nvme/nvme_sysctl.c Mon Aug 28 23:54:25 2017 (r322995) @@ -27,13 +27,19 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_nvme.h" + #include #include #include #include "nvme_private.h" -int nvme_use_nvd = 1; +#ifndef NVME_USE_NVD +#define NVME_USE_NVD 1 +#endif + +int nvme_use_nvd = NVME_USE_NVD; SYSCTL_NODE(_hw, OID_AUTO, nvme, CTLFLAG_RD, 0, "NVMe sysctl tunables"); SYSCTL_INT(_hw_nvme, OID_AUTO, use_nvd, CTLFLAG_RDTUN, ___ 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: r322969 - in head: sbin/mdconfig sys/dev/md sys/sys
On Mon, 28 Aug 2017, Ryan Libby wrote: On Mon, Aug 28, 2017 at 11:24 AM, Maxim Sobolev wrote: Hi John, Thanks for your feedback! To address the points that you've raised: 1. I've tested on both 32 and 64 bit platforms, it seems not to be the case. See imp's comment and my reply here https://reviews.freebsd.org/D10457#216855 . Did I miss something? Can you post piece of C code that produces different sizeof(struct old) vs. sizeof(struct new) on some platform? [...] On Mon, Aug 28, 2017 at 9:19 AM, John Baldwin wrote: On Monday, August 28, 2017 03:54:08 PM Maxim Sobolev wrote: Author: sobomax Date: Mon Aug 28 15:54:07 2017 New Revision: 322969 URL: https://svnweb.freebsd.org/changeset/base/322969 Log: Add ability to label md(4) devices. This patch has some style bugs (mainly unsorting of options list in different ways by not always adding to the end of almost-sorted lists). Modified: head/sys/sys/mdioctl.h == --- head/sys/sys/mdioctl.hMon Aug 28 14:49:26 2017(r322968) +++ head/sys/sys/mdioctl.hMon Aug 28 15:54:07 2017(r322969) @@ -49,7 +49,7 @@ enum md_types {MD_MALLOC, MD_PRELOAD, MD_VNODE, MD_SWA * Ioctl definitions for memory disk pseudo-device. */ -#define MDNPAD 97 +#define MDNPAD 96 struct md_ioctl { unsignedmd_version; /* Structure layout version */ unsignedmd_unit;/* unit number */ @@ -61,6 +61,7 @@ struct md_ioctl { u_int64_t md_base;/* base address */ int md_fwheads; /* firmware heads */ int md_fwsectors; /* firmware sectors */ + char*md_label; /* label of the device */ int md_pad[MDNPAD]; /* padding for future ideas */ }; This isn't correct on 64-bit platforms. MDNPAD needs to be 95 on those platforms. [...] Can you report sizeof(md_ioctl) before and after for 32-bit and 64-bit? I think it may be: 32-bit before: 440 32-bit after: 440 64-bit before: 448 64-bit after: 448 In other words, it looks like it used to produce different sizes on the different architectures, and still does. It also looks like 32-bit before and after and 64-bit before included some undeclared padding after md_pad, so that this would fail: CTASSERT(sizeof(md_ioctl) == offsetof(struct md_ioctl, md_pad) + sizeof(((struct md_ioctl *)NULL)->md_pad)); In any case a CTASSERT(sizeof(md_ioctl) == XXX) may increase confidence in the ABI here. Indeed, the odd count for the padding was nonsense on 64-bit arches. It followed a uint64_t which gives 64-bit alignment, then 2 ints which maintain 64-bit alignment. Then the odd count gets rounded up to even on 64-bit arcesh. The padding could be expressed in intmax_t's, but that causes different problems -- odd padding becomes impossible and char/short/int/long/long long padding might be needed to prepare for the intmax_t padding. char padding is most flexible, but harder to count. It's surprising how many i386 utilities now work on amd64. This requires things like struct layouts for ioctl data to be the same User (?) pointers in structs like md_label in the above might be the largest unportability. Bruce ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"