svn commit: r340491 - in head: share/ctypedef tools/tools/locale tools/tools/locale/etc tools/tools/locale/tools
Author: yuripv Date: Sat Nov 17 10:36:00 2018 New Revision: 340491 URL: https://svnweb.freebsd.org/changeset/base/340491 Log: Use UnicodeData.txt to create UTF-8 ctype map. This should provide more complete coverage of currently defined Unicode characters as compared to manually assembled one we use currently. Comparison of original and new UTF-8 ctype maps by character class: TYPEORIGNEW alnum 94229 126029 alpha 93557 125419 blank 4 2 cntrl 73 137685 digit 469 622 graph 109615 137203 lower 14782145 print 109641 137222 punct 3428797 rune110481 274907 space 33 24 upper 983 1781 xdigit 469 622 Large number of added cntrl definitions is due to the fact that private-use planes are currently defined as such, this can change in the future. Discussed with: bapt Approved by: kib (mentor, implicit) MFC after:1 month Differential revision:https://reviews.freebsd.org/D17842 Deleted: head/tools/tools/locale/etc/common.UTF-8.src head/tools/tools/locale/etc/manual-input.UTF-8 Modified: head/share/ctypedef/C.UTF-8.src head/tools/tools/locale/Makefile head/tools/tools/locale/tools/utf8-rollup.pl Modified: head/share/ctypedef/C.UTF-8.src == --- head/share/ctypedef/C.UTF-8.src Sat Nov 17 00:03:04 2018 (r340490) +++ head/share/ctypedef/C.UTF-8.src Sat Nov 17 10:36:00 2018 (r340491) @@ -7,386 +7,27606 @@ comment_char * escape_char / LC_CTYPE - -** -* 0x - 0x007F Basic Latin -* 0x0080 - 0x00FF Latin-1 Supplement -* 0x0100 - 0x017F Latin Extended-A -* 0x0180 - 0x024F Latin Extended-B -* 0x0250 - 0x02AF IPA Extensions -* 0x1D00 - 0x1D7F Phonetic Extensions -* 0x1D80 - 0x1DBF Phonetic Extensions Supplement -* 0x1E00 - 0x1EFF Latin Extended Additional -* 0x2150 - 0x218F Number Forms (partial - Roman Numerals) -* 0x2C60 - 0x2C7F Latin Extended-C -* 0xA720 - 0xA7FF Latin Extended-D -* 0xAB30 - 0xAB6F Latin Extended-E -* 0xFB00 - 0xFF4F Alphabetic Presentation Forms (partial) -* 0xFF00 - 0xFFEF Halfwidth and Fullwidth Forms (partial) -** -upper ;...;;/ - ;...;;/ - ;...;;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;...;;/ - ;...;;/ - ;/ - ;/ - ;...;;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;...;;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;...;;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;...;;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ -
svn commit: r340492 - head/contrib/netbsd-tests/lib/libc/locale
Author: yuripv Date: Sat Nov 17 12:59:59 2018 New Revision: 340492 URL: https://svnweb.freebsd.org/changeset/base/340492 Log: Make mbstowcs_basic test pass, now that we have more ctype definitions. Reported by: jenkins Approved by: kib (mentor, implicit) Modified: head/contrib/netbsd-tests/lib/libc/locale/t_mbstowcs.c Modified: head/contrib/netbsd-tests/lib/libc/locale/t_mbstowcs.c == --- head/contrib/netbsd-tests/lib/libc/locale/t_mbstowcs.c Sat Nov 17 10:36:00 2018(r340491) +++ head/contrib/netbsd-tests/lib/libc/locale/t_mbstowcs.c Sat Nov 17 12:59:59 2018(r340492) @@ -88,7 +88,7 @@ static struct test { 0x, 0x5D, 0x5B, 0x1, 0x10, 0x5D, 0x0A }, #ifdef __FreeBSD__ - {1, -1, -1, 1, 1, -1, -1, 1, 1, 1, -1, 1, 1, -1, -1, + {1, -1, -1, 1, 1, -1, 1, 1, 1, 1, -1, 1, 1, 1, -1, #else {1, -1, -1, 1, 1, -1, -1, 1, 1, -1, -1, 1, 1, -1, -1, #endif ___ 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: r340493 - head/sys/netinet
Author: bz Date: Sat Nov 17 16:08:36 2018 New Revision: 340493 URL: https://svnweb.freebsd.org/changeset/base/340493 Log: Retire arpresolve_addr(), which is not used anywhere, from if_ether.c. Modified: head/sys/netinet/if_ether.c head/sys/netinet/if_ether.h Modified: head/sys/netinet/if_ether.c == --- head/sys/netinet/if_ether.c Sat Nov 17 12:59:59 2018(r340492) +++ head/sys/netinet/if_ether.c Sat Nov 17 16:08:36 2018(r340493) @@ -573,21 +573,6 @@ arpresolve_full(struct ifnet *ifp, int is_gw, int flag } /* - * Resolve an IP address into an ethernet address. - */ -int -arpresolve_addr(struct ifnet *ifp, int flags, const struct sockaddr *dst, -char *desten, uint32_t *pflags, struct llentry **plle) -{ - int error; - - flags |= LLE_ADDRONLY; - error = arpresolve_full(ifp, 0, flags, NULL, dst, desten, pflags, plle); - return (error); -} - - -/* * Lookups link header based on an IP address. * On input: *ifp is the interface we use Modified: head/sys/netinet/if_ether.h == --- head/sys/netinet/if_ether.h Sat Nov 17 12:59:59 2018(r340492) +++ head/sys/netinet/if_ether.h Sat Nov 17 16:08:36 2018(r340493) @@ -117,9 +117,6 @@ extern u_char ether_ipmulticast_max[ETHER_ADDR_LEN]; struct ifaddr; struct llentry; -intarpresolve_addr(struct ifnet *ifp, int flags, - const struct sockaddr *dst, char *desten, uint32_t *pflags, - struct llentry **plle); intarpresolve(struct ifnet *ifp, int is_gw, struct mbuf *m, const struct sockaddr *dst, u_char *desten, uint32_t *pflags, struct llentry **plle); ___ 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: r340494 - head/sys/netinet
Author: bz Date: Sat Nov 17 16:13:09 2018 New Revision: 340494 URL: https://svnweb.freebsd.org/changeset/base/340494 Log: Improve the comment for arpresolve_full() in if_ether.c. No functional changes. MFC after:6 weeks Modified: head/sys/netinet/if_ether.c Modified: head/sys/netinet/if_ether.c == --- head/sys/netinet/if_ether.c Sat Nov 17 16:08:36 2018(r340493) +++ head/sys/netinet/if_ether.c Sat Nov 17 16:13:09 2018(r340494) @@ -433,10 +433,10 @@ arprequest(struct ifnet *ifp, const struct in_addr *si /* * Resolve an IP address into an ethernet address - heavy version. * Used internally by arpresolve(). - * We have already checked than we can't use existing lle without - * modification so we have to acquire LLE_EXCLUSIVE lle lock. + * We have already checked that we can't use an existing lle without + * modification so we have to acquire an LLE_EXCLUSIVE lle lock. * - * On success, desten and flags are filled in and the function returns 0; + * On success, desten and pflags are filled in and the function returns 0; * If the packet must be held pending resolution, we return EWOULDBLOCK * On other errors, we return the corresponding error code. * Note that m_freem() handles 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: r340495 - head/sys/dev/mmc
Author: marius Date: Sat Nov 17 17:21:36 2018 New Revision: 340495 URL: https://svnweb.freebsd.org/changeset/base/340495 Log: - Restore setting the clock for devices which support the default/legacy transfer mode only (lost with r321385). [1] - Similarly, don't try to set the power class on MMC devices that comply to version 4.0 of the system specification but are operated in default/ legacy transfer or 1-bit bus mode as no power class is specified for these cases. Trying to set a power class nevertheless resulted in an - albeit harmless - error message. PR: 231713 [1] Modified: head/sys/dev/mmc/mmc.c Modified: head/sys/dev/mmc/mmc.c == --- head/sys/dev/mmc/mmc.c Sat Nov 17 16:13:09 2018(r340494) +++ head/sys/dev/mmc/mmc.c Sat Nov 17 17:21:36 2018(r340495) @@ -830,9 +830,14 @@ mmc_set_power_class(struct mmc_softc *sc, struct mmc_i const uint8_t *ext_csd; uint32_t clock; uint8_t value; + enum mmc_bus_timing timing; + enum mmc_bus_width bus_width; dev = sc->dev; - if (mmcbr_get_mode(dev) != mode_mmc || ivar->csd.spec_vers < 4) + timing = mmcbr_get_timing(dev); + bus_width = ivar->bus_width; + if (mmcbr_get_mode(dev) != mode_mmc || ivar->csd.spec_vers < 4 || + timing == bus_timing_normal || bus_width == bus_width_1) return (MMC_ERR_NONE); value = 0; @@ -843,8 +848,8 @@ mmc_set_power_class(struct mmc_softc *sc, struct mmc_i if (clock <= MMC_TYPE_HS_26_MAX) value = ext_csd[EXT_CSD_PWR_CL_26_195]; else if (clock <= MMC_TYPE_HS_52_MAX) { - if (mmcbr_get_timing(dev) >= bus_timing_mmc_ddr52 && - ivar->bus_width >= bus_width_4) + if (timing >= bus_timing_mmc_ddr52 && + bus_width >= bus_width_4) value = ext_csd[EXT_CSD_PWR_CL_52_195_DDR]; else value = ext_csd[EXT_CSD_PWR_CL_52_195]; @@ -863,13 +868,13 @@ mmc_set_power_class(struct mmc_softc *sc, struct mmc_i if (clock <= MMC_TYPE_HS_26_MAX) value = ext_csd[EXT_CSD_PWR_CL_26_360]; else if (clock <= MMC_TYPE_HS_52_MAX) { - if (mmcbr_get_timing(dev) == bus_timing_mmc_ddr52 && - ivar->bus_width >= bus_width_4) + if (timing == bus_timing_mmc_ddr52 && + bus_width >= bus_width_4) value = ext_csd[EXT_CSD_PWR_CL_52_360_DDR]; else value = ext_csd[EXT_CSD_PWR_CL_52_360]; } else if (clock <= MMC_TYPE_HS200_HS400ES_MAX) { - if (ivar->bus_width == bus_width_8) + if (bus_width == bus_width_8) value = ext_csd[EXT_CSD_PWR_CL_200_360_DDR]; else value = ext_csd[EXT_CSD_PWR_CL_200_360]; @@ -881,7 +886,7 @@ mmc_set_power_class(struct mmc_softc *sc, struct mmc_i return (MMC_ERR_INVALID); } - if (ivar->bus_width == bus_width_8) + if (bus_width == bus_width_8) value = (value & EXT_CSD_POWER_CLASS_8BIT_MASK) >> EXT_CSD_POWER_CLASS_8BIT_SHIFT; else @@ -2164,7 +2169,7 @@ mmc_calculate_clock(struct mmc_softc *sc) for (i = 0; i < sc->child_count; i++) { ivar = device_get_ivars(sc->child_list[i]); if ((ivar->timings & ~(1 << bus_timing_normal)) == 0) - continue; + goto clock; rca = ivar->rca; if (mmc_select_card(sc, rca) != MMC_ERR_NONE) { @@ -2230,6 +2235,7 @@ mmc_calculate_clock(struct mmc_softc *sc) } } +clock: /* Set clock (must be done before initial tuning). */ mmcbr_set_clock(dev, max_dtr); mmcbr_update_ios(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"
svn commit: r340507 - head/lib/libbe
Author: kevans Date: Sat Nov 17 19:15:29 2018 New Revision: 340507 URL: https://svnweb.freebsd.org/changeset/base/340507 Log: libbe(3): rewrite init to support chroot usage libbe(3) currently uses zfs_be_root and locates which of its children is currently mounted at "/". This is reasonable, but not correct in the case of a chroot, for two reasons: - chroot root may be of a different zpool than zfs_be_root - chroot root will not show up as mounted at "/" Fix both of these by rewriting libbe_init to work from the rootfs down. zfs_path_to_zhandle on / will resolve to the dataset mounted at the new root, rather than the real root. From there, we can derive the BE root/pool and grab the bootfs off of the new pool. This does no harm in the average case, and opens up bectl to operating on different pools for scenarios where one may be, for instance, updating a pool that generally gets re-rooted into from a separate UFS root or zfs bootpool. While here, I've also: - Eliminated the check for /boot and / to be on the same partition. This leaves one open to a setup where /boot (and consequently, kernel/modules) are not included in the boot environment. This may very well be an intentional setup done by someone that knows what they're doing, we should not kill BE usage because of it. - Eliminated the validation bits of BEs and snapshots that enforced 'mountpoint' to be "/" -- this broke when trying to operate on an imported pool with an altroot, but we need not be this picky. Reported by: philip Reviewed by: philip, allanjude (previous version) Tested by:philip MFC after:3 days Differential Revision:https://reviews.freebsd.org/D18012 Modified: head/lib/libbe/be.c head/lib/libbe/be_info.c Modified: head/lib/libbe/be.c == --- head/lib/libbe/be.c Sat Nov 17 19:02:50 2018(r340506) +++ head/lib/libbe/be.c Sat Nov 17 19:15:29 2018(r340507) @@ -29,11 +29,12 @@ #include __FBSDID("$FreeBSD$"); +#include +#include #include -#include +#include #include -#include #include #include #include @@ -55,23 +56,16 @@ static int be_create_child_cloned(libbe_handle_t *lbh, * zfs_be_root set by loader(8). data is expected to be a libbe_handle_t *. */ static int -be_locate_rootfs(zfs_handle_t *chkds, void *data) +be_locate_rootfs(libbe_handle_t *lbh) { - libbe_handle_t *lbh; - char *mntpoint; + zfs_handle_t *zfs; - lbh = (libbe_handle_t *)data; - if (lbh == NULL) + zfs = zfs_path_to_zhandle(lbh->lzh, "/", ZFS_TYPE_FILESYSTEM); + if (zfs == NULL) return (1); - mntpoint = NULL; - if (zfs_is_mounted(chkds, &mntpoint) && strcmp(mntpoint, "/") == 0) { - strlcpy(lbh->rootfs, zfs_get_name(chkds), sizeof(lbh->rootfs)); - free(mntpoint); - return (1); - } else if(mntpoint != NULL) - free(mntpoint); - + strlcpy(lbh->rootfs, zfs_get_name(zfs), sizeof(lbh->rootfs)); + zfs_close(zfs); return (0); } @@ -82,49 +76,29 @@ be_locate_rootfs(zfs_handle_t *chkds, void *data) libbe_handle_t * libbe_init(void) { - struct stat sb; - dev_t root_dev, boot_dev; libbe_handle_t *lbh; - zfs_handle_t *rootds; char *poolname, *pos; int pnamelen; lbh = NULL; poolname = pos = NULL; - rootds = NULL; - /* Verify that /boot and / are mounted on the same filesystem */ - /* TODO: use errno here?? */ - if (stat("/", &sb) != 0) - goto err; - - root_dev = sb.st_dev; - - if (stat("/boot", &sb) != 0) - goto err; - - boot_dev = sb.st_dev; - - if (root_dev != boot_dev) { - fprintf(stderr, "/ and /boot not on same device, quitting\n"); - goto err; - } - if ((lbh = calloc(1, sizeof(libbe_handle_t))) == NULL) goto err; if ((lbh->lzh = libzfs_init()) == NULL) goto err; - /* Obtain path to boot environment root */ - if ((kenv(KENV_GET, "zfs_be_root", lbh->root, - sizeof(lbh->root))) == -1) + /* Grab rootfs, we'll work backwards from there */ + if (be_locate_rootfs(lbh) != 0) goto err; - /* Remove leading 'zfs:' if present, otherwise use value as-is */ - if (strcmp(lbh->root, "zfs:") == 0) - strlcpy(lbh->root, strchr(lbh->root, ':') + sizeof(char), - sizeof(lbh->root)); + /* Strip off the final slash from the rootfs to get the be root */ + strlcpy(lbh->root, lbh->rootfs, sizeof(lbh->root)); + pos = strrchr(lbh->root, '/'); + if (pos == NULL) + goto err; + *pos = '\0'; if ((pos = strchr(lbh->root, '/')) == NULL) goto err; @@ -
svn commit: r340508 - head/lib/libbe
Author: kevans Date: Sat Nov 17 19:19:37 2018 New Revision: 340508 URL: https://svnweb.freebsd.org/changeset/base/340508 Log: libbe(3): Rewrite be_unmount to stop mucking with getmntinfo(2) Go through the ZFS layer instead; given a BE, we can derive the dataset, zfs_open it, then zfs_unmount. ZFS takes care of the dirty details and likely gets it more correct than we did for more interesting setups. MFC after:3 days Modified: head/lib/libbe/be_access.c Modified: head/lib/libbe/be_access.c == --- head/lib/libbe/be_access.c Sat Nov 17 19:15:29 2018(r340507) +++ head/lib/libbe/be_access.c Sat Nov 17 19:19:37 2018(r340508) @@ -164,37 +164,18 @@ be_unmount(libbe_handle_t *lbh, char *bootenv, int fla { int err, mntflags; char be[BE_MAXPATHLEN]; - struct statfs *mntbuf; - int mntsize; - char *mntpath; + zfs_handle_t *root_hdl; if ((err = be_root_concat(lbh, bootenv, be)) != 0) return (set_error(lbh, err)); - if ((mntsize = getmntinfo(&mntbuf, MNT_NOWAIT)) == 0) { - if (errno == EIO) - return (set_error(lbh, BE_ERR_IO)); - return (set_error(lbh, BE_ERR_NOMOUNT)); - } + if ((root_hdl = zfs_open(lbh->lzh, be, ZFS_TYPE_FILESYSTEM)) == NULL) + return (set_error(lbh, BE_ERR_ZFSOPEN)); - mntpath = NULL; - for (int i = 0; i < mntsize; ++i) { - /* 0x00de is the type number of zfs */ - if (mntbuf[i].f_type != 0x00de) - continue; + mntflags = (flags & BE_MNT_FORCE) ? MS_FORCE : 0; - if (strcmp(mntbuf[i].f_mntfromname, be) == 0) { - mntpath = mntbuf[i].f_mntonname; - break; - } - } - - if (mntpath == NULL) - return (set_error(lbh, BE_ERR_NOMOUNT)); - - mntflags = (flags & BE_MNT_FORCE) ? MNT_FORCE : 0; - - if ((err = unmount(mntpath, mntflags)) != 0) { + if (zfs_unmount(root_hdl, NULL, mntflags) != 0) { + zfs_close(root_hdl); switch (errno) { case ENAMETOOLONG: return (set_error(lbh, BE_ERR_PATHLEN)); @@ -210,6 +191,7 @@ be_unmount(libbe_handle_t *lbh, char *bootenv, int fla return (set_error(lbh, BE_ERR_UNKNOWN)); } } + zfs_close(root_hdl); - return (set_error(lbh, BE_ERR_SUCCESS)); + return (BE_ERR_SUCCESS); } ___ 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: r340525 - head/sbin/mount_fusefs
Author: asomers Date: Sat Nov 17 21:35:01 2018 New Revision: 340525 URL: https://svnweb.freebsd.org/changeset/base/340525 Log: mount_fusefs.8: expand HISTORY section Note that fuse was available from ports long before joining the base system. Also, update the upstream URL. MFC after:2 weeks Modified: head/sbin/mount_fusefs/mount_fusefs.8 Modified: head/sbin/mount_fusefs/mount_fusefs.8 == --- head/sbin/mount_fusefs/mount_fusefs.8 Sat Nov 17 20:59:50 2018 (r340524) +++ head/sbin/mount_fusefs/mount_fusefs.8 Sat Nov 17 21:35:01 2018 (r340525) @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 3, 2016 +.Dd November 17, 2018 .Dt MOUNT_FUSEFS 8 .Os .Sh NAME @@ -339,12 +339,16 @@ does not call any external utility and also provides a .Xr umount 8 .Sh HISTORY .Nm -appeared in -.Fx 10.0 -as the part of the +was written as the part of the .Fx -implementation of the Fuse userspace filesystem -framework (see http://fuse.sourceforge.net). +implementation of the Fuse userspace filesystem framework (see +.Xr https://github.com/libfuse/libfuse ) +and first appeared in the +.Pa sysutils/fusefs-kmod +port, supporting +.Fx 6.0 . +It was added to the base system in +.Fx 10.0 . .Sh CAVEATS This user interface is .Fx ___ 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: r339618 - head/sys/compat/linuxkpi/common/include/linux
You should probably revert this. The implied understanding of the _relaxed version is incorrect. compiler_membar is there to prevent instruction reordering which is possible on FreeBSD because the accesses are done in C. The relaxed variants still do not permit instruction reordering. On Linux __compiler_member (referred to as barrier there) isn’t necessary in the mmio accessors because they always use volatile asm which can’t be reordered. The distinction between the relaxed and non relaxed variants is that the relaxed variant lacks memory barriers (sync / lwsync / eieio on ppc, membar on sparc, etc). Most of the time we don’t run in to problems on x86 because with TSO the only reordering possible is writes that happen before reads can become visible in memory after they occur in the instruction stream. Thanks. -M On Mon, Oct 22, 2018 at 13:55 Tijl Coosemans wrote: > Author: tijl > Date: Mon Oct 22 20:55:35 2018 > New Revision: 339618 > URL: https://svnweb.freebsd.org/changeset/base/339618 > > Log: > Define linuxkpi readq for 64-bit architectures. It is used by drm-kmod. > Currently the compiler picks up the definition in machine/cpufunc.h. > > Add compiler memory barriers to read* and write*. The Linux x86 > implementation of these functions uses inline asm with "memory" clobber. > The Linux x86 implementation of read_relaxed* and write_relaxed* uses the > same inline asm without "memory" clobber. > > Implement ioread* and iowrite* in terms of read* and write* so they also > have memory barriers. > > Qualify the addr parameter in write* as volatile. > > Like Linux, define macros with the same name as the inline functions. > > Only define 64-bit versions on 64-bit architectures because generally > 32-bit architectures can't do atomic 64-bit loads and stores. > > Regroup the functions a bit and add brief comments explaining what they > do: > - __raw_read*, __raw_write*: atomic, no barriers, no byte swapping > - read_relaxed*, write_relaxed*: atomic, no barriers, little-endian > - read*, write*: atomic, with barriers, little-endian > > Add a comment that says our implementation of ioread* and iowrite* > only handles MMIO and does not support port IO. > > Reviewed by: hselasky > MFC after:3 days > > Modified: > head/sys/compat/linuxkpi/common/include/linux/io.h > > Modified: head/sys/compat/linuxkpi/common/include/linux/io.h > > == > --- head/sys/compat/linuxkpi/common/include/linux/io.h Mon Oct 22 > 20:22:33 2018(r339617) > +++ head/sys/compat/linuxkpi/common/include/linux/io.h Mon Oct 22 > 20:55:35 2018(r339618) > @@ -38,153 +38,309 @@ > #include > #include > > +/* > + * XXX This is all x86 specific. It should be bus space access. > + */ > + > +/* Access MMIO registers atomically without barriers and byte swapping. */ > + > +static inline uint8_t > +__raw_readb(const volatile void *addr) > +{ > + return (*(const volatile uint8_t *)addr); > +} > +#define__raw_readb(addr) __raw_readb(addr) > + > +static inline void > +__raw_writeb(uint8_t v, volatile void *addr) > +{ > + *(volatile uint8_t *)addr = v; > +} > +#define__raw_writeb(v, addr) __raw_writeb(v, addr) > + > +static inline uint16_t > +__raw_readw(const volatile void *addr) > +{ > + return (*(const volatile uint16_t *)addr); > +} > +#define__raw_readw(addr) __raw_readw(addr) > + > +static inline void > +__raw_writew(uint16_t v, volatile void *addr) > +{ > + *(volatile uint16_t *)addr = v; > +} > +#define__raw_writew(v, addr) __raw_writew(v, addr) > + > static inline uint32_t > __raw_readl(const volatile void *addr) > { > - return *(const volatile uint32_t *)addr; > + return (*(const volatile uint32_t *)addr); > } > +#define__raw_readl(addr) __raw_readl(addr) > > static inline void > -__raw_writel(uint32_t b, volatile void *addr) > +__raw_writel(uint32_t v, volatile void *addr) > { > - *(volatile uint32_t *)addr = b; > + *(volatile uint32_t *)addr = v; > } > +#define__raw_writel(v, addr) __raw_writel(v, addr) > > +#ifdef __LP64__ > static inline uint64_t > __raw_readq(const volatile void *addr) > { > - return *(const volatile uint64_t *)addr; > + return (*(const volatile uint64_t *)addr); > } > +#define__raw_readq(addr) __raw_readq(addr) > > static inline void > -__raw_writeq(uint64_t b, volatile void *addr) > +__raw_writeq(uint64_t v, volatile void *addr) > { > - *(volatile uint64_t *)addr = b; > + *(volatile uint64_t *)addr = v; > } > +#define__raw_writeq(v, addr) __raw_writeq(v, addr) > +#endif > > -/* > - * XXX This is all x86 specific. It should be bus space access. > - */ > #definemmiowb()barrier() > > -#undef writel > +/* Access little-endian MMIO registers atomically with memory barriers. */ > + > +#
Re: svn commit: r339618 - head/sys/compat/linuxkpi/common/include/linux
When looking at powerpc io.h raw and relaxed are not aliases, but it appears that on x86, they are: https://github.com/torvalds/linux/blob/master/arch/x86/include/asm/io.h Sorry for the noise. But let's starting moving the x86 specific atomic.h and io.h under asm/x86. Thanks. On Sat, Nov 17, 2018 at 2:01 PM Matthew Macy wrote: > > You should probably revert this. The implied understanding of the _relaxed > version is incorrect. compiler_membar is there to prevent instruction > reordering which is possible on FreeBSD because the accesses are done in C. > The relaxed variants still do not permit instruction reordering. On Linux > __compiler_member (referred to as barrier there) isn’t necessary in the mmio > accessors because they always use volatile asm which can’t be reordered. The > distinction between the relaxed and non relaxed variants is that the relaxed > variant lacks memory barriers (sync / lwsync / eieio on ppc, membar on sparc, > etc). Most of the time we don’t run in to problems on x86 because with TSO > the only reordering possible is writes that happen before reads can become > visible in memory after they occur in the instruction stream. > > Thanks. > -M > > On Mon, Oct 22, 2018 at 13:55 Tijl Coosemans wrote: >> >> Author: tijl >> Date: Mon Oct 22 20:55:35 2018 >> New Revision: 339618 >> URL: https://svnweb.freebsd.org/changeset/base/339618 >> >> Log: >> Define linuxkpi readq for 64-bit architectures. It is used by drm-kmod. >> Currently the compiler picks up the definition in machine/cpufunc.h. >> >> Add compiler memory barriers to read* and write*. The Linux x86 >> implementation of these functions uses inline asm with "memory" clobber. >> The Linux x86 implementation of read_relaxed* and write_relaxed* uses the >> same inline asm without "memory" clobber. >> >> Implement ioread* and iowrite* in terms of read* and write* so they also >> have memory barriers. >> >> Qualify the addr parameter in write* as volatile. >> >> Like Linux, define macros with the same name as the inline functions. >> >> Only define 64-bit versions on 64-bit architectures because generally >> 32-bit architectures can't do atomic 64-bit loads and stores. >> >> Regroup the functions a bit and add brief comments explaining what they do: >> - __raw_read*, __raw_write*: atomic, no barriers, no byte swapping >> - read_relaxed*, write_relaxed*: atomic, no barriers, little-endian >> - read*, write*: atomic, with barriers, little-endian >> >> Add a comment that says our implementation of ioread* and iowrite* >> only handles MMIO and does not support port IO. >> >> Reviewed by: hselasky >> MFC after:3 days >> >> Modified: >> head/sys/compat/linuxkpi/common/include/linux/io.h >> >> Modified: head/sys/compat/linuxkpi/common/include/linux/io.h >> == >> --- head/sys/compat/linuxkpi/common/include/linux/io.h Mon Oct 22 20:22:33 >> 2018(r339617) >> +++ head/sys/compat/linuxkpi/common/include/linux/io.h Mon Oct 22 20:55:35 >> 2018(r339618) >> @@ -38,153 +38,309 @@ >> #include >> #include >> >> +/* >> + * XXX This is all x86 specific. It should be bus space access. >> + */ >> + >> +/* Access MMIO registers atomically without barriers and byte swapping. */ >> + >> +static inline uint8_t >> +__raw_readb(const volatile void *addr) >> +{ >> + return (*(const volatile uint8_t *)addr); >> +} >> +#define__raw_readb(addr) __raw_readb(addr) >> + >> +static inline void >> +__raw_writeb(uint8_t v, volatile void *addr) >> +{ >> + *(volatile uint8_t *)addr = v; >> +} >> +#define__raw_writeb(v, addr) __raw_writeb(v, addr) >> + >> +static inline uint16_t >> +__raw_readw(const volatile void *addr) >> +{ >> + return (*(const volatile uint16_t *)addr); >> +} >> +#define__raw_readw(addr) __raw_readw(addr) >> + >> +static inline void >> +__raw_writew(uint16_t v, volatile void *addr) >> +{ >> + *(volatile uint16_t *)addr = v; >> +} >> +#define__raw_writew(v, addr) __raw_writew(v, addr) >> + >> static inline uint32_t >> __raw_readl(const volatile void *addr) >> { >> - return *(const volatile uint32_t *)addr; >> + return (*(const volatile uint32_t *)addr); >> } >> +#define__raw_readl(addr) __raw_readl(addr) >> >> static inline void >> -__raw_writel(uint32_t b, volatile void *addr) >> +__raw_writel(uint32_t v, volatile void *addr) >> { >> - *(volatile uint32_t *)addr = b; >> + *(volatile uint32_t *)addr = v; >> } >> +#define__raw_writel(v, addr) __raw_writel(v, addr) >> >> +#ifdef __LP64__ >> static inline uint64_t >> __raw_readq(const volatile void *addr) >> { >> - return *(const volatile uint64_t *)addr; >> + return (*(const volatile uint64_t *)addr); >> } >> +#define__raw_readq(addr) __raw_readq(addr) >> >> static inline void >> -__raw_wr
svn commit: r340543 - head/sys/dev/sdhci
Author: marius Date: Sun Nov 18 00:52:27 2018 New Revision: 340543 URL: https://svnweb.freebsd.org/changeset/base/340543 Log: Add a quirk handling for AMDI0040 controllers allowing them to do HS400. Submitted by: Shreyank Amartya (original version) Modified: head/sys/dev/sdhci/sdhci.c head/sys/dev/sdhci/sdhci.h head/sys/dev/sdhci/sdhci_acpi.c Modified: head/sys/dev/sdhci/sdhci.c == --- head/sys/dev/sdhci/sdhci.c Sun Nov 18 00:35:36 2018(r340542) +++ head/sys/dev/sdhci/sdhci.c Sun Nov 18 00:52:27 2018(r340543) @@ -898,6 +898,9 @@ sdhci_init_slot(device_t dev, struct sdhci_slot *slot, if (slot->quirks & SDHCI_QUIRK_CAPS_BIT63_FOR_MMC_HS400 && caps2 & SDHCI_CAN_MMC_HS400) host_caps |= MMC_CAP_MMC_HS400; + if (slot->quirks & SDHCI_QUIRK_MMC_HS400_IF_CAN_SDR104 && + caps2 & SDHCI_CAN_SDR104) + host_caps |= MMC_CAP_MMC_HS400; /* * Disable UHS-I and eMMC modes if the set_uhs_timing method is the Modified: head/sys/dev/sdhci/sdhci.h == --- head/sys/dev/sdhci/sdhci.h Sun Nov 18 00:35:36 2018(r340542) +++ head/sys/dev/sdhci/sdhci.h Sun Nov 18 00:52:27 2018(r340543) @@ -93,6 +93,8 @@ #defineSDHCI_QUIRK_PRESET_VALUE_BROKEN (1 << 27) /* Controller does not support or the support for ACMD12 is broken. */ #defineSDHCI_QUIRK_BROKEN_AUTO_STOP(1 << 28) +/* Controller supports eMMC HS400 mode if SDHCI_CAN_SDR104 is set. */ +#defineSDHCI_QUIRK_MMC_HS400_IF_CAN_SDR104 (1 << 29) /* * Controller registers Modified: head/sys/dev/sdhci/sdhci_acpi.c == --- head/sys/dev/sdhci/sdhci_acpi.c Sun Nov 18 00:35:36 2018 (r340542) +++ head/sys/dev/sdhci/sdhci_acpi.c Sun Nov 18 00:52:27 2018 (r340543) @@ -45,12 +45,15 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include "mmcbr_if.h" #include "sdhci_if.h" +#defineSDHCI_AMD_RESET_DLL_REG 0x908 + static const struct sdhci_acpi_device { const char* hid; int uid; @@ -80,7 +83,8 @@ static const struct sdhci_acpi_device { SDHCI_QUIRK_CAPS_BIT63_FOR_MMC_HS400 | SDHCI_QUIRK_PRESET_VALUE_BROKEN }, { "AMDI0040", 0, "AMD eMMC 5.0 Controller", - SDHCI_QUIRK_32BIT_DMA_SIZE }, + SDHCI_QUIRK_32BIT_DMA_SIZE | + SDHCI_QUIRK_MMC_HS400_IF_CAN_SDR104 }, { NULL, 0, NULL, 0} }; @@ -94,12 +98,11 @@ static char *sdhci_ids[] = { }; struct sdhci_acpi_softc { - u_int quirks; /* Chip specific quirks */ - struct resource *irq_res; /* IRQ resource */ - void*intrhand; /* Interrupt handle */ - struct sdhci_slot slot; struct resource *mem_res; /* Memory resource */ + struct resource *irq_res; /* IRQ resource */ + void*intrhand; /* Interrupt handle */ + const struct sdhci_acpi_device *acpi_dev; }; static void sdhci_acpi_intr(void *arg); @@ -189,6 +192,52 @@ sdhci_acpi_write_multi_4(device_t dev, struct sdhci_sl bus_write_multi_stream_4(sc->mem_res, off, data, count); } +static void +sdhci_acpi_set_uhs_timing(device_t dev, struct sdhci_slot *slot) +{ + const struct sdhci_acpi_softc *sc; + const struct sdhci_acpi_device *acpi_dev; + const struct mmc_ios *ios; + device_t bus; + uint16_t old_timing; + enum mmc_bus_timing timing; + + bus = slot->bus; + old_timing = sdhci_acpi_read_2(bus, slot, SDHCI_HOST_CONTROL2); + old_timing &= SDHCI_CTRL2_UHS_MASK; + sdhci_generic_set_uhs_timing(dev, slot); + + sc = device_get_softc(dev); + acpi_dev = sc->acpi_dev; + /* +* AMDI0040 controllers require SDHCI_CTRL2_SAMPLING_CLOCK to be +* disabled when switching from HS200 to high speed and to always +* be turned on again when tuning for HS400. In the later case, +* an AMD-specific DLL reset additionally is needed. +*/ + if (strcmp(acpi_dev->hid, "AMDI0040") == 0 && acpi_dev->uid == 0) { + ios = &slot->host.ios; + timing = ios->timing; + if (old_timing == SDHCI_CTRL2_UHS_SDR104 && + timing == bus_timing_hs) + sdhci_acpi_write_2(bus, slot, SDHCI_HOST_CONTROL2, + sdhci_acpi_read_2(bus, slot, SDHCI_HOST_CONTROL2) & + ~SDHCI_CTRL2_SAMPLING_CLOCK); + if (ios->clock > SD_SDR50_MAX && + old_timing != SDHCI_CTRL2_MMC_HS400 && + timing == bus_timing_mmc_hs400) { + sdhci_acpi_write
svn commit: r340546 - head/sys/vm
Author: alc Date: Sun Nov 18 01:27:17 2018 New Revision: 340546 URL: https://svnweb.freebsd.org/changeset/base/340546 Log: Tidy up vm_map_simplify_entry() and its recently introduced helper functions. Notably, reflow the text of some comments so that they occupy fewer lines, and introduce an assertion in one of the new helper functions so that it is not misused by a future caller. In collaboration with:Doug Moore MFC after:1 week Differential Revision:https://reviews.freebsd.org/D17635 Modified: head/sys/vm/vm_map.c Modified: head/sys/vm/vm_map.c == --- head/sys/vm/vm_map.cSun Nov 18 01:07:36 2018(r340545) +++ head/sys/vm/vm_map.cSun Nov 18 01:27:17 2018(r340546) @@ -1644,16 +1644,25 @@ vm_map_find_min(vm_map_t map, vm_object_t object, vm_o } } +/* + * A map entry with any of the following flags set must not be merged with + * another entry. + */ +#defineMAP_ENTRY_NOMERGE_MASK (MAP_ENTRY_GROWS_DOWN | MAP_ENTRY_GROWS_UP | \ + MAP_ENTRY_IN_TRANSITION | MAP_ENTRY_IS_SUB_MAP) + static bool vm_map_mergeable_neighbors(vm_map_entry_t prev, vm_map_entry_t entry) { - vm_size_t prevsize; - prevsize = prev->end - prev->start; + KASSERT((prev->eflags & MAP_ENTRY_NOMERGE_MASK) == 0 || + (entry->eflags & MAP_ENTRY_NOMERGE_MASK) == 0, + ("vm_map_mergeable_neighbors: neither %p nor %p are mergeable", + prev, entry)); return (prev->end == entry->start && prev->object.vm_object == entry->object.vm_object && (prev->object.vm_object == NULL || - prev->offset + prevsize == entry->offset) && + prev->offset + (prev->end - prev->start) == entry->offset) && prev->eflags == entry->eflags && prev->protection == entry->protection && prev->max_protection == entry->max_protection && @@ -1667,18 +1676,14 @@ vm_map_merged_neighbor_dispose(vm_map_t map, vm_map_en { /* -* If the backing object is a vnode object, -* vm_object_deallocate() calls vrele(). -* However, vrele() does not lock the vnode -* because the vnode has additional -* references. Thus, the map lock can be kept -* without causing a lock-order reversal with -* the vnode lock. +* If the backing object is a vnode object, vm_object_deallocate() +* calls vrele(). However, vrele() does not lock the vnode because +* the vnode has additional references. Thus, the map lock can be +* kept without causing a lock-order reversal with the vnode lock. * -* Since we count the number of virtual page -* mappings in object->un_pager.vnp.writemappings, -* the writemappings value should not be adjusted -* when the entry is disposed of. +* Since we count the number of virtual page mappings in +* object->un_pager.vnp.writemappings, the writemappings value +* should not be adjusted when the entry is disposed of. */ if (entry->object.vm_object != NULL) vm_object_deallocate(entry->object.vm_object); @@ -1704,10 +1709,8 @@ vm_map_simplify_entry(vm_map_t map, vm_map_entry_t ent { vm_map_entry_t next, prev; - if ((entry->eflags & (MAP_ENTRY_GROWS_DOWN | MAP_ENTRY_GROWS_UP | - MAP_ENTRY_IN_TRANSITION | MAP_ENTRY_IS_SUB_MAP)) != 0) + if ((entry->eflags & MAP_ENTRY_NOMERGE_MASK) != 0) return; - prev = entry->prev; if (vm_map_mergeable_neighbors(prev, entry)) { vm_map_entry_unlink(map, prev); @@ -1717,7 +1720,6 @@ vm_map_simplify_entry(vm_map_t map, vm_map_entry_t ent vm_map_entry_resize_free(map, entry->prev); vm_map_merged_neighbor_dispose(map, prev); } - next = entry->next; if (vm_map_mergeable_neighbors(entry, next)) { vm_map_entry_unlink(map, next); @@ -1726,6 +1728,7 @@ vm_map_simplify_entry(vm_map_t map, vm_map_entry_t ent vm_map_merged_neighbor_dispose(map, next); } } + /* * vm_map_clip_start: [ internal use only ] * ___ 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: r340547 - head/sbin/dumpon
Author: markj Date: Sun Nov 18 01:58:48 2018 New Revision: 340547 URL: https://svnweb.freebsd.org/changeset/base/340547 Log: Change dumpon(8)'s handling of -g. Rather than using a special value to denote "use the default router", treat the absence of the -g option to mean the same thing. The in-kernel netdump client will always attempt to reach the server directly before falling back to the configured gateway anyway. This change makes it cleaner to support a hostname value for -g. Reviewed by: cem MFC after:3 days Differential Revision:https://reviews.freebsd.org/D18025 Modified: head/sbin/dumpon/dumpon.8 head/sbin/dumpon/dumpon.c Modified: head/sbin/dumpon/dumpon.8 == --- head/sbin/dumpon/dumpon.8 Sun Nov 18 01:27:17 2018(r340546) +++ head/sbin/dumpon/dumpon.8 Sun Nov 18 01:58:48 2018(r340547) @@ -28,7 +28,7 @@ .\" From: @(#)swapon.8 8.1 (Berkeley) 6/5/93 .\" $FreeBSD$ .\" -.Dd October 26, 2018 +.Dd November 17, 2018 .Dt DUMPON 8 .Os .Sh NAME @@ -46,7 +46,7 @@ .Op Fl k Ar pubkey .Op Fl Z .Op Fl z -.Op Fl g Ar gateway | Li default +.Op Fl g Ar gateway .Fl s Ar server .Fl c Ar client .Ar iface @@ -140,21 +140,22 @@ The local IP address of the .Xr netdump 4 client. .It Fl g Ar gateway -Optional. -If not specified, it is assumed that the -.Ar server -is on the same link as the -.Ar client . -.Pp -If specified, -.Ar gateway -is the address of the first-hop router between the +The first-hop router between .Ar client -and the +and .Ar server . -The special value -.Dv Dq default -indicates that the currently configured system default route should be used. +If the +.Fl g +option is not specified and the system has a default route, the default +router is used as the +.Xr netdump 4 +gateway. +If the +.Fl g +option is not specified and the system does not have a default route, +.Ar server +is assumed to be on the same link as +.Ar client . .It Fl s Ar server The IP address of the .Xr netdumpd 8 Modified: head/sbin/dumpon/dumpon.c == --- head/sbin/dumpon/dumpon.c Sun Nov 18 01:27:17 2018(r340546) +++ head/sbin/dumpon/dumpon.c Sun Nov 18 01:58:48 2018(r340547) @@ -88,7 +88,7 @@ usage(void) fprintf(stderr, "usage: dumpon [-v] [-k ] [-Zz] \n" " dumpon [-v] [-k ] [-Zz]\n" -" [-g |default] -s -c \n" +" [-g ] -s -c \n" " dumpon [-v] off\n" " dumpon [-v] -l\n"); exit(EX_USAGE); @@ -109,8 +109,6 @@ find_gateway(const char *ifname) size_t sz; int error, i, ifindex, mib[7]; - ret = NULL; - /* First look up the interface index. */ if (getifaddrs(&ifap) != 0) err(EX_OSERR, "getifaddrs"); @@ -148,6 +146,7 @@ find_gateway(const char *ifname) free(buf); } + ret = NULL; for (next = buf; next < buf + sz; next += rtm->rtm_msglen) { rtm = (struct rt_msghdr *)(void *)next; if (rtm->rtm_version != RTM_VERSION) @@ -476,12 +475,13 @@ main(int argc, char *argv[]) if (inet_aton(client, &ndconf.ndc_client) == 0) errx(EX_USAGE, "invalid client address '%s'", client); - if (gateway == NULL) + gateway = find_gateway(argv[0]); + if (gateway == NULL) { + if (verbose) + printf("failed to look up gateway for %s\n", + server); gateway = server; - else if (strcmp(gateway, "default") == 0 && - (gateway = find_gateway(argv[0])) == NULL) - errx(EX_NOHOST, - "failed to look up next-hop router for %s", server); + } if (inet_aton(gateway, &ndconf.ndc_gateway) == 0) errx(EX_USAGE, "invalid gateway address '%s'", gateway); ___ 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"